From 7e522a81ef99a2e7ce0b86bd2c5fd33233e464fe Mon Sep 17 00:00:00 2001 From: nikstur Date: Mon, 17 Jul 2023 17:19:44 +0200 Subject: [PATCH] nixos/tests: refactor gpg-keyring test utility --- nixos/tests/common/gpg-keyring.nix | 23 +++++++++++++++++++++++ nixos/tests/systemd-nspawn.nix | 22 +--------------------- 2 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 nixos/tests/common/gpg-keyring.nix diff --git a/nixos/tests/common/gpg-keyring.nix b/nixos/tests/common/gpg-keyring.nix new file mode 100644 index 000000000000..50b5846b0965 --- /dev/null +++ b/nixos/tests/common/gpg-keyring.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: + +pkgs.runCommand "gpg-keyring" { nativeBuildInputs = [ pkgs.gnupg ]; } '' + mkdir -p $out + export GNUPGHOME=$out + cat > foo < $out/pubkey.gpg +'' diff --git a/nixos/tests/systemd-nspawn.nix b/nixos/tests/systemd-nspawn.nix index bc77ee2a4d15..1a4251ef069e 100644 --- a/nixos/tests/systemd-nspawn.nix +++ b/nixos/tests/systemd-nspawn.nix @@ -1,26 +1,6 @@ import ./make-test-python.nix ({pkgs, lib, ...}: let - gpgKeyring = (pkgs.runCommand "gpg-keyring" { buildInputs = [ pkgs.gnupg ]; } '' - mkdir -p $out - export GNUPGHOME=$out - cat > foo < $out/pubkey.gpg - ''); + gpgKeyring = import ./common/gpg-keyring.nix { inherit pkgs; }; nspawnImages = (pkgs.runCommand "localhost" { buildInputs = [ pkgs.coreutils pkgs.gnupg ]; } '' mkdir -p $out