-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
176 lines (167 loc) · 4.98 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
iogo.url = "github:input-output-hk/bitte-iogo";
ragenix.url = "github:input-output-hk/ragenix";
bitte.url = "github:input-output-hk/bitte";
# Required nix version for current deploy-rs and bitte deploy compat
nix-deployer.url = "github:NixOS/nix/2.14-maintenance";
};
outputs = inputs: let
nixpkgs = inputs.nixpkgs.legacyPackages;
withCategory = category: attrset: attrset // {inherit category;};
clouder = map (withCategory "cloud");
metaler = map (withCategory "metal");
integrator = map (withCategory "integrations");
tooler = map (withCategory "tools");
baser = map (withCategory "base");
_file = "github:input-outupt-hk/devshell-capsules";
in {
# --------------------------------------
# Base: should be part of any devshell
# --------------------------------------
base = {pkgs, ...}: let
nixpkgs' = nixpkgs.${pkgs.system};
iogo = inputs.iogo.defaultPackage.${pkgs.system};
in {
commands = baser [
{package = nixpkgs'.arion;}
];
packages = with nixpkgs'; [pwgen];
devshell.startup.iogo-login = nixpkgs'.lib.stringsWithDeps.noDepEntry ''
if ! [[ -v BITTE_NO_LOGIN ]]; then
eval "$(${iogo}/bin/iogo login)"
fi
'';
};
# --------------------------------------
# Cloud: tools for managing the company cloud
# --------------------------------------
cloud = {pkgs, ...}: let
nixpkgs' = nixpkgs.${pkgs.system};
in {
inherit _file;
commands = clouder [
{
package = nixpkgs'.vault-bin;
name = "vault";
}
{package = nixpkgs'.consul;}
{package = nixpkgs'.nomad;}
{package = nixpkgs'.sops;}
{
name = "htdigest";
command = ''${nixpkgs'.apacheHttpd}/bin/htdigest "$@"'';
help = "create new http authentication tokens";
}
{package = nixpkgs'.skopeo;}
{
package = nixpkgs'.writeShellApplication {
name = "nomad-exec";
runtimeInputs = [
nixpkgs'.consul
nixpkgs'.curl
nixpkgs'.jq
nixpkgs'.nomad
];
text = builtins.readFile ./nomad-exec.sh;
};
help = "Nomad allocation shell exec helper";
}
];
};
# --------------------------------------
# Metal: tools for managing the bare metal
# --------------------------------------
metal = {pkgs, ...}: let
nixpkgs' = nixpkgs.${pkgs.system};
bitte = inputs.bitte.packages.${pkgs.system}.bitte;
ragenix = inputs.ragenix.defaultPackage.${pkgs.system};
nix-deployer = inputs.nix-deployer.packages.${pkgs.system}.nix;
in {
inherit _file;
commands = metaler [
{package = bitte;}
{package = ragenix;}
{
package = nixpkgs'.awscli;
name = "aws";
}
{
package = nix-deployer;
name = "nix";
help = "nix 2.14.X for bitte and deploy-rs deploy compatibility";
}
{
package = nixpkgs'.writeShellApplication {
name = "diff-bitte";
runtimeInputs = [nixpkgs'.nix-diff];
text = builtins.readFile ./diff-bitte.sh;
};
help = "What changes with bitte commit XYZ";
}
];
};
# --------------------------------------
# Intergations: interations with jira et al.
# --------------------------------------
integrations = {pkgs, ...}: let
nixpkgs' = nixpkgs.${pkgs.system};
in {
inherit _file;
commands = integrator [
{
package = nixpkgs'.reuse;
}
{
package = nixpkgs'.gh;
}
{
package = nixpkgs'.go-jira;
name = "jira";
}
{
package = nixpkgs'.bitwarden-cli;
name = "bw";
help = "cli to interact with vaultwarden";
}
];
};
# --------------------------------------
# Tools: utility tooling - enjoy!
# --------------------------------------
tools = {pkgs, ...}: let
nixpkgs' = nixpkgs.${pkgs.system};
in {
inherit _file;
commands = tooler [
{package = nixpkgs'.jq;}
{package = nixpkgs'.ijq;}
{package = nixpkgs'.icdiff;}
{
package = nixpkgs'.fx;
name = "fx";
}
{package = nixpkgs'.curlie;}
{
package = nixpkgs'.difftastic;
name = "difft";
}
];
};
# for local use only ...
# --------------------------------------
devShell."x86_64-linux" = with nixpkgs."x86_64-linux";
mkShell {
name = "Devshell-Capsules";
packages = [
treefmt
alejandra
nodejs # for node path setup hook for prettier plugin
nodePackages.prettier
nodePackages.prettier-plugin-toml
shfmt
];
};
};
}