feat: add cuda setup

This commit is contained in:
DACHXY 2025-01-05 23:01:08 +08:00
parent 4d0a35652c
commit d5782ada85
4 changed files with 33 additions and 2 deletions

View file

@ -46,6 +46,10 @@
}@inputs: }@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs {
system = "x86_64-linux";
config.allowUnfree = true;
};
nix-version = "25.05"; nix-version = "25.05";
username = "danny"; username = "danny";
git-config = { git-config = {
@ -67,6 +71,7 @@
nix-version nix-version
username username
git-config git-config
pkgs
; ;
}; };
}; };
@ -83,6 +88,7 @@
nix-version nix-version
username username
git-config git-config
pkgs
; ;
}; };
}; };

View file

@ -24,6 +24,7 @@ in
./hardware-configuration.nix ./hardware-configuration.nix
./boot.nix ./boot.nix
../../modules ../../modules
../../modules/cuda.nix
(import ../../modules/nvidia.nix { (import ../../modules/nvidia.nix {
nvidia-mode = nvidia-mode; nvidia-mode = nvidia-mode;
intel-bus-id = intel-bus-id; intel-bus-id = intel-bus-id;

21
system/modules/cuda.nix Normal file
View file

@ -0,0 +1,21 @@
# Here only set the environment for cuda shell env
# For futher, see flake: https://github.com/DACHXY/python-cuda-flake
{ lib, ... }:
{
nix = {
settings = {
substituters = [
"https://cuda-maintainers.cachix.org"
"https://cache.nixos.org/"
];
trusted-public-keys = [
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
];
};
};
nixpkgs.config.allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) [
"cuda-merged"
];
}

View file

@ -7,6 +7,9 @@
{ {
environment.systemPackages = environment.systemPackages =
(with pkgs; [ (with pkgs; [
# Binary cache platform
cachix
# gtk theme # gtk theme
gtk3 gtk3
adwaita-icon-theme adwaita-icon-theme
@ -90,7 +93,7 @@
# Thumbnail # Thumbnail
ffmpegthumbnailer ffmpegthumbnailer
]) ])
++ ([ ++ [
inputs.ghostty.packages.${system}.default inputs.ghostty.packages.${system}.default
]); ];
} }