feat: add cudaSupport option for mkNixOS
All checks were successful
Discord / discord commits (push) Has been skipped

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;

View file

@ -57,7 +57,7 @@
perSystem = attrs:
nixpkgs.lib.genAttrs (import systems) (system:
attrs (mkPkgs system nixpkgs));
attrs (mkPkgs {inherit system nixpkgs;}));
in {
nixosModules = import ./nixosModules self;
@ -65,40 +65,57 @@
nixosConfigurations = {
# Desktops
wim = mkNixOS [
wim = mkNixOS {
extraModules = [
./devices/wim
secrets.nixosModules.default
];
binto = mkNixOS [./devices/binto];
};
binto = mkNixOS {
# FIXME: https://github.com/NixOS/nixpkgs/issues/338315
# cudaSupport = true;
extraModules = [./devices/binto];
};
bbsteamie = mkNixOS [./devices/bbsteamie];
bbsteamie = mkNixOS {extraModules = [./devices/bbsteamie];};
# NAS
nos = mkNixOS [
nos = mkNixOS {
# FIXME: https://github.com/NixOS/nixpkgs/issues/338315
# cudaSupport = true;
extraModules = [
./devices/nos
secrets.nixosModules.nos
];
};
# Build / test server
servivi = mkNixOS [
servivi = mkNixOS {
extraModules = [
./devices/servivi
secrets.nixosModules.servivi
];
};
# Home-assistant
homie = mkNixOS [./devices/homie];
homie = mkNixOS {extraModules = [./devices/homie];};
# Cluster
thingone = mkNixOS [
thingone = mkNixOS {
extraModules = [
(import ./devices/cluster "thingone")
secrets.nixosModules.thingy
];
thingtwo = mkNixOS [
};
thingtwo = mkNixOS {
extraModules = [
(import ./devices/cluster "thingtwo")
secrets.nixosModules.thingy
];
};
live-image = mkNixOS [
live-image = mkNixOS {
extraModules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
{home-manager.users.nixos.home.stateVersion = "24.05";}
{
@ -109,6 +126,7 @@
}
];
};
};
nixOnDroidConfigurations.default =
mkNixOnDroid [./devices/android];