diff --git a/.github/workflows/aarch64-linux.yml b/.github/workflows/aarch64-linux.yml index f197d8c..1db5c8d 100644 --- a/.github/workflows/aarch64-linux.yml +++ b/.github/workflows/aarch64-linux.yml @@ -1,8 +1,7 @@ name: DevX closures for aarch64-linux on: - # Disabled until we have a new aarch64-linux hydra builder - # push: + push: jobs: build: diff --git a/.github/workflows/hello.yml b/.github/workflows/hello.yml index 25bf092..d64d0b9 100644 --- a/.github/workflows/hello.yml +++ b/.github/workflows/hello.yml @@ -11,13 +11,11 @@ jobs: fail-fast: false matrix: platform: - - x86_64-darwin - x86_64-linux - # Skipping because we do not have runners for these set up. - #- aarch64-darwin - #- aarch64-linux + - x86_64-darwin + - aarch64-darwin + - aarch64-linux compiler-nix-name: - - ghc810 - ghc96 - ghc98 - ghc910 @@ -34,9 +32,6 @@ jobs: - false - true exclude: - # Just cross compiling javascript with ghc 9.6 and above - - compiler-nix-name: ghc810 - target-platform: "-js" # Windows cross compilation only works on x86_64 right now. - platform: aarch64-darwin target-platform: "-windows" diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index 769d8a6..bcbec09 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -42,7 +42,7 @@ jobs: nix_path: nixpkgs=channel:nixos-unstable - run: | nix profile install github:Kha/nixprof - nixprof record nix develop .#ghc8107 --accept-flake-config + nixprof record nix develop .#ghc96 --accept-flake-config nixprof report -p nixprof report -a nixprof report -s diff --git a/flake.lock b/flake.lock index 940028b..e755d9e 100644 --- a/flake.lock +++ b/flake.lock @@ -36,11 +36,11 @@ "cabal": { "flake": false, "locked": { - "lastModified": 1743338359, - "narHash": "sha256-OHjT+UbGcyz46cUW+/eLeezvO0om/vSQ8BZ/oLld1AE=", + "lastModified": 1753671809, + "narHash": "sha256-HeO1VCtD+azwoDAlf9uJfB8D5u5LtiozifD3lCXNG2M=", "owner": "stable-haskell", "repo": "cabal", - "rev": "c0d52b2cb168d3204b0c56a85a42be65d87cdabd", + "rev": "0a74ea16d75f94d282de8598fd7b244b9ab9a2e4", "type": "github" }, "original": { @@ -103,16 +103,16 @@ "cabal-experimental": { "flake": false, "locked": { - "lastModified": 1744014992, - "narHash": "sha256-UsMDgfti/yctTcRt6c8h56/CPjviG7+qlrKy9FXvrN0=", + "lastModified": 1756180484, + "narHash": "sha256-lwipN9FjBfbpBuUeI3oICeSUit/hjWOK/Exr7hJwJQE=", "owner": "stable-haskell", "repo": "cabal", - "rev": "7e50837ade188504d1401bad932a5b8b3769661e", + "rev": "bc52b097aa2f26aa440fcacdb506843987bba346", "type": "github" }, "original": { "owner": "stable-haskell", - "ref": "angerman/cross", + "ref": "stable-haskell/feature/cross-compile", "repo": "cabal", "type": "github" } @@ -168,52 +168,51 @@ "type": "github" } }, - "ghc-8.6.5-iohk": { + "hackage": { "flake": false, "locked": { - "lastModified": 1600920045, - "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", + "lastModified": 1765240039, + "narHash": "sha256-yY2rz/qyvX9oB5FpPWSvXKi6baAKDQNaaRuaIl+ms/M=", "owner": "input-output-hk", - "repo": "ghc", - "rev": "95713a6ecce4551240da7c96b6176f980af75cae", + "repo": "hackage.nix", + "rev": "b0bc4ecf472e97fa635890d9b128ee66b1e288db", "type": "github" }, "original": { "owner": "input-output-hk", - "ref": "release/8.6.5-iohk", - "repo": "ghc", + "repo": "hackage.nix", "type": "github" } }, - "hackage": { + "hackage-for-stackage": { "flake": false, "locked": { - "lastModified": 1743726306, - "narHash": "sha256-47ILvNh/RSQP6PQ9TkuiqSdxLbOEuAlQZVQrHdj8dwU=", + "lastModified": 1765240028, + "narHash": "sha256-XHZRYH6zh3xTls8SOkbGqoF8D9W1W3cD2c8I6JOl+NM=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "9f3c25c7eb211f558744d7d4e8ef0a41265eda45", + "rev": "f3472c5c91886aa99c2535cf4709f6fa4a99dc87", "type": "github" }, "original": { "owner": "input-output-hk", + "ref": "for-stackage", "repo": "hackage.nix", "type": "github" } }, - "hackage-for-stackage": { + "hackage-internal": { "flake": false, "locked": { - "lastModified": 1743726296, - "narHash": "sha256-E8ABsEHk0zPyy5tRH01VYN0XgHRKWLSukJMrTtie6Lw=", + "lastModified": 1750307553, + "narHash": "sha256-iiafNoeLHwlSLQTyvy8nPe2t6g5AV4PPcpMeH/2/DLs=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "fdd3d2bb06fb0b798820126537ca0933f132c535", + "rev": "f7867baa8817fab296528f4a4ec39d1c7c4da4f3", "type": "github" }, "original": { "owner": "input-output-hk", - "ref": "for-stackage", "repo": "hackage.nix", "type": "github" } @@ -226,13 +225,14 @@ "cabal-36": "cabal-36", "cardano-shell": "cardano-shell", "flake-compat": "flake-compat", - "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", "hackage": "hackage", "hackage-for-stackage": "hackage-for-stackage", + "hackage-internal": "hackage-internal", "hls": "hls", "hls-1.10": "hls-1.10", "hls-2.0": "hls-2.0", "hls-2.10": "hls-2.10", + "hls-2.11": "hls-2.11", "hls-2.2": "hls-2.2", "hls-2.3": "hls-2.3", "hls-2.4": "hls-2.4", @@ -251,16 +251,18 @@ "nixpkgs-2311": "nixpkgs-2311", "nixpkgs-2405": "nixpkgs-2405", "nixpkgs-2411": "nixpkgs-2411", + "nixpkgs-2505": "nixpkgs-2505", + "nixpkgs-2511": "nixpkgs-2511", "nixpkgs-unstable": "nixpkgs-unstable", "old-ghc-nix": "old-ghc-nix", "stackage": "stackage" }, "locked": { - "lastModified": 1743757633, - "narHash": "sha256-WfGGRcl0P0Xf7G0lJKLNEcIDbGPktqo8/fY7lDCGwFo=", + "lastModified": 1765270203, + "narHash": "sha256-AcZ7Nj840/KJI9Dlr90sgyxQa18tOvndudvD0JClG+I=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "835d1d863e8a885a644cb8529c1fa391eb5f14a3", + "rev": "7e7550c6214036a8c4b2576fc964396b7a7082ab", "type": "github" }, "original": { @@ -336,6 +338,23 @@ "type": "github" } }, + "hls-2.11": { + "flake": false, + "locked": { + "lastModified": 1747306193, + "narHash": "sha256-/MmtpF8+FyQlwfKHqHK05BdsxC9LHV70d/FiMM7pzBM=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "46ef4523ea4949f47f6d2752476239f1c6d806fe", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.11.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, "hls-2.2": { "flake": false, "locked": { @@ -496,11 +515,11 @@ "sodium": "sodium" }, "locked": { - "lastModified": 1743649718, - "narHash": "sha256-Wl1nQ2dak4b3fXA7+9rB2ntiKUS+yAzR2kOIUoAF0u8=", + "lastModified": 1762970280, + "narHash": "sha256-1OZsxij29cBXBFK2NtexgBXbkt2a2sqnRq1HB8RejxE=", "owner": "input-output-hk", "repo": "iohk-nix", - "rev": "3acad181ea6619b64fa49961133026110a460945", + "rev": "a704b93ea51ee1a8a7e456659e0b28ddba280a95", "type": "github" }, "original": { @@ -512,11 +531,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1742121966, - "narHash": "sha256-x4bg4OoKAPnayom0nWc0BmlxgRMMHk6lEPvbiyFBq1s=", + "lastModified": 1755243078, + "narHash": "sha256-GLbl1YaohKdpzZVJFRdcI1O1oE3F3uBer4lFv3Yy0l8=", "owner": "stable-haskell", "repo": "iserv-proxy", - "rev": "e9dc86ed6ad71f0368c16672081c8f26406c3a7e", + "rev": "150605195cb7183a6fb7bed82f23fedf37c6f52a", "type": "github" }, "original": { @@ -528,16 +547,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1684171562, - "narHash": "sha256-BMUWjVWAUdyMWKk0ATMC9H0Bv4qAV/TXwwPUvTiC5IQ=", + "lastModified": 1751071626, + "narHash": "sha256-/uHE/AD2qGq4QLigWAnBHiVvpVXB04XAfrOtw8JMv+Y=", "owner": "nixos", "repo": "nixpkgs", - "rev": "55af203d468a6f5032a519cba4f41acf5a74b638", + "rev": "a47938d89bdf8e279ad432bd6a473cf4c430f48c", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-22.11", + "ref": "release-25.05", "repo": "nixpkgs", "type": "github" } @@ -592,11 +611,11 @@ }, "nixpkgs-2411": { "locked": { - "lastModified": 1739151041, - "narHash": "sha256-uNszcul7y++oBiyYXjHEDw/AHeLNp8B6pyWOB+RLA/4=", + "lastModified": 1751290243, + "narHash": "sha256-kNf+obkpJZWar7HZymXZbW+Rlk3HTEIMlpc6FCNz0Ds=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "94792ab2a6beaec81424445bf917ca2556fbeade", + "rev": "5ab036a8d97cb9476fbe81b09076e6e91d15e1b6", "type": "github" }, "original": { @@ -606,13 +625,45 @@ "type": "github" } }, + "nixpkgs-2505": { + "locked": { + "lastModified": 1764560356, + "narHash": "sha256-M5aFEFPppI4UhdOxwdmceJ9bDJC4T6C6CzCK1E2FZyo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6c8f0cca84510cc79e09ea99a299c9bc17d03cb6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-25.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2511": { + "locked": { + "lastModified": 1764572236, + "narHash": "sha256-hLp6T/vKdrBQolpbN3EhJOKTXZYxJZPzpnoZz+fEGlE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b0924ea1889b366de6bb0018a9db70b2c43a15f8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-25.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { - "lastModified": 1737110817, - "narHash": "sha256-DSenga8XjPaUV5KUFW/i3rNkN7jm9XmguW+qQ1ZJTR4=", + "lastModified": 1764587062, + "narHash": "sha256-hdFa0TAVQAQLDF31cEW3enWmBP+b592OvHs6WVe3D8k=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "041c867bad68dfe34b78b2813028a2e2ea70a23c", + "rev": "c1cb7d097cb250f6e1904aacd5f2ba5ffd8a49ce", "type": "github" }, "original": { @@ -648,7 +699,7 @@ "iohk-nix": "iohk-nix", "nixpkgs": [ "haskellNix", - "nixpkgs-2411" + "nixpkgs-2511" ] } }, @@ -689,11 +740,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1743725527, - "narHash": "sha256-kjR/FLAg7bVMI8h40QWSV8mQRSdTUesMG3ITYbcAlKM=", + "lastModified": 1765239207, + "narHash": "sha256-FrgBhMpTDbde9EcS5qFUy/xDDxORjyJ4UdIzTRBJ98w=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "b7d2fd63e4b3b1a2633f61248b06bb5ecf08fd71", + "rev": "238321daf3522a3fe1284bbf18b877bc1bf32715", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 5a62054..61a3e42 100644 --- a/flake.nix +++ b/flake.nix @@ -2,12 +2,12 @@ description = "Minimal devshell flake for haskell"; inputs.haskellNix.url = "github:input-output-hk/haskell.nix"; - inputs.nixpkgs.follows = "haskellNix/nixpkgs-2411"; + inputs.nixpkgs.follows = "haskellNix/nixpkgs-2511"; inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.iohk-nix.url = "github:input-output-hk/iohk-nix"; inputs.cabal.url = "github:stable-haskell/cabal"; inputs.cabal.flake = false; - inputs.cabal-experimental.url = "github:stable-haskell/cabal?ref=angerman/cross"; + inputs.cabal-experimental.url = "github:stable-haskell/cabal?ref=stable-haskell/feature/cross-compile"; inputs.cabal-experimental.flake = false; outputs = { self, nixpkgs, flake-utils, haskellNix, iohk-nix, ... }: @@ -61,8 +61,7 @@ supportedSystems = [ "x86_64-linux" "x86_64-darwin" - # Currently no aarch64 linux builders - # "aarch64-linux" + "aarch64-linux" "aarch64-darwin" ]; in let flake-outputs = flake-utils.lib.eachSystem supportedSystems (system: @@ -90,7 +89,6 @@ # Map the compiler-nix-name to a final compiler-nix-name the way haskell.nix # projects do (that way we can use short names) let compilers = pkgs: pkgs.lib.genAttrs [ - "ghc810" "ghc96" "ghc98" "ghc910" @@ -210,55 +208,43 @@ } "touch $out"; } // (pkgs.lib.mapAttrs' (name: drv: pkgs.lib.nameValuePair "${name}-env" ( - # We need to use unsafeDiscardOutputDependency here, as it will otherwise - # pull in a bunch of dependenceis we don't care about at all from the .drvPath - # query. - let env = pkgs.runCommand "${name}-env.sh" { - requiredSystemFeatures = [ "recursive-nix" ]; - nativeBuildInputs = [ pkgs.nix ]; - } '' - nix --offline --extra-experimental-features "nix-command flakes" \ - print-dev-env '${builtins.unsafeDiscardOutputDependency drv.drvPath}^*' >> $out - ''; - # this needs to be linux. It would be great if we could have this - # eval platform agnostic, but flakes don't permit this. A the - # platform where we build the docker images is linux (github - # ubuntu runners), this needs to be evaluable on linux. - in (import nixpkgs { system = "x86_64-linux"; }).writeTextFile { - name = "devx"; - executable = true; + # Build-time read approach: read the mkShell output at build time using cat. + # This avoids both: + # - IFD (Import From Derivation) which forces cross-platform builds during eval + # - recursive-nix which is not supported on remote builders + # + # The shell (drv) is a normal build dependency. Its output contains + # "declare -x VAR=value" lines which we read at build time. + pkgs.runCommand "devx" {} '' + # Read the shell's output at build time + shellContent=$(cat ${drv}) + + # Filter out the $out self-reference to avoid circular dependency issues + filteredContent=$(echo "$shellContent" | grep -v 'declare -x out=') + + # Create the wrapper script # We use nix-shell to invoke bash, to work around some shells being just too ancient. - # This primarily happens on macOS. But as the sourced env may expect a bash version - # current with the current nix, using nix-shell to launch the bash is probably the - # most reliable option. - text = '' - #! /usr/bin/env nix-shell - #! nix-shell -i bash -p bash + # This primarily happens on macOS. + cat > $out <<'SCRIPT' +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p bash + +set -euo pipefail +SCRIPT - set -euo pipefail + # Append the filtered environment + echo "$filteredContent" >> $out - # Set up the environment - source ${env} - source "$1" - ''; - meta = { - description = "DevX shell"; - longDescription = '' - The DevX shell is supposed to be used with GitHub Actions, and - can be used by setting the default shell to: + # Append the source command + echo 'source "$1"' >> $out - shell: devx {0} - ''; - homepage = "https://github.com/input-output-hk/devx"; - license = pkgs.lib.licenses.asl20; - platforms = pkgs.lib.platforms.unix; - }; - })) devShells) + chmod +x $out + '')) devShells) // (pkgs.lib.mapAttrs' (name: drv: pkgs.lib.nameValuePair "${name}-plans" drv.plans) devShells); - packages.cabalProjectLocal.static = (import ./quirks.nix { pkgs = static-pkgs; static = true; }).template; - packages.cabalProjectLocal.cross-js = (import ./quirks.nix { pkgs = js-pkgs; }).template; - packages.cabalProjectLocal.cross-windows = (import ./quirks.nix { pkgs = windows-pkgs; }).template; + packages.cabalProjectLocal-static = (import ./quirks.nix { pkgs = static-pkgs; static = true; }).template; + packages.cabalProjectLocal-cross-js = (import ./quirks.nix { pkgs = js-pkgs; }).template; + packages.cabalProjectLocal-cross-windows = (import ./quirks.nix { pkgs = windows-pkgs; }).template; }); # we use flake-outputs here to inject a required job that aggregates all required jobs. in flake-outputs // { diff --git a/tool-map.nix b/tool-map.nix index bc5fe54..78d4466 100644 --- a/tool-map.nix +++ b/tool-map.nix @@ -15,7 +15,7 @@ let f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-+hzciiQqWb5oOzQ2JZ2lzJGfGuwA3ZigeWgAQ8Dz+kk= + --sha256: sha256-AO/vHIMSIBwjbp5GY561SmnPr5qTTyBt9ruy8D3lKZI= if impl(ghc < 9.13) active-repositories: hackage.haskell.org @@ -37,7 +37,7 @@ compiler-nix-name: tool: { # Use the github source of HLS that is tested with haskell.nix CI src = { "ghc8107" = pkgs.haskell-nix.sources."hls-2.2"; "ghc902" = pkgs.haskell-nix.sources."hls-2.4"; - }.${compiler-nix-name} or pkgs.haskell-nix.sources."hls-2.10"; + }.${compiler-nix-name} or pkgs.haskell-nix.sources."hls-2.11"; # `tool` normally ignores the `cabal.project` (if there is one in the hackage source). # We need to use the github one (since it has settings to make hls build). cabalProject = __readFile (src + "/cabal.project"); @@ -45,7 +45,7 @@ compiler-nix-name: tool: { }; happy = { version = "1.20.1.1"; inherit cabalProjectLocal; }; alex = { version = "3.2.7.3"; inherit cabalProjectLocal; }; - cabal = { + cabal = rec { src = self.inputs.cabal; # We use the cabal.boostrap.project file, as we don't # want an of the cabal complexities they have. The @@ -54,10 +54,10 @@ compiler-nix-name: tool: { # # cabal = { src = { outPath = self.inputs.cabal; filterPath = { path, ... }: path; }; } # - cabalProjectFileName = "cabal.bootstrap.project"; - cabalProjectLocal = '' - index-state: hackage.haskell.org 2025-03-17T00:00:00Z - ''; + cabalProject = __replaceStrings + ["import: project-cabal/constraints.config"] + [(__readFile (src + "/project-cabal/constraints.config"))] + (__readFile (src + "/cabal.bootstrap.project")); }; hlint = { cabalProjectLocal = ''