Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: cachix#498
- Loading branch information