mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 20:39:04 +02:00
Merge pull request #167242 from helsinki-systems/feat/systemd-stage-1-variable-bin
nixos/systemd-stage-1: Softcode bin tools...
This commit is contained in:
commit
b69bd66518
|
@ -108,7 +108,7 @@ let
|
||||||
|
|
||||||
fileSystems = filter utils.fsNeededForBoot config.system.build.fileSystems;
|
fileSystems = filter utils.fsNeededForBoot config.system.build.fileSystems;
|
||||||
|
|
||||||
fstab = pkgs.writeText "fstab" (lib.concatMapStringsSep "\n"
|
fstab = pkgs.writeText "initrd-fstab" (lib.concatMapStringsSep "\n"
|
||||||
({ fsType, mountPoint, device, options, autoFormat, autoResize, ... }@fs: let
|
({ fsType, mountPoint, device, options, autoFormat, autoResize, ... }@fs: let
|
||||||
opts = options ++ optional autoFormat "x-systemd.makefs" ++ optional autoResize "x-systemd.growfs";
|
opts = options ++ optional autoFormat "x-systemd.makefs" ++ optional autoResize "x-systemd.growfs";
|
||||||
in "${device} /sysroot${mountPoint} ${fsType} ${lib.concatStringsSep "," opts}") fileSystems);
|
in "${device} /sysroot${mountPoint} ${fsType} ${lib.concatStringsSep "," opts}") fileSystems);
|
||||||
|
@ -128,11 +128,7 @@ let
|
||||||
name = "initrd-emergency-env";
|
name = "initrd-emergency-env";
|
||||||
paths = map getBin cfg.initrdBin;
|
paths = map getBin cfg.initrdBin;
|
||||||
pathsToLink = ["/bin" "/sbin"];
|
pathsToLink = ["/bin" "/sbin"];
|
||||||
# Make recovery easier
|
postBuild = concatStringsSep "\n" (mapAttrsToList (n: v: "ln -s '${v}' $out/bin/'${n}'") cfg.extraBin);
|
||||||
postBuild = ''
|
|
||||||
ln -s ${cfg.package.util-linux}/bin/mount $out/bin/
|
|
||||||
ln -s ${cfg.package.util-linux}/bin/umount $out/bin/
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
initialRamdisk = pkgs.makeInitrdNG {
|
initialRamdisk = pkgs.makeInitrdNG {
|
||||||
|
@ -205,6 +201,19 @@ in {
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraBin = mkOption {
|
||||||
|
description = ''
|
||||||
|
Tools to add to /bin
|
||||||
|
'';
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
umount = ''${pkgs.util-linux}/bin/umount;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
type = types.attrsOf types.path;
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
|
||||||
suppressedStorePaths = mkOption {
|
suppressedStorePaths = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Store paths specified in the storePaths option that
|
Store paths specified in the storePaths option that
|
||||||
|
@ -342,8 +351,15 @@ in {
|
||||||
|
|
||||||
config = mkIf (config.boot.initrd.enable && cfg.enable) {
|
config = mkIf (config.boot.initrd.enable && cfg.enable) {
|
||||||
system.build = { inherit initialRamdisk; };
|
system.build = { inherit initialRamdisk; };
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "autofs4" ]; # systemd needs this for some features
|
||||||
|
|
||||||
boot.initrd.systemd = {
|
boot.initrd.systemd = {
|
||||||
initrdBin = [pkgs.bash pkgs.coreutils pkgs.kmod cfg.package] ++ config.system.fsPackages;
|
initrdBin = [pkgs.bash pkgs.coreutils pkgs.kmod cfg.package] ++ config.system.fsPackages;
|
||||||
|
extraBin = {
|
||||||
|
mount = "${cfg.package.util-linux}/bin/mount";
|
||||||
|
umount = "${cfg.package.util-linux}/bin/umount";
|
||||||
|
};
|
||||||
|
|
||||||
contents = {
|
contents = {
|
||||||
"/init".source = "${cfg.package}/lib/systemd/systemd";
|
"/init".source = "${cfg.package}/lib/systemd/systemd";
|
||||||
|
|
Loading…
Reference in a new issue