Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 36 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -21,6 +24,7 @@
{
self,
nixpkgs,
nixpkgs-x86_64-darwin,
shell-hooks,
filter,
...
Expand All @@ -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"; ... }'.
Expand All @@ -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
{
Expand Down
53 changes: 53 additions & 0 deletions nix/patches/fs-python-3.14.patch
Original file line number Diff line number Diff line change
@@ -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";
Loading