From 711c1aa81d9e504c937b2568e961a8bbac52bbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Wed, 3 Jul 2024 23:49:04 +0200 Subject: [PATCH] [fix] flake.nix: use runCommandNoCC for checks It's much simpler and allows us to embed it into the flake.nix --- flake.nix | 12 +++++++++--- fmt.nix | 12 ------------ lint.nix | 12 ------------ typos.nix | 12 ------------ 4 files changed, 9 insertions(+), 39 deletions(-) delete mode 100644 fmt.nix delete mode 100644 lint.nix delete mode 100644 typos.nix diff --git a/flake.nix b/flake.nix index 9bad87f..f86e00a 100644 --- a/flake.nix +++ b/flake.nix @@ -101,14 +101,20 @@ path = ./.; name = "configuration.nix"; }; + runCmdInSrc = name: cmd: + pkgs.runCommandNoCC name {} '' + cd ${src} + ${cmd} + mkdir $out + ''; in { nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule { pkgs = import nixpkgs {inherit system overlays;}; module = ./nvim/standalone.nix; }; - fmt = pkgs.callPackage ./fmt.nix {inherit src;}; - lint = pkgs.callPackage ./lint.nix {inherit src;}; - typos = pkgs.callPackage ./lint.nix {inherit src;}; + fmt = runCmdInSrc "fmt-src" "${lib.getExe self.formatter.${system}} --check ."; + lint = runCmdInSrc "lint-src" "${lib.getExe pkgs.statix} check ."; + typos = runCmdInSrc "typos-src" "${lib.getExe pkgs.typos} ."; } ); diff --git a/fmt.nix b/fmt.nix deleted file mode 100644 index 84b7369..0000000 --- a/fmt.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - lib, - stdenvNoCC, - alejandra, - src, -}: -stdenvNoCC.mkDerivation { - name = "fmt-src"; - inherit src; - buildPhase = "${lib.getExe alejandra} --check ."; - installPhase = "mkdir $out"; -} diff --git a/lint.nix b/lint.nix deleted file mode 100644 index 5c80e23..0000000 --- a/lint.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - lib, - stdenvNoCC, - statix, - src, -}: -stdenvNoCC.mkDerivation { - name = "lint-src"; - inherit src; - buildPhase = "${lib.getExe statix} check ."; - installPhase = "mkdir $out"; -} diff --git a/typos.nix b/typos.nix deleted file mode 100644 index 9a02768..0000000 --- a/typos.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - lib, - stdenvNoCC, - typos, - src, -}: -stdenvNoCC.mkDerivation { - name = "typos-src"; - inherit src; - buildPhase = "${lib.getExe typos} ."; - installPhase = "mkdir $out"; -}