2024-04-12 11:29:10 +02:00
|
|
|
{ pkgs, ... }:
|
|
|
|
let
|
2024-04-14 15:41:06 +02:00
|
|
|
# Can't use the cool helper because inputDerivation does not work with FODs :(
|
2024-04-12 11:29:10 +02:00
|
|
|
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}')
|
|
|
|
'';
|
|
|
|
}
|