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

View file

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