nixos/etc: use nixos-init to find etc
This commit is contained in:
@@ -563,6 +563,8 @@ in
|
||||
|
||||
# Resolving sysroot symlinks without code exec
|
||||
"${pkgs.chroot-realpath}/bin/chroot-realpath"
|
||||
# Find the etc paths
|
||||
"${config.system.nixos-init.package}/bin/find-etc"
|
||||
]
|
||||
++ lib.optionals config.system.nixos-init.enable [
|
||||
"${config.system.nixos-init.package}/bin/initrd-init"
|
||||
|
||||
@@ -144,15 +144,10 @@
|
||||
{
|
||||
initrd-find-etc = {
|
||||
description = "Find the path to the etc metadata image and based dir";
|
||||
requires = [
|
||||
config.boot.initrd.systemd.services.initrd-find-nixos-closure.name
|
||||
];
|
||||
after = [
|
||||
config.boot.initrd.systemd.services.initrd-find-nixos-closure.name
|
||||
];
|
||||
before = [ "shutdown.target" ];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
requiredBy = [ "initrd.target" ];
|
||||
path = [ config.system.nixos-init.package ];
|
||||
unitConfig = {
|
||||
DefaultDependencies = false;
|
||||
RequiresMountsFor = "/sysroot/nix/store";
|
||||
@@ -160,20 +155,8 @@
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = "${config.system.nixos-init.package}/bin/find-etc";
|
||||
};
|
||||
|
||||
script = # bash
|
||||
''
|
||||
set -uo pipefail
|
||||
|
||||
closure="$(realpath /nixos-closure)"
|
||||
|
||||
metadata_image="$(${pkgs.chroot-realpath}/bin/chroot-realpath /sysroot "$closure/etc-metadata-image")"
|
||||
ln -s "/sysroot$metadata_image" /etc-metadata-image
|
||||
|
||||
basedir="$(${pkgs.chroot-realpath}/bin/chroot-realpath /sysroot "$closure/etc-basedir")"
|
||||
ln -s "/sysroot$basedir" /etc-basedir
|
||||
'';
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user