summary refs log tree commit diff
path: root/nix/testVm/vm.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/testVm/vm.nix')
-rw-r--r--nix/testVm/vm.nix67
1 files changed, 66 insertions, 1 deletions
diff --git a/nix/testVm/vm.nix b/nix/testVm/vm.nix

index 0c61aa83..3f2e9311 100644 --- a/nix/testVm/vm.nix +++ b/nix/testVm/vm.nix
@@ -1,4 +1,5 @@ { + config, pkgs, lib, modulesPath, @@ -6,7 +7,8 @@ }: { imports = [ -# (modulesPath + "/virtualisation/qemu-vm.nix") + # (modulesPath + "/virtualisation/qemu-vm.nix") + ./musl.nix ]; virtualisation.vmVariant = { @@ -59,4 +61,67 @@ font = "${pkgs.cozette}/share/consolefonts/cozette6x13.psfu"; packages = with pkgs; [ cozette ]; }; + + # Remove perl from activation + system.etc.overlay.enable = lib.mkForce true; + systemd.sysusers.enable = lib.mkForce true; + + programs.less.lessopen = lib.mkForce null; + programs.command-not-found.enable = lib.mkForce false; + environment.defaultPackages = lib.mkForce [ ]; + documentation.info.enable = lib.mkForce false; + documentation.man.enable = false; + + system = { + copySystemConfiguration = false; + includeBuildDependencies = false; + disableInstallerTools = lib.mkForce true; + build = { + separateActivationScript = true; + }; + switch.enable = lib.mkForce false; + nixos-init.enable = true; + }; + + nixpkgs.hostPlatform = { + system = "x86_64-linux"; + config = "x86_64-unknown-linux-musl"; + }; + + boot.loader.grub.enable = lib.mkDefault false; + fileSystems."/".device = lib.mkDefault "/dev/disk/by-label/nixos"; + # https://github.com/NixOS/nixpkgs/pull/496852/changes + boot.postBootCommands = lib.mkForce ""; + systemd.services.register-nix-paths = lib.mkIf config.nix.enable { + # Run early during boot so the nix store DB is populated before any + # service (or test backdoor) tries to use nix commands. + # nix-store --load-db writes to the SQLite DB directly, so it does not + # need the nix-daemon. + unitConfig.DefaultDependencies = false; + wantedBy = [ + "sysinit.target" + ]; + before = [ + "sysinit.target" + "shutdown.target" + "nix-daemon.socket" + "nix-daemon.service" + ]; + after = [ + "local-fs.target" + ]; + conflicts = [ + "shutdown.target" + ]; + restartIfChanged = false; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + script = '' + if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then + ${lib.getExe' config.nix.package.out "nix-store"} --load-db < "''${BASH_REMATCH[1]}" + fi + ''; + }; }