commit 83d576fb58c8b1807952523918aa3be35a8bebf4
parent b38b0bd932044ddceaa2ffe523c04de024fd87dc
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 20 Sep 2022 15:46:03 +0100
remove unused lets, add test case
Diffstat:
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/make-image.nix b/make-image.nix
@@ -1,6 +1,6 @@
pkgs: config:
let
- inherit (pkgs) buildPlatform callPackage stdenvNoCC closureInfo stdenv writeText s6-rc;
+ inherit (pkgs) callPackage stdenvNoCC closureInfo stdenv writeText s6-rc;
# we need to generate s6 db, by generating closure of all
# config.services and calling s6-rc-compile on them
diff --git a/tests/smoke/configuration.nix b/tests/smoke/configuration.nix
@@ -24,9 +24,9 @@ in rec {
# the simplest approach at the consumer end is to require the
# producer to create a file per output variable.
name = "ntp";
- run = let s = services;
- r = "${pkgs.ntp}/bin/ntp $(cat ${output s.dhcpv4 "ntp_servers"}) $(cat ${output s.dhcpv6 "NTP_IP"})";
- in (builtins.trace r r);
+ run = let inherit (services) dhcpv4 dhcpv6;
+ in "${pkgs.ntp}/bin/ntp $(cat ${output dhcpv4 "ntp_servers"}) $(cat ${output dhcpv6 "NTP_IP"})";
+
# I don't think it's possible to standardise the file names
# generally, as different services have different outputs, but it
# would be cool if services that provide an interface could use
@@ -41,16 +41,16 @@ in rec {
};
services.defaultroute4 =
- let s = services;
+ let inherit (services) dhcpv4;
in oneshot {
name = "defaultroute4";
up = ''
- ip route add default gw $(cat ${output s.dhcpv4 "address"})
- echo "1" > /sys/net/ipv4/$(cat ${output s.dhcpv4 "ifname"})
+ ip route add default gw $(cat ${output dhcpv4 "address"})
+ echo "1" > /sys/net/ipv4/$(cat ${output dhcpv4 "ifname"})
'';
down = ''
- ip route del default gw $(cat ${output s.dhcpv4 "address"})
- echo "0" > /sys/net/ipv4/$(cat ${output s.dhcpv4 "ifname"})
+ ip route del default gw $(cat ${output dhcpv4 "address"})
+ echo "0" > /sys/net/ipv4/$(cat ${output dhcpv4 "ifname"})
'';
};
systemPackages = [ pkgs.hello ] ;
diff --git a/tests/smoke/run.sh b/tests/smoke/run.sh
@@ -14,6 +14,7 @@ chmod -R +w $db
# check we have closure of config.services (lo.link.service exists only
# as a dependency)
test "$(s6-rc-db -c $db type lo.link.service)" = "oneshot"
+test "$(s6-rc-db -c $db type ntp.service)" = "longrun"
echo OK
EOF
)