add nix support with flake

This commit is contained in:
x807x 2025-03-15 13:03:16 +08:00
parent 96d891cb94
commit 17fb1042ae
3 changed files with 100 additions and 1 deletions

62
flake.lock Normal file
View File

@ -0,0 +1,62 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1741708242,
"narHash": "sha256-cNRqdQD4sZpN7JLqxVOze4+WsWTmv2DGH0wNCOVwrWc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b62d2a95c72fb068aecd374a7262b37ed92df82b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1741513245,
"narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pyproject-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1741648141,
"narHash": "sha256-jQEZCSCgm60NGmBg3JPu290DDhNVI1GVVEd0P8VCnME=",
"owner": "pyproject-nix",
"repo": "pyproject.nix",
"rev": "7747e5a058245c7abe033a798f818f0572d8e155",
"type": "github"
},
"original": {
"owner": "pyproject-nix",
"repo": "pyproject.nix",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"pyproject-nix": "pyproject-nix"
}
}
},
"root": "root",
"version": 7
}

37
flake.nix Normal file
View File

@ -0,0 +1,37 @@
{
description = "ComfyUI with requirements.txt";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
pyproject-nix.url = "github:pyproject-nix/pyproject.nix";
};
outputs = {
self,
nixpkgs,
pyproject-nix,
...
} @ inputs: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
config.cudaSupport = true;
};
python = pkgs.python3;
project = pyproject-nix.lib.project.loadRequirementsTxt {
projectRoot = ./.;
};
pythonEnv = assert project.validators.validateVersionConstraints {inherit python;} == {}; (
pkgs.python3.withPackages (project.renderers.withPackages {
inherit python;
})
);
in {
formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra;
devShells.${system}.default = pkgs.mkShell {
packages = [
pythonEnv
];
};
};
}

View File

@ -18,6 +18,6 @@ psutil
#non essential dependencies:
kornia>=0.7.1
spandrel
# spandrel
soundfile
av