From 80cc25eb51e52b2b90d1080ca583b46dec9c2e3e Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 6 Oct 2023 23:52:04 +0300 Subject: [PATCH 01/14] nixos/testing: fix eval for tests created without make-python-test.nix We have too many test entrypoints and this is a problem. --- nixos/lib/testing/nodes.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/nixos/lib/testing/nodes.nix b/nixos/lib/testing/nodes.nix index c6ba2a4feac6..a47d1c98ecec 100644 --- a/nixos/lib/testing/nodes.nix +++ b/nixos/lib/testing/nodes.nix @@ -30,13 +30,15 @@ let }) ({ options, ... }: { key = "nodes.nix-pkgs"; - config = mkIf (!options.nixpkgs.pkgs.isDefined) { - # Ensure we do not use aliases. Ideally this is only set - # when the test framework is used by Nixpkgs NixOS tests. - nixpkgs.config.allowAliases = false; - # TODO: switch to nixpkgs.hostPlatform and make sure containers-imperative test still evaluates. - nixpkgs.system = hostPkgs.stdenv.hostPlatform.system; - }; + config = optionalAttrs (!config.node.pkgsReadOnly) ( + mkIf (!options.nixpkgs.pkgs.isDefined) { + # Ensure we do not use aliases. Ideally this is only set + # when the test framework is used by Nixpkgs NixOS tests. + nixpkgs.config.allowAliases = false; + # TODO: switch to nixpkgs.hostPlatform and make sure containers-imperative test still evaluates. + nixpkgs.system = hostPkgs.stdenv.hostPlatform.system; + } + ); }) testModuleArgs.config.extraBaseModules ]; From d4eca0e8bbfb20a667d684f4c207372c5dc95248 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 6 Oct 2023 23:52:42 +0300 Subject: [PATCH 02/14] nixos/gollum: remove non-existent maintainer --- nixos/modules/services/misc/gollum.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/gollum.nix b/nixos/modules/services/misc/gollum.nix index d607e92e5ec9..b73528abaf65 100644 --- a/nixos/modules/services/misc/gollum.nix +++ b/nixos/modules/services/misc/gollum.nix @@ -154,5 +154,5 @@ in }; }; - meta.maintainers = with lib.maintainers; [ erictapen bbenno joscha ]; + meta.maintainers = with lib.maintainers; [ erictapen bbenno ]; } From 1bc5af0f6a0ce3ff7e18577a92aae4d467ee0630 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 6 Oct 2023 23:52:52 +0300 Subject: [PATCH 03/14] nixos/tests/dconf: fix config format This was changed in the module, but not in the test --- nixos/tests/dconf.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/tests/dconf.nix b/nixos/tests/dconf.nix index 86f703e3b98e..192c075540a4 100644 --- a/nixos/tests/dconf.nix +++ b/nixos/tests/dconf.nix @@ -14,8 +14,8 @@ import ./make-test-python.nix profiles.user.databases = [ { settings = { - "test/not/locked" = mkInt32 1; - "test/is/locked" = "locked"; + "test/not".locked = mkInt32 1; + "test/is".locked = "locked"; }; locks = [ "/test/is/locked" From a3323f68a7d46d8762646cd0265b90bc1bc1a3b8 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 6 Oct 2023 23:53:28 +0300 Subject: [PATCH 04/14] nixos/tests/hardened: fix eval --- nixos/tests/hardened.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/hardened.nix b/nixos/tests/hardened.nix index f54506224e51..e38834961e13 100644 --- a/nixos/tests/hardened.nix +++ b/nixos/tests/hardened.nix @@ -28,7 +28,7 @@ import ./make-test-python.nix ({ pkgs, ... } : { }; }; boot.extraModulePackages = - optional (versionOlder config.boot.kernelPackages.kernel.version "5.6") + pkgs.lib.optional (pkgs.lib.versionOlder config.boot.kernelPackages.kernel.version "5.6") config.boot.kernelPackages.wireguard; boot.kernelModules = [ "wireguard" ]; }; From 16753291fae405d829174b1c5e23ff63f9582f65 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 6 Oct 2023 23:53:50 +0300 Subject: [PATCH 05/14] nixos/tests/legit: fix eval --- nixos/tests/legit.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/legit.nix b/nixos/tests/legit.nix index 3eb3f5035699..a71fb1743c76 100644 --- a/nixos/tests/legit.nix +++ b/nixos/tests/legit.nix @@ -8,7 +8,7 @@ in meta.maintainers = [ lib.maintainers.ratsclub ]; nodes = { - server = { config, pkgs }: { + server = { config, pkgs, ... }: { services.legit = { enable = true; settings = { From a1012165264b2b56db912a79f6bca1159b7d76ce Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 6 Oct 2023 23:54:04 +0300 Subject: [PATCH 06/14] nixos/tests/osquery: fix eval --- nixos/tests/osquery.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/osquery.nix b/nixos/tests/osquery.nix index 9aa9820e50c5..e98e7c1baf04 100644 --- a/nixos/tests/osquery.nix +++ b/nixos/tests/osquery.nix @@ -36,7 +36,7 @@ in machine.succeed("echo 'SELECT address FROM etc_hosts LIMIT 1;' | osqueryi | tee /dev/console | grep -q '127.0.0.1'") # osquery binaries respect configuration from the Nix config option. - machine.succeed("echo 'SELECT value FROM osquery_flags WHERE name = \"utc\";' | osqueryi | tee /dev/console | grep -q ${boolToString utc}") + machine.succeed("echo 'SELECT value FROM osquery_flags WHERE name = \"utc\";' | osqueryi | tee /dev/console | grep -q ${lib.boolToString utc}") # osquery binaries respect configuration from the Nix flags option. machine.succeed("echo 'SELECT value FROM osquery_flags WHERE name = \"config_refresh\";' | osqueryi | tee /dev/console | grep -q ${config_refresh}") From 969a309b9e04e2b3a6c564ea2c0b600d4a3075e9 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 6 Oct 2023 23:54:15 +0300 Subject: [PATCH 07/14] nixos/tests/sftpgo: fix eval --- nixos/tests/sftpgo.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nixos/tests/sftpgo.nix b/nixos/tests/sftpgo.nix index 8cd5675c1d4d..e50c694c9c55 100644 --- a/nixos/tests/sftpgo.nix +++ b/nixos/tests/sftpgo.nix @@ -17,7 +17,7 @@ let # Returns an attributeset of users who are not system users. normalUsers = config: - filterAttrs (name: user: user.isNormalUser) config.users.users; + lib.filterAttrs (name: user: user.isNormalUser) config.users.users; # Returns true if a user is a member of the given group isMemberOf = @@ -26,7 +26,7 @@ let groupName: # users.users attrset user: - any (x: x == user.name) config.users.groups.${groupName}.members; + lib.any (x: x == user.name) config.users.groups.${groupName}.members; # Generates a valid SFTPGo user configuration for a given user # Will be converted to JSON and loaded on application startup. @@ -144,7 +144,7 @@ in { name = "sftpgo"; - meta.maintainers = with maintainers; [ yayayayaka ]; + meta.maintainers = with lib.maintainers; [ yayayayaka ]; nodes = { server = { nodes, ... }: { @@ -228,7 +228,7 @@ in # Created shared folder directories "d ${statePath}/${sharedFolderName} 2770 ${sftpgoUser} ${sharedFolderName} -" ] - ++ mapAttrsToList (name: user: + ++ lib.mapAttrsToList (name: user: # Create private user directories '' d ${statePath}/users/${user.name} 0700 ${sftpgoUser} ${sftpgoGroup} - @@ -273,12 +273,12 @@ in networking.firewall.allowedTCPPorts = [ 22 80 ]; services.sftpgo = { settings = { - sftpd.bindings = mkForce [{ + sftpd.bindings = lib.mkForce [{ address = ""; port = 22; }]; - httpd.bindings = mkForce [{ + httpd.bindings = lib.mkForce [{ address = ""; port = 80; }]; From a4e7f5011d86f966dcd632b9d8065a4b0c4f7322 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 6 Oct 2023 23:54:42 +0300 Subject: [PATCH 08/14] nixos/tests: remove reference to non-existent test --- nixos/tests/all-tests.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index d5cfeaef9cc3..da788cc159c8 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -331,7 +331,6 @@ in { graylog = handleTest ./graylog.nix {}; grocy = handleTest ./grocy.nix {}; grub = handleTest ./grub.nix {}; - guacamole-client = handleTest ./guacamole-client.nix {}; guacamole-server = handleTest ./guacamole-server.nix {}; gvisor = handleTest ./gvisor.nix {}; hadoop = import ./hadoop { inherit handleTestOn; package=pkgs.hadoop; }; From 3626143f19637366bf0260d32f6401de0fa62a0a Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 7 Oct 2023 00:07:11 +0300 Subject: [PATCH 09/14] nixos/tests/litestream: fix eval Test still doesn't pass. --- nixos/tests/litestream.nix | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/nixos/tests/litestream.nix b/nixos/tests/litestream.nix index f9d71c526e9e..a281d8538694 100644 --- a/nixos/tests/litestream.nix +++ b/nixos/tests/litestream.nix @@ -44,14 +44,22 @@ import ./make-test-python.nix ({ pkgs, ...} : { }; services.grafana = { enable = true; - security = { - adminUser = "admin"; - adminPassword = "admin"; - }; - addr = "localhost"; - port = 3000; - extraOptions = { - DATABASE_URL = "sqlite3:///var/lib/grafana/data/grafana.db?cache=private&mode=rwc&_journal_mode=WAL"; + settings = { + security = { + admin_user = "admin"; + admin_password = "admin"; + }; + + server = { + http_addr = "localhost"; + http_port = 3000; + }; + + database = { + type = "sqlite3"; + path = "/var/lib/grafana/data/grafana.db"; + wal = true; + }; }; }; users.users.foo = { From 2c596b216ae08674b764870bcdebfa04dfa7cd84 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 7 Oct 2023 00:07:23 +0300 Subject: [PATCH 10/14] nixos/orangefs: fix typo in group name This would have broken eval and has broken the test. --- nixos/modules/services/network-filesystems/orangefs/server.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/network-filesystems/orangefs/server.nix b/nixos/modules/services/network-filesystems/orangefs/server.nix index e20e7975ebaa..085b64e4c040 100644 --- a/nixos/modules/services/network-filesystems/orangefs/server.nix +++ b/nixos/modules/services/network-filesystems/orangefs/server.nix @@ -192,7 +192,7 @@ in { # orangefs daemon will run as user users.users.orangefs = { isSystemUser = true; - group = "orangfs"; + group = "orangefs"; }; users.groups.orangefs = {}; From 93d52c5609aaa58a78a01cc06f2a79e1cdeb6abd Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 7 Oct 2023 00:07:40 +0300 Subject: [PATCH 11/14] nixos/tests/mongodb: remove non-existent maintainer --- nixos/tests/mongodb.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/mongodb.nix b/nixos/tests/mongodb.nix index 75b0c4c2ab2b..1afc891817af 100644 --- a/nixos/tests/mongodb.nix +++ b/nixos/tests/mongodb.nix @@ -27,7 +27,7 @@ import ./make-test-python.nix ({ pkgs, ... }: in { name = "mongodb"; meta = with pkgs.lib.maintainers; { - maintainers = [ bluescreen303 offline cstrahan rvl phile314 ]; + maintainers = [ bluescreen303 offline rvl phile314 ]; }; nodes = { From 29535e40efd26cbfa98f56436a13932189996722 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 7 Oct 2023 00:07:50 +0300 Subject: [PATCH 12/14] nixos/tests/lxd-image-server: fix eval --- nixos/tests/lxd-image-server.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/tests/lxd-image-server.nix b/nixos/tests/lxd-image-server.nix index d0afa495a5b1..619542bdd945 100644 --- a/nixos/tests/lxd-image-server.nix +++ b/nixos/tests/lxd-image-server.nix @@ -8,8 +8,8 @@ let }; }; - lxd-image-metadata = lxd-image.lxdMeta.${pkgs.stdenv.hostPlatform.system}; - lxd-image-rootfs = lxd-image.lxdImage.${pkgs.stdenv.hostPlatform.system}; + lxd-image-metadata = lxd-image.lxdContainerMeta.${pkgs.stdenv.hostPlatform.system}; + lxd-image-rootfs = lxd-image.lxdContainerImage.${pkgs.stdenv.hostPlatform.system}; in { name = "lxd-image-server"; From b854f27f475aca3fba6f9c45801468916386176e Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 7 Oct 2023 00:10:50 +0300 Subject: [PATCH 13/14] nixos/tests/sftpgo: fix eval --- nixos/tests/sftpgo.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/tests/sftpgo.nix b/nixos/tests/sftpgo.nix index e50c694c9c55..db0098d2ac48 100644 --- a/nixos/tests/sftpgo.nix +++ b/nixos/tests/sftpgo.nix @@ -52,7 +52,7 @@ let # inside the dataprovider they will be automatically created. # You have to create the folder on the filesystem yourself virtual_folders = - lib.optional (lib.isMemberOf config sharedFolderName user) { + lib.optional (isMemberOf config sharedFolderName user) { name = sharedFolderName; mapped_path = "${config.services.sftpgo.dataDir}/${sharedFolderName}"; virtual_path = "/${sharedFolderName}"; @@ -63,7 +63,7 @@ let lib.recursiveUpdate { "/" = [ "list" ]; # read-only top level directory "/private" = [ "*" ]; # private subdirectory, not shared with others - } (lib.optionalAttrs (lib.isMemberOf config "shared" user) { + } (lib.optionalAttrs (isMemberOf config "shared" user) { "/shared" = [ "*" ]; }); @@ -89,7 +89,7 @@ let # of users and folders to import to SFTPGo. loadDataJson = config: pkgs.writeText "users-and-folders.json" (builtins.toJSON { users = - lib.mapAttrsToList (name: user: lib.generateUserAttrSet config user) (normalUsers config); + lib.mapAttrsToList (name: user: generateUserAttrSet config user) (normalUsers config); folders = [ { From 320fcb409cdd75aa31ce661a7e5bce71a315c7a6 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 7 Oct 2023 00:17:54 +0300 Subject: [PATCH 14/14] nixos/tests/tracee: fix eval Test still doesn't pass. --- nixos/tests/tracee.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nixos/tests/tracee.nix b/nixos/tests/tracee.nix index 8ec86ef091ef..3dadc0f9fdb3 100644 --- a/nixos/tests/tracee.nix +++ b/nixos/tests/tracee.nix @@ -43,6 +43,10 @@ import ./make-test-python.nix ({ pkgs, ... }: { mv $GOPATH/tracee-integration $out/bin/ ''; doInstallCheck = false; + + meta = oa.meta // { + outputsToInstall = []; + }; })) ]; };