feat: add flake for nix users
This commit is contained in:
parent
59f183ab9b
commit
c1f2baca5e
|
|
@ -53,3 +53,4 @@ user_path_config-deprecated.txt
|
|||
/.coverage*
|
||||
/auth.json
|
||||
.DS_Store
|
||||
.direnv
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1742069588,
|
||||
"narHash": "sha256-C7jVfohcGzdZRF6DO+ybyG/sqpo1h6bZi9T56sxLy+k=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
venv-dir = "fooocus_env";
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
# For more packages/package search go to https://search.nixos.org/
|
||||
python310 # Adjust Python version as needed
|
||||
python310Packages.pip
|
||||
python310Packages.virtualenv
|
||||
pkg-config
|
||||
stdenv.cc.cc.lib
|
||||
cudatoolkit
|
||||
cudaPackages.cudnn
|
||||
cudaPackages.cuda_cudart
|
||||
gcc13
|
||||
zlib
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export CUDA_PATH=${pkgs.cudatoolkit}
|
||||
export CC=${pkgs.gcc13}/bin/gcc
|
||||
export CXX=${pkgs.gcc13}/bin/g++
|
||||
export PATH=${pkgs.gcc13}/bin:$PATH
|
||||
|
||||
export LD_LIBRARY_PATH=${
|
||||
pkgs.lib.makeLibraryPath [
|
||||
"/run/opengl-driver"
|
||||
pkgs.cudatoolkit
|
||||
pkgs.cudaPackages.cudnn
|
||||
pkgs.stdenv.cc.cc
|
||||
]
|
||||
}:$LD_LIBRARY_PATH
|
||||
|
||||
|
||||
export LIBRARY_PATH=${
|
||||
pkgs.lib.makeLibraryPath [ pkgs.cudatoolkit ]
|
||||
}:$LIBRARY_PATH
|
||||
|
||||
if [ ! -d ${venv-dir} ]; then
|
||||
echo "Creating virtual environment..."
|
||||
python3 -m venv ${venv-dir}
|
||||
fi
|
||||
|
||||
echo "Activating virtual environment..."
|
||||
source ${venv-dir}/bin/activate
|
||||
pip install -r ./requirements_versions.txt
|
||||
'';
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue