Skip to content

Commit 197ea64

Browse files
authored
Merge pull request #95 from input-output-hk/andrea/update-flake
Update flake
2 parents 677fb75 + cb6d627 commit 197ea64

File tree

2 files changed

+110
-62
lines changed

2 files changed

+110
-62
lines changed

flake.lock

Lines changed: 82 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
inputs = {
66
nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
77
haskell-nix.url = "github:input-output-hk/haskell.nix";
8-
haskell-nix.inputs.hackage.follows = "hackage-nix";
9-
hackage-nix.url = "github:input-output-hk/hackage.nix";
10-
hackage-nix.flake = false;
118
flake-utils.url = "github:numtide/flake-utils";
129
};
1310

@@ -16,8 +13,7 @@
1613
systems = [
1714
"x86_64-linux"
1815
"x86_64-darwin"
19-
# TODO switch back on when ci.iog.io has builders for aarch64-linux
20-
# "aarch64-linux"
16+
"aarch64-linux"
2117
"aarch64-darwin"
2218
];
2319
in
@@ -39,43 +35,45 @@
3935
haskell-language-server = "latest";
4036
fourmolu = "0.14.0.0";
4137
};
38+
39+
modules = [{
40+
# Wrap executables with the needed dependencies in PATH. See #71.
41+
packages.foliage.postInstall = ''
42+
for exe in $(find $out/bin -type f -executable); do
43+
wrapProgram "$exe" \
44+
--prefix PATH : ${with pkgs; lib.makeBinPath [ coreutils curl gnutar gitMinimal patch ]}
45+
done
46+
'';
47+
}];
4248
};
4349

4450
flake = project.flake (
4551
lib.attrsets.optionalAttrs (system == "x86_64-linux")
4652
{ crossPlatforms = p: [ p.musl64 ]; }
4753
);
48-
49-
# Wrap the foliage executable with the needed dependencies in PATH.
50-
# See #71.
51-
wrapExe = drv:
52-
pkgs.runCommand "foliage"
53-
{
54-
nativeBuildInputs = [ pkgs.makeWrapper ];
55-
} ''
56-
mkdir -p $out/bin
57-
makeWrapper ${drv}/bin/foliage $out/bin/foliage \
58-
--prefix PATH : ${with pkgs; lib.makeBinPath [ curl patch ]}:$out/bin
59-
'';
60-
6154
in
62-
6355
flake // {
6456
inherit project;
6557

66-
# This is way too much boilerplate. I only want the default package to
67-
# be the main exe (package or app) and "static" the static version on
68-
# the systems where it is available.
58+
apps =
59+
flake.apps
60+
// { default = flake.apps."foliage:exe:foliage"; }
61+
# Expose the derivation for a static executable as "static"
62+
// lib.attrsets.optionalAttrs (system == "x86_64-linux")
63+
{ static = flake.apps."x86_64-unknown-linux-musl:foliage:exe:foliage"; }
64+
// lib.attrsets.optionalAttrs (system == "aarch64-linux")
65+
{ static = flake.apps."aarch64-multiplatform-musl:foliage:exe:foliage"; }
66+
;
6967

70-
apps = { default = flake.apps."foliage:exe:foliage"; }
71-
// lib.attrsets.optionalAttrs (system == "x86_64-linux")
72-
{ static = wrapExe flake.apps."x86_64-unknown-linux-musl:foliage:exe:foliage"; }
73-
// lib.attrsets.optionalAttrs (system == "aarch64-linux")
74-
{ static = wrapExe flake.apps."aarch64-multiplatform-musl:foliage:exe:foliage"; };
68+
packages =
69+
flake.packages
70+
// { default = flake.packages."foliage:exe:foliage"; }
7571

76-
packages = { default = flake.packages."foliage:exe:foliage"; }
77-
// lib.attrsets.optionalAttrs (system == "x86_64-linux")
78-
{ static = flake.packages."x86_64-unknown-linux-musl:foliage:exe:foliage"; }
72+
# Expose the derivation for a static executable as "static"
73+
// lib.attrsets.optionalAttrs (system == "x86_64-linux")
74+
{ static = flake.packages."x86_64-unknown-linux-musl:foliage:exe:foliage"; }
75+
// lib.attrsets.optionalAttrs (system == "aarch64-linux")
76+
{ static = flake.packages."aarch64-multiplatform-musl:foliage:exe:foliage"; }
7977
;
8078
}
8179
);

0 commit comments

Comments
 (0)