File tree Expand file tree Collapse file tree 4 files changed +47
-38
lines changed Expand file tree Collapse file tree 4 files changed +47
-38
lines changed Original file line number Diff line number Diff line change 13
13
nix build ${ contextFreeDrv target }
14
14
'' ;
15
15
targetDrv = target . drvPath ;
16
- proviso =
16
+ proviso = let
17
+ filter = ./build-filter.jq ;
18
+ in
17
19
l . toFile "build-proviso"
18
20
# bash
19
21
''
20
- # FIXME: merge upstream to avoid any need for runtime context
21
- command nix build github:divnix/nix-uncached?ref=refs/pull/2/head
22
-
23
22
local -a drvs
24
23
eval "$(
25
- command jq --raw-output '
26
- "drvs=(\(map(.targetDrv|strings)|@sh))"
27
- ' <<< "$1"
24
+ command jq --raw-output '"drvs=(\(map(.targetDrv|strings)|@sh))"' <<< "$1"
28
25
)"
29
26
27
+ # FIXME: merge upstream to avoid any need for runtime context
28
+ command nix build github:divnix/nix-uncached?ref=refs/pull/2/head
29
+
30
30
command jq --raw-output \
31
31
--argjson checked "$(./result/bin/nix-uncached '' ${drvs[@]})" \
32
- ' (
33
- $checked | with_entries(select(.value == [])) | keys
34
- ) as $cached
35
- | map(select(
36
- [.targetDrv] | IN($cached) | not
37
- ))
38
- ' <<< "$1"
32
+ --from-file ${ filter } <<< "$1"
39
33
40
34
unset drvs
41
35
'' ;
Original file line number Diff line number Diff line change
1
+ . as $inputs
2
+
3
+ | $inputs | map ( select (
4
+ .meta.images [0 ] | inside ($available ) | not
5
+ ))
Original file line number Diff line number Diff line change 70
70
copy docker://${ img }
71
71
'' ;
72
72
meta . images = map ( tag : "${ img } :${ tag } " ) tags ;
73
- proviso = l . toFile "container-proviso" ''
74
- function _scopeo_inspect() {
75
- if command &>/dev/null skopeo inspect --insecure-policy "docker://$image"; then
76
- echo "$image"
77
- fi
78
- }
79
- export -f _scopeo_inspect
73
+ proviso = let
74
+ filter = ./container-publish-filter.jq ;
75
+ in
76
+ l . toFile "container-proviso" ''
77
+ function _scopeo_inspect() {
78
+ if command &>/dev/null skopeo inspect --insecure-policy "docker://$image"; then
79
+ echo "$image"
80
+ fi
81
+ }
82
+ export -f _scopeo_inspect
80
83
81
- function scopeo_inspect() {
82
- echo "$@" | command xargs -n 1 -P 0 -I {} bash -c '_scopeo_inspect "$@"'
83
- }
84
+ function scopeo_inspect() {
85
+ echo "$@" | command xargs -n 1 -P 0 -I {} bash -c '_scopeo_inspect "$@"'
86
+ }
84
87
85
- declare -a images
86
- eval "$(
87
- command jq --raw-output '
88
- "images=(\(map(.meta.images[0]|strings)|@sh))"
89
- ' <<< "$1"
90
- )"
88
+ declare -a images
89
+ eval "$(
90
+ command jq --raw-output '
91
+ "images=(\(map(.meta.images[0]|strings)|@sh))"
92
+ ' <<< "$1"
93
+ )"
91
94
92
- command jq --raw-output \
93
- --arg available "$(_scopeo_inspect '' ${images[@]})" \
94
- ' map(select(
95
- .meta.images[0] | inside($available) | not
96
- ))
97
- ' <<< "$1"
95
+ command jq --raw-output \
96
+ --arg available "$(_scopeo_inspect '' ${images[@]})" \
97
+ --from-file ${ filter } <<< "$1"
98
98
99
- unset images
100
- '' ;
99
+ unset images
100
+ '' ;
101
101
} )
102
102
( mkCommand currentSystem {
103
103
name = "load" ;
Original file line number Diff line number Diff line change
1
+ . as $inputs |
2
+
3
+ ( $checked
4
+ | with_entries (select (.value == []))
5
+ | keys
6
+ ) as $cached
7
+
8
+ | $inputs | map ( select (
9
+ [.targetDrv ] | IN ($cached ) | not
10
+ ))
You can’t perform that action at this time.
0 commit comments