shell: pin a Nixpkgs that supports x86_64-darwin

When instantiating a dev-shell for x86_64-darwin, we cannot use 26.11's
pinned revision. Instead, we must use a revision that still supports
x86_64-darwin.

Print a warning when we need to use that revision, because it is likely
there will be subtle formatting & linting differences vs CI.
This commit is contained in:
Matt Sturgeon
2026-07-24 20:03:50 +01:00
parent 6c8710c402
commit f86bce2497
3 changed files with 56 additions and 2 deletions
+13
View File
@@ -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
+2 -1
View File
@@ -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.
+41 -1
View File
@@ -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;
}