feat: add cudaSupport option for mkNixOS

This commit is contained in:
matt1432 2024-09-04 23:41:56 -04:00
parent 129aa3224e
commit 72611337ab
2 changed files with 76 additions and 42 deletions

View file

@ -1,9 +1,16 @@
inputs: rec {
# Import pkgs from a nixpkgs instance
mkPkgs = system: nixpkgs:
mkPkgs = {
system,
nixpkgs,
cudaSupport ? false,
}:
import nixpkgs {
inherit system;
config.allowUnfree = true;
config = {
allowUnfree = true;
inherit cudaSupport;
};
overlays =
(map (i: inputs.${i}.overlays.default) [
"discord-overlay"
@ -21,28 +28,37 @@ inputs: rec {
};
# Function that makes the attrs that make up the specialArgs
mkArgs = system:
mkArgs = {
system,
cudaSupport ? false,
}:
inputs
// {
pkgs = mkPkgs system inputs.nixpkgs;
pkgs = mkPkgs {
inherit system cudaSupport;
inherit (inputs) nixpkgs;
};
};
# Default system
mkNixOS = mods:
mkNixOS = {
extraModules ? [],
cudaSupport ? false,
}:
inputs.nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = mkArgs system;
specialArgs = mkArgs {inherit system cudaSupport;};
modules =
[
{home-manager.extraSpecialArgs = specialArgs;}
../common
]
++ mods;
++ extraModules;
};
mkNixOnDroid = mods:
inputs.nix-on-droid.lib.nixOnDroidConfiguration rec {
extraSpecialArgs = mkArgs "aarch64-linux";
extraSpecialArgs = mkArgs {system = "aarch64-linux";};
home-manager-path = inputs.home-manager.outPath;
pkgs = extraSpecialArgs.pkgs;