Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ongoing removal of overuses of with #245981

Merged
merged 7 commits into from
Aug 1, 2023
10 changes: 4 additions & 6 deletions nixos/tests/binary-cache.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import ./make-test-python.nix ({ lib, ... }:

with lib;
import ./make-test-python.nix ({ lib, pkgs, ... }:

{
name = "binary-cache";
meta.maintainers = with maintainers; [ thomasjm ];
meta.maintainers = with lib.maintainers; [ thomasjm ];

nodes.machine =
{ pkgs, ... }: {
imports = [ ../modules/installer/cd-dvd/channel.nix ];
environment.systemPackages = with pkgs; [python3];
system.extraDependencies = with pkgs; [hello.inputDerivation];
AndersonTorres marked this conversation as resolved.
Show resolved Hide resolved
environment.systemPackages = [ pkgs.python3 ];
system.extraDependencies = [ pkgs.hello.inputDerivation ];
nix.extraOptions = ''
experimental-features = nix-command
'';
Expand Down
6 changes: 2 additions & 4 deletions nixos/tests/buildkite-agents.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import ./make-test-python.nix ({ pkgs, ... }:
import ./make-test-python.nix ({ lib, pkgs, ... }:

{
name = "buildkite-agent";
meta = with pkgs.lib.maintainers; {
maintainers = [ flokli ];
};
meta.maintainers = with lib.maintainers; [ flokli ];

nodes.machine = { pkgs, ... }: {
services.buildkite-agents = {
Expand Down
4 changes: 1 addition & 3 deletions nixos/tests/deepin.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "deepin";

meta = with lib; {
maintainers = teams.deepin.members;
};
meta.maintainers = lib.teams.deepin.members;

nodes.machine = { ... }: {
imports = [
Expand Down
18 changes: 8 additions & 10 deletions nixos/tests/initrd-network-ssh/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import ../make-test-python.nix ({ lib, ... }:
import ../make-test-python.nix ({ lib, pkgs, ... }:

{
name = "initrd-network-ssh";
meta = with lib.maintainers; {
maintainers = [ willibutz emily ];
};
meta.maintainers = with lib.maintainers; [ willibutz emily ];

nodes = with lib; {
nodes = {
server =
{ config, ... }:
{
Expand All @@ -17,7 +15,7 @@ import ../make-test-python.nix ({ lib, ... }:
enable = true;
ssh = {
enable = true;
authorizedKeys = [ (readFile ./id_ed25519.pub) ];
authorizedKeys = [ (lib.readFile ./id_ed25519.pub) ];
port = 22;
hostKeys = [ ./ssh_host_ed25519_key ];
};
Expand All @@ -37,12 +35,12 @@ import ../make-test-python.nix ({ lib, ... }:
{
environment.etc = {
knownHosts = {
text = concatStrings [
text = lib.concatStrings [
"server,"
"${toString (head (splitString " " (
toString (elemAt (splitString "\n" config.networking.extraHosts) 2)
"${toString (lib.head (lib.splitString " " (
toString (lib.elemAt (lib.splitString "\n" config.networking.extraHosts) 2)
)))} "
"${readFile ./ssh_host_ed25519_key.pub}"
"${lib.readFile ./ssh_host_ed25519_key.pub}"
];
};
sshKey = {
Expand Down
6 changes: 1 addition & 5 deletions nixos/tests/osquery.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import ./make-test-python.nix ({ lib, pkgs, ... }:

with lib;

let
config_refresh = "10";
nullvalue = "NULL";
utc = false;
in
{
name = "osquery";
meta = with maintainers; {
maintainers = [ znewman01 lewo ];
};
meta.maintainers = with lib.maintainers; [ znewman01 lewo ];

nodes.machine = { config, pkgs, ... }: {
services.osquery = {
Expand Down
10 changes: 4 additions & 6 deletions nixos/tests/sftpgo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# would be a nice to have for the future.
{ pkgs, lib, ... }:

with lib;

let
inherit (import ./ssh-keys.nix pkgs) snakeOilPrivateKey snakeOilPublicKey;

Expand Down Expand Up @@ -54,18 +52,18 @@ let
# inside the dataprovider they will be automatically created.
# You have to create the folder on the filesystem yourself
virtual_folders =
optional (isMemberOf config sharedFolderName user) {
lib.optional (lib.isMemberOf config sharedFolderName user) {
name = sharedFolderName;
mapped_path = "${config.services.sftpgo.dataDir}/${sharedFolderName}";
virtual_path = "/${sharedFolderName}";
};

# Defines the ACL on the virtual filesystem
permissions =
recursiveUpdate {
lib.recursiveUpdate {
"/" = [ "list" ]; # read-only top level directory
"/private" = [ "*" ]; # private subdirectory, not shared with others
} (optionalAttrs (isMemberOf config "shared" user) {
} (lib.optionalAttrs (lib.isMemberOf config "shared" user) {
"/shared" = [ "*" ];
});

Expand All @@ -91,7 +89,7 @@ let
# of users and folders to import to SFTPGo.
loadDataJson = config: pkgs.writeText "users-and-folders.json" (builtins.toJSON {
users =
mapAttrsToList (name: user: generateUserAttrSet config user) (normalUsers config);
lib.mapAttrsToList (name: user: lib.generateUserAttrSet config user) (normalUsers config);

folders = [
{
Expand Down
17 changes: 9 additions & 8 deletions nixos/tests/systemd-initrd-networkd-ssh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import ./make-test-python.nix ({ lib, ... }: {
name = "systemd-initrd-network-ssh";
meta.maintainers = [ lib.maintainers.elvishjerricco ];

nodes = with lib; {
nodes = {
server = { config, pkgs, ... }: {
environment.systemPackages = [pkgs.cryptsetup];
environment.systemPackages = [ pkgs.cryptsetup ];
boot.loader.systemd-boot.enable = true;
boot.loader.timeout = 0;
virtualisation = {
emptyDiskImages = [ 4096 ];
useBootLoader = true;
# Booting off the encrypted disk requires an available init script from the Nix store
# Booting off the encrypted disk requires an available init script from
# the Nix store
mountHostNixStore = true;
useEFIBoot = true;
};
Expand All @@ -26,7 +27,7 @@ import ./make-test-python.nix ({ lib, ... }: {
enable = true;
ssh = {
enable = true;
authorizedKeys = [ (readFile ./initrd-network-ssh/id_ed25519.pub) ];
authorizedKeys = [ (lib.readFile ./initrd-network-ssh/id_ed25519.pub) ];
port = 22;
# Terrible hack so it works with useBootLoader
hostKeys = [ { outPath = "${./initrd-network-ssh/ssh_host_ed25519_key}"; } ];
Expand All @@ -38,13 +39,13 @@ import ./make-test-python.nix ({ lib, ... }: {
client = { config, ... }: {
environment.etc = {
knownHosts = {
text = concatStrings [
text = lib.concatStrings [
"server,"
"${
toString (head (splitString " " (toString
(elemAt (splitString "\n" config.networking.extraHosts) 2))))
toString (lib.head (lib.splitString " " (toString
(lib.elemAt (lib.splitString "\n" config.networking.extraHosts) 2))))
} "
"${readFile ./initrd-network-ssh/ssh_host_ed25519_key.pub}"
"${lib.readFile ./initrd-network-ssh/ssh_host_ed25519_key.pub}"
];
};
sshKey = {
Expand Down