Files
mt/Deep-SAD-PyTorch/flake.nix
2025-06-17 07:26:03 +02:00

84 lines
2.4 KiB
Nix

{
description = "Deepsad devenv with python 3.11";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
# Added newest nixpkgs for an updated poetry package.
nixpkgs-newest.url = "github:NixOS/nixpkgs/nixos-unstable";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
nixpkgs-newest,
flake-utils,
poetry2nix,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
# see https://github.com/nix-community/poetry2nix/tree/master#api for more functions and examples.
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
config.cudaSupport = true;
};
pkgsNew = nixpkgs-newest.legacyPackages.${system};
thundersvm = import ./nix/thundersvm.nix {
inherit pkgs;
inherit (pkgs) fetchFromGitHub cmake gcc12Stdenv;
cudaPackages = pkgs.cudaPackages;
};
thundersvm-python = import ./nix/thundersvm-python.nix {
inherit pkgs;
pythonPackages = pkgs.python311Packages;
thundersvm = thundersvm;
};
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication defaultPoetryOverrides;
in
{
packages = {
deepsad = mkPoetryApplication {
projectDir = self;
preferWheels = true;
python = pkgs.python311;
overrides = defaultPoetryOverrides.extend (
final: prev: {
torch-receptive-field = prev.torch-receptive-field.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ [ prev.setuptools ];
});
}
);
};
default = self.packages.${system}.deepsad;
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.deepsad ];
buildInputs = with pkgs.python311Packages; [
torch-bin
torchvision-bin
thundersvm-python
];
#LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [
#pkgs.stdenv.cc.cc
#];
};
devShells.poetry = pkgs.mkShell {
packages = [
pkgsNew.poetry
pkgs.python311
];
};
}
);
}