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

move all nix expressions to pkgs

This commit is contained in:
Jörg Thalheim 2022-05-15 07:48:48 +02:00
parent 0c20c6257b
commit 150afcb240
No known key found for this signature in database
6 changed files with 48 additions and 34 deletions

View file

@ -16,42 +16,18 @@ in rec {
inherit (pkgs) ssh-to-pgp;
# used in the CI only
sops-pgp-hook-test = pkgs.buildGoModule {
name = "sops-pgp-hook-test";
src = ./.;
sops-pgp-hook-test = pkgs.callPackage ./pkgs/sops-pgp-hook-test.nix {
inherit vendorSha256;
buildPhase = ''
go test -c ./pkgs/sops-pgp-hook
install -D sops-pgp-hook.test $out/bin/sops-pgp-hook.test
'';
};
unit-tests = pkgs.callPackage ./unit-tests.nix {};
unit-tests = pkgs.callPackage ./pkgs/unit-tests.nix {};
} // (pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
inherit sops-install-secrets;
lint = sops-install-secrets.overrideAttrs (old: {
name = "golangci-lint";
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.golangci-lint ];
buildPhase = ''
HOME=$TMPDIR golangci-lint run --timeout 360s
'';
doCheck = false;
installPhase = ''
touch $out $unittest
'';
fixupPhase = ":";
});
lint = pkgs.callPackage ./pkgs/lint.nix {
inherit sops-install-secrets;
};
cross-build = sops-install-secrets.overrideAttrs (old: {
name = "cross-build";
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.gox ];
buildPhase = ''
(cd pkgs/sops-install-secrets && gox -os linux)
'';
doCheck = false;
installPhase = ''
touch $out $unittest
'';
fixupPhase = ":";
});
cross-build = pkgs.callPackage ./pkgs/cross-build.nix {
inherit sops-install-secrets;
};
})

View file

@ -40,7 +40,7 @@
nixpkgs.legacyPackages.${system}.callPackage ./shell.nix {}
);
devShells = forAllSystems (system: {
unit-tests = nixpkgs.legacyPackages.${system}.callPackage ./unit-tests.nix {};
unit-tests = nixpkgs.legacyPackages.${system}.callPackage ./pkgs/unit-tests.nix {};
});
};
}

14
pkgs/cross-build.nix Normal file
View 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
View 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 = ":";
})

View 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
'';
}

View file

@ -1,7 +1,7 @@
{ pkgs ? import <nixpkgs> {}
}:
let
sopsPkgs = import ./. { inherit pkgs; };
sopsPkgs = import ../. { inherit pkgs; };
in pkgs.stdenv.mkDerivation {
name = "env";
nativeBuildInputs = with pkgs; [