diff options
author | pacien | 2022-11-14 00:40:17 +0100 |
---|---|---|
committer | pacien | 2022-11-14 00:40:17 +0100 |
commit | 94b4db41750a7b6846ba57f643cb05d8bf94e1cb (patch) | |
tree | 9a2b81b2ce8347ae300f57a39ac9cf808a83a92c /lib | |
parent | e8459a4a34f2611a547b966b2c58867d99d0f40c (diff) | |
download | flaky-utils-94b4db41750a7b6846ba57f643cb05d8bf94e1cb.tar.gz |
mkSandboxSystem: add tools and envVars option with printing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mk-sandbox-system.nix | 20 |
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 | ||
10 | rec { | 12 | let |
13 | shellLib = flake.lib.shell { inherit pkgs; }; | ||
14 | |||
15 | in 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"; |