nixos-configs/lib/flake-lib.nix
matt1432 5d6ed1be6e
All checks were successful
Discord / discord commits (push) Has been skipped
fix(whisper): add CuDNN support
2024-09-05 09:18:23 -04:00

86 lines
2 KiB
Nix

inputs: rec {
# Import pkgs from a nixpkgs instance
mkPkgs = {
system,
nixpkgs,
cudaSupport ? false,
}:
import nixpkgs {
inherit system;
config = {
allowUnfree = true;
inherit cudaSupport;
};
overlays =
(map (i: inputs.${i}.overlays.default) [
"discord-overlay"
"grim-hyprland"
"jovian"
"nixpkgs-wayland"
])
++ (builtins.attrValues {
inherit
(inputs.self.overlays)
misc
xdg-desktop-portal-kde
;
});
};
# Function that makes the attrs that make up the specialArgs
mkArgs = {
system,
cudaSupport ? false,
}:
inputs
// {
pkgs = mkPkgs {
inherit system cudaSupport;
inherit (inputs) nixpkgs;
};
};
# Default system
mkNixOS = {
extraModules ? [],
cudaSupport ? false,
}:
inputs.nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = mkArgs {inherit system cudaSupport;};
modules =
[
{home-manager.extraSpecialArgs = specialArgs;}
../common
]
++ extraModules;
};
mkNixOnDroid = mods:
inputs.nix-on-droid.lib.nixOnDroidConfiguration rec {
extraSpecialArgs = mkArgs {system = "aarch64-linux";};
home-manager-path = inputs.home-manager.outPath;
pkgs = extraSpecialArgs.pkgs;
modules = let
inherit (pkgs.lib) mkOption types;
in
[
({config, ...}: {
options = {
environment.variables.FLAKE = mkOption {
type = with types; nullOr str;
};
environment.systemPackages = mkOption {
type = with types; listOf package;
default = [];
};
};
config.environment.packages = config.environment.systemPackages;
})
{home-manager = {inherit extraSpecialArgs;};}
../common/nix-on-droid.nix
]
++ mods;
};
}