nixosModules: reformat to store all options in options.nix

This commit is contained in:
Aly Raffauf 2024-06-11 16:24:12 -04:00
parent 5438cc2dc5
commit b01e8ebadb
40 changed files with 282 additions and 328 deletions

View file

@ -41,7 +41,7 @@
plymouth.enable = true;
zramSwap = {enable = true;};
};
user = {
users = {
aly = {
enable = true;
password = "$y$j9T$0p6rc4p5sn0LJ/6XyAGP7.$.wmTafwMMscdW1o8kqqoHJP7U8kF.4WBmzzcPYielR3";

View file

@ -33,7 +33,7 @@
plymouth.enable = true;
zramSwap = {enable = true;};
};
user = {
users = {
aly = {
enable = true;
password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6";

View file

@ -55,7 +55,7 @@ in {
hyprland.enable = true;
sway.enable = true;
};
user = {
users = {
aly = {
enable = true;
password = "$y$j9T$SHPShqI2IpRE101Ey2ry/0$0mhW1f9LbVY02ifhJlP9XVImge9HOpf23s9i1JFLIt9";

View file

@ -29,7 +29,7 @@
plymouth.enable = true;
zramSwap = {enable = true;};
};
user = {
users = {
aly = {
enable = true;
password = "$y$j9T$TitXX3J690cnK41XciNMg/$APKHM/os6FKd9H9aXGxaHaQ8zP5SenO9EO94VYafl43";

View file

@ -29,7 +29,7 @@
size = 100;
};
};
user = {
users = {
aly = {
enable = true;
password = "$y$j9T$VdtiEyMOegHpcUwgmCVFD0$K8Ne6.zk//VJNq2zxVQ0xE0Wg3LohvAQd3Xm9aXdM15";

View file

@ -4,11 +4,6 @@
config,
...
}: {
options = {
alyraffauf.apps.nicotine-plus.enable =
lib.mkEnableOption "Enable Nicotine+ soulseek client.";
};
config = lib.mkIf config.alyraffauf.apps.nicotine-plus.enable {
environment.systemPackages = [pkgs.nicotine-plus];
networking = {

View file

@ -4,11 +4,6 @@
config,
...
}: {
options = {
alyraffauf.apps.podman.enable =
lib.mkEnableOption "Enables Podman for OCI container support.";
};
config = lib.mkIf config.alyraffauf.apps.podman.enable {
virtualisation = {
oci-containers = {backend = "podman";};

View file

@ -4,10 +4,6 @@
config,
...
}: {
options = {
alyraffauf.apps.steam.enable = lib.mkEnableOption "Enables Steam for video games.";
};
config = lib.mkIf config.alyraffauf.apps.steam.enable {
hardware.steam-hardware.enable = true;
programs.steam = {

View file

@ -4,11 +4,6 @@
config,
...
}: {
options = {
alyraffauf.apps.virt-manager.enable =
lib.mkEnableOption "Enables virt-manager with TPM and EFI support.";
};
config = lib.mkIf config.alyraffauf.apps.virt-manager.enable {
programs.virt-manager.enable = true;

View file

@ -4,23 +4,6 @@
config,
...
}: {
options = {
alyraffauf.containers.nixos.audiobookshelf = {
enable =
lib.mkEnableOption "Enable audiobookshelf nixos container.";
mediaDirectory = lib.mkOption {
description = "Media directory for Audiobookshelf.";
default = "/mnt/Media";
type = lib.types.str;
};
port = lib.mkOption {
description = "Port for audiobookshelf.";
default = 13378;
type = lib.types.int;
};
};
};
config = lib.mkIf config.alyraffauf.containers.nixos.audiobookshelf.enable {
containers.audiobookshelf = {
autoStart = true;

View file

@ -6,21 +6,6 @@
self,
...
}: {
options = {
alyraffauf.containers.nixos.navidrome.enable =
lib.mkEnableOption "Enable navidrome nixos container.";
alyraffauf.containers.nixos.navidrome.musicDirectory = lib.mkOption {
description = "Music directory for Navidrome.";
default = "/mnt/Media/Music";
type = lib.types.str;
};
alyraffauf.containers.nixos.navidrome.port = lib.mkOption {
description = "Port for Navidrome.";
default = 4533;
type = lib.types.int;
};
};
config = lib.mkIf config.alyraffauf.containers.nixos.navidrome.enable {
# Spotify secrets aren't exactly safe, because they are world-readable in the nix store.
# But they're reasonably disposable and hidden from the public git repo.

View file

@ -4,21 +4,6 @@
config,
...
}: {
options = {
alyraffauf.containers.oci.audiobookshelf.enable =
lib.mkEnableOption "Enable audiobookshelf podcast and audiobook server.";
alyraffauf.containers.oci.audiobookshelf.mediaDirectory = lib.mkOption {
description = "Media directory for audiobookshelf.";
default = "/mnt/Media";
type = lib.types.str;
};
alyraffauf.containers.oci.audiobookshelf.port = lib.mkOption {
description = "Port for audiobookshelf.";
default = 13378;
type = lib.types.int;
};
};
config = lib.mkIf config.alyraffauf.containers.oci.audiobookshelf.enable {
virtualisation.oci-containers.containers = {
audiobookshelf = {

View file

@ -4,16 +4,6 @@
config,
...
}: {
options = {
alyraffauf.containers.oci.freshRSS.enable =
lib.mkEnableOption "Enable FreshRSS news client.";
alyraffauf.containers.oci.freshRSS.port = lib.mkOption {
description = "Port for FreshRSS.";
default = 8080;
type = lib.types.int;
};
};
config = lib.mkIf config.alyraffauf.containers.oci.freshRSS.enable {
virtualisation.oci-containers.containers = {
freshrss = {

View file

@ -4,26 +4,6 @@
config,
...
}: {
options = {
alyraffauf.containers.oci.jellyfin.enable =
lib.mkEnableOption "Enable Jellyfin media server.";
alyraffauf.containers.oci.jellyfin.mediaDirectory = lib.mkOption {
description = "Media directory for Jellyfin.";
default = "/mnt/Media";
type = lib.types.str;
};
alyraffauf.containers.oci.jellyfin.archiveDirectory = lib.mkOption {
description = "Archive directory for Jellyfin.";
default = "/mnt/Archive";
type = lib.types.str;
};
alyraffauf.containers.oci.jellyfin.port = lib.mkOption {
description = "Port for Jellyfin.";
default = 8096;
type = lib.types.int;
};
};
config = lib.mkIf config.alyraffauf.containers.oci.jellyfin.enable {
virtualisation.oci-containers.containers = {
jellyfin = {

View file

@ -1,29 +1,9 @@
{
pkgs,
lib,
config,
lib,
pkgs,
...
}: {
options = {
alyraffauf.containers.oci.plexMediaServer.enable =
lib.mkEnableOption "Enable Plex Media Server.";
alyraffauf.containers.oci.plexMediaServer.mediaDirectory = lib.mkOption {
description = "Media directory for Plex Media Server.";
default = "/mnt/Media";
type = lib.types.str;
};
alyraffauf.containers.oci.plexMediaServer.archiveDirectory = lib.mkOption {
description = "Archive directory for Plex Media Server.";
default = "/mnt/Archive";
type = lib.types.str;
};
alyraffauf.containers.oci.plexMediaServer.port = lib.mkOption {
description = "Port for Plex Media Server.";
default = 32400;
type = lib.types.int;
};
};
config = lib.mkIf config.alyraffauf.containers.oci.plexMediaServer.enable {
virtualisation.oci-containers.containers = {
plexMediaServer = {

View file

@ -4,31 +4,6 @@
config,
...
}: {
options = {
alyraffauf.containers.oci.transmission.enable =
lib.mkEnableOption "Enable Transmission Bittorrent server.";
alyraffauf.containers.oci.transmission.mediaDirectory = lib.mkOption {
description = "Media directory for Transmission.";
default = "/mnt/Media";
type = lib.types.str;
};
alyraffauf.containers.oci.transmission.archiveDirectory = lib.mkOption {
description = "Archive directory for Transmission.";
default = "/mnt/Archive";
type = lib.types.str;
};
alyraffauf.containers.oci.transmission.port = lib.mkOption {
description = "Port for Transmission.";
default = 9091;
type = lib.types.int;
};
alyraffauf.containers.oci.transmission.bitTorrentPort = lib.mkOption {
description = "Port for BitTorrent p2p services..";
default = 5143;
type = lib.types.int;
};
};
config = lib.mkIf config.alyraffauf.containers.oci.transmission.enable {
virtualisation.oci-containers.containers = {
transmission = {

View file

@ -13,10 +13,11 @@ in {
./apps
./containers
./desktop
./options.nix
./scripts
./services
./system
./user
./users
];
nixpkgs.overlays = [

View file

@ -4,11 +4,6 @@
config,
...
}: {
options = {
alyraffauf.desktop.cinnamon.enable =
lib.mkEnableOption "Cinnamon desktop session.";
};
config = lib.mkIf config.alyraffauf.desktop.cinnamon.enable {
services = {
xserver = {

View file

@ -23,11 +23,6 @@ in {
./fprintdFix.nix
];
options = {
alyraffauf.desktop.gnome.enable =
lib.mkEnableOption "Enable GNOME desktop session.";
};
config = lib.mkIf config.alyraffauf.desktop.gnome.enable {
environment.systemPackages = with pkgs;
[

View file

@ -4,12 +4,6 @@
config,
...
}: {
options = {
alyraffauf.desktop.gnome.fprintdFix.enable =
lib.mkEnableOption
"Fix fprintd and pam issues with GNOME Display Manager.";
};
config = lib.mkIf config.alyraffauf.desktop.gnome.fprintdFix.enable {
# Need to change the order pam loads its modules
# to get proper fingerprint behavior on GDM and the lockscreen.

View file

@ -4,28 +4,6 @@
pkgs,
...
}: {
options = {
alyraffauf.desktop.greetd = {
enable =
lib.mkEnableOption "Enable greetd.";
session = lib.mkOption {
description = "Default command to execute on login.";
default = lib.getExe config.programs.hyprland.package;
type = lib.types.str;
};
autologin.enable = lib.mkOption {
description = "Whether to enable autologin.";
default = false;
type = lib.types.bool;
};
autologin.user = lib.mkOption {
description = "User to autologin.";
default = "aly";
type = lib.types.str;
};
};
};
config = lib.mkIf config.alyraffauf.desktop.greetd.enable {
security.pam.services = {
greetd.enableKwallet = lib.mkDefault true;

View file

@ -4,11 +4,6 @@
pkgs,
...
}: {
options = {
alyraffauf.desktop.hyprland.enable =
lib.mkEnableOption "Hyprland wayland compositor.";
};
config = lib.mkIf config.alyraffauf.desktop.hyprland.enable {
alyraffauf.desktop.waylandComp.enable = lib.mkDefault true;

View file

@ -4,12 +4,6 @@
config,
...
}: {
options = {
alyraffauf.desktop.lightdm.enable =
lib.mkEnableOption
"Lightdm and slick greeter with Catppuccin theme.";
};
config = lib.mkIf config.alyraffauf.desktop.lightdm.enable {
security.pam.services.lightdm = {
enableGnomeKeyring = true;

View file

@ -16,11 +16,6 @@
fi
'';
in {
options = {
alyraffauf.desktop.plasma.enable =
lib.mkEnableOption "Enable plasma desktop session.";
};
config = lib.mkIf config.alyraffauf.desktop.plasma.enable {
environment.systemPackages = with pkgs;
[

View file

@ -5,11 +5,6 @@
config,
...
}: {
options = {
alyraffauf.desktop.sway.enable =
lib.mkEnableOption "Sway wayland compositor.";
};
config = lib.mkIf config.alyraffauf.desktop.sway.enable {
alyraffauf.desktop.waylandComp.enable = lib.mkDefault true;

View file

@ -5,11 +5,6 @@
config,
...
}: {
options = {
alyraffauf.desktop.waylandComp.enable =
lib.mkEnableOption "Shared defaults for wayland compositors.";
};
config = lib.mkIf config.alyraffauf.desktop.waylandComp.enable {
programs = {
gnupg.agent.pinentryPackage = lib.mkForce pkgs.pinentry-gnome3;

255
nixosModules/options.nix Normal file
View file

@ -0,0 +1,255 @@
{
config,
inputs,
lib,
pkgs,
self,
...
}: {
options = {
alyraffauf = {
apps = {
nicotine-plus.enable =
lib.mkEnableOption "Nicotine+ Soulseek client.";
podman.enable =
lib.mkEnableOption "Podman for OCI container support.";
steam.enable =
lib.mkEnableOption "Valve's Steam for video games.";
virt-manager.enable =
lib.mkEnableOption "Virt-manager with TPM and EFI support.";
};
containers = {
nixos = {
audiobookshelf = {
enable =
lib.mkEnableOption "audiobookshelf nixos container.";
mediaDirectory = lib.mkOption {
description = "Media directory for audiobookshelf.";
default = "/mnt/Media";
type = lib.types.str;
};
port = lib.mkOption {
description = "Port for audiobookshelf.";
default = 13378;
type = lib.types.int;
};
};
navidrome = {
enable =
lib.mkEnableOption "navidrome nixos container.";
musicDirectory = lib.mkOption {
description = "Music directory for Navidrome.";
default = "/mnt/Media/Music";
type = lib.types.str;
};
port = lib.mkOption {
description = "Port for Navidrome.";
default = 4533;
type = lib.types.int;
};
};
};
oci = {
audiobookshelf = {
enable =
lib.mkEnableOption "audiobookshelf podcast and audiobook server in OCI container.";
mediaDirectory = lib.mkOption {
description = "Media directory for audiobookshelf.";
default = "/mnt/Media";
type = lib.types.str;
};
port = lib.mkOption {
description = "Port for audiobookshelf.";
default = 13378;
type = lib.types.int;
};
};
freshRSS = {
enable =
lib.mkEnableOption "FreshRSS news client in OCI container.";
port = lib.mkOption {
description = "Port for FreshRSS.";
default = 8080;
type = lib.types.int;
};
};
jellyfin = {
enable =
lib.mkEnableOption "Jellyfin media server in OCI container.";
archiveDirectory = lib.mkOption {
description = "Archive directory for Jellyfin.";
default = "/mnt/Archive";
type = lib.types.str;
};
mediaDirectory = lib.mkOption {
description = "Media directory for Jellyfin.";
default = "/mnt/Media";
type = lib.types.str;
};
port = lib.mkOption {
description = "Port for Jellyfin.";
default = 8096;
type = lib.types.int;
};
};
plexMediaServer = {
enable =
lib.mkEnableOption "Plex Media Server in OCI container.";
archiveDirectory = lib.mkOption {
description = "Archive directory for Plex Media Server.";
default = "/mnt/Archive";
type = lib.types.str;
};
mediaDirectory = lib.mkOption {
description = "Media directory for Plex Media Server.";
default = "/mnt/Media";
type = lib.types.str;
};
port = lib.mkOption {
description = "Port for Plex Media Server.";
default = 32400;
type = lib.types.int;
};
};
transmission = {
enable =
lib.mkEnableOption "Transmission Bittorrent client in OCI container.";
archiveDirectory = lib.mkOption {
description = "Archive directory for Transmission.";
default = "/mnt/Archive";
type = lib.types.str;
};
bitTorrentPort = lib.mkOption {
description = "Port for BitTorrent p2p services..";
default = 5143;
type = lib.types.int;
};
mediaDirectory = lib.mkOption {
description = "Media directory for Transmission.";
default = "/mnt/Media";
type = lib.types.str;
};
port = lib.mkOption {
description = "Port for Transmission.";
default = 9091;
type = lib.types.int;
};
};
};
};
desktop = {
cinnamon.enable =
lib.mkEnableOption "Cinnamon desktop session.";
gnome = {
enable =
lib.mkEnableOption "GNOME desktop session.";
fprintdFix.enable =
lib.mkEnableOption
"Fix fprintd & pam issues with GNOME Display Manager.";
};
greetd = {
enable =
lib.mkEnableOption "Greetd display manager.";
autologin = {
enable = lib.mkOption {
description = "Whether to enable autologin.";
default = false;
type = lib.types.bool;
};
user = lib.mkOption {
description = "User to autologin.";
default = "aly";
type = lib.types.str;
};
};
session = lib.mkOption {
description = "Default command to execute on login.";
default = lib.getExe config.programs.hyprland.package;
type = lib.types.str;
};
};
hyprland.enable =
lib.mkEnableOption "Hyprland wayland session.";
lightdm.enable =
lib.mkEnableOption
"Lightdm and slick greeter with Catppuccin theme.";
plasma.enable =
lib.mkEnableOption "Plasma desktop session.";
sway.enable =
lib.mkEnableOption "Sway wayland session.";
waylandComp.enable =
lib.mkEnableOption "Shared defaults for wayland compositors.";
};
scripts.hoenn.enable =
lib.mkEnableOption "Hoenn system configuration script";
services = {
binaryCache.enable = lib.mkEnableOption "nixpkgs cache server.";
flatpak.enable =
lib.mkEnableOption "Flatpak support with GUI.";
ollama = {
enable = lib.mkEnableOption "Ollama interface for LLMs.";
listenAddress = lib.mkOption {
description = "Listen Address for Ollama.";
default = "127.0.0.1:11434";
type = lib.types.str;
};
gpu = lib.mkOption {
description = "Type of GPU for enabling GPU acceleration.";
default = null;
type = lib.types.str;
};
};
syncthing = {
enable = lib.mkEnableOption "Syncthing sync service.";
user = lib.mkOption {
description = "Specify user Syncthing runs as.";
default = "aly";
type = lib.types.str;
};
syncMusic = lib.mkOption {
description = "Whether to sync music folder.";
default = true;
type = lib.types.bool;
};
musicPath = lib.mkOption {
description = "Whether to sync music folder.";
default = "/home/${config.alyraffauf.services.syncthing.user}/music";
type = lib.types.str;
};
};
tailscale.enable = lib.mkEnableOption "Enable Tailscale";
};
system = {
plymouth.enable =
lib.mkEnableOption "Plymouth boot screen with catppuccin theme.";
power-profiles-daemon.enable =
lib.mkEnableOption "Power-profiles-daemon.";
zramSwap = {
enable = lib.mkEnableOption "Zram swap.";
size = lib.mkOption {
description = "Percent size of the zram swap.";
default = 50;
type = lib.types.int;
};
};
};
users = {
aly = {
enable = lib.mkEnableOption "Aly's user.";
password = lib.mkOption {
description = "Hashed password for user aly.";
type = lib.types.str;
};
};
dustin = {
enable = lib.mkEnableOption "Dustin's user.";
password = lib.mkOption {
description = "Hashed password.";
type = lib.types.str;
};
};
};
};
};
}

View file

@ -4,11 +4,6 @@
config,
...
}: {
options = {
alyraffauf.scripts.hoenn.enable =
lib.mkEnableOption "Enable hoenn system configuration script";
};
config = lib.mkIf config.alyraffauf.scripts.hoenn.enable {
environment.systemPackages = [
(pkgs.writeShellScriptBin "hoenn" ''

View file

@ -4,10 +4,6 @@
config,
...
}: {
options = {
alyraffauf.services.binaryCache.enable = lib.mkEnableOption "Enable nixpkgs cache server.";
};
config = lib.mkIf config.alyraffauf.services.binaryCache.enable {
services.nix-serve = {
enable = true;

View file

@ -4,11 +4,6 @@
config,
...
}: {
options = {
alyraffauf.services.flatpak.enable =
lib.mkEnableOption "Enables flatpak support with GUI.";
};
config = lib.mkIf config.alyraffauf.services.flatpak.enable {
environment.systemPackages = with pkgs; [gnome.gnome-software];

View file

@ -4,22 +4,6 @@
config,
...
}: {
options = {
alyraffauf.services.ollama = {
enable = lib.mkEnableOption "Enable ollama interface for LLMs.";
listenAddress = lib.mkOption {
description = "Listen Address for Ollama.";
default = "127.0.0.1:11434";
type = lib.types.str;
};
gpu = lib.mkOption {
description = "Type of GPU for enabling GPU acceleration.";
default = null;
type = lib.types.str;
};
};
};
config = lib.mkIf config.alyraffauf.services.ollama.enable {
services.ollama = {
enable = true;

View file

@ -6,27 +6,6 @@
}: {
imports = [./syncMusic.nix];
options = {
alyraffauf.services.syncthing = {
enable = lib.mkEnableOption "Enable Syncthing";
user = lib.mkOption {
description = "Specify user Syncthing runs as.";
default = "aly";
type = lib.types.str;
};
syncMusic = lib.mkOption {
description = "Whether to sync music folder.";
default = true;
type = lib.types.bool;
};
musicPath = lib.mkOption {
description = "Whether to sync music folder.";
default = "/home/${config.alyraffauf.services.syncthing.user}/music";
type = lib.types.str;
};
};
};
config = lib.mkIf config.alyraffauf.services.syncthing.enable {
age.secrets = {
syncthingCert.file = ../../../secrets/syncthing + "/${config.networking.hostName}/cert.age";

View file

@ -4,10 +4,6 @@
config,
...
}: {
options = {
alyraffauf.services.tailscale.enable = lib.mkEnableOption "Enable Tailscale";
};
config = lib.mkIf config.alyraffauf.services.tailscale.enable {
age.secrets.tailscaleAuthKey.file = ../../../secrets/tailscale/authKeyFile.age;
services.tailscale = {

View file

@ -4,12 +4,6 @@
config,
...
}: {
options = {
alyraffauf.system.plymouth.enable =
lib.mkEnableOption
"Enables plymouth boot screen with reduced text verbosity.";
};
config = lib.mkIf config.alyraffauf.system.plymouth.enable {
boot = {
consoleLogLevel = 0;

View file

@ -4,11 +4,6 @@
config,
...
}: {
options = {
alyraffauf.system.power-profiles-daemon.enable =
lib.mkEnableOption "Enables power-profiles-daemon.";
};
config = lib.mkIf config.alyraffauf.system.power-profiles-daemon.enable {
services = {
power-profiles-daemon.enable = true;

View file

@ -4,17 +4,6 @@
config,
...
}: {
options = {
alyraffauf.system.zramSwap = {
enable = lib.mkEnableOption "Enables zram swap.";
size = lib.mkOption {
description = "Percent size of the zram swap.";
default = 50;
type = lib.types.int;
};
};
};
config = lib.mkIf config.alyraffauf.system.zramSwap.enable {
zramSwap = {
enable = true;

View file

@ -1,26 +0,0 @@
{
inputs,
pkgs,
lib,
config,
...
}: {
options = {
alyraffauf.user.dustin = {
enable = lib.mkEnableOption "Enables Dustin's user.";
password = lib.mkOption {
description = "Hashed password.";
type = lib.types.str;
};
};
};
config = lib.mkIf config.alyraffauf.user.dustin.enable {
users.users.dustin = {
description = "Dustin Raffauf";
extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "video"];
hashedPassword = config.alyraffauf.user.dustin.password;
isNormalUser = true;
};
};
}

View file

@ -5,21 +5,11 @@
config,
...
}: {
options = {
alyraffauf.user.aly = {
enable = lib.mkEnableOption "Enables Aly's user.";
password = lib.mkOption {
description = "Hashed password for user aly.";
type = lib.types.str;
};
};
};
config = lib.mkIf config.alyraffauf.user.aly.enable {
config = lib.mkIf config.alyraffauf.users.aly.enable {
users.users.aly = {
description = "Aly Raffauf";
extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "video"];
hashedPassword = config.alyraffauf.user.aly.password;
hashedPassword = config.alyraffauf.users.aly.password;
isNormalUser = true;
linger = true;
openssh.authorizedKeys.keys = [

View file

@ -0,0 +1,16 @@
{
inputs,
pkgs,
lib,
config,
...
}: {
config = lib.mkIf config.alyraffauf.users.dustin.enable {
users.users.dustin = {
description = "Dustin Raffauf";
extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "video"];
hashedPassword = config.alyraffauf.users.dustin.password;
isNormalUser = true;
};
};
}