diff --git a/hosts/local-packages.nix b/hosts/local-packages.nix index 1978a98..ad70d6b 100644 --- a/hosts/local-packages.nix +++ b/hosts/local-packages.nix @@ -41,10 +41,13 @@ in { visualvm jdt-language-server python3Packages.pip - (python310.withPackages (ps: + (python311.withPackages (ps: with ps; [ virtualenv + torch-bin + torchvision-bin + torchaudio-bin ipython i3ipc xlib @@ -114,12 +117,7 @@ in { starship flameshot yarn - nodePackages.typescript-language-server - nodePackages.eslint - nodePackages.prettier - nodePackages.vitest - nodePackages.pg - nodePackages.sqlite3 + mpv httpie wrk nodePackages.pnpm diff --git a/modules/default.nix b/modules/default.nix index d3731b8..34ddcfb 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -19,6 +19,7 @@ ./steam.nix ./timezone.nix ./user.nix + ./torch.nix ]; # Enable CUPS to print documents. diff --git a/modules/torch.nix b/modules/torch.nix new file mode 100644 index 0000000..0c8aa58 --- /dev/null +++ b/modules/torch.nix @@ -0,0 +1,28 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.custom.torch; +in { + options.custom.torch = { + enable = mkEnableOption "PyTorch with CUDA support"; + cudaSupport = mkOption { + type = types.bool; + default = true; + }; + package = mkOption { + type = types.package; + default = pkgs.python311Packages.torch.override { cudaSupport = cfg.cudaSupport; }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + (python3.withPackages (ps: with ps; [ + cfg.package + numpy + ])) + ]; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index a052b94..8e3f6f3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -4,18 +4,18 @@ }: let python-opencv-headless = pkgs.callPackage ./python-opencv-headless { inherit (pkgs) lib fetchurl; - python310Packages = pkgs.python310.pkgs; + python311Packages = pkgs.python311.pkgs; }; python-pymatting = pkgs.callPackage ./python-pymatting { inherit (pkgs) lib fetchPypi; - python310Packages = pkgs.python310.pkgs; + python311Packages = pkgs.python311.pkgs; }; python-rembg = pkgs.callPackage ./python-rembg { inherit (pkgs) lib fetchPypi; inherit python-pymatting python-opencv-headless; - python310Packages = pkgs.python310.pkgs; + python311Packages = pkgs.python311.pkgs; }; in { fish-rust = pkgs.callPackage ./fish-rust {}; diff --git a/pkgs/fish-rust/default.nix b/pkgs/fish-rust/default.nix index c65f2d3..0f09311 100644 --- a/pkgs/fish-rust/default.nix +++ b/pkgs/fish-rust/default.nix @@ -25,8 +25,8 @@ rustPlatform.buildRustPackage rec { }; }; - buildInputs = [ ncurses gettext ]; - nativeBuildInputs = with python3Packages; [ sphinx sphinx_rtd_theme ]; + buildInputs = [ncurses gettext]; + nativeBuildInputs = with python3Packages; [sphinx sphinx_rtd_theme]; preBuild = '' export FISH_BUILD_VERSION="${version}" @@ -49,7 +49,7 @@ rustPlatform.buildRustPackage rec { license = licenses.gpl2; platforms = platforms.unix; mainProgram = "fish"; - maintainers = [ "Cobray" ]; + maintainers = ["Cobray"]; }; passthru.shellPath = "/bin/fish"; diff --git a/pkgs/python-opencv-headless/default.nix b/pkgs/python-opencv-headless/default.nix index 223f687..8b19864 100644 --- a/pkgs/python-opencv-headless/default.nix +++ b/pkgs/python-opencv-headless/default.nix @@ -1,6 +1,6 @@ -{lib, python310Packages, fetchurl}: +{lib, python311Packages, fetchurl}: -python310Packages.buildPythonPackage rec { +python311Packages.buildPythonPackage rec { pname = "opencv-python-headless"; version = "4.9.0.80"; format = "wheel"; @@ -10,7 +10,7 @@ python310Packages.buildPythonPackage rec { sha256 = "976656362d68d9f40a5c66f83901430538002465f7db59142784f3893918f3df"; }; - propagatedBuildInputs = with python310Packages; [ + propagatedBuildInputs = with python311Packages; [ numpy ]; diff --git a/pkgs/python-pymatting/default.nix b/pkgs/python-pymatting/default.nix index ef85c43..14f282d 100644 --- a/pkgs/python-pymatting/default.nix +++ b/pkgs/python-pymatting/default.nix @@ -1,9 +1,9 @@ { lib, - python310Packages, + python311Packages, fetchPypi, }: -python310Packages.buildPythonPackage rec { +python311Packages.buildPythonPackage rec { pname = "pymatting"; version = "1.1.13"; format = "pyproject"; @@ -13,12 +13,12 @@ python310Packages.buildPythonPackage rec { hash = "sha256-LNt8S++s3e9Netwt6ONKJy3mOdYIrlwKCGE9+kJTgQE="; }; - nativeBuildInputs = with python310Packages; [ + nativeBuildInputs = with python311Packages; [ setuptools poetry-core ]; - propagatedBuildInputs = with python310Packages; [ + propagatedBuildInputs = with python311Packages; [ numpy scipy pillow diff --git a/pkgs/python-rembg/default.nix b/pkgs/python-rembg/default.nix index a7ea9fe..7cf95c4 100644 --- a/pkgs/python-rembg/default.nix +++ b/pkgs/python-rembg/default.nix @@ -1,10 +1,10 @@ { lib, -python310Packages, +python311Packages, fetchPypi, python-pymatting, python-opencv-headless }: -python310Packages.buildPythonPackage rec { +python311Packages.buildPythonPackage rec { pname = "rembg"; version = "2.0.50"; format = "pyproject"; @@ -14,12 +14,12 @@ python310Packages.buildPythonPackage rec { hash = "sha256-bMt/GbplRawFZUqoXq37zAq1dribnu/ZlIYTuUIS+DU="; }; - nativeBuildInputs = with python310Packages; [ + nativeBuildInputs = with python311Packages; [ poetry-core setuptools ]; - propagatedBuildInputs = with python310Packages; [ + propagatedBuildInputs = with python311Packages; [ numpy onnxruntime python-opencv-headless