From ceafec213ff2514791848b1999e01ebf17dd6ceb Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Sat, 20 Jul 2024 16:16:21 +0200 Subject: [PATCH] nixos/proxmox-lxc: fix nixos-rebuild Same is being done in lxc-container module. --- nixos/modules/virtualisation/proxmox-lxc.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nixos/modules/virtualisation/proxmox-lxc.nix b/nixos/modules/virtualisation/proxmox-lxc.nix index d9d60b52e3ae..9a8325f92636 100644 --- a/nixos/modules/virtualisation/proxmox-lxc.nix +++ b/nixos/modules/virtualisation/proxmox-lxc.nix @@ -64,6 +64,18 @@ with lib; extraCommands = "mkdir -p root etc/systemd/network"; }; + boot.postBootCommands = '' + # After booting, register the contents of the Nix store in the Nix + # database. + if [ -f /nix-path-registration ]; then + ${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration && + rm /nix-path-registration + fi + + # nixos-rebuild also requires a "system" profile + ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system + ''; + boot = { isContainer = true; loader.initScript.enable = true;