nixos/chrony: add simple test

+35
+1
nixos/tests/all-tests.nix
··· 167 167 cgit = handleTest ./cgit.nix {}; 168 168 charliecloud = handleTest ./charliecloud.nix {}; 169 169 chromium = (handleTestOn ["aarch64-linux" "x86_64-linux"] ./chromium.nix {}).stable or {}; 170 + chrony = handleTestOn ["aarch64-linux" "x86_64-linux"] ./chrony.nix {}; 170 171 chrony-ptp = handleTestOn ["aarch64-linux" "x86_64-linux"] ./chrony-ptp.nix {}; 171 172 cinnamon = handleTest ./cinnamon.nix {}; 172 173 cjdns = handleTest ./cjdns.nix {};
+31
nixos/tests/chrony.nix
··· 1 + import ./make-test-python.nix ({ lib, ... }: 2 + { 3 + name = "chrony"; 4 + 5 + meta = { 6 + maintainers = with lib.maintainers; [ fpletz ]; 7 + }; 8 + 9 + nodes = { 10 + default = { 11 + services.chrony.enable = true; 12 + }; 13 + graphene-hardened = { 14 + services.chrony.enable = true; 15 + services.chrony.enableMemoryLocking = true; 16 + environment.memoryAllocator.provider = "graphene-hardened"; 17 + # dhcpcd privsep is incompatible with graphene-hardened 18 + networking.useNetworkd = true; 19 + }; 20 + }; 21 + 22 + testScript = {nodes, ...} : let 23 + graphene-hardened = nodes.graphene-hardened.system.build.toplevel; 24 + in '' 25 + default.start() 26 + default.wait_for_unit('multi-user.target') 27 + default.succeed('systemctl is-active chronyd.service') 28 + default.succeed('${graphene-hardened}/bin/switch-to-configuration test') 29 + default.succeed('systemctl is-active chronyd.service') 30 + ''; 31 + })
+3
pkgs/tools/networking/chrony/default.nix
··· 1 1 { lib, stdenv, fetchurl, pkg-config 2 2 , gnutls, libedit, nspr, nss, readline, texinfo 3 3 , libcap, libseccomp, pps-tools 4 + , nixosTests 4 5 }: 5 6 6 7 stdenv.mkDerivation rec { ··· 35 36 ''; 36 37 37 38 hardeningEnable = [ "pie" ]; 39 + 40 + passthru.tests = { inherit (nixosTests) chrony chrony-ptp; }; 38 41 39 42 meta = with lib; { 40 43 description = "Sets your computer's clock from time servers on the Net";