Commit 9f73309
committed
modules: pre-commit: make pkgs.buildEnv composable
Passing a git-hooks.lib.<SYSTEM>.run derivation as a path to
pkgs.buildEnv results in the following error due to derivations with an
empty file being treated differently from derivations with an empty
directory:
The store path <TARGET> is a file and can't be merged into an
environment using pkgs.buildEnv!
Since Nixpkgs rejected explicitly handling derivations with an empty
file in pkgs.buildEnv [1], affected derivations should transition from
'touch $out' to 'mkdir $out' to be pkgs.buildEnv composable.
This change replaces 'touch $out' with 'mkdir $out' and makes the
following command work:
nix \
build \
--expr '
let
flake = builtins.getFlake (toString ./.);
system = builtins.currentSystem;
in
flake.inputs.nixpkgs.legacyPackages.${system}.buildEnv {
name = "";
paths = [(flake.outputs.lib.${system}.run {src = ./.;})];
}
' \
--impure
[1]: NixOS/nixpkgs#325140
Link: #4981 parent 85f7a71 commit 9f73309
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
0 commit comments