File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -112,11 +112,20 @@ in {
112
112
113
113
mkdir -p "\$dest"
114
114
115
- echo "switching manifests"
116
-
117
- ${ pkgs . rsync } /bin/rsync --recursive --delete -L "${ config . build . environmentPackage } /" "\$dest"
118
-
119
- echo "done!"
115
+ # We need to check if there is a difference between
116
+ # the newly built environment and the destination
117
+ # excluding `.revision` because that will most likely
118
+ # always change when going through CI, avoiding infinite
119
+ # loop.
120
+ if ! ${ pkgs . diffutils } /bin/diff -q -r --exclude .revision "${ config . build . environmentPackage } " "\$dest" &>/dev/null; then
121
+ echo "switching manifests"
122
+
123
+ ${ pkgs . rsync } /bin/rsync --recursive --delete -L "${ config . build . environmentPackage } /" "\$dest"
124
+
125
+ echo "done!"
126
+ else
127
+ echo "no changes!"
128
+ fi
120
129
EOF
121
130
122
131
chmod +x $out/activate
Original file line number Diff line number Diff line change 62
62
} ;
63
63
} ;
64
64
65
+ build = {
66
+ revision = mkOption {
67
+ type = types . nullOr types . str ;
68
+ default = null ;
69
+ example = literalExpression ''
70
+ if (self ? rev) then self.rev else self.dirtyRev
71
+ '' ;
72
+ description = "The revision being built. Will be written to `.revision` in the environment destination directory." ;
73
+ } ;
74
+ } ;
75
+
65
76
extraFiles = mkOption {
66
77
type = types . attrsOf ( types . submodule extraFilesOpts ) ;
67
78
default = { } ;
181
192
182
193
_module . args . charts = config . nixidy . charts ;
183
194
nixidy . charts = lib . optionalAttrs ( cfg . chartsDir != null ) ( mkChartAttrs cfg . chartsDir ) ;
195
+
196
+ nixidy . extraFiles = lib . optionalAttrs ( cfg . build . revision != null ) {
197
+ ".revision" . text = cfg . build . revision ;
198
+ } ;
184
199
} ;
185
200
}
You can’t perform that action at this time.
0 commit comments