diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 94e56a900c8a..5f001e05aa47 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -1236,25 +1236,11 @@ in # allow `system.build.toplevel' to be included. (If we had a direct # reference to ${regInfo} here, then we would get a cyclic # dependency.) - systemd.services.register-nix-paths = lib.mkIf config.nix.enable { - wantedBy = [ - "multi-user.target" - ]; - after = [ - "nix-daemon.service" - "nix-daemon.socket" - ]; - restartIfChanged = false; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - }; - script = '' - if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then - ${config.nix.package.out}/bin/nix-store --load-db < "''${BASH_REMATCH[1]}" - fi - ''; - }; + boot.postBootCommands = lib.mkIf config.nix.enable '' + if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then + ${config.nix.package.out}/bin/nix-store --load-db < ''${BASH_REMATCH[1]} + fi + ''; boot.initrd.availableKernelModules = optional (cfg.qemu.diskInterface == "scsi") "sym53c8xx" ++ optional (cfg.tpm.enable) "tpm_tis";