1- { inputs , targetSystem , cluster } :
1+ { inputs , targetSystem } :
22
33assert targetSystem == "x86_64-darwin" || targetSystem == "aarch64-darwin" ;
44
55let
66
7- newCommon = import ./new- common.nix { inherit inputs targetSystem cluster ; } ;
7+ common = import ./common.nix { inherit inputs targetSystem ; } ;
88
9- inherit ( newCommon ) sourceLib oldCode pkgs ;
9+ inherit ( common ) sourceLib pkgs ;
1010 inherit ( pkgs ) lib ;
1111
12- inherit ( oldCode )
12+ inherit ( common )
1313 daedalus-bridge daedalus-installer launcherConfigs mock-token-metadata-server
1414 cardanoNodeVersion cardanoWalletVersion ;
1515
16- inherit ( newCommon ) originalPackageJson electronVersion electronChromedriverVersion commonSources ;
16+ inherit ( common ) originalPackageJson electronVersion electronChromedriverVersion commonSources ;
1717
1818 archSuffix = if pkgs . system == "aarch64-darwin" then "arm64" else "x64" ;
1919 packageVersion = originalPackageJson . version ;
20- installerName = "daedalus-${ packageVersion } -${ toString sourceLib . buildCounter } -${ cluster } -${ sourceLib . buildRevShort } -${ pkgs . system } " ;
20+ installerName = cluster : "daedalus-${ packageVersion } -${ toString sourceLib . buildCounter } -${ cluster } -${ sourceLib . buildRevShort } -${ pkgs . system } " ;
21+
22+ genClusters = lib . genAttrs sourceLib . installerClusters ;
2123
2224in rec {
2325
24- inherit newCommon oldCode ;
25- inherit ( newCommon ) nodejs nodePackages yarn yarn2nix offlineCache srcLockfiles srcWithoutNix ;
26+ inherit common ;
27+ inherit ( common ) nodejs nodePackages yarn yarn2nix offlineCache srcLockfiles srcWithoutNix ;
2628
2729 # The following is used in all `configurePhase`s:
2830 darwinSpecificCaches = let
@@ -65,7 +67,7 @@ in rec {
6567 apple_sdk . frameworks . CoreServices
6668 apple_sdk . frameworks . AppKit
6769 ] ) ;
68- configurePhase = newCommon . setupCacheAndGypDirs + darwinSpecificCaches ;
70+ configurePhase = common . setupCacheAndGypDirs + darwinSpecificCaches ;
6971 buildPhase = ''
7072 # Do not look up in the registry, but in the offline cache:
7173 ${ yarn2nix . fixup_yarn_lock } /bin/fixup_yarn_lock yarn.lock
@@ -103,7 +105,7 @@ in rec {
103105
104106 darwin-launcher = pkgs . callPackage ./darwin-launcher.nix { } ;
105107
106- package = let
108+ package = genClusters ( cluster : let
107109 pname = "daedalus" ;
108110 in pkgs . stdenv . mkDerivation {
109111 name = pname ;
@@ -115,7 +117,7 @@ in rec {
115117 apple_sdk . frameworks . AppKit
116118 libobjc
117119 ] ) ++ [
118- daedalus-bridge
120+ daedalus-bridge . ${ cluster }
119121 darwin-launcher
120122 mock-token-metadata-server
121123 ] ;
@@ -125,25 +127,25 @@ in rec {
125127 BUILD_COUNTER = sourceLib . buildCounter ;
126128 CARDANO_WALLET_VERSION = cardanoWalletVersion ;
127129 CARDANO_NODE_VERSION = cardanoNodeVersion ;
128- configurePhase = newCommon . setupCacheAndGypDirs + darwinSpecificCaches + ''
130+ configurePhase = common . setupCacheAndGypDirs + darwinSpecificCaches + ''
129131 # Grab all cached `node_modules` from above:
130132 cp -r ${ node_modules } /. ./
131133 chmod -R +w .
132134 '' ;
133135 outputs = [ "out" "futureInstaller" ] ;
134136 buildPhase = ''
135137 patchShebangs .
136- sed -r 's#.*patchElectronRebuild.*#${ newCommon . patchElectronRebuild } /bin/*#' -i scripts/rebuild-native-modules.sh
138+ sed -r 's#.*patchElectronRebuild.*#${ common . patchElectronRebuild } /bin/*#' -i scripts/rebuild-native-modules.sh
137139
138140 export DEVX_FIXME_DONT_YARN_INSTALL=1
139141 (
140142 cd installers/
141- cp -r ${ launcherConfigs . configFiles } /. ./.
143+ cp -r ${ launcherConfigs . ${ cluster } . configFiles } /. ./.
142144
143145 # make-installer needs to see `bin/nix-store` to break all references to dylibs inside /nix/store:
144146 export PATH="${ lib . makeBinPath [ pkgs . nixUnstable ] } :$PATH"
145147
146- make-installer --cardano ${ daedalus-bridge } \
148+ make-installer --cardano ${ daedalus-bridge . ${ cluster } } \
147149 --build-rev-short ${ sourceLib . buildRevShort } \
148150 --build-counter ${ toString sourceLib . buildCounter } \
149151 --cluster ${ cluster } \
@@ -153,7 +155,7 @@ in rec {
153155 '' ;
154156 installPhase = ''
155157 mkdir -p $out/Applications/
156- cp -r release/darwin-${ archSuffix } /${ lib . escapeShellArg launcherConfigs . installerConfig . spacedName } -darwin-${ archSuffix } /${ lib . escapeShellArg launcherConfigs . installerConfig . spacedName } .app $out/Applications/
158+ cp -r release/darwin-${ archSuffix } /${ lib . escapeShellArg launcherConfigs . ${ cluster } . installerConfig . spacedName } -darwin-${ archSuffix } /${ lib . escapeShellArg launcherConfigs . ${ cluster } . installerConfig . spacedName } .app $out/Applications/
157159
158160 # XXX: remove redundant native modules, and point bindings.js to Contents/MacOS/*.node instead:
159161 echo 'Deleting all redundant ‘*.node’ files under to-be-distributed ‘node_modules/’:'
@@ -169,7 +171,7 @@ in rec {
169171 mkdir -p $out/bin/
170172 cat >$out/bin/${ pname } << EOF
171173 #!/bin/sh
172- exec $out/Applications/${ lib . escapeShellArg launcherConfigs . installerConfig . spacedName } .app/Contents/MacOS/${ lib . escapeShellArg launcherConfigs . installerConfig . spacedName }
174+ exec $out/Applications/${ lib . escapeShellArg launcherConfigs . ${ cluster } . installerConfig . spacedName } .app/Contents/MacOS/${ lib . escapeShellArg launcherConfigs . ${ cluster } . installerConfig . spacedName }
173175 EOF
174176 chmod +x $out/bin/${ pname }
175177
@@ -181,13 +183,13 @@ in rec {
181183 ${ signAllBinaries } $out
182184 '' ;
183185 dontFixup = true ; # TODO: just to shave some seconds, turn back on after everything works
184- } ;
186+ } ) ;
185187
186- unsignedInstaller = pkgs . stdenv . mkDerivation {
188+ unsignedInstaller = genClusters ( cluster : pkgs . stdenv . mkDerivation {
187189 name = "daedalus-unsigned-darwin-installer" ;
188190 dontUnpack = true ;
189191 buildPhase = ''
190- ${ makeSignedInstaller } /bin/* | tee make-installer.log
192+ ${ makeSignedInstaller . ${ cluster } } /bin/* | tee make-installer.log
191193 '' ;
192194 installPhase = ''
193195 mkdir -p $out
@@ -197,9 +199,9 @@ in rec {
197199 mkdir -p $out/nix-support
198200 echo "file binary-dist \"$(echo $out/*.pkg)\"" >$out/nix-support/hydra-build-products
199201 '' ;
200- } ;
202+ } ) ;
201203
202- makeSignedInstaller = pkgs . writeShellScriptBin "make-signed-installer" ( let
204+ makeSignedInstaller = genClusters ( cluster : pkgs . writeShellScriptBin "make-signed-installer" ( let
203205
204206 # FIXME: in the future this has to be done better, now let’s reuse the Buildkite legacy:
205207 credentials = "/var/lib/buildkite-agent/signing.sh" ;
@@ -230,8 +232,8 @@ in rec {
230232 eval $(${ readConfigs } )
231233
232234 workDir=$(mktemp -d)
233- appName=${ lib . escapeShellArg launcherConfigs . installerConfig . spacedName } .app
234- appDir=${ package } /Applications/"$appName"
235+ appName=${ lib . escapeShellArg launcherConfigs . ${ cluster } . installerConfig . spacedName } .app
236+ appDir=${ package . ${ cluster } } /Applications/"$appName"
235237
236238 echo "Info: workDir = $workDir"
237239 cd "$workDir"
@@ -242,20 +244,20 @@ in rec {
242244
243245 if ${ shallSignPredicate } ; then
244246 echo "Signing code…"
245- ${ package . futureInstaller } /codesign.sh "$codeSigningIdentity" "$codeSigningKeyChain" \
246- "$appName" ${ package . futureInstaller } /entitlements.xml
247+ ${ package . ${ cluster } . futureInstaller } /codesign.sh "$codeSigningIdentity" "$codeSigningKeyChain" \
248+ "$appName" ${ package . ${ cluster } . futureInstaller } /entitlements.xml
247249 fi
248250
249251 echo "Making installer…"
250252 /usr/bin/pkgbuild \
251- --identifier ${ lib . escapeShellArg ( "org." + launcherConfigs . installerConfig . macPackageName + ".pkg" ) } \
253+ --identifier ${ lib . escapeShellArg ( "org." + launcherConfigs . ${ cluster } . installerConfig . macPackageName + ".pkg" ) } \
252254 --component "$workDir/$appName" \
253255 --install-location /Applications \
254- ${ lib . escapeShellArg ( installerName + ".phase1.pkg" ) }
256+ ${ lib . escapeShellArg ( ( installerName cluster ) + ".phase1.pkg" ) }
255257 rm -r "$workDir/$appName"
256258 /usr/bin/productbuild --product ${ ../../installers/data/plist } \
257259 --package *.phase1.pkg \
258- ${ lib . escapeShellArg ( installerName + ".phase2.pkg" ) }
260+ ${ lib . escapeShellArg ( ( installerName cluster ) + ".phase2.pkg" ) }
259261 rm *.phase1.pkg
260262
261263 if ${ shallSignPredicate } ; then
@@ -269,14 +271,14 @@ in rec {
269271
270272 productsign --sign "$signingIdentity" --keychain "$signingKeyChain" \
271273 *.phase2.pkg \
272- ${ lib . escapeShellArg ( installerName + ".pkg" ) }
274+ ${ lib . escapeShellArg ( ( installerName cluster ) + ".pkg" ) }
273275 rm *.phase2.pkg
274276 else
275- mv *.phase2.pkg ${ lib . escapeShellArg ( installerName + ".pkg" ) }
277+ mv *.phase2.pkg ${ lib . escapeShellArg ( ( installerName cluster ) + ".pkg" ) }
276278 fi
277279
278280 echo "Done, you can submit it for notarization now:"
279- echo "$workDir"/${ lib . escapeShellArg ( installerName + ".pkg" ) }
281+ echo "$workDir"/${ lib . escapeShellArg ( ( installerName cluster ) + ".pkg" ) }
280282 '' ;
281283
282284 in ''
@@ -287,7 +289,7 @@ in rec {
287289 else
288290 exec ${ packAndSign }
289291 fi
290- '' ) ;
292+ '' ) ) ;
291293
292294 darwinSources = {
293295 electron = pkgs . fetchurl {
0 commit comments