-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: flake overlays not re-usable (#1457)
* Problem: flake overlays not re-usable Solution: - cleanup for usage in testground which will reuse this flake and add sth else on top * cleanup
- Loading branch information
Showing
2 changed files
with
68 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ lib | ||
, stdenv | ||
, callPackage | ||
, buildPackages | ||
, runCommand | ||
, bundle-exe | ||
, rev ? "dirty" | ||
}: | ||
let | ||
# make-tarball don't follow symbolic links to avoid duplicate file, the bundle should have no external references. | ||
# reset the ownership and permissions to make the extract result more normal. | ||
make-tarball = drv: runCommand "tarball-${drv.name}" | ||
{ | ||
nativeBuildInputs = with buildPackages; [ gnutar gzip ]; | ||
} '' | ||
tar cfv - -C "${drv}" \ | ||
--owner=0 --group=0 --mode=u+rw,uga+r --hard-dereference . \ | ||
| gzip -9 > $out | ||
''; | ||
bundle-win-exe = drv: callPackage ./bundle-win-exe.nix { cronosd = drv; }; | ||
matrix = lib.cartesianProductOfSets { | ||
network = [ "mainnet" "testnet" ]; | ||
pkgtype = [ | ||
"nix" # normal nix package | ||
"bundle" # relocatable bundled package | ||
"tarball" # tarball of the bundle, for distribution and checksum | ||
]; | ||
}; | ||
in | ||
builtins.listToAttrs (builtins.map | ||
({ network, pkgtype }: { | ||
name = builtins.concatStringsSep "-" ( | ||
[ "cronosd" ] ++ | ||
lib.optional (network != "mainnet") network ++ | ||
lib.optional (pkgtype != "nix") pkgtype | ||
); | ||
value = | ||
let | ||
cronosd = callPackage ../. { | ||
inherit rev network; | ||
}; | ||
bundle = | ||
if stdenv.hostPlatform.isWindows then | ||
bundle-win-exe cronosd | ||
else | ||
bundle-exe cronosd; | ||
in | ||
if pkgtype == "bundle" then | ||
bundle | ||
else if pkgtype == "tarball" then | ||
make-tarball bundle | ||
else | ||
cronosd; | ||
}) | ||
matrix | ||
) |