From f0c3c00b56a4e41c88f53b7d5f1a847aa0c3ed3c Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Thu, 24 Oct 2024 00:33:12 +0200 Subject: [PATCH] feat(fmt): Add formatter using alejandra and format flake --- flake.nix | 5 +++++ nix/cpptools.nix | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index 11fe841..e1f0205 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,10 @@ # This is where the Neovim derivation is built. neovim-overlay = import ./nix/neovim-overlay.nix {inherit inputs;}; + inherit (self) outputs; + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; in flake-utils.lib.eachSystem supportedSystems (system: let pkgs = import nixpkgs { @@ -66,6 +70,7 @@ ''; }; in { + formatter = nixpkgs.legacyPackages.${system}.alejandra; packages = rec { default = nvim; nvim = pkgs.nvim-pkg; diff --git a/nix/cpptools.nix b/nix/cpptools.nix index 5b63ea8..b888ad3 100644 --- a/nix/cpptools.nix +++ b/nix/cpptools.nix @@ -1,13 +1,14 @@ -{ stdenv, lib -, system ? builtins.currentSystem -, fetchurl -, unzip -, libz -, libcxx -, lttng-ust_2_12 -, autoPatchelfHook +{ + stdenv, + lib, + system ? builtins.currentSystem, + fetchurl, + unzip, + libz, + libcxx, + lttng-ust_2_12, + autoPatchelfHook, }: - stdenv.mkDerivation rec { pname = "cpptools"; version = "1.21.6"; @@ -19,7 +20,6 @@ stdenv.mkDerivation rec { linux-arm64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-linux-arm64.vsix"; darwin-x64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-x64.vsix"; darwin-arm64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-arm64.vsix"; - src = fetchurl { url = lib.getAttr system { @@ -34,8 +34,8 @@ stdenv.mkDerivation rec { x86_64-darwin = "sha256-P2LacAaCRXnsGUQOLuIyvfgxweeVHsDFTrAEuN/lBIQ="; aarch64-darwin = "sha256-P2LacAaCRXnsGUQOLuIyvfgxweeVHsDFTrAEuN/lBIQ="; }; - }; - + }; + nativeBuildInputs = [ autoPatchelfHook ];