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

29 lines
831 B
Nix
Raw Normal View History

2020-11-13 09:39:17 +00:00
{ pkgs ? import <nixpkgs> {}
}:
let
2022-05-15 05:48:48 +00:00
sopsPkgs = import ../. { inherit pkgs; };
2020-11-13 09:39:17 +00:00
in pkgs.stdenv.mkDerivation {
name = "env";
nativeBuildInputs = with pkgs; [
bashInteractive
gnupg
2022-09-26 14:28:23 +00:00
util-linux
2020-11-13 09:39:17 +00:00
nix
sopsPkgs.sops-pgp-hook-test
] ++ pkgs.lib.optional (pkgs.stdenv.isLinux) sopsPkgs.sops-install-secrets.unittest;
# 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
''}
'';
}