forked from JoshVanL/kubecon-2023-spiffe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
80 lines (67 loc) · 2.33 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
description = "cert-manager-csi-spiffe";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
gomod2nix = {
url = "github:tweag/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "utils";
};
};
outputs = { self, nixpkgs, utils, gomod2nix }:
let
lib = nixpkgs.lib;
targetSystems = with utils.lib.system; [
x86_64-linux
x86_64-darwin
aarch64-linux
aarch64-darwin
];
repo = ./.;
src = nixpkgs.lib.sourceFilesBySuffices ./. [ ".go" "go.mod" "go.sum" "gomod2nix.toml" ];
version = "aws";
in utils.lib.eachSystem targetSystems (system:
let
overlays = lib.mapAttrsToList (name: _: import ./nix/overlays/${name})
(lib.filterAttrs
(name: entryType: lib.hasSuffix ".nix" name) (builtins.readDir ./nix/overlays)
) ++ [ gomod2nix.overlays.default ];
pkgs = import nixpkgs {
inherit system overlays;
config.packageOverrides = (import ./nix/pkgs/default.nix);
};
amdPkgs = import nixpkgs { inherit overlays; system = "x86_64-linux"; };
armPkgs = import nixpkgs { inherit overlays; system = "aarch64-linux"; };
image = import ./nix/image.nix { inherit src pkgs amdPkgs armPkgs version; };
demo = import ./nix/demo.nix {
images = (image.images localSystem "dev");
inherit repo pkgs;
};
ci = import ./nix/ci.nix {
gomod2nix = (gomod2nix.packages.${system}.default);
demo = demo.demo;
inherit repo pkgs;
};
localSystem = if pkgs.stdenv.hostPlatform.isAarch64 then "arm64" else "amd64";
in {
packages = {
default = (image.build-driver localSystem "dev" pkgs);
driver = (image.build-driver localSystem "dev" pkgs);
approver = (image.build-approver localSystem "dev" pkgs);
sample-app = (image.build-sample localSystem "dev" pkgs);
} // image.packages;
apps = {
default = {type = "app"; program = "${self.packages.${system}.default}/bin/cert-manager-csi-driver"; };
} // image.apps // ci.apps // demo.apps;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
gopls
gotools
go-tools
gomod2nix.packages.${system}.default
];
};
});
}