-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
71 lines (66 loc) · 2 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
{
description = "A collection of kubernetes helm charts in a nix-digestable format.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nix-kube-generators.url = "github:farcaller/nix-kube-generators";
poetry2nix.url = "github:nix-community/poetry2nix";
poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, nix-kube-generators, poetry2nix, ... }: {
chartsMetadata = builtins.listToAttrs (map
(repo: {
name = repo;
value =
let
charts = builtins.attrNames (builtins.readDir ./charts/${repo});
in
builtins.listToAttrs (map
(name: {
inherit name;
value = import ./charts/${repo}/${name};
})
charts);
})
(builtins.attrNames (builtins.readDir ./charts)));
charts = { pkgs }:
let
kubelib = nix-kube-generators.lib { inherit pkgs; };
in
builtins.mapAttrs
(
reponame: charts:
builtins.mapAttrs
(
chartname: chartspec:
(kubelib.downloadHelmChart (builtins.removeAttrs chartspec ["bogusVersion"]))
)
charts
)
self.chartsMetadata;
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryEnv mkPoetryApplication;
in
{
chartsDerivations = self.charts { inherit pkgs; };
packages.helmupdater = mkPoetryApplication {
python = pkgs.python310;
projectDir = ./.;
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
nixpkgs-fmt
poetry
python310Packages.autopep8
(mkPoetryEnv {
python = pkgs.python310;
projectDir = ./.;
editablePackageSources = {
manager = ./.;
};
})
];
};
});
}