From ebd825349bfc1f011f2d8e322df1703de085293f Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 13 Nov 2022 01:39:59 +0100 Subject: mkSandboxSystem: remove usage of nixpkgs.lib --- lib/mk-sandbox-system.nix | 86 ++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 46 deletions(-) (limited to 'lib') diff --git a/lib/mk-sandbox-system.nix b/lib/mk-sandbox-system.nix index 7514b93..5574736 100644 --- a/lib/mk-sandbox-system.nix +++ b/lib/mk-sandbox-system.nix @@ -7,8 +7,6 @@ , patchQemu9p ? false }: -with nixpkgs.lib; - let pkgs = import nixpkgs { inherit system; }; @@ -26,62 +24,58 @@ let in rec { - nixosConfigurations.${name} = nixosSystem { - inherit system; - - modules = [ - (nixpkgs + "/nixos/modules/profiles/minimal.nix") + nixosConfigurations.${name} = pkgs.nixos + ({ modulesPath, lib, pkgs, ... }: with lib; { + imports = [ + (modulesPath + "/profiles/minimal.nix") { environment.noXlibs = false; } # avoid mass rebuild - (nixpkgs + "/nixos/modules/profiles/qemu-guest.nix") - (nixpkgs + "/nixos/modules/virtualisation/qemu-vm.nix") - - ({ config, lib, pkgs, ... }: { + (modulesPath + "/profiles/qemu-guest.nix") + (modulesPath + "/virtualisation/qemu-vm.nix") - system.stateVersion = mkDefault pkgs.lib.trivial.release; + config + ]; - networking = { - hostName = name; - firewall.enable = mkDefault false; - }; + system.stateVersion = mkDefault trivial.release; - users.users.${user} = { - isNormalUser = mkDefault true; - password = mkDefault ""; - extraGroups = mkDefault [ "wheel" ]; - }; + networking = { + hostName = name; + firewall.enable = mkDefault false; + }; - security.sudo.wheelNeedsPassword = mkDefault false; + users.users.${user} = { + isNormalUser = mkDefault true; + password = mkDefault ""; + extraGroups = mkDefault [ "wheel" ]; + }; - services.getty = { - autologinUser = mkDefault user; - helpLine = mkDefault '' - Press to terminate the virtual machine. - The working directory on the host is mounted to /mnt. - ''; - }; + security.sudo.wheelNeedsPassword = mkDefault false; - virtualisation = { - graphics = mkDefault false; - diskImage = mkDefault "$(mktemp).qcow2"; + services.getty = { + autologinUser = mkDefault user; + helpLine = mkDefault '' + Press to terminate the virtual machine. + The working directory on the host is mounted to /mnt. + ''; + }; - sharedDirectories.host = { - source = "$SHARED_CWD"; - target = "/mnt"; - }; + virtualisation = { + graphics = mkDefault false; + diskImage = mkDefault "$(mktemp).qcow2"; - # Uncomment when this is merged: - # https://github.com/NixOS/nixpkgs/pull/200225 - #restrictNetwork = mkDefault true; + sharedDirectories.host = { + source = "$SHARED_CWD"; + target = "/mnt"; + }; - qemu.package = mkDefault - (if patchQemu9p then qemu_kvm_patched_9p else pkgs.qemu_kvm); - }; - }) + # Uncomment when this is merged: + # https://github.com/NixOS/nixpkgs/pull/200225 + #restrictNetwork = mkDefault true; - config - ]; - }; + qemu.package = mkDefault + (if patchQemu9p then qemu_kvm_patched_9p else pkgs.qemu_kvm); + }; + }); packages.${name} = nixosConfigurations.${name}.config.system.build.vm; -- cgit v1.2.3