diff --git a/flake.lock b/flake.lock index 83a6ab6143..05683a524a 100644 --- a/flake.lock +++ b/flake.lock @@ -33,11 +33,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1778036283, - "narHash": "sha256-62EWg6lI0qyzm7oAx5cAnGkLutvJsRBe0KkEW2JDZCE=", + "lastModified": 1784555310, + "narHash": "sha256-/FCliTPgiuV1owejZFNx3Ch9irdvkOfOFl+HHZ+DrtM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ed67bc86e84e51d4a88e73c7fd36006dc876476f", + "rev": "421eebfd0ec7bccd4abe826ce62d7e6e83129493", "type": "github" }, "original": { @@ -47,11 +47,28 @@ "type": "github" } }, + "nixpkgs-x86_64-darwin": { + "locked": { + "lastModified": 1784707089, + "narHash": "sha256-2V/6imsUgB7mPZlHY54oeVBRDoZbPKnvzwkAHUSSufk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b3fe9581c9061c749abef42b6d4ee7b7c05c33fa", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-26.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "filter": "filter", "flake-compat": "flake-compat", "nixpkgs": "nixpkgs", + "nixpkgs-x86_64-darwin": "nixpkgs-x86_64-darwin", "shell-hooks": "shell-hooks" } }, diff --git a/flake.nix b/flake.nix index 6364834388..5e5049759a 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,9 @@ description = "Extract files from any kind of container formats"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + # nixpkgs 26.11 no longer has an x86_64-darwin stdenv. Keep this input + # only while that platform remains in unblob's CI matrix. + inputs.nixpkgs-x86_64-darwin.url = "github:NixOS/nixpkgs/nixos-26.05"; inputs.filter.url = "github:numtide/nix-filter"; inputs.flake-compat = { url = "github:edolstra/flake-compat"; @@ -21,6 +24,7 @@ { self, nixpkgs, + nixpkgs-x86_64-darwin, shell-hooks, filter, ... @@ -36,6 +40,7 @@ # Temporary patches for nixpkgs required for current unblob nixpkgsPatches = [ + ./nix/patches/fs-python-3.14.patch ]; # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. @@ -45,27 +50,50 @@ nixpkgsFor = forAllSystems ( system: let + nixpkgsSource = if system == "x86_64-darwin" then nixpkgs-x86_64-darwin else nixpkgs; + systemNixpkgsPatches = if system == "x86_64-darwin" then [ ] else nixpkgsPatches; + importPkgs = - nixpkgs: - import nixpkgs { + nixpkgsSource: extraOverlays: + import nixpkgsSource { inherit system; overlays = [ self.overlays.default shell-hooks.overlays.default - ]; + ] + ++ extraOverlays; }; - bootstrapPkgs = importPkgs nixpkgs; + bootstrapPkgs = importPkgs nixpkgsSource [ ]; patchedNixpkgs = bootstrapPkgs.applyPatches { name = "nixpkgs-patched"; - src = nixpkgs; - patches = map bootstrapPkgs.fetchpatch nixpkgsPatches; + src = nixpkgsSource; + patches = map ( + patch: if builtins.isPath patch then patch else bootstrapPkgs.fetchpatch patch + ) systemNixpkgsPatches; }; - finalPkgs = importPkgs patchedNixpkgs; + finalPkgs = importPkgs patchedNixpkgs [ + (final: prev: { + # Preserve the derivation context so consumers of `pkgs.path` + # retain the patched nixpkgs source as a build dependency. + path = "${patchedNixpkgs}"; + + # nix-shell-hooks currently references the former nixpkgs source + # location of auto-patchelf.sh. Use the packaged setup hook until + # it switches to a stable package path. + pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [ + (_pythonFinal: pythonPrev: { + autoPatchelfVenvShellHook = pythonPrev.autoPatchelfVenvShellHook.overrideAttrs (_old: { + autoPatchelfHook = "${final.autoPatchelfHook}/nix-support/setup-hook"; + }); + }) + ]; + }) + ]; in - if builtins.length nixpkgsPatches != 0 then finalPkgs else bootstrapPkgs + if builtins.length systemNixpkgsPatches != 0 then finalPkgs else bootstrapPkgs ); in { diff --git a/nix/patches/fs-python-3.14.patch b/nix/patches/fs-python-3.14.patch new file mode 100644 index 0000000000..25b61eb29d --- /dev/null +++ b/nix/patches/fs-python-3.14.patch @@ -0,0 +1,53 @@ +diff --git a/pkgs/development/python-modules/fs/default.nix b/pkgs/development/python-modules/fs/default.nix +index f77d02801153..97eea4e5be7c 100644 +--- a/pkgs/development/python-modules/fs/default.nix ++++ b/pkgs/development/python-modules/fs/default.nix +@@ -6,0 +7 @@ ++ fetchpatch, +@@ -24,3 +24,0 @@ +- # https://github.com/PyFilesystem/pyfilesystem2/issues/596 +- disabled = pythonAtLeast "3.14"; +- +@@ -32,5 +29,32 @@ +- postPatch = '' +- # https://github.com/PyFilesystem/pyfilesystem2/pull/591 +- substituteInPlace tests/test_ftpfs.py \ +- --replace ThreadedTestFTPd FtpdThreadWrapper +- ''; ++ # Temporary compatibility fixes for Python 3.14 and setuptools 82. ++ # Remove once PyFilesystem and nixpkgs ship equivalent fixes. ++ patches = [ ++ (fetchpatch { ++ # https://github.com/PyFilesystem/pyfilesystem2/pull/588 ++ url = "https://github.com/PyFilesystem/pyfilesystem2/commit/5c4bde407300dc7b4af6019c19219eaad59d93ee.patch"; ++ hash = "sha256-rH0sOq19KPoXFLmIZdwP2/dZAFmGwViE1e+XYdVdUb0="; ++ }) ++ (fetchpatch { ++ # https://github.com/PyFilesystem/pyfilesystem2/pull/589 ++ url = "https://github.com/PyFilesystem/pyfilesystem2/commit/136e7e257eebfcd1f561a6b2f897eb8bfd44574e.patch"; ++ hash = "sha256-AGeT8GUlbI1O7EFhuS9zzqPTE2lVXOzj8/JPjUnpNPk="; ++ }) ++ (fetchpatch { ++ # https://github.com/PyFilesystem/pyfilesystem2/pull/590 ++ url = "https://github.com/PyFilesystem/pyfilesystem2/commit/c009996c7f4a9ac3bd98cdd86b354c08a68d36c0.patch"; ++ excludes = [ "setup.cfg" ]; ++ hash = "sha256-Pw30ofLvxMm5dfY3XrjYsWcPKf3rLWMLbREsrB2tuZw="; ++ }) ++ ]; ++ ++ postPatch = '' ++ # https://github.com/PyFilesystem/pyfilesystem2/pull/591 ++ substituteInPlace tests/test_ftpfs.py \ ++ --replace ThreadedTestFTPd FtpdThreadWrapper ++ '' ++ + lib.optionalString (pythonAtLeast "3.14") '' ++ # https://github.com/PyFilesystem/pyfilesystem2/issues/596 ++ substituteInPlace fs/_url_tools.py \ ++ --replace 'import platform' $'import platform\nimport sys' \ ++ --replace ' return path_snippet' $' if sys.version_info >= (3, 14):\n path_snippet = path_snippet.removeprefix("//")\n return path_snippet' ++ ''; +@@ -41 +65,0 @@ +- setuptools +@@ -91,2 +114,0 @@ +- # https://github.com/PyFilesystem/pyfilesystem2/issues/577 +- broken = lib.versionAtLeast setuptools.version "82";