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

56 lines
2 KiB
Nix
Raw Normal View History

2020-07-06 07:44:11 +00:00
{
description = "Integrates sops into nixos";
2020-11-08 13:23:58 +00:00
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2022-05-25 06:40:52 +00:00
inputs.nixpkgs-22_05.url = "github:NixOS/nixpkgs/release-22.05";
2022-05-13 21:24:44 +00:00
nixConfig.extra-substituters = ["https://cache.garnix.io"];
nixConfig.extra-trusted-public-keys = ["cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="];
outputs = {
self,
nixpkgs,
2022-05-25 06:40:52 +00:00
nixpkgs-22_05
2022-05-13 21:24:44 +00:00
}: let
2020-07-06 07:44:11 +00:00
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
2020-07-06 07:44:11 +00:00
"aarch64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
2022-05-25 06:40:52 +00:00
suffix-version = version: attrs: nixpkgs.lib.mapAttrs' (name: value: nixpkgs.lib.nameValuePair (name + version) value) attrs;
suffix-22_05 = suffix-version "-22_05";
2020-07-06 07:44:11 +00:00
in {
2022-05-13 21:24:44 +00:00
overlay = final: prev: let
localPkgs = import ./default.nix {pkgs = final;};
in {
inherit (localPkgs) sops-install-secrets sops-init-gpg-key sops-pgp-hook sops-import-keys-hook sops-ssh-to-age;
# backward compatibility
inherit (prev) ssh-to-pgp;
};
2020-07-06 07:44:11 +00:00
nixosModules.sops = import ./modules/sops;
nixosModule = self.nixosModules.sops;
2022-05-13 21:24:44 +00:00
packages = forAllSystems (system:
import ./default.nix {
pkgs = import nixpkgs {inherit system;};
});
2022-05-15 06:09:09 +00:00
checks = nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-linux"]
(system: let
tests = self.packages.${system}.sops-install-secrets.tests;
2022-05-25 06:40:52 +00:00
packages-22_05 = import ./default.nix {
pkgs = import nixpkgs-22_05 {inherit system;};
};
tests-22_05 = packages-22_05.sops-install-secrets.tests;
in tests //
(suffix-22_05 tests-22_05) //
(suffix-22_05 packages-22_05));
2022-05-15 06:09:09 +00:00
2020-07-06 07:44:11 +00:00
defaultPackage = forAllSystems (system: self.packages.${system}.sops-init-gpg-key);
2022-05-13 21:24:44 +00:00
devShell = forAllSystems (
system:
nixpkgs.legacyPackages.${system}.callPackage ./shell.nix {}
);
devShells = forAllSystems (system: {
2022-05-15 05:48:48 +00:00
unit-tests = nixpkgs.legacyPackages.${system}.callPackage ./pkgs/unit-tests.nix {};
2022-05-13 21:24:44 +00:00
});
2020-07-06 07:44:11 +00:00
};
}