nixos/modules/boot/stage2patch.nix
Gerg-L c4e6bcb664 moved install iso from a package to a host
made funnier functions

gave more modules disable options

updated lint command
2023-07-28 20:18:57 -04:00

40 lines
1.2 KiB
Nix

_: {
lib,
config,
pkgs,
...
}:
#TAKEN FROM https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/stage-2.nix
let
useHostResolvConf = config.networking.resolvconf.enable && config.networking.useHostResolvConf;
bootStage2 = pkgs.substituteAll {
src = ./stage-2-init.sh;
shellDebug = "${pkgs.bashInteractive}/bin/bash";
shell = "${pkgs.bash}/bin/bash";
inherit (config.boot) readOnlyNixStore systemdExecutable extraSystemdUnitPaths;
inherit (config.system.nixos) distroName;
isExecutable = true;
inherit useHostResolvConf;
inherit (config.system.build) earlyMountScript;
path = lib.makeBinPath ([
pkgs.coreutils
pkgs.util-linux
]
++ lib.optional useHostResolvConf pkgs.openresolv);
postBootCommands =
pkgs.writeText "local-cmds"
''
${config.boot.postBootCommands}
${config.powerManagement.powerUpCommands}
'';
};
in {
options.local.bootConfig.stage2patch.disable = lib.mkEnableOption "";
config =
lib.mkIf (!config.local.bootConfig.stage2patch.disable)
{
system.build.bootStage2 = lib.mkForce bootStage2;
};
_file = ./stage2patch.nix;
}