|
5 | 5 | inputs = { |
6 | 6 | nixpkgs.follows = "haskell-nix/nixpkgs-unstable"; |
7 | 7 | 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; |
11 | 8 | flake-utils.url = "github:numtide/flake-utils"; |
12 | 9 | }; |
13 | 10 |
|
|
16 | 13 | systems = [ |
17 | 14 | "x86_64-linux" |
18 | 15 | "x86_64-darwin" |
19 | | - # TODO switch back on when ci.iog.io has builders for aarch64-linux |
20 | | - # "aarch64-linux" |
| 16 | + "aarch64-linux" |
21 | 17 | "aarch64-darwin" |
22 | 18 | ]; |
23 | 19 | in |
|
39 | 35 | haskell-language-server = "latest"; |
40 | 36 | fourmolu = "0.14.0.0"; |
41 | 37 | }; |
| 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 | + }]; |
42 | 48 | }; |
43 | 49 |
|
44 | 50 | flake = project.flake ( |
45 | 51 | lib.attrsets.optionalAttrs (system == "x86_64-linux") |
46 | 52 | { crossPlatforms = p: [ p.musl64 ]; } |
47 | 53 | ); |
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 | | - |
61 | 54 | in |
62 | | - |
63 | 55 | flake // { |
64 | 56 | inherit project; |
65 | 57 |
|
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 | + ; |
69 | 67 |
|
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"; } |
75 | 71 |
|
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"; } |
79 | 77 | ; |
80 | 78 | } |
81 | 79 | ); |
|
0 commit comments