aboutsummaryrefslogtreecommitdiff
path: root/tests/nixos
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2024-04-12 12:29:10 +0300
committerK900 <me@0upti.me>2024-04-13 12:43:19 +0300
commitb469c6509ba616da6df8a27e4ccb205a877c66c9 (patch)
treede7ed716d1346043e2085693f88ebffbce106581 /tests/nixos
parentd363bc2f123876b2524ca76997f27f9f4e0a2391 (diff)
libstore/build: just copy the magic /etc files into the sandbox
Saves us a bunch of thinking about how to handle symlinks, and prevents the DNS config from changing on the fly under the build, which may or may not be a good thing? Change-Id: I071e6ae7e220884690b788d94f480866f428db71
Diffstat (limited to 'tests/nixos')
-rw-r--r--tests/nixos/default.nix2
-rw-r--r--tests/nixos/symlink-resolvconf.nix28
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/nixos/default.nix b/tests/nixos/default.nix
index 547290188..14fc0da81 100644
--- a/tests/nixos/default.nix
+++ b/tests/nixos/default.nix
@@ -158,4 +158,6 @@ in
ca-fd-leak = runNixOSTestFor "x86_64-linux" ./ca-fd-leak;
fetch-git = runNixOSTestFor "x86_64-linux" ./fetch-git;
+
+ symlinkResolvconf = runNixOSTestFor "x86_64-linux" ./symlink-resolvconf.nix;
}
diff --git a/tests/nixos/symlink-resolvconf.nix b/tests/nixos/symlink-resolvconf.nix
new file mode 100644
index 000000000..47df27524
--- /dev/null
+++ b/tests/nixos/symlink-resolvconf.nix
@@ -0,0 +1,28 @@
+{ pkgs, ... }:
+let
+ checkResolvconfInSandbox = pkgs.runCommand "resolvconf-works-in-sandbox" {
+ # must be an FOD to have a resolv.conf in the first place
+ outputHash = "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=";
+ outputHashAlgo = "sha256";
+ outputHashType = "flat";
+ } ''
+ cat /etc/resolv.conf
+ touch $out
+ '';
+in {
+ name = "symlink-resolvconf";
+
+ nodes.machine = {
+ # Enabling resolved makes /etc/resolv.conf a symlink to /etc/static/resolv.conf, which is itself a symlink to /run.
+ # If this works, most other things probably will too.
+ services.resolved.enable = true;
+
+ virtualisation.additionalPaths = [checkResolvconfInSandbox.drvPath];
+ };
+
+ testScript = { nodes }: ''
+ start_all()
+
+ machine.succeed('nix-build --check ${checkResolvconfInSandbox.drvPath}')
+ '';
+}