aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mk-sandbox-system.nix20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/mk-sandbox-system.nix b/lib/mk-sandbox-system.nix
index a56bdab..b678399 100644
--- a/lib/mk-sandbox-system.nix
+++ b/lib/mk-sandbox-system.nix
@@ -3,11 +3,16 @@ flake:
3, name ? "sandbox" 3, name ? "sandbox"
4, user ? "dummy" 4, user ? "dummy"
5, config ? { } 5, config ? { }
6, tools ? []
7, envVars ? { }
6, restrictNetwork ? true # to be replaced with virtualisation.restrictNetwork 8, restrictNetwork ? true # to be replaced with virtualisation.restrictNetwork
7, patchQemu9p ? false # until qemu 7.2.0 becomes available in nixpkgs 9, patchQemu9p ? false # until qemu 7.2.0 becomes available in nixpkgs
8}: 10}:
9 11
10rec { 12let
13 shellLib = flake.lib.shell { inherit pkgs; };
14
15in rec {
11 16
12 nixosConfigurations.${name} = pkgs.nixos ({ modulesPath, lib, pkgs, ... }: { 17 nixosConfigurations.${name} = pkgs.nixos ({ modulesPath, lib, pkgs, ... }: {
13 imports = [ 18 imports = [
@@ -43,6 +48,19 @@ rec {
43 ''; 48 '';
44 }; 49 };
45 50
51 environment = {
52 variables = envVars;
53 systemPackages = tools;
54
55 # TODO: also print a summary of the host mount points
56 # TODO: also print a summary of the forwarded ports
57 interactiveShellInit = lib.mkBefore ''
58 ${lib.optionalString (envVars != {}) (shellLib.printEnvVars envVars)}
59 ${lib.optionalString (tools != []) (shellLib.printBins tools)}
60 echo
61 '';
62 };
63
46 virtualisation = { 64 virtualisation = {
47 graphics = lib.mkDefault false; 65 graphics = lib.mkDefault false;
48 diskImage = lib.mkDefault "$TMP_DISK"; 66 diskImage = lib.mkDefault "$TMP_DISK";