From 0f8a5d41a576a91224f3aa7c35f516b45e15e84a Mon Sep 17 00:00:00 2001 From: Andre Date: Fri, 2 Aug 2024 17:55:48 -0400 Subject: [PATCH] General: cleanup 'with lib;'s --- hosts/Dimaga/default.nix | 7 +- hosts/Dimaga/hardware-configuration.nix | 1 - hosts/Khanda/default.nix | 8 +- hosts/Pihole/default.nix | 1 - hosts/Pihole/hardware-configuration.nix | 9 +- hosts/Shura/default.nix | 13 +- hosts/Shura/hardware-configuration.nix | 8 +- hosts/_retired/Haven/default.nix | 8 +- .../_retired/Haven/hardware-configuration.nix | 8 +- hosts/hardware-configuration.nix.template | 1 - modules/apps/development.nix | 11 +- modules/apps/dj.nix | 5 +- modules/apps/gaming.nix | 5 +- modules/apps/media.nix | 5 +- modules/apps/office.nix | 5 +- modules/apps/recording.nix | 5 +- modules/apps/social.nix | 5 +- modules/apps/tmux.nix | 12 +- modules/autoimport.nix | 14 +- modules/services/apcupsd.nix | 12 +- modules/services/autoupgrade.nix | 7 +- modules/services/cache.nix | 7 +- modules/services/duplicacy-web.nix | 13 +- modules/services/msmtp.nix | 5 +- modules/services/virtualization.nix | 2 +- modules/system/editor.nix | 8 +- modules/system/nix.nix | 1 - modules/ui/desktops/budgie.nix | 7 +- modules/ui/desktops/hyprland.nix | 7 +- modules/ui/desktops/xfce.nix | 7 +- modules/ui/flatpak.nix | 1 - modules/users/aires/default.nix | 269 +++++++++--------- modules/users/common/home-manager/gnome.nix | 7 +- modules/users/gremlin/default.nix | 21 +- modules/users/media/default.nix | 12 +- modules/users/root/default.nix | 7 +- packages/airsonic-advanced.nix | 6 +- packages/duplicacy-web.nix | 6 +- 38 files changed, 215 insertions(+), 321 deletions(-) diff --git a/hosts/Dimaga/default.nix b/hosts/Dimaga/default.nix index 218936a..46cbe13 100644 --- a/hosts/Dimaga/default.nix +++ b/hosts/Dimaga/default.nix @@ -1,9 +1,4 @@ -{ - config, - lib, - pkgs, - ... -}: +{ config, pkgs, ... }: let # Do not change this value! This tracks when NixOS was installed on your system. diff --git a/hosts/Dimaga/hardware-configuration.nix b/hosts/Dimaga/hardware-configuration.nix index 01f4dd6..5fac811 100644 --- a/hosts/Dimaga/hardware-configuration.nix +++ b/hosts/Dimaga/hardware-configuration.nix @@ -1,7 +1,6 @@ { config, lib, - pkgs, modulesPath, ... }: diff --git a/hosts/Khanda/default.nix b/hosts/Khanda/default.nix index 52323cf..c4ed372 100644 --- a/hosts/Khanda/default.nix +++ b/hosts/Khanda/default.nix @@ -1,10 +1,4 @@ -{ - config, - lib, - pkgs, - system, - ... -}: +{ ... }: let # Do not change this value! This tracks when NixOS was installed on your system. diff --git a/hosts/Pihole/default.nix b/hosts/Pihole/default.nix index 316d7a0..ddc9768 100644 --- a/hosts/Pihole/default.nix +++ b/hosts/Pihole/default.nix @@ -2,7 +2,6 @@ config, pkgs, lib, - nix-secrets, ... }: let diff --git a/hosts/Pihole/hardware-configuration.nix b/hosts/Pihole/hardware-configuration.nix index c356c35..49e2ce6 100644 --- a/hosts/Pihole/hardware-configuration.nix +++ b/hosts/Pihole/hardware-configuration.nix @@ -1,13 +1,6 @@ # Raspberry Pi 4B # See https://wiki.nixos.org/wiki/NixOS_on_ARM/Raspberry_Pi_4 -{ - config, - lib, - pkgs, - modulesPath, - nixos-hardware, - ... -}: +{ lib, modulesPath, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; diff --git a/hosts/Shura/default.nix b/hosts/Shura/default.nix index 48d3a39..dd87149 100644 --- a/hosts/Shura/default.nix +++ b/hosts/Shura/default.nix @@ -1,9 +1,4 @@ -{ - config, - pkgs, - lib, - ... -}: +{ config, pkgs, ... }: let # Do not change this value! This tracks when NixOS was installed on your system. stateVersion = "24.05"; @@ -30,6 +25,12 @@ in system.stateVersion = stateVersion; networking.hostName = hostName; + # TESTING: Try out different GTK renderers: gl (old), ngl (new), or vulkan (new and unstable) + # See https://blog.gtk.org/2024/01/28/new-renderers-for-gtk/ + environment.sessionVariables = { + "GSK_RENDERER" = "gl"; + }; + aux.system = { apps = { development.enable = true; diff --git a/hosts/Shura/hardware-configuration.nix b/hosts/Shura/hardware-configuration.nix index 1c55bdf..368ec97 100644 --- a/hosts/Shura/hardware-configuration.nix +++ b/hosts/Shura/hardware-configuration.nix @@ -1,11 +1,5 @@ # Lenovo Legion Slim 7 Gen 7 AMD (16ARHA7) -{ - config, - lib, - pkgs, - modulesPath, - ... -}: +{ pkgs, modulesPath, ... }: let bootUUID = "AFCB-D880"; # The UUID of the boot partition. luksUUID = "bcf67e34-339e-40b9-8ffd-bec8f7f55248"; # The UUID of the locked LUKS partition. diff --git a/hosts/_retired/Haven/default.nix b/hosts/_retired/Haven/default.nix index dcb986b..dfc06fe 100644 --- a/hosts/_retired/Haven/default.nix +++ b/hosts/_retired/Haven/default.nix @@ -1,10 +1,4 @@ -{ - pkgs, - home-manager, - lib, - config, - ... -}: +{ pkgs, config, ... }: let stateVersion = "24.05"; hostName = "Haven"; diff --git a/hosts/_retired/Haven/hardware-configuration.nix b/hosts/_retired/Haven/hardware-configuration.nix index 40f3640..8ab9605 100644 --- a/hosts/_retired/Haven/hardware-configuration.nix +++ b/hosts/_retired/Haven/hardware-configuration.nix @@ -1,11 +1,5 @@ # Minisforum UM340 -{ - config, - lib, - pkgs, - modulesPath, - ... -}: +{ config, modulesPath, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; diff --git a/hosts/hardware-configuration.nix.template b/hosts/hardware-configuration.nix.template index b61ec8b..1c78c81 100644 --- a/hosts/hardware-configuration.nix.template +++ b/hosts/hardware-configuration.nix.template @@ -2,7 +2,6 @@ { config, lib, - pkgs, modulesPath, ... }: diff --git a/modules/apps/development.nix b/modules/apps/development.nix index f619727..7d0d3af 100644 --- a/modules/apps/development.nix +++ b/modules/apps/development.nix @@ -8,17 +8,16 @@ let cfg = config.aux.system.apps.development; in -with lib; { options = { aux.system.apps.development = { - enable = mkEnableOption (mdDoc "Enables development tools"); - kubernetes.enable = mkEnableOption (mdDoc "Enables kubectl, virtctl, and similar tools."); + enable = lib.mkEnableOption "Enables development tools"; + kubernetes.enable = lib.mkEnableOption "Enables kubectl, virtctl, and similar tools."; }; }; - config = mkMerge [ - (mkIf cfg.enable { + config = lib.mkMerge [ + (lib.mkIf cfg.enable { aux.system = { packages = with pkgs; [ nixd ]; ui.flatpak = { @@ -27,7 +26,7 @@ with lib; }; }; }) - (mkIf cfg.kubernetes.enable { + (lib.mkIf cfg.kubernetes.enable { environment.systemPackages = with pkgs; [ kubectl kubernetes-helm diff --git a/modules/apps/dj.nix b/modules/apps/dj.nix index 1a3391c..eeda16b 100644 --- a/modules/apps/dj.nix +++ b/modules/apps/dj.nix @@ -3,13 +3,12 @@ let cfg = config.aux.system.apps.dj; in -with lib; { options = { - aux.system.apps.dj.enable = mkEnableOption (mdDoc "Enables DJing tools (i.e. Mixxx)"); + aux.system.apps.dj.enable = lib.mkEnableOption "Enables DJing tools (i.e. Mixxx)"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { aux.system.ui.flatpak = { enable = true; packages = [ "org.mixxx.Mixxx" ]; diff --git a/modules/apps/gaming.nix b/modules/apps/gaming.nix index 83f0ca7..838bc40 100644 --- a/modules/apps/gaming.nix +++ b/modules/apps/gaming.nix @@ -14,13 +14,12 @@ let sudo systemctl restart bluetooth.service ''; in -with lib; { options = { - aux.system.apps.gaming.enable = mkEnableOption (mdDoc "Enables gaming features"); + aux.system.apps.gaming.enable = lib.mkEnableOption "Enables gaming features"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { aux.system.ui.flatpak = { enable = true; packages = [ diff --git a/modules/apps/media.nix b/modules/apps/media.nix index 6d99881..b296ddd 100644 --- a/modules/apps/media.nix +++ b/modules/apps/media.nix @@ -3,13 +3,12 @@ let cfg = config.aux.system.apps.media; in -with lib; { options = { - aux.system.apps.media.enable = mkEnableOption (mdDoc "Enables media playback and editing apps"); + aux.system.apps.media.enable = lib.mkEnableOption "Enables media playback and editing apps"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { aux.system.ui.flatpak = { enable = true; packages = [ diff --git a/modules/apps/office.nix b/modules/apps/office.nix index 224a1f8..5a3ba3c 100644 --- a/modules/apps/office.nix +++ b/modules/apps/office.nix @@ -3,13 +3,12 @@ let cfg = config.aux.system.apps.office; in -with lib; { options = { - aux.system.apps.office.enable = mkEnableOption (mdDoc "Enables office and workstation apps"); + aux.system.apps.office.enable = lib.mkEnableOption "Enables office and workstation apps"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { aux.system.ui.flatpak = { enable = true; packages = [ diff --git a/modules/apps/recording.nix b/modules/apps/recording.nix index dc0ffda..4f8e446 100644 --- a/modules/apps/recording.nix +++ b/modules/apps/recording.nix @@ -8,13 +8,12 @@ let cfg = config.aux.system.apps.recording; in -with lib; { options = { - aux.system.apps.recording.enable = mkEnableOption (mdDoc "Enables video editing tools"); + aux.system.apps.recording.enable = lib.mkEnableOption "Enables video editing tools"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { aux.system.ui.flatpak.enable = true; services.flatpak.packages = [ diff --git a/modules/apps/social.nix b/modules/apps/social.nix index 9999bab..802af05 100644 --- a/modules/apps/social.nix +++ b/modules/apps/social.nix @@ -8,13 +8,12 @@ let cfg = config.aux.system.apps.social; in -with lib; { options = { - aux.system.apps.social.enable = mkEnableOption (mdDoc "Enables chat apps"); + aux.system.apps.social.enable = lib.mkEnableOption "Enables chat apps"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { aux.system = { allowUnfree = true; ui.flatpak = { diff --git a/modules/apps/tmux.nix b/modules/apps/tmux.nix index eddad14..36442bc 100644 --- a/modules/apps/tmux.nix +++ b/modules/apps/tmux.nix @@ -1,20 +1,14 @@ -{ - pkgs, - config, - lib, - ... -}: +{ config, lib, ... }: let cfg = config.aux.system.apps.tmux; in -with lib; { options = { - aux.system.apps.tmux.enable = mkEnableOption (mdDoc "Enables tmux - terminal multiplexer"); + aux.system.apps.tmux.enable = lib.mkEnableOption "Enables tmux - terminal multiplexer"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.tmux = { enable = true; newSession = true; diff --git a/modules/autoimport.nix b/modules/autoimport.nix index 848bce7..a487591 100644 --- a/modules/autoimport.nix +++ b/modules/autoimport.nix @@ -1,27 +1,29 @@ # Auto-import modules in this folder, recursively. # Sourced from https://github.com/evanjs/nixos_cfg/blob/4bb5b0b84a221b25cf50853c12b9f66f0cad3ea4/config/new-modules/default.nix { lib, ... }: -with lib; let # Recursively constructs an attrset of a given folder, recursing on directories, value of attrs is the filetype getDir = dir: - mapAttrs (file: type: if type == "directory" then getDir "${dir}/${file}" else type) ( + lib.mapAttrs (file: type: if type == "directory" then getDir "${dir}/${file}" else type) ( builtins.readDir dir ); # Collects all files of a directory as a list of strings of paths files = - dir: collect isString (mapAttrsRecursive (path: type: concatStringsSep "/" path) (getDir dir)); + dir: + lib.collect lib.isString ( + lib.mapAttrsRecursive (path: type: lib.concatStringsSep "/" path) (getDir dir) + ); # Search all files and folders within and below the current directory. # Filters out directories that belong to home-manager, and don't end with .nix or are this file. validFiles = dir: map (file: ./. + "/${file}") ( - filter (file: !hasInfix "home-manager" file && file != "autoimport.nix" && hasSuffix ".nix" file) ( - files dir - ) + lib.filter ( + file: !lib.hasInfix "home-manager" file && file != "autoimport.nix" && lib.hasSuffix ".nix" file + ) (files dir) ); in { diff --git a/modules/services/apcupsd.nix b/modules/services/apcupsd.nix index cd89ca3..93e5041 100644 --- a/modules/services/apcupsd.nix +++ b/modules/services/apcupsd.nix @@ -1,17 +1,11 @@ -{ - pkgs, - config, - lib, - ... -}: +{ config, lib, ... }: let cfg = config.aux.system.services.apcupsd; in -with lib; { options = { aux.system.services.apcupsd = { - enable = mkEnableOption (mdDoc "Enables apcupsd"); + enable = lib.mkEnableOption "Enables apcupsd"; configText = lib.mkOption { type = lib.types.str; description = "The configuration to pass to apcupsd."; @@ -19,7 +13,7 @@ with lib; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.apcupsd = { enable = true; configText = cfg.configText; diff --git a/modules/services/autoupgrade.nix b/modules/services/autoupgrade.nix index 7776b5e..d1e162e 100644 --- a/modules/services/autoupgrade.nix +++ b/modules/services/autoupgrade.nix @@ -1,10 +1,5 @@ # Run automatic updates. Replaces system.autoUpgrade. -{ - config, - lib, - pkgs, - ... -}: +{ config, lib, ... }: let cfg = config.aux.system.services.autoUpgrade; diff --git a/modules/services/cache.nix b/modules/services/cache.nix index 6a9c6be..ed49fac 100644 --- a/modules/services/cache.nix +++ b/modules/services/cache.nix @@ -1,10 +1,5 @@ # Serves a binary cache for Nix packages -{ - config, - lib, - self, - ... -}: +{ config, lib, ... }: let cfg = config.aux.system.services.cache; diff --git a/modules/services/duplicacy-web.nix b/modules/services/duplicacy-web.nix index a208205..483e6e9 100644 --- a/modules/services/duplicacy-web.nix +++ b/modules/services/duplicacy-web.nix @@ -9,20 +9,19 @@ let cfg = config.aux.system.services.duplicacy-web; duplicacy-web = pkgs.callPackage ../../packages/duplicacy-web.nix { inherit pkgs lib; }; in -with lib; -rec { +{ options = { aux.system.services.duplicacy-web = { - enable = mkEnableOption (mdDoc "Enables duplicacy-web"); - autostart = mkOption { + enable = lib.mkEnableOption "Enables duplicacy-web"; + autostart = lib.mkOption { default = true; - type = types.bool; + type = lib.types.bool; description = "Whether to auto-start duplicacy-web on boot"; }; - environment = mkOption { + environment = lib.mkOption { default = ""; - type = types.str; + type = lib.types.str; description = "Environment where duplicacy-web stores its config files"; }; }; diff --git a/modules/services/msmtp.nix b/modules/services/msmtp.nix index 13dfec6..66de5ad 100644 --- a/modules/services/msmtp.nix +++ b/modules/services/msmtp.nix @@ -4,13 +4,12 @@ let cfg = config.aux.system.services.msmtp; in -with lib; { options = { - aux.system.services.msmtp.enable = mkEnableOption (mdDoc "Enables mail server"); + aux.system.services.msmtp.enable = lib.mkEnableOption "Enables mail server"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.msmtp = { enable = true; accounts.default = { diff --git a/modules/services/virtualization.nix b/modules/services/virtualization.nix index d3390ed..004c994 100644 --- a/modules/services/virtualization.nix +++ b/modules/services/virtualization.nix @@ -39,7 +39,7 @@ in }; config = lib.mkMerge [ - ({ programs.virt-manager.enable = cfg.enable; }) + { programs.virt-manager.enable = cfg.enable; } (lib.mkIf (cfg.host.enable || cfg.host.vmBuilds.enable) { virtualisation = { libvirtd = { diff --git a/modules/system/editor.nix b/modules/system/editor.nix index 0d38083..a646ab3 100644 --- a/modules/system/editor.nix +++ b/modules/system/editor.nix @@ -1,11 +1,5 @@ # Basic system-wide text editor configuration. -{ - pkgs, - config, - lib, - inputs, - ... -}: +{ config, lib, ... }: let cfg = config.aux.system.editor; diff --git a/modules/system/nix.nix b/modules/system/nix.nix index 062b3ab..6c92ffa 100644 --- a/modules/system/nix.nix +++ b/modules/system/nix.nix @@ -1,6 +1,5 @@ # Core Nix configuration { - pkgs, config, lib, inputs, diff --git a/modules/ui/desktops/budgie.nix b/modules/ui/desktops/budgie.nix index dbfe0ff..9fce7f9 100644 --- a/modules/ui/desktops/budgie.nix +++ b/modules/ui/desktops/budgie.nix @@ -1,10 +1,5 @@ # Enables the Budgie desktop environment. -{ - pkgs, - config, - lib, - ... -}: +{ config, lib, ... }: let cfg = config.aux.system.ui.desktops.budgie; in diff --git a/modules/ui/desktops/hyprland.nix b/modules/ui/desktops/hyprland.nix index 18f06f0..c57c400 100644 --- a/modules/ui/desktops/hyprland.nix +++ b/modules/ui/desktops/hyprland.nix @@ -1,10 +1,5 @@ # Enables the Hyprland desktop environment. -{ - pkgs, - config, - lib, - ... -}: +{ config, lib, ... }: let cfg = config.aux.system.ui.desktops.hyprland; in diff --git a/modules/ui/desktops/xfce.nix b/modules/ui/desktops/xfce.nix index c6583b2..712ef0b 100644 --- a/modules/ui/desktops/xfce.nix +++ b/modules/ui/desktops/xfce.nix @@ -1,10 +1,5 @@ # Enables the XFCE desktop environment. -{ - pkgs, - config, - lib, - ... -}: +{ config, lib, ... }: let cfg = config.aux.system.ui.desktops.xfce; in diff --git a/modules/ui/flatpak.nix b/modules/ui/flatpak.nix index 4eaa2de..23398f3 100644 --- a/modules/ui/flatpak.nix +++ b/modules/ui/flatpak.nix @@ -1,5 +1,4 @@ { - nix-flatpak, pkgs, config, lib, diff --git a/modules/users/aires/default.nix b/modules/users/aires/default.nix index 4f4d370..bf59897 100644 --- a/modules/users/aires/default.nix +++ b/modules/users/aires/default.nix @@ -9,160 +9,161 @@ let cfg = config.aux.system.users.aires; in -with lib; { options = { aux.system.users.aires = { - enable = mkEnableOption (mdDoc "Enables aires user account"); - autologin = mkEnableOption (mdDoc "Automatically logs aires in on boot"); + enable = lib.mkEnableOption "Enables aires user account"; + autologin = lib.mkEnableOption "Automatically logs aires in on boot"; services.syncthing = { - enable = mkEnableOption (mdDoc "Enables Syncthing"); - enableTray = mkEnableOption (mdDoc "Enables the Syncthing Tray application"); - autostart = mkOption { + enable = lib.mkEnableOption "Enables Syncthing"; + enableTray = lib.mkEnableOption "Enables the Syncthing Tray application"; + autostart = lib.mkOption { default = true; - type = types.bool; + type = lib.types.bool; description = "Whether to auto-start Syncthing on boot"; }; }; }; }; - config = mkIf cfg.enable (mkMerge [ - { - users.users.aires = { - isNormalUser = true; - description = "Aires"; - uid = 1000; - hashedPassword = config.secrets.users.aires.hashedPassword; - extraGroups = [ - "input" - "networkmanager" - "plugdev" - "tss" - "wheel" - ]; # tss group has access to TPM devices + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + users.users.aires = { + isNormalUser = true; + description = "Aires"; + uid = 1000; + hashedPassword = config.secrets.users.aires.hashedPassword; + extraGroups = [ + "input" + "networkmanager" + "plugdev" + "tss" + "wheel" + ]; # tss group has access to TPM devices - # Allow systemd services to run even while aires is logged out - linger = true; - }; + # Allow systemd services to run even while aires is logged out + linger = true; + }; - # Configure home-manager - home-manager.users.aires = { - imports = [ - ../common/home-manager/gnome.nix - ../common/home-manager/zsh.nix + # Configure home-manager + home-manager.users.aires = { + imports = [ + ../common/home-manager/gnome.nix + ../common/home-manager/zsh.nix + ]; + + home = { + # The state version is required and should stay at the version you originally installed. + stateVersion = "24.05"; + + # Basic setup + username = "aires"; + homeDirectory = "/home/aires"; + + # Install extra packages, specifically gnome extensions + packages = lib.mkIf config.aux.system.ui.desktops.gnome.enable [ + pkgs.gnomeExtensions.wallpaper-slideshow + ]; + + # Set environment variables + sessionVariables = { + KUBECONFIG = "/home/aires/.kube/config"; + }; + + # Create .face file + file.".face".source = ./face.png; + }; + + programs = { + # Let home Manager install and manage itself. + home-manager.enable = true; + + # Set up git + git = { + enable = true; + userName = config.secrets.users.aires.firstName; + userEmail = config.secrets.users.aires.email; + extraConfig = { + push.autoSetupRemote = "true"; + aliases.pull = "!git pull && git submodule foreach --recursive 'git pull origin main'"; + }; + }; + + # Set up SSH + ssh = { + enable = true; + matchBlocks = config.secrets.users.aires.sshConfig; + }; + + # Set up Zsh + zsh = { + oh-my-zsh = { + theme = "gentoo"; + }; + shellAliases = { + update = "upgrade"; + upgrade = "nh os boot --update --ask"; + }; + loginExtra = "fastfetch"; + }; + }; + + # Gnome settings specific to aires on Shura + /* + dconf.settings = lib.mkIf (config.networking.hostName == "Shura") { + "org/gnome/desktop/interface" = { + # Increase font scaling; + text-scaling-factor = 1.3; + + # Dark mode + color-scheme = "prefer-dark"; + }; + }; + */ + }; + } + + # Autologin aires + (lib.mkIf cfg.autologin { + services.displayManager.autoLogin = { + enable = true; + user = "aires"; + }; + systemd.services = { + "getty@tty1".enable = false; + "autovt@tty1".enable = false; + }; + }) + + # Enable Syncthing + (lib.mkIf cfg.services.syncthing.enable { + users.users.aires.packages = [ + pkgs.syncthing + (lib.mkIf cfg.services.syncthing.enableTray pkgs.syncthingtray) ]; - home = { - # The state version is required and should stay at the version you originally installed. - stateVersion = "24.05"; + # Open port 8080 + networking.firewall.allowedTCPPorts = [ 8080 ]; - # Basic setup - username = "aires"; - homeDirectory = "/home/aires"; - - # Install extra packages, specifically gnome extensions - packages = lib.mkIf config.aux.system.ui.desktops.gnome.enable [ - pkgs.gnomeExtensions.wallpaper-slideshow - ]; - - # Set environment variables - sessionVariables = { - KUBECONFIG = "/home/aires/.kube/config"; - }; - - # Create .face file - file.".face".source = ./face.png; - }; - - programs = { - # Let home Manager install and manage itself. - home-manager.enable = true; - - # Set up git - git = { + home-manager.users.aires = { + # Syncthing options + services.syncthing = { enable = true; - userName = config.secrets.users.aires.firstName; - userEmail = config.secrets.users.aires.email; - extraConfig = { - push.autoSetupRemote = "true"; - aliases.pull = "!git pull && git submodule foreach --recursive 'git pull origin main'"; - }; + extraOptions = [ + "--gui-address=0.0.0.0:8080" + "--home=${config.users.users.aires.home}/.config/syncthing" + "--no-default-folder" + ]; }; - # Set up SSH - ssh = { - enable = true; - matchBlocks = config.secrets.users.aires.sshConfig; - }; - - # Set up Zsh - zsh = { - oh-my-zsh = { - theme = "gentoo"; - }; - shellAliases = { - update = "upgrade"; - upgrade = "nh os boot --update --ask"; - }; - loginExtra = "fastfetch"; + # Override the default Syncthing settings so it doesn't start on boot + systemd.user.services."syncthing" = lib.mkIf (!cfg.services.syncthing.autostart) { + wantedBy = lib.mkForce { }; }; }; - - # Gnome settings specific to aires on Shura - /* - dconf.settings = lib.mkIf (config.networking.hostName == "Shura") { - "org/gnome/desktop/interface" = { - # Increase font scaling; - text-scaling-factor = 1.3; - - # Dark mode - color-scheme = "prefer-dark"; - }; - }; - */ - }; - } - - # Autologin aires - (mkIf cfg.autologin { - services.displayManager.autoLogin = { - enable = true; - user = "aires"; - }; - systemd.services = { - "getty@tty1".enable = false; - "autovt@tty1".enable = false; - }; - }) - - # Enable Syncthing - (mkIf cfg.services.syncthing.enable { - users.users.aires.packages = [ - pkgs.syncthing - (mkIf cfg.services.syncthing.enableTray pkgs.syncthingtray) - ]; - - # Open port 8080 - networking.firewall.allowedTCPPorts = [ 8080 ]; - - home-manager.users.aires = { - # Syncthing options - services.syncthing = { - enable = true; - extraOptions = [ - "--gui-address=0.0.0.0:8080" - "--home=${config.users.users.aires.home}/.config/syncthing" - "--no-default-folder" - ]; - }; - - # Override the default Syncthing settings so it doesn't start on boot - systemd.user.services."syncthing" = mkIf (!cfg.services.syncthing.autostart) { - wantedBy = lib.mkForce { }; - }; - }; - }) - ]); + }) + ] + ); } diff --git a/modules/users/common/home-manager/gnome.nix b/modules/users/common/home-manager/gnome.nix index 8f9c960..5160c82 100644 --- a/modules/users/common/home-manager/gnome.nix +++ b/modules/users/common/home-manager/gnome.nix @@ -1,9 +1,4 @@ -{ - lib, - pkgs, - osConfig, - ... -}: +{ lib, osConfig, ... }: { # Additional Gnome configurations via home-manager. dconf.settings = lib.mkIf osConfig.aux.system.ui.desktops.gnome.enable { diff --git a/modules/users/gremlin/default.nix b/modules/users/gremlin/default.nix index 0e7aa05..fc7952b 100644 --- a/modules/users/gremlin/default.nix +++ b/modules/users/gremlin/default.nix @@ -9,26 +9,25 @@ let cfg = config.aux.system.users.gremlin; in -with lib; { options = { aux.system.users.gremlin = { - enable = mkEnableOption (mdDoc "Enables gremlin user account"); + enable = lib.mkEnableOption "Enables gremlin user account"; services.syncthing = { - enable = mkEnableOption (mdDoc "Enables Syncthing"); - enableTray = mkEnableOption (mdDoc "Enables the Syncthing Tray application"); - autostart = mkOption { + enable = lib.mkEnableOption "Enables Syncthing"; + enableTray = lib.mkEnableOption "Enables the Syncthing Tray application"; + autostart = lib.mkOption { default = true; - type = types.bool; + type = lib.types.bool; description = "Whether to auto-start Syncthing on boot"; }; }; }; }; - config = mkMerge [ - (mkIf cfg.enable { + config = lib.mkMerge [ + (lib.mkIf cfg.enable { # Add Gremlin account users.users.gremlin = { isNormalUser = true; @@ -110,11 +109,11 @@ with lib; }) # Enable Syncthing - (mkIf cfg.services.syncthing.enable { + (lib.mkIf cfg.services.syncthing.enable { users.users.gremlin = { packages = [ pkgs.syncthing - (mkIf cfg.services.syncthing.enableTray pkgs.syncthingtray) + (lib.mkIf cfg.services.syncthing.enableTray pkgs.syncthingtray) ]; }; @@ -130,7 +129,7 @@ with lib; }; # Override the default Syncthing settings so it doesn't start on boot - systemd.user.services."syncthing" = mkIf (!cfg.services.syncthing.autostart) { + systemd.user.services."syncthing" = lib.mkIf (!cfg.services.syncthing.autostart) { wantedBy = lib.mkForce { }; }; }; diff --git a/modules/users/media/default.nix b/modules/users/media/default.nix index 0aa9ff8..93ca682 100644 --- a/modules/users/media/default.nix +++ b/modules/users/media/default.nix @@ -1,24 +1,18 @@ -{ - pkgs, - lib, - config, - ... -}: +{ lib, config, ... }: # Define user for managing media files let cfg = config.aux.system.users.media; in -with lib; { options = { aux.system.users.media = { - enable = mkEnableOption (mdDoc "Enables media user account"); + enable = lib.mkEnableOption "Enables media user account"; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { users.groups."media" = { gid = 1001; }; diff --git a/modules/users/root/default.nix b/modules/users/root/default.nix index 94fbd77..84d498b 100644 --- a/modules/users/root/default.nix +++ b/modules/users/root/default.nix @@ -1,9 +1,4 @@ -{ - config, - home-manager, - lib, - ... -}: +{ config, lib, ... }: { # Give root user access to run remote builds home-manager.users.root = { diff --git a/packages/airsonic-advanced.nix b/packages/airsonic-advanced.nix index 1921e0f..3208420 100644 --- a/packages/airsonic-advanced.nix +++ b/packages/airsonic-advanced.nix @@ -23,11 +23,11 @@ stdenv.mkDerivation rec { airsonic-starts = nixosTests.airsonic; }; - meta = with lib; { + meta = { description = "Free, web-based media streamer providing ubiquitous access to your music."; homepage = "https://github.com/kagemomiji/airsonic-advanced/"; - sourceProvenance = with sourceTypes; [ binaryBytecode ]; + sourceProvenance = [ lib.sourceTypes.binaryBytecode ]; license = lib.licenses.gpl3; - platforms = platforms.all; + platforms = lib.platforms.all; }; } diff --git a/packages/duplicacy-web.nix b/packages/duplicacy-web.nix index bf7554a..70c1b8e 100644 --- a/packages/duplicacy-web.nix +++ b/packages/duplicacy-web.nix @@ -18,10 +18,10 @@ pkgs.stdenv.mkDerivation rec { chmod a+x $out/duplicacy-web ''; - meta = with lib; { + meta = { homepage = "https://duplicacy.com"; description = "A new generation cloud backup tool"; - platforms = platforms.linux; - license = licenses.unfreeRedistributable; + platforms = lib.platforms.linux; + license = lib.licenses.unfreeRedistributable; }; }