-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.nix
41 lines (37 loc) · 1.28 KB
/
default.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
{ pog, jq, cachix, git, ... }:
pog.pog {
name = "cachix-push-om-outputs";
description = "Foo bar";
flags = [
{
name = "cache";
description = "The name of the cachix cache to push to";
argument = "CACHIX_CACHE";
}
{
name = "subflake";
description = "The name of the omnix CI subflake to use";
argument = "SUBFLAKE";
}
{
name = "prefix";
description = "The prefix to use in conjunction with system string when pinning paths";
argument = "PREFIX";
}
{
name = "names";
description = "The list of derivation names to do whitelisted cachix push and pin";
argument = "NAMES";
}
];
runtimeInputs = [ jq cachix git ];
strict = true;
script = helpers: ''
blue "Parsing omnix JSON (subflake=$subflake)"
STORE_PATHS=$(jq -r --arg prefix "$prefix" --arg subflake "$subflake" --arg derivations "$names" -f ${./script.jq})
green "Pushing to https://''${cache}.cachix.org"
echo "$STORE_PATHS" | jq -r --arg cache "$cache" '"cachix push \($cache) \(values | join(" "))"' | sh
green "Pinning on https://''${cache}.cachix.org"
echo "$STORE_PATHS" | jq -r --arg cache "$cache" 'to_entries[] | "echo '"'Pin \(.key) => \(.value)'"'; cachix pin -v \($cache) \(.key) \(.value)"' | sh
'';
}