1
0
Fork 0
mirror of https://github.com/Mic92/sops-nix.git synced 2024-12-14 11:57:52 +00:00
sops-nix/pkgs/unit-tests.nix

34 lines
859 B
Nix
Raw Permalink Normal View History

2024-11-17 11:17:45 +00:00
{
pkgs ? import <nixpkgs> { },
2020-11-13 09:39:17 +00:00
}:
let
2022-05-15 05:48:48 +00:00
sopsPkgs = import ../. { inherit pkgs; };
2024-11-17 11:17:45 +00:00
in
pkgs.stdenv.mkDerivation {
2020-11-13 09:39:17 +00:00
name = "env";
2024-11-17 11:17:45 +00:00
nativeBuildInputs =
with pkgs;
[
bashInteractive
gnupg
util-linux
nix
sopsPkgs.sops-pgp-hook-test
]
++ pkgs.lib.optional (pkgs.stdenv.isLinux) sopsPkgs.sops-install-secrets.unittest;
2020-11-13 09:39:17 +00:00
# allow to prefetch shell dependencies in build phase
dontUnpack = true;
installPhase = ''
echo $nativeBuildInputs > $out
'';
shellHook = ''
set -x
NIX_PATH=nixpkgs=${toString pkgs.path} TEST_ASSETS=$(realpath ./pkgs/sops-pgp-hook/test-assets) \
sops-pgp-hook.test
${pkgs.lib.optionalString (pkgs.stdenv.isLinux) ''
2022-05-13 21:24:44 +00:00
sudo TEST_ASSETS=$(realpath ./pkgs/sops-install-secrets/test-assets) \
2020-11-13 09:39:17 +00:00
unshare --mount --fork sops-install-secrets.test
''}
'';
}