nixosModules: simplify options

This commit is contained in:
Aly Raffauf 2024-06-28 21:07:20 -04:00
parent e8f5b4bb19
commit efcc254856
17 changed files with 218 additions and 178 deletions

View file

@ -14,48 +14,54 @@
./waylandComp.nix
];
config = lib.mkIf config.ar.home.desktop.enable {
dconf = {
enable = true;
settings = {
"org/gtk/gtk4/settings/file-chooser".sort-directories-first = true;
"org/gtk/settings/file-chooser".sort-directories-first = true;
"org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"];
uris = ["qemu:///system"];
config =
lib.mkIf (
config.ar.home.desktop.cinnamon.enable
|| config.ar.home.desktop.gnome.enable
|| config.ar.home.desktop.hyprland.enable
|| config.ar.home.desktop.sway.enable
) {
dconf = {
enable = true;
settings = {
"org/gtk/gtk4/settings/file-chooser".sort-directories-first = true;
"org/gtk/settings/file-chooser".sort-directories-first = true;
"org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"];
uris = ["qemu:///system"];
};
};
};
gtk.gtk3.bookmarks =
[
"file://${config.xdg.userDirs.documents}"
"file://${config.xdg.userDirs.download}"
"file://${config.xdg.userDirs.music}"
"file://${config.xdg.userDirs.videos}"
"file://${config.xdg.userDirs.pictures}"
"file://${config.home.homeDirectory}/src"
]
++ lib.optional (
osConfig.ar.services.syncthing.enable
&& (osConfig.ar.services.syncthing.user == config.home.username)
) "file://${config.home.homeDirectory}/sync";
xdg = {
dataFile."backgrounds/".source = ../../files/wallpapers;
userDirs = {
enable = true;
createDirectories = true;
desktop = lib.mkDefault "${config.home.homeDirectory}/dsktp";
documents = lib.mkDefault "${config.home.homeDirectory}/docs";
download = lib.mkDefault "${config.home.homeDirectory}/dwnlds";
extraConfig = {XDG_SRC_DIR = "${config.home.homeDirectory}/src";};
music = lib.mkDefault "${config.home.homeDirectory}/music";
pictures = lib.mkDefault "${config.home.homeDirectory}/pics";
publicShare = lib.mkDefault "${config.home.homeDirectory}/pub";
templates = lib.mkDefault "${config.home.homeDirectory}/tmplts";
videos = lib.mkDefault "${config.home.homeDirectory}/vids";
};
};
};
gtk.gtk3.bookmarks =
[
"file://${config.xdg.userDirs.documents}"
"file://${config.xdg.userDirs.download}"
"file://${config.xdg.userDirs.music}"
"file://${config.xdg.userDirs.videos}"
"file://${config.xdg.userDirs.pictures}"
"file://${config.home.homeDirectory}/src"
]
++ lib.optional (
osConfig.ar.services.syncthing.enable
&& (osConfig.ar.services.syncthing.user == config.home.username)
) "file://${config.home.homeDirectory}/sync";
xdg = {
dataFile."backgrounds/".source = ../../files/wallpapers;
userDirs = {
enable = true;
createDirectories = true;
desktop = lib.mkDefault "${config.home.homeDirectory}/dsktp";
documents = lib.mkDefault "${config.home.homeDirectory}/docs";
download = lib.mkDefault "${config.home.homeDirectory}/dwnlds";
extraConfig = {XDG_SRC_DIR = "${config.home.homeDirectory}/src";};
music = lib.mkDefault "${config.home.homeDirectory}/music";
pictures = lib.mkDefault "${config.home.homeDirectory}/pics";
publicShare = lib.mkDefault "${config.home.homeDirectory}/pub";
templates = lib.mkDefault "${config.home.homeDirectory}/tmplts";
videos = lib.mkDefault "${config.home.homeDirectory}/vids";
};
};
};
}

View file

@ -49,11 +49,8 @@
wlogout.enable = lib.mkEnableOption "Wlogout session prompt.";
};
defaultApps = {
enable = lib.mkOption {
description = "Declaratively set default apps and file associations.";
default = config.ar.home.desktop.enable;
type = lib.types.bool;
};
enable = lib.mkEnableOption "Declaratively set default apps and file associations.";
audioPlayer = {
exe = lib.mkOption {
description = "Default audio player executable.";
@ -209,11 +206,6 @@
};
};
desktop = {
enable = lib.mkOption {
description = "Graphical desktop.";
default = osConfig.ar.desktop.enable;
type = lib.types.bool;
};
cinnamon.enable = lib.mkOption {
description = "Cinnamon with sane defaults";
default = osConfig.ar.desktop.cinnamon.enable;
@ -315,12 +307,10 @@
};
};
};
theme = {
enable = lib.mkOption {
description = "Gtk, Qt, and application colors.";
default = config.ar.home.desktop.enable;
type = lib.types.bool;
};
enable = lib.mkEnableOption "Gtk, Qt, and application colors.";
gtk = {
name = lib.mkOption {
description = "GTK theme name.";

View file

@ -115,6 +115,8 @@
vsCodium.enable = true;
};
defaultApps.enable = true;
desktop = {
startupApps = [(lib.getExe' pkgs.keepassxc "keepassxc")];
};
@ -124,6 +126,7 @@
};
theme = {
enable = true;
wallpaper = "${config.xdg.dataHome}/backgrounds/wallhaven-3led2d.jpg";
};
};

View file

@ -38,14 +38,21 @@
firefox.enable = true;
vsCodium.enable = true;
};
defaultApps.enable = true;
desktop = {
hyprland = {
randomWallpaper = true;
};
};
theme = {
enable = true;
gtk = {
name = "catppuccin-frappe-mauve-compact+normal";
package = pkgs.catppuccin-gtk.override {
accents = ["mauve"];
size = "compact";
@ -53,35 +60,43 @@
tweaks = ["normal"];
};
};
qt = {
name = "Catppuccin-Frappe-Mauve";
package = pkgs.catppuccin-kvantum.override {
accent = "Mauve";
variant = "Frappe";
};
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.catppuccin-papirus-folders.override {
flavor = "frappe";
accent = "mauve";
};
};
cursorTheme = {
name = "Catppuccin-Frappe-Dark-Cursors";
size = 24;
package = pkgs.catppuccin-cursors.frappeDark;
};
font = {
name = "NotoSans Nerd Font";
size = 11;
package = pkgs.nerdfonts.override {fonts = ["Noto"];};
};
terminalFont = {
name = "NotoSansM Nerd Font";
size = 11;
package = pkgs.nerdfonts.override {fonts = ["Noto"];};
};
colors = {
text = "#FAFAFA";
background = "#232634";
@ -90,6 +105,7 @@
inactive = "#626880";
shadow = "#1A1A1A";
};
wallpaper = "${config.xdg.dataHome}/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";
};
};

View file

@ -36,9 +36,15 @@
firefox.enable = true;
vsCodium.enable = true;
};
defaultApps.enable = true;
theme = {
enable = true;
gtk = {
name = "catppuccin-frappe-mauve-compact+normal";
package = pkgs.catppuccin-gtk.override {
accents = ["mauve"];
size = "compact";
@ -46,35 +52,43 @@
tweaks = ["normal"];
};
};
qt = {
name = "Catppuccin-Frappe-Mauve";
package = pkgs.catppuccin-kvantum.override {
accent = "Mauve";
variant = "Frappe";
};
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.catppuccin-papirus-folders.override {
flavor = "frappe";
accent = "mauve";
};
};
cursorTheme = {
name = "Catppuccin-Frappe-Dark-Cursors";
size = 24;
package = pkgs.catppuccin-cursors.frappeDark;
};
font = {
name = "NotoSans Nerd Font";
size = 11;
package = pkgs.nerdfonts.override {fonts = ["Noto"];};
};
terminalFont = {
name = "NotoSansM Nerd Font";
size = 11;
package = pkgs.nerdfonts.override {fonts = ["Noto"];};
};
colors = {
text = "#FAFAFA";
background = "#232634";
@ -83,6 +97,7 @@
inactive = "#626880";
shadow = "#1A1A1A";
};
wallpaper = "${config.xdg.dataHome}/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";
};
};

View file

@ -19,18 +19,20 @@
};
networking.hostName = "fallarbor";
system.stateVersion = "24.05";
ar = {
apps.steam.enable = true;
apps = {
firefox.enable = true;
steam.enable = true;
};
base = {
enable = true;
sambaAutoMount = false;
};
desktop = {
enable = true;
greetd.enable = true;
hyprland.enable = true;
};

View file

@ -24,16 +24,15 @@
ar = {
apps = {
steam.enable = true;
firefox.enable = true;
podman.enable = true;
steam.enable = true;
virt-manager.enable = true;
};
base.enable = true;
desktop = {
enable = true;
greetd = {
enable = true;

View file

@ -24,6 +24,7 @@
ar = {
apps = {
firefox.enable = true;
podman.enable = true;
steam.enable = true;
virt-manager.enable = true;
@ -32,8 +33,6 @@
base.enable = true;
desktop = {
enable = true;
greetd = {
enable = true;

View file

@ -161,6 +161,12 @@ in {
};
};
};
nix-serve = {
enable = true;
secretKeyFile = "/var/cache-priv-key.pem";
};
samba = {
enable = true;
openFirewall = true;
@ -197,6 +203,7 @@ in {
ar = {
apps = {
firefox.enable = true;
nicotine-plus.enable = true;
podman.enable = true;
steam.enable = true;
@ -220,8 +227,6 @@ in {
};
desktop = {
enable = true;
greetd = {
enable = true;
@ -248,8 +253,6 @@ in {
};
services = {
binaryCache.enable = true;
ollama = {
enable = true;
gpu = "amd";

View file

@ -23,13 +23,15 @@
system.stateVersion = "24.05";
ar = {
apps.steam.enable = true;
apps = {
firefox.enable = true;
podman.enable = true;
steam.enable = true;
};
base.enable = true;
desktop = {
enable = true;
greetd = {
enable = true;

View file

@ -23,13 +23,14 @@
system.stateVersion = "24.05";
ar = {
apps.firefox.enable = true;
base = {
enable = true;
zramSwap.size = 100;
};
desktop = {
enable = true;
cinnamon.enable = true;
lightdm.enable = true;
};

View file

@ -1,21 +1,25 @@
{
pkgs,
lib,
config,
lib,
pkgs,
...
}: {
config = lib.mkIf config.ar.apps.steam.enable {
programs = {
gamescope.enable = config.ar.desktop.steam.enable;
config =
lib.mkIf (
config.ar.apps.steam.enable
|| config.ar.desktop.steam.enable
) {
programs = {
gamescope.enable = config.ar.desktop.steam.enable;
steam = {
enable = true;
dedicatedServer.openFirewall = true;
extraCompatPackages = with pkgs; [proton-ge-bin];
gamescopeSession.enable = config.ar.desktop.steam.enable;
localNetworkGameTransfers.openFirewall = true;
remotePlay.openFirewall = true;
steam = {
enable = true;
dedicatedServer.openFirewall = true;
extraCompatPackages = with pkgs; [proton-ge-bin];
gamescopeSession.enable = config.ar.desktop.steam.enable;
localNetworkGameTransfers.openFirewall = true;
remotePlay.openFirewall = true;
};
};
};
};
}

View file

@ -15,25 +15,33 @@
./waylandComp.nix
];
config = lib.mkIf config.ar.desktop.enable {
environment.sessionVariables.NIXOS_OZONE_WL = "1";
config =
lib.mkIf (
config.ar.desktop.cinnamon.enable
|| config.ar.desktop.gnome.enable
|| config.ar.desktop.hyprland.enable
|| config.ar.desktop.plasma.enable
|| config.ar.desktop.steam.enable
|| config.ar.desktop.sway.enable
) {
environment.sessionVariables.NIXOS_OZONE_WL = "1";
fonts.packages = with pkgs; [
liberation_ttf
nerdfonts
];
fonts.packages = with pkgs; [
liberation_ttf
nerdfonts
];
services = {
gnome.gnome-keyring.enable = true;
gvfs.enable = true; # Mount, trash, etc.
xserver = {
enable = true;
xkb = {
layout = "us";
variant = "altgr-intl";
services = {
gnome.gnome-keyring.enable = true;
gvfs.enable = true; # Mount, trash, etc.
xserver = {
enable = true;
xkb = {
layout = "us";
variant = "altgr-intl";
};
excludePackages = with pkgs; [xterm];
};
excludePackages = with pkgs; [xterm];
};
};
};
}

View file

@ -4,7 +4,7 @@
config,
...
}: {
config = lib.mkIf config.ar.desktop.gnome.fprintdFix.enable {
config = lib.mkIf config.ar.desktop.gnome.fprintdFix {
# Need to change the order pam loads its modules
# to get proper fingerprint behavior on GDM and the lockscreen.
security.pam.services = {

View file

@ -8,48 +8,40 @@
}: {
options.ar = {
apps = {
firefox.enable = lib.mkOption {
description = "Firefox Web Browser.";
default = config.ar.desktop.enable;
type = lib.types.bool;
};
nicotine-plus.enable =
lib.mkEnableOption "Nicotine+ Soulseek client.";
podman.enable =
lib.mkEnableOption "Podman for OCI container support.";
steam.enable = lib.mkOption {
description = "Valve's Steam for video games.";
default = config.ar.desktop.steam.enable;
type = lib.types.bool;
};
virt-manager.enable =
lib.mkEnableOption "Virt-manager for virtual machines with TPM and EFI support.";
firefox.enable = lib.mkEnableOption "Firefox Web Browser.";
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 "Virtual machine client.";
};
containers = {
nixos = {
audiobookshelf = {
enable =
lib.mkEnableOption "audiobookshelf audiobook and podcast server in NixOS container.";
enable = lib.mkEnableOption "audiobookshelf server in 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 music server in NixOS container.";
enable = lib.mkEnableOption "Navidrome music server in 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;
@ -57,86 +49,99 @@
};
};
};
oci = {
audiobookshelf = {
enable =
lib.mkEnableOption "audiobookshelf podcast and audiobook server in OCI container.";
enable = lib.mkEnableOption "audiobookshelf 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.";
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.";
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.";
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.";
enable = lib.mkEnableOption "Transmission 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..";
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;
@ -145,110 +150,111 @@
};
};
};
desktop = {
enable =
lib.mkEnableOption "Enable basic GUI X11 and Wayland environment.";
cinnamon.enable =
lib.mkEnableOption "Cinnamon desktop session.";
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.";
enable = lib.mkEnableOption "GNOME desktop session.";
fprintdFix = lib.mkEnableOption "Fingerprint login fix for GDM";
};
greetd = {
enable =
lib.mkEnableOption "Greetd display manager.";
enable = lib.mkEnableOption "Greetd display manager.";
autologin = {
enable = lib.mkOption {
description = "Whether to enable autologin.";
default = false;
type = lib.types.bool;
};
enable = lib.mkEnableOption "Whether to enable autologin.";
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.";
steam.enable =
lib.mkEnableOption "Steam + Gamescope session.";
sway.enable =
lib.mkEnableOption "Sway wayland session.";
hyprland.enable = lib.mkEnableOption "Hyprland wayland session.";
lightdm.enable = lib.mkEnableOption "Lightdm with Catppuccin theme.";
plasma.enable = lib.mkEnableOption "Plasma desktop session.";
steam.enable = lib.mkEnableOption "Steam + Gamescope session.";
sway.enable = lib.mkEnableOption "Sway wayland session.";
};
services = {
binaryCache.enable = lib.mkEnableOption "nixpkgs cache server.";
flatpak.enable =
lib.mkEnableOption "Flatpak support with GUI.";
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 = config.ar.services.syncthing.enable;
type = lib.types.bool;
};
musicPath = lib.mkOption {
description = "Whether to sync music folder.";
default = "/home/${config.ar.services.syncthing.user}/music";
type = lib.types.str;
};
};
tailscale.enable = lib.mkEnableOption "Tailscale WireGuard VPN.";
};
base = {
enable =
lib.mkEnableOption "Basic system configuration and sane defaults.";
sambaAutoMount = lib.mkOption {
description = "Automounting of mauville Samba Shares.";
default =
config.ar.services.tailscale.enable && !(config.networking.hostName == "mauville");
config.ar.services.tailscale.enable
&& !(config.networking.hostName == "mauville");
type = lib.types.bool;
};
plymouth.enable = lib.mkOption {
description = "Plymouth boot screen with catppuccin theme.";
default = config.ar.base.enable;
type = lib.types.bool;
};
zramSwap = {
enable = lib.mkOption {
description = "zram swap.";
default = config.ar.base.enable;
type = lib.types.bool;
};
size = lib.mkOption {
description = "zram swap size relative to RAM.";
default = 50;

View file

@ -1,13 +0,0 @@
{
pkgs,
lib,
config,
...
}: {
config = lib.mkIf config.ar.services.binaryCache.enable {
services.nix-serve = {
enable = true;
secretKeyFile = "/var/cache-priv-key.pem";
};
};
}

View file

@ -5,7 +5,6 @@
...
}: {
imports = [
./binaryCache
./flatpak
./ollama
./syncthing