{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; pyproject-nix = { url = "github:pyproject-nix/pyproject.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; uv2nix = { url = "github:pyproject-nix/uv2nix"; inputs.pyproject-nix.follows = "pyproject-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; pyproject-build-systems = { url = "github:pyproject-nix/build-system-pkgs"; inputs.pyproject-nix.follows = "pyproject-nix"; inputs.uv2nix.follows = "uv2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, flake-utils, pyproject-nix, uv2nix, pyproject-build-systems, }: let workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; }; overlay = workspace.mkPyprojectOverlay { sourcePreference = "wheel"; }; in flake-utils.lib.eachDefaultSystem ( system: let pkgs = import nixpkgs { inherit system; config.allowUnfree = true; }; python = pkgs.python311; # Override to provide fastentrypoints build-system dep # (not in pyproject-build-systems because it's niche) buildSystemOverride = final: prev: { fastentrypoints = prev.fastentrypoints.overrideAttrs (old: { nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ (final.resolveBuildSystem { setuptools = [ ]; }) ]; }); thefuck = prev.thefuck.overrideAttrs (old: { nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ (final.resolveBuildSystem { setuptools = [ ]; fastentrypoints = [ ]; }) ]; }); }; pythonSet = (pkgs.callPackage pyproject-nix.build.packages { inherit python; }).overrideScope ( nixpkgs.lib.composeManyExtensions [ pyproject-build-systems.overlays.wheel overlay buildSystemOverride ] ); in { packages.default = pythonSet.mkVirtualEnv "thefuck-env" workspace.deps.default; apps.default = { type = "app"; program = "${self.packages.${system}.default}/bin/thefuck"; }; devShell = pkgs.mkShell { packages = with pkgs; [ uv gh ] ++ [ python ]; env = { UV_NO_SYNC = "1"; UV_PYTHON = python.interpreter; UV_PYTHON_DOWNLOADS = "never"; }; }; } ); }