diff --git a/ci/pinned.json b/ci/pinned.json index 000a33c6dc71..32f5e186650c 100644 --- a/ci/pinned.json +++ b/ci/pinned.json @@ -12,6 +12,19 @@ "revision": "7525d999cd850b9a488817abc89c75dc733acf17", "url": "https://github.com/NixOS/nixpkgs/archive/7525d999cd850b9a488817abc89c75dc733acf17.tar.gz", "hash": "sha256-4IHyyLgLBdKefkljdKod4IMn023pQiDXAWJA187cmdY=" + }, + "nixpkgs-26.05-darwin": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "NixOS", + "repo": "nixpkgs" + }, + "branch": "nixpkgs-26.05-darwin", + "submodules": false, + "revision": "51fe96f9107566e6b8eeb7fc4ba696c01e548b04", + "url": "https://github.com/NixOS/nixpkgs/archive/51fe96f9107566e6b8eeb7fc4ba696c01e548b04.tar.gz", + "hash": "sha256-yj0LPLnsmYoLmA3FGANjeTEwej0/DHjZBXWnDQDUuIs=" } }, "version": 8 diff --git a/flake.nix b/flake.nix index 6c3321e8c7fe..5c5d89f241ad 100644 --- a/flake.nix +++ b/flake.nix @@ -199,7 +199,8 @@ && system != "riscv64-linux" # Exclude x86_64-freebsd because "Package ‘go-1.22.12-freebsd-amd64-bootstrap’ in /nix/store/0yw40qnrar3lvc5hax5n49abl57apjbn-source/pkgs/development/compilers/go/binary.nix:50 is not available on the requested hostPlatform" && system != "x86_64-freebsd" - ) (forAllSystems (system: (import ./ci { inherit system; }).fmt.pkg)); + # TODO: revert to importing fmt.pkg directly from ./ci when support for 26.05 ends + ) (forAllSystems (system: (import ./shell.nix { inherit system; }).formatter)); /** A nested structure of [packages](https://nix.dev/manual/nix/latest/glossary#package-attribute-set) and other values. diff --git a/shell.nix b/shell.nix index b68b120a2529..81ef55a637f3 100644 --- a/shell.nix +++ b/shell.nix @@ -16,7 +16,44 @@ nixpkgs ? null, }: let - inherit (import ./ci { inherit nixpkgs system; }) pkgs fmt; + version = builtins.readFile ./.version; + + # On 26.05 we need a CI-pinned Nixpkgs revision that supports x86_64-darwin. + # TODO: remove after 26.05 support ends. + nixpkgs' = + if nixpkgs == null && system == "x86_64-darwin" && version == "26.05" then + let + pinned = (builtins.fromJSON (builtins.readFile ./ci/pinned.json)).pins; + warn = builtins.warn or (import ./lib).warn; + + inherit (pinned."nixpkgs-26.05-darwin") + url + hash + revision + branch + ; + + withWarning = warn (toString [ + "The currently pinned Nixpkgs (${pinned.nixpkgs.revision}) does not support ${system}," + "using revision (${revision}) from ${branch}." + "You may experience some differences to CI." + ]); + in + withWarning fetchTarball { + inherit url; + sha256 = hash; + } + else + nixpkgs; + + inherit + (import ./ci { + inherit system; + nixpkgs = nixpkgs'; + }) + pkgs + fmt + ; # For `nix-shell -A hello` curPkgs = removeAttrs (import ./. { inherit system; }) [ @@ -39,3 +76,6 @@ curPkgs fmt.pkg ]; } +// { + formatter = fmt.pkg; +}