From 80a23fc2e8c3965a7bc8be693ef025949669abe9 Mon Sep 17 00:00:00 2001 From: Swarsel Date: Wed, 11 Dec 2024 01:17:01 +0100 Subject: [PATCH] feat: add checks to devShell --- .pre-commit-config.yaml | 1 + SwarselSystems.org | 21 +++++++++++++++++---- flake.nix | 34 ++++++++++++++++++++++++---------- 3 files changed, 42 insertions(+), 14 deletions(-) create mode 120000 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 120000 index 0000000..be71b2d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1 @@ +/nix/store/h0fd0fa9961mkr01vx4fhvna571qqxbw-pre-commit-config.json \ No newline at end of file diff --git a/SwarselSystems.org b/SwarselSystems.org index 9ebd05b..cb99f27 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -684,16 +684,29 @@ In this section I am creating some attributes that define general concepts of my homeManagerModules = import ./modules/home; packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; }); - devShells = forEachSystem - (pkgs: + devShells = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + checks = self.checks.${system}; + in { default = pkgs.mkShell { NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = [ pkgs.nix pkgs.home-manager pkgs.git ]; + inherit (checks.pre-commit-check) shellHook; + buildInputs = checks.pre-commit-check.enabledPackages; + nativeBuildInputs = [ + pkgs.nix + pkgs.home-manager + pkgs.git + pkgs.just + pkgs.age + pkgs.ssh-to-age + pkgs.sops + ]; }; }); - # this sets the formatter that is going to be used by nix fmt formatter = forEachSystem (pkgs: pkgs.nixpkgs-fmt); checks = forAllSystems ( system: diff --git a/flake.nix b/flake.nix index 25dcafb..5d762b8 100644 --- a/flake.nix +++ b/flake.nix @@ -199,16 +199,30 @@ homeManagerModules = import ./modules/home; packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; }); - devShells = forEachSystem - (pkgs: - { - default = pkgs.mkShell { - NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = [ pkgs.nix pkgs.home-manager pkgs.git ]; - }; - }); - - # this sets the formatter that is going to be used by nix fmt + devShells = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + checks = self.checks.${system}; + in + { + default = pkgs.mkShell { + NIX_CONFIG = "experimental-features = nix-command flakes"; + inherit (checks.pre-commit-check) shellHook; + buildInputs = checks.pre-commit-check.enabledPackages; + nativeBuildInputs = [ + pkgs.nix + pkgs.home-manager + pkgs.git + pkgs.just + pkgs.age + pkgs.ssh-to-age + pkgs.sops + ]; + }; + } + ); + formatter = forEachSystem (pkgs: pkgs.nixpkgs-fmt); checks = forAllSystems ( system: