mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 14:10:33 +03:00
Merge pull request #164943 from ElvishJerricco/systemd-initrd-reuse-systemd-module
initrd: Opt-in bare bones systemd-based initrd
This commit is contained in:
commit
7cdc4dd5d1
25 changed files with 1307 additions and 270 deletions
|
@ -923,6 +923,8 @@ in
|
|||
mkVMOverride (cfg.fileSystems //
|
||||
{
|
||||
"/".device = cfg.bootDevice;
|
||||
"/".fsType = "ext4";
|
||||
"/".autoFormat = true;
|
||||
|
||||
"/tmp" = mkIf config.boot.tmpOnTmpfs
|
||||
{ device = "tmpfs";
|
||||
|
@ -953,6 +955,28 @@ in
|
|||
};
|
||||
} // lib.mapAttrs' mkSharedDir cfg.sharedDirectories);
|
||||
|
||||
boot.initrd.systemd = lib.mkIf (config.boot.initrd.systemd.enable && cfg.writableStore) {
|
||||
mounts = [{
|
||||
where = "/sysroot/nix/store";
|
||||
what = "overlay";
|
||||
type = "overlay";
|
||||
options = "lowerdir=/sysroot/nix/.ro-store,upperdir=/sysroot/nix/.rw-store/store,workdir=/sysroot/nix/.rw-store/work";
|
||||
wantedBy = ["local-fs.target"];
|
||||
before = ["local-fs.target"];
|
||||
requires = ["sysroot-nix-.ro\\x2dstore.mount" "sysroot-nix-.rw\\x2dstore.mount" "rw-store.service"];
|
||||
after = ["sysroot-nix-.ro\\x2dstore.mount" "sysroot-nix-.rw\\x2dstore.mount" "rw-store.service"];
|
||||
unitConfig.IgnoreOnIsolate = true;
|
||||
}];
|
||||
services.rw-store = {
|
||||
after = ["sysroot-nix-.rw\\x2dstore.mount"];
|
||||
unitConfig.DefaultDependencies = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "/bin/mkdir -p 0755 /sysroot/nix/.rw-store/store /sysroot/nix/.rw-store/work /sysroot/nix/store";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
swapDevices = mkVMOverride [ ];
|
||||
boot.initrd.luks.devices = mkVMOverride {};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue