mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-01 00:12:39 +03:00
Allow specifying packages whose closures should be in the chroot
Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
parent
883d310bac
commit
be3d498b18
@ -29,10 +29,12 @@ let
|
|||||||
# other paths in the store, we need the closure of /bin/sh
|
# other paths in the store, we need the closure of /bin/sh
|
||||||
# in `build-chroot-dirs' - otherwise any builder that uses
|
# in `build-chroot-dirs' - otherwise any builder that uses
|
||||||
# /bin/sh won't work.
|
# /bin/sh won't work.
|
||||||
binshDeps = pkgs.writeReferencesToFile config.system.build.binsh;
|
closureFile = pkgs.runCommand "closure" {
|
||||||
|
exportReferencesGraph = concatMap (pkg: [ "closure${baseNameOf pkg}" pkg ]) cfg.chrootClosures;
|
||||||
|
} "cat closure* | sort | uniq > $out";
|
||||||
in
|
in
|
||||||
pkgs.runCommand "nix.conf" {extraOptions = cfg.extraOptions; } ''
|
pkgs.runCommand "nix.conf" {extraOptions = cfg.extraOptions; } ''
|
||||||
extraPaths=$(for i in $(cat ${binshDeps}); do if test -d $i; then echo $i; fi; done)
|
extraPaths=$(for i in $(cat ${closureFile}); do if test -e $i; then echo $i; fi; done)
|
||||||
cat > $out <<END
|
cat > $out <<END
|
||||||
# WARNING: this file is generated.
|
# WARNING: this file is generated.
|
||||||
build-users-group = nixbld
|
build-users-group = nixbld
|
||||||
@ -95,6 +97,13 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
chrootClosures = mkOption {
|
||||||
|
default = [];
|
||||||
|
example = [ config.system.build.binsh pkgs.coreutils ];
|
||||||
|
description = "Packages whose closures should be included in the chroot";
|
||||||
|
type = types.listOf types.package;
|
||||||
|
};
|
||||||
|
|
||||||
extraOptions = mkOption {
|
extraOptions = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
example = "
|
example = "
|
||||||
@ -251,6 +260,8 @@ in
|
|||||||
|
|
||||||
nix.chrootDirs = [ "/dev" "/dev/pts" "/proc" "/bin/sh=${config.system.build.binsh}/bin/bash" ];
|
nix.chrootDirs = [ "/dev" "/dev/pts" "/proc" "/bin/sh=${config.system.build.binsh}/bin/bash" ];
|
||||||
|
|
||||||
|
nix.chrootClosures = [ config.system.build.binsh ];
|
||||||
|
|
||||||
environment.etc."nix/nix.conf".source = nixConf;
|
environment.etc."nix/nix.conf".source = nixConf;
|
||||||
|
|
||||||
# List of machines for distributed Nix builds in the format
|
# List of machines for distributed Nix builds in the format
|
||||||
|
Loading…
Reference in New Issue
Block a user