From cb6d627cbc04bc4dcc0e5e519c7a8bb88e4b79f8 Mon Sep 17 00:00:00 2001 From: Andrea Bedini Date: Tue, 16 Jan 2024 12:23:08 +0800 Subject: [PATCH] Update flake - Bump flake.lock - Re-enable aarch64-linux - Include more programs in foliage's path - Don't override haskell.nix's flake apps and packages entirely - Remove hackage.nix input workaround (nix lets you update a transitive input) --- flake.lock | 114 ++++++++++++++++++++++++++++++++++++++--------------- flake.nix | 58 +++++++++++++-------------- 2 files changed, 110 insertions(+), 62 deletions(-) diff --git a/flake.lock b/flake.lock index ba31144..9253e83 100644 --- a/flake.lock +++ b/flake.lock @@ -105,11 +105,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -157,11 +157,11 @@ "ghc99": { "flake": false, "locked": { - "lastModified": 1697054644, - "narHash": "sha256-kKarOuXUaAH3QWv7ASx+gGFMHaHKe0pK5Zu37ky2AL4=", + "lastModified": 1701580282, + "narHash": "sha256-drA01r3JrXnkKyzI+owMZGxX0JameMzjK0W5jJE/+V4=", "ref": "refs/heads/master", - "rev": "f383a242c76f90bcca8a4d7ee001dcb49c172a9a", - "revCount": 62040, + "rev": "f5eb0f2982e9cf27515e892c4bdf634bcfb28459", + "revCount": 62197, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" @@ -172,14 +172,14 @@ "url": "https://gitlab.haskell.org/ghc/ghc" } }, - "hackage-nix": { + "hackage": { "flake": false, "locked": { - "lastModified": 1700353452, - "narHash": "sha256-YUy4t7Wfow3K6nyfJV4GY7NCnEoxDEAufXiF9f7Ryg8=", + "lastModified": 1705364601, + "narHash": "sha256-buraKVhWjyoM33EiL/c0aocuABZ+7zR4tk+QZeJHmX0=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "6e756c20a4537db56d9bcb3e4936dae912381da1", + "rev": "ba18979d9c6daf12cb34ad4a5e6e03dd9cc635bd", "type": "github" }, "original": { @@ -199,14 +199,14 @@ "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", "ghc98X": "ghc98X", "ghc99": "ghc99", - "hackage": [ - "hackage-nix" - ], + "hackage": "hackage", "hls-1.10": "hls-1.10", "hls-2.0": "hls-2.0", "hls-2.2": "hls-2.2", "hls-2.3": "hls-2.3", "hls-2.4": "hls-2.4", + "hls-2.5": "hls-2.5", + "hls-2.6": "hls-2.6", "hpc-coveralls": "hpc-coveralls", "hydra": "hydra", "iserv-proxy": "iserv-proxy", @@ -220,16 +220,17 @@ "nixpkgs-2205": "nixpkgs-2205", "nixpkgs-2211": "nixpkgs-2211", "nixpkgs-2305": "nixpkgs-2305", + "nixpkgs-2311": "nixpkgs-2311", "nixpkgs-unstable": "nixpkgs-unstable", "old-ghc-nix": "old-ghc-nix", "stackage": "stackage" }, "locked": { - "lastModified": 1700268617, - "narHash": "sha256-iFZLbV5eK3c/k/FdtnSolrwWwNcMl8ynu79IGwt4TXI=", + "lastModified": 1705393246, + "narHash": "sha256-63wDOld7PF2oTmcNbIOoa5e5/uqaoTFMgfctq3Q6GDw=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "da8693b6f8da82f2516778d646880779ff3fef91", + "rev": "dd0a035c1de8708212d2a477c3426c775f8c118f", "type": "github" }, "original": { @@ -309,16 +310,50 @@ "hls-2.4": { "flake": false, "locked": { - "lastModified": 1696939266, - "narHash": "sha256-VOMf5+kyOeOmfXTHlv4LNFJuDGa7G3pDnOxtzYR40IU=", + "lastModified": 1699862708, + "narHash": "sha256-YHXSkdz53zd0fYGIYOgLt6HrA0eaRJi9mXVqDgmvrjk=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "54507ef7e85fa8e9d0eb9a669832a3287ffccd57", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.4.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.5": { + "flake": false, + "locked": { + "lastModified": 1701080174, + "narHash": "sha256-fyiR9TaHGJIIR0UmcCb73Xv9TJq3ht2ioxQ2mT7kVdc=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "27f8c3d3892e38edaef5bea3870161815c4d014c", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.5.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.6": { + "flake": false, + "locked": { + "lastModified": 1705325287, + "narHash": "sha256-+P87oLdlPyMw8Mgoul7HMWdEvWP/fNlo8jyNtwME8E8=", "owner": "haskell", "repo": "haskell-language-server", - "rev": "362fdd1293efb4b82410b676ab1273479f6d17ee", + "rev": "6e0b342fa0327e628610f2711f8c3e4eaaa08b1e", "type": "github" }, "original": { "owner": "haskell", - "ref": "2.4.0.0", + "ref": "2.6.0.0", "repo": "haskell-language-server", "type": "github" } @@ -514,11 +549,11 @@ }, "nixpkgs-2305": { "locked": { - "lastModified": 1695416179, - "narHash": "sha256-610o1+pwbSu+QuF3GE0NU5xQdTHM3t9wyYhB9l94Cd8=", + "lastModified": 1701362232, + "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "715d72e967ec1dd5ecc71290ee072bcaf5181ed6", + "rev": "d2332963662edffacfddfad59ff4f709dde80ffe", "type": "github" }, "original": { @@ -528,6 +563,22 @@ "type": "github" } }, + "nixpkgs-2311": { + "locked": { + "lastModified": 1701386440, + "narHash": "sha256-xI0uQ9E7JbmEy/v8kR9ZQan6389rHug+zOtZeZFiDJk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "293822e55ec1872f715a66d0eda9e592dc14419f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-regression": { "locked": { "lastModified": 1643052045, @@ -546,17 +597,17 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1695318763, - "narHash": "sha256-FHVPDRP2AfvsxAdc+AsgFJevMz5VBmnZglFUMlxBkcY=", + "lastModified": 1694822471, + "narHash": "sha256-6fSDCj++lZVMZlyqOe9SIOL8tYSBz1bI8acwovRwoX8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e12483116b3b51a185a33a272bf351e357ba9a99", + "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", "repo": "nixpkgs", + "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", "type": "github" } }, @@ -580,7 +631,6 @@ "root": { "inputs": { "flake-utils": "flake-utils", - "hackage-nix": "hackage-nix", "haskell-nix": "haskell-nix", "nixpkgs": [ "haskell-nix", @@ -591,11 +641,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1700266158, - "narHash": "sha256-igWcCBu9dcScZ/MxLEHmMEGXg3fbS+11Anwlct4QDzQ=", + "lastModified": 1705363778, + "narHash": "sha256-lORuVSwOPc0/OZlN4bTGbRQ2qb2VrTxM0XjyqaTkiTU=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "df04fc0233b8ca688fade91c9c48ad746d6986fd", + "rev": "3801e5d646d276073c4bd618c8d6a136afe87759", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c84e4cd..cb4d44a 100644 --- a/flake.nix +++ b/flake.nix @@ -5,9 +5,6 @@ inputs = { nixpkgs.follows = "haskell-nix/nixpkgs-unstable"; haskell-nix.url = "github:input-output-hk/haskell.nix"; - haskell-nix.inputs.hackage.follows = "hackage-nix"; - hackage-nix.url = "github:input-output-hk/hackage.nix"; - hackage-nix.flake = false; flake-utils.url = "github:numtide/flake-utils"; }; @@ -16,8 +13,7 @@ systems = [ "x86_64-linux" "x86_64-darwin" - # TODO switch back on when ci.iog.io has builders for aarch64-linux - # "aarch64-linux" + "aarch64-linux" "aarch64-darwin" ]; in @@ -39,43 +35,45 @@ haskell-language-server = "latest"; fourmolu = "0.14.0.0"; }; + + modules = [{ + # Wrap executables with the needed dependencies in PATH. See #71. + packages.foliage.postInstall = '' + for exe in $(find $out/bin -type f -executable); do + wrapProgram "$exe" \ + --prefix PATH : ${with pkgs; lib.makeBinPath [ coreutils curl gnutar gitMinimal patch ]} + done + ''; + }]; }; flake = project.flake ( lib.attrsets.optionalAttrs (system == "x86_64-linux") { crossPlatforms = p: [ p.musl64 ]; } ); - - # Wrap the foliage executable with the needed dependencies in PATH. - # See #71. - wrapExe = drv: - pkgs.runCommand "foliage" - { - nativeBuildInputs = [ pkgs.makeWrapper ]; - } '' - mkdir -p $out/bin - makeWrapper ${drv}/bin/foliage $out/bin/foliage \ - --prefix PATH : ${with pkgs; lib.makeBinPath [ curl patch ]}:$out/bin - ''; - in - flake // { inherit project; - # This is way too much boilerplate. I only want the default package to - # be the main exe (package or app) and "static" the static version on - # the systems where it is available. + apps = + flake.apps + // { default = flake.apps."foliage:exe:foliage"; } + # Expose the derivation for a static executable as "static" + // lib.attrsets.optionalAttrs (system == "x86_64-linux") + { static = flake.apps."x86_64-unknown-linux-musl:foliage:exe:foliage"; } + // lib.attrsets.optionalAttrs (system == "aarch64-linux") + { static = flake.apps."aarch64-multiplatform-musl:foliage:exe:foliage"; } + ; - apps = { default = flake.apps."foliage:exe:foliage"; } - // lib.attrsets.optionalAttrs (system == "x86_64-linux") - { static = wrapExe flake.apps."x86_64-unknown-linux-musl:foliage:exe:foliage"; } - // lib.attrsets.optionalAttrs (system == "aarch64-linux") - { static = wrapExe flake.apps."aarch64-multiplatform-musl:foliage:exe:foliage"; }; + packages = + flake.packages + // { default = flake.packages."foliage:exe:foliage"; } - packages = { default = flake.packages."foliage:exe:foliage"; } - // lib.attrsets.optionalAttrs (system == "x86_64-linux") - { static = flake.packages."x86_64-unknown-linux-musl:foliage:exe:foliage"; } + # Expose the derivation for a static executable as "static" + // lib.attrsets.optionalAttrs (system == "x86_64-linux") + { static = flake.packages."x86_64-unknown-linux-musl:foliage:exe:foliage"; } + // lib.attrsets.optionalAttrs (system == "aarch64-linux") + { static = flake.packages."aarch64-multiplatform-musl:foliage:exe:foliage"; } ; } );