mirror of
https://github.com/Mic92/sops-nix.git
synced 2026-05-13 16:38:45 +08:00
move all nix expressions to pkgs
This commit is contained in:
parent
0c20c6257b
commit
150afcb240
6 changed files with 48 additions and 34 deletions
14
pkgs/cross-build.nix
Normal file
14
pkgs/cross-build.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ sops-install-secrets, gox }:
|
||||
|
||||
sops-install-secrets.overrideAttrs (old: {
|
||||
name = "cross-build";
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ gox ];
|
||||
buildPhase = ''
|
||||
(cd pkgs/sops-install-secrets && gox -os linux)
|
||||
'';
|
||||
doCheck = false;
|
||||
installPhase = ''
|
||||
touch $out $unittest
|
||||
'';
|
||||
fixupPhase = ":";
|
||||
})
|
||||
13
pkgs/lint.nix
Normal file
13
pkgs/lint.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ sops-install-secrets, golangci-lint }:
|
||||
sops-install-secrets.overrideAttrs (old: {
|
||||
name = "golangci-lint";
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ golangci-lint ];
|
||||
buildPhase = ''
|
||||
HOME=$TMPDIR golangci-lint run --timeout 360s
|
||||
'';
|
||||
doCheck = false;
|
||||
installPhase = ''
|
||||
touch $out $unittest
|
||||
'';
|
||||
fixupPhase = ":";
|
||||
})
|
||||
11
pkgs/sops-pgp-hook-test.nix
Normal file
11
pkgs/sops-pgp-hook-test.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ buildGoModule, vendorSha256 }:
|
||||
|
||||
buildGoModule {
|
||||
name = "sops-pgp-hook-test";
|
||||
src = ../.;
|
||||
inherit vendorSha256;
|
||||
buildPhase = ''
|
||||
go test -c ./pkgs/sops-pgp-hook
|
||||
install -D sops-pgp-hook.test $out/bin/sops-pgp-hook.test
|
||||
'';
|
||||
}
|
||||
28
pkgs/unit-tests.nix
Normal file
28
pkgs/unit-tests.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ pkgs ? import <nixpkgs> {}
|
||||
}:
|
||||
let
|
||||
sopsPkgs = import ../. { inherit pkgs; };
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
name = "env";
|
||||
nativeBuildInputs = with pkgs; [
|
||||
bashInteractive
|
||||
gnupg
|
||||
utillinux
|
||||
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) ''
|
||||
sudo TEST_ASSETS=$(realpath ./pkgs/sops-install-secrets/test-assets) \
|
||||
unshare --mount --fork sops-install-secrets.test
|
||||
''}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue