From 3a2f52f45eed57aeaee2cc1f07a1aef310d8e1e5 Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Tue, 18 Mar 2025 16:43:07 +0100 Subject: [PATCH] progress in multi user config --- hosts/orome/default.nix | 38 ---- hosts/orome/users/chris/default.nix | 46 +---- hosts/orome/users/kaas/default.nix | 44 +---- lib/_users.nix | 10 + lib/nixos.nix | 19 +- modules/desktop/browsers/zen.nix | 92 --------- modules/desktop/editors/kate.nix | 36 ---- modules/desktop/plasma.nix | 75 -------- modules/desktop/terminal/default.nix | 30 --- .../desktop/applications/communication.nix | 6 +- .../{ => home}/desktop/applications/email.nix | 11 +- .../desktop/applications/office.nix | 6 +- .../desktop/applications/passwords.nix | 6 +- .../desktop/applications/recording.nix | 6 +- .../{ => home}/desktop/applications/steam.nix | 8 +- .../{ => home}/desktop/browsers/chrome.nix | 8 +- .../{ => home}/desktop/browsers/default.nix | 7 +- .../{ => home}/desktop/browsers/firefox.nix | 10 +- modules/home/desktop/browsers/zen.nix | 43 +++++ modules/{ => home}/desktop/default.nix | 6 +- .../{ => home}/desktop/editors/default.nix | 7 +- modules/home/desktop/editors/kate.nix | 16 ++ modules/{ => home}/desktop/editors/nano.nix | 10 +- modules/{ => home}/desktop/editors/nvim.nix | 10 +- .../{ => home}/desktop/editors/vscodium.nix | 6 +- modules/{ => home}/desktop/editors/zed.nix | 20 +- .../{ => home}/desktop/games/minecraft.nix | 6 +- modules/home/desktop/plasma.nix | 60 ++++++ .../{ => home}/desktop/terminal/alacritty.nix | 7 +- modules/home/desktop/terminal/default.nix | 24 +++ .../{ => home}/desktop/terminal/ghostty.nix | 9 +- modules/{ => home}/develop/default.nix | 0 modules/{ => home}/develop/dotnet.nix | 0 modules/{ => home}/develop/js.nix | 0 modules/{ => home}/develop/rust.nix | 0 modules/{ => home}/shell/default.nix | 10 +- modules/{ => home}/shell/toolset/btop.nix | 9 +- modules/{ => home}/shell/toolset/fzf.nix | 6 +- modules/{ => home}/shell/toolset/git.nix | 11 +- modules/{ => home}/shell/toolset/gnupg.nix | 6 +- modules/{ => home}/shell/toolset/starship.nix | 8 +- modules/{ => home}/shell/toolset/tmux.nix | 8 +- modules/home/shell/zsh.nix | 99 ++++++++++ .../{ => home}/themes/catppuccin-latte.jpg | Bin modules/{ => home}/themes/default.nix | 8 +- modules/{ => home}/themes/everforest.jpg | Bin modules/{ => home}/xgd.nix | 4 +- modules/shell/zsh.nix | 174 ------------------ modules/{ => system}/common/qbittorrent.nix | 0 modules/{ => system}/networking/default.nix | 0 modules/{ => system}/networking/samba.nix | 0 modules/{ => system}/networking/ssh.nix | 0 modules/{ => system}/options.nix | 22 +-- modules/{ => system}/services/auth.nix | 0 modules/{ => system}/services/default.nix | 0 .../{ => system}/services/games/minecraft.nix | 0 .../{ => system}/services/games/palworld.nix | 0 modules/{ => system}/services/media.nix | 0 modules/{ => system}/services/nextcloud.nix | 0 .../{ => system}/services/oidc_clients.yml | 0 modules/system/{ => system}/audio.nix | 0 modules/system/{ => system}/boot.nix | 0 modules/system/{ => system}/graphics.nix | 0 modules/system/{ => system}/networking.nix | 0 modules/system/{ => system}/security.nix | 0 modules/system/{ => system}/zsa_voyager.nix | 0 .../{ => system}/virtualisation/default.nix | 0 .../{ => system}/virtualisation/podman.nix | 0 68 files changed, 384 insertions(+), 663 deletions(-) create mode 100644 lib/_users.nix delete mode 100644 modules/desktop/browsers/zen.nix delete mode 100644 modules/desktop/editors/kate.nix delete mode 100644 modules/desktop/plasma.nix delete mode 100644 modules/desktop/terminal/default.nix rename modules/{ => home}/desktop/applications/communication.nix (65%) rename modules/{ => home}/desktop/applications/email.nix (79%) rename modules/{ => home}/desktop/applications/office.nix (75%) rename modules/{ => home}/desktop/applications/passwords.nix (66%) rename modules/{ => home}/desktop/applications/recording.nix (81%) rename modules/{ => home}/desktop/applications/steam.nix (85%) rename modules/{ => home}/desktop/browsers/chrome.nix (86%) rename modules/{ => home}/desktop/browsers/default.nix (67%) rename modules/{ => home}/desktop/browsers/firefox.nix (97%) create mode 100644 modules/home/desktop/browsers/zen.nix rename modules/{ => home}/desktop/default.nix (69%) rename modules/{ => home}/desktop/editors/default.nix (82%) create mode 100644 modules/home/desktop/editors/kate.nix rename modules/{ => home}/desktop/editors/nano.nix (65%) rename modules/{ => home}/desktop/editors/nvim.nix (72%) rename modules/{ => home}/desktop/editors/vscodium.nix (65%) rename modules/{ => home}/desktop/editors/zed.nix (81%) rename modules/{ => home}/desktop/games/minecraft.nix (71%) create mode 100644 modules/home/desktop/plasma.nix rename modules/{ => home}/desktop/terminal/alacritty.nix (82%) create mode 100644 modules/home/desktop/terminal/default.nix rename modules/{ => home}/desktop/terminal/ghostty.nix (69%) rename modules/{ => home}/develop/default.nix (100%) rename modules/{ => home}/develop/dotnet.nix (100%) rename modules/{ => home}/develop/js.nix (100%) rename modules/{ => home}/develop/rust.nix (100%) rename modules/{ => home}/shell/default.nix (84%) rename modules/{ => home}/shell/toolset/btop.nix (91%) rename modules/{ => home}/shell/toolset/fzf.nix (84%) rename modules/{ => home}/shell/toolset/git.nix (92%) rename modules/{ => home}/shell/toolset/gnupg.nix (80%) rename modules/{ => home}/shell/toolset/starship.nix (89%) rename modules/{ => home}/shell/toolset/tmux.nix (93%) create mode 100644 modules/home/shell/zsh.nix rename modules/{ => home}/themes/catppuccin-latte.jpg (100%) rename modules/{ => home}/themes/default.nix (90%) rename modules/{ => home}/themes/everforest.jpg (100%) rename modules/{ => home}/xgd.nix (92%) delete mode 100644 modules/shell/zsh.nix rename modules/{ => system}/common/qbittorrent.nix (100%) rename modules/{ => system}/networking/default.nix (100%) rename modules/{ => system}/networking/samba.nix (100%) rename modules/{ => system}/networking/ssh.nix (100%) rename modules/{ => system}/options.nix (74%) rename modules/{ => system}/services/auth.nix (100%) rename modules/{ => system}/services/default.nix (100%) rename modules/{ => system}/services/games/minecraft.nix (100%) rename modules/{ => system}/services/games/palworld.nix (100%) rename modules/{ => system}/services/media.nix (100%) rename modules/{ => system}/services/nextcloud.nix (100%) rename modules/{ => system}/services/oidc_clients.yml (100%) rename modules/system/{ => system}/audio.nix (100%) rename modules/system/{ => system}/boot.nix (100%) rename modules/system/{ => system}/graphics.nix (100%) rename modules/system/{ => system}/networking.nix (100%) rename modules/system/{ => system}/security.nix (100%) rename modules/system/{ => system}/zsa_voyager.nix (100%) rename modules/{ => system}/virtualisation/default.nix (100%) rename modules/{ => system}/virtualisation/podman.nix (100%) diff --git a/hosts/orome/default.nix b/hosts/orome/default.nix index 2dc39da..82067c9 100644 --- a/hosts/orome/default.nix +++ b/hosts/orome/default.nix @@ -1,45 +1,7 @@ { config, lib, pkgs, ... }: { modules = { - themes = { - enable = true; - theme = "everforest"; - polarity = "dark"; - }; - system.audio.enable = true; networking.enable = true; - - develop = { - rust.enable = true; - js.enable = true; - dotnet.enable = true; - }; - - desktop = { - plasma.enable = true; - - terminal = { - default = "ghostty"; - ghostty.enable = true; - }; - - editors = { - default = "zed"; - zed.enable = true; - nvim.enable = true; - }; - - browsers = { - default = "chromium"; - firefox.enable = true; - chrome.enable = true; - }; - }; - - shell = { - default = "zsh"; - corePkgs.enable = true; - }; }; } diff --git a/hosts/orome/users/chris/default.nix b/hosts/orome/users/chris/default.nix index 5755c52..132884f 100644 --- a/hosts/orome/users/chris/default.nix +++ b/hosts/orome/users/chris/default.nix @@ -2,47 +2,9 @@ { # full_name = "Chris Kruining"; # is_trusted = true; - - modules = { - themes = { - enable = true; - theme = "everforest"; - polarity = "dark"; - }; - - system.audio.enable = true; - networking.enable = true; - - develop = { - rust.enable = true; - js.enable = true; - dotnet.enable = true; - }; - - desktop = { - plasma.enable = true; - - terminal = { - default = "ghostty"; - ghostty.enable = true; - }; - - editors = { - default = "zed"; - zed.enable = true; - nvim.enable = true; - }; - - browsers = { - default = "chromium"; - firefox.enable = true; - chrome.enable = true; - }; - }; - - shell = { - default = "zsh"; - corePkgs.enable = true; - }; + + shell = { + default = "zsh"; + corePkgs.enable = true; }; } \ No newline at end of file diff --git a/hosts/orome/users/kaas/default.nix b/hosts/orome/users/kaas/default.nix index 4796502..752e887 100644 --- a/hosts/orome/users/kaas/default.nix +++ b/hosts/orome/users/kaas/default.nix @@ -3,46 +3,8 @@ # full_name = "Kaas Mans"; # is_trusted = false; - modules = { - themes = { - enable = true; - theme = "everforest"; - polarity = "dark"; - }; - - system.audio.enable = true; - networking.enable = true; - - develop = { - rust.enable = true; - js.enable = true; - dotnet.enable = true; - }; - - desktop = { - plasma.enable = true; - - terminal = { - default = "ghostty"; - ghostty.enable = true; - }; - - editors = { - default = "zed"; - zed.enable = true; - nvim.enable = true; - }; - - browsers = { - default = "chromium"; - firefox.enable = true; - chrome.enable = true; - }; - }; - - shell = { - default = "zsh"; - corePkgs.enable = true; - }; + shell = { + default = "fish"; + corePkgs.enable = true; }; } \ No newline at end of file diff --git a/lib/_users.nix b/lib/_users.nix new file mode 100644 index 0000000..00203fb --- /dev/null +++ b/lib/_users.nix @@ -0,0 +1,10 @@ +args@{ lib, pkgs, ... }: let + inherit (lib.my.modules) mapModulesRec'; +in +{ + imports = [] + ++ (mapModulesRec' (toString ../modules) (file: import file (args // { user = "chris"; }))) + ++ (mapModulesRec' (toString ../modules) (file: import file (args // { user = "kaas"; }))); + + config = {}; +} \ No newline at end of file diff --git a/lib/nixos.nix b/lib/nixos.nix index a6227e8..f99289b 100644 --- a/lib/nixos.nix +++ b/lib/nixos.nix @@ -37,9 +37,9 @@ in rec imports = [ inputs.home-manager.nixosModules.home-manager "${path}/hardware.nix" - ] - ++ (mapModulesRec' (toString ../modules) import); - + ./_users.nix + ] + ++ (mapModulesRec' (toString ../modules/system) import); users = { mutableUsers = true; # Set this to false when I get sops with passwords set up properly @@ -53,18 +53,13 @@ in rec inputs.plasma-manager.homeManagerModules.plasma-manager ]; - users = { - chris = { - imports = [ "${path}/users/chris/default.nix" ]; - }; - kaas = { - imports = [ "${path}/users/kaas/default.nix" ]; - }; - }; - # users = mapModules "${path}/users" (p: mkHmUser p stateVersion); }; } + { + modules.chris = (import "${path}/user/chris/default.nix"); + modules.kaas = (import "${path}/user/kaas/default.nix"); + } (filterAttrs (n: v: !elem n ["system"]) attrs) ../. # ../default.nix (import path) diff --git a/modules/desktop/browsers/zen.nix b/modules/desktop/browsers/zen.nix deleted file mode 100644 index f42d5b4..0000000 --- a/modules/desktop/browsers/zen.nix +++ /dev/null @@ -1,92 +0,0 @@ -{ inputs, options, config, lib, pkgs, ... }: -let - inherit (builtins) toJSON; - inherit (lib.attrsets) attrValues mapAttrsToList; - inherit (lib.modules) mkIf mkMerge; - inherit (lib.strings) concatStrings; - - cfg = config.modules.desktop.browsers.zen; -in { - options.modules.desktop.browsers.zen = let - inherit (lib.options) mkEnableOption; - inherit (lib.types) attrsOf oneOf bool int lines str; - inherit (lib.my) mkOpt mkOpt'; - in { - enable = mkEnableOption "Gecko-based libre browser"; - privacy.enable = mkEnableOption "Privacy Focused Firefox fork"; - - profileName = mkOpt str config.user.name; - settings = mkOpt' (attrsOf (oneOf [bool int str])) {} '' - Firefox preferences set in user.js - ''; - extraConfig = mkOpt' lines "" '' - Extra lines to add to user.js - ''; - userChrome = mkOpt' lines "" "CSS Styles for Firefox's interface"; - userContent = mkOpt' lines "" "Global CSS Styles for websites"; - }; - - config = mkMerge [ - (mkIf (config.modules.desktop.type == "wayland") { - environment.variables.MOZ_ENABLE_WAYLAND = "1"; - }) - - (mkIf cfg.enable { - user.packages = let - inherit (pkgs) makeDesktopItem; - inherit (inputs.zen.packages.${pkgs.system}.specific) zen; - in [ - zen -# (makeDesktopItem { -# name = "zen"; -# desktopName = "Zen"; -# genericName = "Launch a Zen instance"; -# icon = "zen"; -# exec = "${lib.getExe zen-bin}"; -# categories = ["Network" "WebBrowser"]; -# }) - ]; - - # Use a stable profile name so we can target it in themes -# home.file = let -# cfgPath = ".mozilla/firefox"; -# in { -# firefox-profiles = { -# target = "${cfgPath}/profiles.ini"; -# text = '' -# [Profile0] -# Name=default -# IsRelative=1 -# Path=${cfg.profileName}.default -# Default=1 -# -# [General] -# StartWithLastProfile=1 -# Version=2 -# ''; -# }; -# -# user-js = mkIf (cfg.settings != {} || cfg.extraConfig != "") { -# target = "${cfgPath}/${cfg.profileName}.default/user.js"; -# text = '' -# ${concatStrings (mapAttrsToList (name: value: '' -# user_pref("${name}", ${toJSON value}); -# '') -# cfg.settings)} -# ${cfg.extraConfig} -# ''; -# }; -# -# user-chrome = mkIf (cfg.userChrome != "") { -# target = "${cfgPath}/${cfg.profileName}.default/chrome/userChrome.css"; -# text = cfg.userChrome; -# }; -# -# user-content = mkIf (cfg.userContent != "") { -# target = "${cfgPath}/${cfg.profileName}.default/chrome/userContent.css"; -# text = cfg.userContent; -# }; -# }; - }) - ]; -} diff --git a/modules/desktop/editors/kate.nix b/modules/desktop/editors/kate.nix deleted file mode 100644 index 7237542..0000000 --- a/modules/desktop/editors/kate.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ config, options, lib, pkgs, ... }: -let - inherit (lib.meta) getExe; - inherit (lib.modules) mkIf; - - cfg = config.modules.desktop.editors.kate; -in -{ - options.modules.desktop.editors.kate = let - inherit (lib.options) mkEnableOption; - in { enable = mkEnableOption "kate"; }; - - config = mkIf cfg.enable { -# programs.kate = { -# enable = true; -# -# editor = { -# brackets.highlightMatching = true; -# -# indent = { -# keepExtraSpaces = false; -# replaceWithSpaces = true; -# showLines = true; -# undoByShiftTab = true; -# -# width = 4; -# tabWidth = 4; -# }; -# }; -# -# lsp = { -# typescript = {}; -# }; -# }; - }; -} diff --git a/modules/desktop/plasma.nix b/modules/desktop/plasma.nix deleted file mode 100644 index c2fd5c9..0000000 --- a/modules/desktop/plasma.nix +++ /dev/null @@ -1,75 +0,0 @@ -{ config, options, lib, pkgs, ... }: -let - inherit (lib.meta) getExe; - inherit (lib.modules) mkIf; -in -{ - options.modules.desktop.plasma = let - inherit (lib.options) mkEnableOption; - in { enable = mkEnableOption "plasma 6"; }; - - config = mkIf config.modules.desktop.plasma.enable { - services = { - xserver.enable = true; - - displayManager = { - sddm = { - enable = true; - wayland.enable = true; - }; - autoLogin = { - enable = true; - user = config.user.name; - }; - }; - - desktopManager.plasma6.enable = true; - }; - - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - - environment.plasma6.excludePackages = with pkgs.kdePackages; [ - konsole - ]; - - # should enable theme integration with gtk apps (i.e. firefox, thunderbird) - programs.dconf.enable = true; - - hm.programs.plasma = { - enable = true; - -# panels = [ -# { -# location = "bottom"; -# widgets = [ -# { -# name = "org.kde.plasma.kickoff"; -# config = { -# General = { -# icon = "nix-snowflake-white"; -# alphaSort = true; -# }; -# }; -# } -# -# { -# kickoff = { -# sortAlphabetically = true; -# icon = "nix-snowflake-white"; -# }; -# } -# ]; -# } -# ]; - - kwin = { - edgeBarrier = 0; - cornerBarrier = false; - }; - - spectacle.shortcuts = { - captureRectangularRegion = "Meta+Shift+S"; - }; - }; - }; -} diff --git a/modules/desktop/terminal/default.nix b/modules/desktop/terminal/default.nix deleted file mode 100644 index 5b4b544..0000000 --- a/modules/desktop/terminal/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ config, options, lib, pkgs, ... }: -let - inherit (lib.modules) mkDefault mkIf mkMerge; - - cfg = config.modules.desktop.terminal; -in { - options.modules.desktop.terminal = let - inherit (lib.options) mkOption; - inherit (lib.types) str; - in { - default = mkOption { - type = str; - default = "alacrity"; - description = "Default terminal"; - example = "alacrity"; - }; - }; - - config = mkMerge [ - { - home.sessionVariables.TERMINAL = cfg.default; - services.xserver.desktopManager.xterm.enable = mkDefault (cfg.default == "xterm"); - } - - (mkIf (config.modules.desktop.type == "x11") { - services.xserver.excludePackages = - mkIf (cfg.default != "xterm") [pkgs.xterm]; - }) - ]; -} diff --git a/modules/desktop/applications/communication.nix b/modules/home/desktop/applications/communication.nix similarity index 65% rename from modules/desktop/applications/communication.nix rename to modules/home/desktop/applications/communication.nix index 9b9e5cc..3afd523 100644 --- a/modules/desktop/applications/communication.nix +++ b/modules/home/desktop/applications/communication.nix @@ -1,12 +1,12 @@ -{ options, config, lib, pkgs, ... }: +{ options, config, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf mkForce mkMerge; inherit (lib.attrsets) attrValues; - cfg = config.modules.desktop.applications.communication; + cfg = config.modules.${user}.desktop.applications.communication; in { - options.modules.desktop.applications.communication = let + options.modules.${user}.desktop.applications.communication = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "Enable office suite (only-office)"; diff --git a/modules/desktop/applications/email.nix b/modules/home/desktop/applications/email.nix similarity index 79% rename from modules/desktop/applications/email.nix rename to modules/home/desktop/applications/email.nix index 56ebd22..1435e1f 100644 --- a/modules/desktop/applications/email.nix +++ b/modules/home/desktop/applications/email.nix @@ -1,12 +1,12 @@ -{ options, config, lib, pkgs, ... }: +{ options, config, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf mkForce mkMerge; inherit (lib.attrsets) attrValues; - cfg = config.modules.desktop.applications.email; + cfg = config.modules.${user}.desktop.applications.email; in { - options.modules.desktop.applications.email = let + options.modules.${user}.desktop.applications.email = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "Enable email client (thunderbird)"; @@ -20,12 +20,9 @@ in programs.thunderbird = { enable = true; -# profiles.chris = { -# isDefault = true; -# }; }; - hm.accounts.email.accounts = { + home-manager.users.${user}.accounts.email.accounts = { kruining = { primary = true; address = "chris@kruinin.eu"; diff --git a/modules/desktop/applications/office.nix b/modules/home/desktop/applications/office.nix similarity index 75% rename from modules/desktop/applications/office.nix rename to modules/home/desktop/applications/office.nix index 3f3484d..4e6478d 100644 --- a/modules/desktop/applications/office.nix +++ b/modules/home/desktop/applications/office.nix @@ -1,12 +1,12 @@ -{ options, config, lib, pkgs, ... }: +{ options, config, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf mkForce mkMerge; inherit (lib.attrsets) attrValues; - cfg = config.modules.desktop.applications.office; + cfg = config.modules.${user}.desktop.applications.office; in { - options.modules.desktop.applications.office = let + options.modules.${user}.desktop.applications.office = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "Enable office suite (only-office)"; diff --git a/modules/desktop/applications/passwords.nix b/modules/home/desktop/applications/passwords.nix similarity index 66% rename from modules/desktop/applications/passwords.nix rename to modules/home/desktop/applications/passwords.nix index d896702..7dae703 100644 --- a/modules/desktop/applications/passwords.nix +++ b/modules/home/desktop/applications/passwords.nix @@ -1,12 +1,12 @@ -{ options, config, lib, pkgs, ... }: +{ options, config, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf mkForce mkMerge; inherit (lib.attrsets) attrValues; - cfg = config.modules.desktop.applications.passwords; + cfg = config.modules.${user}.desktop.applications.passwords; in { - options.modules.desktop.applications.passwords = let + options.modules.${user}.desktop.applications.passwords = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "Enable password manager (bitwarden)"; diff --git a/modules/desktop/applications/recording.nix b/modules/home/desktop/applications/recording.nix similarity index 81% rename from modules/desktop/applications/recording.nix rename to modules/home/desktop/applications/recording.nix index f36c459..858729c 100644 --- a/modules/desktop/applications/recording.nix +++ b/modules/home/desktop/applications/recording.nix @@ -1,12 +1,12 @@ -{ options, config, lib, pkgs, ... }: +{ options, config, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf mkForce mkMerge; inherit (lib.attrsets) attrValues; - cfg = config.modules.desktop.applications.recording; + cfg = config.modules.${user}.desktop.applications.recording; in { - options.modules.desktop.applications.recording = let + options.modules.${user}.desktop.applications.recording = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "Enable recording software (OBS Studio)"; diff --git a/modules/desktop/applications/steam.nix b/modules/home/desktop/applications/steam.nix similarity index 85% rename from modules/desktop/applications/steam.nix rename to modules/home/desktop/applications/steam.nix index 7770515..f40ef0e 100644 --- a/modules/desktop/applications/steam.nix +++ b/modules/home/desktop/applications/steam.nix @@ -1,12 +1,12 @@ -{ options, config, lib, pkgs, ... }: +{ options, config, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf mkForce mkMerge; - cfg = config.modules.desktop.applications.steam; - desktop = config.modules.desktop; + cfg = config.modules.${user}.desktop.applications.steam; + desktop = config.modules.${user}.desktop; in { - options.modules.desktop.applications.steam = let + options.modules.${user}.desktop.applications.steam = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "Enable steam, the game/software store"; diff --git a/modules/desktop/browsers/chrome.nix b/modules/home/desktop/browsers/chrome.nix similarity index 86% rename from modules/desktop/browsers/chrome.nix rename to modules/home/desktop/browsers/chrome.nix index 61a0d33..3273be6 100644 --- a/modules/desktop/browsers/chrome.nix +++ b/modules/home/desktop/browsers/chrome.nix @@ -1,13 +1,13 @@ -{ inputs, options, config, lib, pkgs, ... }: +{ inputs, options, config, lib, pkgs, user, ... }: let inherit (builtins) toJSON; inherit (lib.attrsets) attrValues mapAttrsToList; inherit (lib.modules) mkIf mkMerge; inherit (lib.strings) concatStrings; - cfg = config.modules.desktop.browsers.chrome; + cfg = config.modules.${user}.desktop.browsers.chrome; in { - options.modules.desktop.browsers.chrome = let + options.modules.${user}.desktop.browsers.chrome = let inherit (lib.options) mkEnableOption; inherit (lib.types) attrsOf oneOf bool int lines str; inherit (lib.my) mkOpt mkOpt'; @@ -28,7 +28,7 @@ in { }) ]; - programs.chromium = { + home-manager.users.${user}.programs.chromium = { enable = true; enablePlasmaBrowserIntegration = true; extensions = [ diff --git a/modules/desktop/browsers/default.nix b/modules/home/desktop/browsers/default.nix similarity index 67% rename from modules/desktop/browsers/default.nix rename to modules/home/desktop/browsers/default.nix index 7975516..6bdfa36 100644 --- a/modules/desktop/browsers/default.nix +++ b/modules/home/desktop/browsers/default.nix @@ -3,12 +3,13 @@ config, lib, pkgs, + user, ... }: let inherit (lib.modules) mkIf; - cfg = config.modules.desktop.browsers; + cfg = config.modules.${user}.desktop.browsers; in { - options.modules.desktop.browsers = let + options.modules.${user}.desktop.browsers = let inherit (lib.options) mkOption; inherit (lib.types) nullOr str; in { @@ -21,6 +22,6 @@ in { }; config = mkIf (cfg.default != null) { - home.sessionVariables.BROWSER = cfg.default; + home-manager.users.${user}.home.sessionVariables.BROWSER = cfg.default; }; } diff --git a/modules/desktop/browsers/firefox.nix b/modules/home/desktop/browsers/firefox.nix similarity index 97% rename from modules/desktop/browsers/firefox.nix rename to modules/home/desktop/browsers/firefox.nix index 0b63a43..09148f0 100644 --- a/modules/desktop/browsers/firefox.nix +++ b/modules/home/desktop/browsers/firefox.nix @@ -1,13 +1,13 @@ -{ inputs, options, config, lib, pkgs, ... }: +{ inputs, options, config, lib, pkgs, user, ... }: let inherit (builtins) toJSON; inherit (lib.attrsets) attrValues mapAttrsToList; inherit (lib.modules) mkIf mkMerge; inherit (lib.strings) concatStrings; - cfg = config.modules.desktop.browsers.firefox; + cfg = config.modules.${user}.desktop.browsers.firefox; in { - options.modules.desktop.browsers.firefox = let + options.modules.${user}.desktop.browsers.firefox = let inherit (lib.options) mkEnableOption; inherit (lib.types) attrsOf oneOf bool int lines str; inherit (lib.my) mkOpt mkOpt'; @@ -47,7 +47,7 @@ in { }) ]; - modules.desktop.browsers.firefox.settings = { + modules.${user}.desktop.browsers.firefox.settings = { # TAB cycle URL's, not buttons.. "browser.toolbars.keyboard_navigation" = false; # Disable annoying translation pop-up! @@ -180,7 +180,7 @@ in { }; # Use a stable profile name so we can target it in themes - home.file = let + home-manager.users.${user}.home.file = let cfgPath = ".mozilla/firefox"; in { firefox-profiles = { diff --git a/modules/home/desktop/browsers/zen.nix b/modules/home/desktop/browsers/zen.nix new file mode 100644 index 0000000..43b8a28 --- /dev/null +++ b/modules/home/desktop/browsers/zen.nix @@ -0,0 +1,43 @@ +{ inputs, options, config, lib, pkgs, user, ... }: +let + inherit (builtins) toJSON; + inherit (lib.attrsets) attrValues mapAttrsToList; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.strings) concatStrings; + + cfg = config.modules.${user}.desktop.browsers.zen; +in { + options.modules.${user}.desktop.browsers.zen = let + inherit (lib.options) mkEnableOption; + inherit (lib.types) attrsOf oneOf bool int lines str; + inherit (lib.my) mkOpt mkOpt'; + in { + enable = mkEnableOption "Gecko-based libre browser"; + privacy.enable = mkEnableOption "Privacy Focused Firefox fork"; + + profileName = mkOpt str config.user.name; + settings = mkOpt' (attrsOf (oneOf [bool int str])) {} '' + Firefox preferences set in user.js + ''; + extraConfig = mkOpt' lines "" '' + Extra lines to add to user.js + ''; + userChrome = mkOpt' lines "" "CSS Styles for Firefox's interface"; + userContent = mkOpt' lines "" "Global CSS Styles for websites"; + }; + + config = mkMerge [ + (mkIf (config.modules.desktop.type == "wayland") { + environment.variables.MOZ_ENABLE_WAYLAND = "1"; + }) + + (mkIf cfg.enable { + user.packages = let + inherit (pkgs) makeDesktopItem; + inherit (inputs.zen.packages.${pkgs.system}.specific) zen; + in [ + zen + ]; + }) + ]; +} diff --git a/modules/desktop/default.nix b/modules/home/desktop/default.nix similarity index 69% rename from modules/desktop/default.nix rename to modules/home/desktop/default.nix index 072af0f..718a5c7 100644 --- a/modules/desktop/default.nix +++ b/modules/home/desktop/default.nix @@ -1,14 +1,14 @@ -{ config, options, lib, pkgs, ... }: +{ config, options, lib, pkgs, user, ... }: let inherit (builtins) isAttrs; inherit (lib.attrsets) attrValues; inherit (lib.modules) mkIf mkMerge; inherit (lib.my) anyAttrs countAttrs value; - cfg = config.modules.desktop; + cfg = config.modules.${user}.desktop; in { - options.modules.desktop = let + options.modules.${user}.desktop = let inherit (lib.types) either str; inherit (lib.my) mkOpt; in { diff --git a/modules/desktop/editors/default.nix b/modules/home/desktop/editors/default.nix similarity index 82% rename from modules/desktop/editors/default.nix rename to modules/home/desktop/editors/default.nix index ed64f54..0bc4871 100644 --- a/modules/desktop/editors/default.nix +++ b/modules/home/desktop/editors/default.nix @@ -3,13 +3,14 @@ options, lib, pkgs, + user, ... }: let inherit (lib.attrsets) attrValues; inherit (lib.modules) mkIf mkMerge; - cfg = config.modules.desktop.editors; + cfg = config.modules.${user}.desktop.editors; in { - options.modules.desktop.editors = let + options.modules.${user}.desktop.editors = let inherit (lib.options) mkOption; inherit (lib.types) nullOr enum; in { @@ -23,7 +24,7 @@ in { config = mkMerge [ (mkIf (cfg.default != null) { - home.sessionVariables = { + home-manager.users.${user}.home.sessionVariables = { EDITOR = cfg.default; }; }) diff --git a/modules/home/desktop/editors/kate.nix b/modules/home/desktop/editors/kate.nix new file mode 100644 index 0000000..8f4704c --- /dev/null +++ b/modules/home/desktop/editors/kate.nix @@ -0,0 +1,16 @@ +{ config, options, lib, pkgs, user, ... }: +let + inherit (lib.meta) getExe; + inherit (lib.modules) mkIf; + + cfg = config.modules.${user}.desktop.editors.kate; +in +{ + options.modules.${user}.desktop.editors.kate = let + inherit (lib.options) mkEnableOption; + in { enable = mkEnableOption "kate"; }; + + config = mkIf cfg.enable { + home-manager.users.${user}.programs.kate.enable = true; + }; +} diff --git a/modules/desktop/editors/nano.nix b/modules/home/desktop/editors/nano.nix similarity index 65% rename from modules/desktop/editors/nano.nix rename to modules/home/desktop/editors/nano.nix index 2ade641..54030f0 100644 --- a/modules/desktop/editors/nano.nix +++ b/modules/home/desktop/editors/nano.nix @@ -1,15 +1,17 @@ -{ config, options, lib, pkgs, ... }: +{ config, options, lib, pkgs, user, ... }: let inherit (lib.meta) getExe; inherit (lib.modules) mkIf; + + cfg = config.modules.${user}.desktop.editors.nano; in { - options.modules.desktop.editors.nano = let + options.modules.${user}.desktop.editors.nano = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "nano"; }; - config = mkIf config.modules.desktop.editors.nano.enable { - programs.nano = { + config = mkIf cfg.enable { + home-manager.users.${user}.programs.nano = { enable = true; syntaxHighlight = true; nanorc = '' diff --git a/modules/desktop/editors/nvim.nix b/modules/home/desktop/editors/nvim.nix similarity index 72% rename from modules/desktop/editors/nvim.nix rename to modules/home/desktop/editors/nvim.nix index a8517f4..d874e7c 100644 --- a/modules/desktop/editors/nvim.nix +++ b/modules/home/desktop/editors/nvim.nix @@ -1,19 +1,21 @@ -{ inputs, config, options, lib, pkgs, ... }: +{ inputs, config, options, lib, pkgs, user, ... }: let inherit (lib.meta) getExe; inherit (lib.modules) mkIf; + + cfg = options.modules.${user}.desktop.editors.nvim; in { imports = [ inputs.nvf.nixosModules.default ]; - options.modules.desktop.editors.nvim = let + options.modules.${user}.desktop.editors.nvim = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "neo-vim (nixvim)"; }; - config = mkIf config.modules.desktop.editors.nvim.enable { - programs.nvf = { + config = mkIf cfg.enable { + home-manager.users.${user}.programs.nvf = { enable = true; settings = { vim = { diff --git a/modules/desktop/editors/vscodium.nix b/modules/home/desktop/editors/vscodium.nix similarity index 65% rename from modules/desktop/editors/vscodium.nix rename to modules/home/desktop/editors/vscodium.nix index c68ccf8..fa96352 100644 --- a/modules/desktop/editors/vscodium.nix +++ b/modules/home/desktop/editors/vscodium.nix @@ -1,13 +1,13 @@ -{ config, options, lib, pkgs, ... }: +{ config, options, lib, pkgs, user, ... }: let inherit (lib.meta) getExe; inherit (lib.modules) mkIf; inherit (lib.attrsets) attrValues; - cfg = config.modules.desktop.editors.vscodium; + cfg = config.modules.${user}.desktop.editors.vscodium; in { - options.modules.desktop.editors.vscodium = let + options.modules.${user}.desktop.editors.vscodium = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "vscodium"; }; diff --git a/modules/desktop/editors/zed.nix b/modules/home/desktop/editors/zed.nix similarity index 81% rename from modules/desktop/editors/zed.nix rename to modules/home/desktop/editors/zed.nix index ca0aa66..1d30d11 100644 --- a/modules/desktop/editors/zed.nix +++ b/modules/home/desktop/editors/zed.nix @@ -1,25 +1,19 @@ -{ - config, - options, - lib, - pkgs, - ... -}: let +{ config, options, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf; inherit (lib.attrsets) attrValues; - cfg = config.modules.desktop.editors.zed; + cfg = config.modules.${user}.desktop.editors.zed; in { - options.modules.desktop.editors.zed = let + options.modules.${user}.desktop.editors.zed = let inherit (lib.options) mkEnableOption; in {enable = mkEnableOption "zed";}; config = mkIf cfg.enable { - user.packages = attrValues { - inherit (pkgs) zed-editor; - }; + user.packages = with pkgs; [ + zed-editor + ]; - hm.programs.zed-editor = { + home-manager.users.${user}.programs.zed-editor = { enable = true; extraPackages = with pkgs; [ nixd nil alejandra ]; diff --git a/modules/desktop/games/minecraft.nix b/modules/home/desktop/games/minecraft.nix similarity index 71% rename from modules/desktop/games/minecraft.nix rename to modules/home/desktop/games/minecraft.nix index 9ecaf29..8eab646 100644 --- a/modules/desktop/games/minecraft.nix +++ b/modules/home/desktop/games/minecraft.nix @@ -1,12 +1,12 @@ -{ options, config, lib, pkgs, ... }: +{ options, config, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf mkForce mkMerge; inherit (lib.attrsets) attrValues; - cfg = config.modules.desktop.games.minecraft; + cfg = config.modules.${user}.desktop.games.minecraft; in { - options.modules.desktop.games.minecraft = let + options.modules.${user}.desktop.games.minecraft = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "minecraft (Modrinth)"; diff --git a/modules/home/desktop/plasma.nix b/modules/home/desktop/plasma.nix new file mode 100644 index 0000000..1fcf0e5 --- /dev/null +++ b/modules/home/desktop/plasma.nix @@ -0,0 +1,60 @@ +{ config, options, lib, pkgs, user, ... }: +let + inherit (lib.meta) getExe; + inherit (lib.modules) mkOption mkIf; + + cfg = config.modules.${user}.desktop.plasma; +in +{ + options.modules.${user}.desktop.plasma = let + inherit (lib.options) mkEnableOption; + in { + enable = mkEnableOption "plasma 6"; + + autoLogin = mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Enable plasma's auto login feature."; + }; + }; + + config = mkIf cfg.enable { + services = { + desktopManager.plasma6.enable = true; + + displayManager = { + sddm = { + enable = true; + wayland.enable = true; + }; + autoLogin = mkIf cfg.autoLogin { + enable = true; + inherit user; + }; + }; + }; + + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + environment.plasma6.excludePackages = with pkgs.kdePackages; [ + konsole + ]; + + # should enable theme integration with gtk apps (i.e. firefox, thunderbird) + home-manager.users.${user}.programs.dconf.enable = true; + + home-manager.users.${user}.programs.plasma = { + enable = true; + + kwin = { + edgeBarrier = 0; + cornerBarrier = false; + }; + + spectacle.shortcuts = { + captureRectangularRegion = "Meta+Shift+S"; + }; + }; + }; +} diff --git a/modules/desktop/terminal/alacritty.nix b/modules/home/desktop/terminal/alacritty.nix similarity index 82% rename from modules/desktop/terminal/alacritty.nix rename to modules/home/desktop/terminal/alacritty.nix index bc3a7cd..2b0e6b1 100644 --- a/modules/desktop/terminal/alacritty.nix +++ b/modules/home/desktop/terminal/alacritty.nix @@ -3,20 +3,21 @@ options, lib, pkgs, + user, ... }: let inherit (builtins) toString; inherit (lib.meta) getExe; inherit (lib.modules) mkIf mkMerge; in { - options.modules.desktop.terminal.alacritty = let + options.modules.${user}.desktop.terminal.alacritty = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "OpenGL terminal emulator"; }; - config = mkIf config.modules.desktop.terminal.alacritty.enable { + config = mkIf config.${user}.modules.desktop.terminal.alacritty.enable { modules.shell.toolset.tmux.enable = true; - hm.programs.alacritty = { + home-manager.users.${user}.programs.alacritty = { enable = true; settings = mkMerge [ diff --git a/modules/home/desktop/terminal/default.nix b/modules/home/desktop/terminal/default.nix new file mode 100644 index 0000000..d408215 --- /dev/null +++ b/modules/home/desktop/terminal/default.nix @@ -0,0 +1,24 @@ +{ config, options, lib, pkgs, user, ... }: +let + inherit (lib.modules) mkDefault mkIf mkMerge; + + cfg = config.modules.${user}.desktop.terminal; +in { + options.modules.${user}.desktop.terminal = let + inherit (lib.options) mkOption; + inherit (lib.types) str; + in { + default = mkOption { + type = str; + default = "alacrity"; + description = "Default terminal"; + example = "alacrity"; + }; + }; + + config = mkMerge [ + { + home-manager.users.${user}.home.sessionVariables.TERMINAL = cfg.default; + } + ]; +} diff --git a/modules/desktop/terminal/ghostty.nix b/modules/home/desktop/terminal/ghostty.nix similarity index 69% rename from modules/desktop/terminal/ghostty.nix rename to modules/home/desktop/terminal/ghostty.nix index 436c6e7..5b974d6 100644 --- a/modules/desktop/terminal/ghostty.nix +++ b/modules/home/desktop/terminal/ghostty.nix @@ -3,24 +3,25 @@ options, lib, pkgs, + user, ... }: let inherit (builtins) toString; inherit (lib.meta) getExe; inherit (lib.modules) mkIf mkMerge; in { - options.modules.desktop.terminal.ghostty = let + options.modules.${user}.desktop.terminal.ghostty = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "ghostty"; }; - config = mkIf config.modules.desktop.terminal.ghostty.enable { + config = mkIf config.modules.${user}.desktop.terminal.ghostty.enable { environment.systemPackages = [ pkgs.ghostty ]; - modules.shell.toolset.tmux.enable = true; + modules.${user}.shell.toolset.tmux.enable = true; - hm.programs.ghostty = { + home-manager.users.${user}.programs.ghostty = { enable = true; settings = { background-blur-radius = 20; diff --git a/modules/develop/default.nix b/modules/home/develop/default.nix similarity index 100% rename from modules/develop/default.nix rename to modules/home/develop/default.nix diff --git a/modules/develop/dotnet.nix b/modules/home/develop/dotnet.nix similarity index 100% rename from modules/develop/dotnet.nix rename to modules/home/develop/dotnet.nix diff --git a/modules/develop/js.nix b/modules/home/develop/js.nix similarity index 100% rename from modules/develop/js.nix rename to modules/home/develop/js.nix diff --git a/modules/develop/rust.nix b/modules/home/develop/rust.nix similarity index 100% rename from modules/develop/rust.nix rename to modules/home/develop/rust.nix diff --git a/modules/shell/default.nix b/modules/home/shell/default.nix similarity index 84% rename from modules/shell/default.nix rename to modules/home/shell/default.nix index 54054bf..e33a138 100644 --- a/modules/shell/default.nix +++ b/modules/home/shell/default.nix @@ -1,12 +1,12 @@ -{ options, config, lib, pkgs, ... }: +{ options, config, lib, pkgs, user, ... }: let inherit (lib.attrsets) attrValues; inherit (lib.modules) mkIf mkMerge; - cfg = config.modules.shell; + cfg = config.modules.${user}.shell; in { - options.modules.shell = let + options.modules.${user}.shell = let inherit (lib.options) mkOption mkEnableOption; inherit (lib.types) nullOr enum; in { @@ -33,7 +33,7 @@ in tmux.enable = true; }; - hm.programs.direnv = { + home-manager.users.${user}.programs.direnv = { enable = true; nix-direnv.enable = true; config.whitelist.prefix = ["/home"]; @@ -46,7 +46,7 @@ in rgFull = pkgs.ripgrep.override {withPCRE2 = true;}; }; - hm.programs = { + home-manager.users.${user}.programs = { bat.enable = true; eza.enable = true; fzf.enable = true; diff --git a/modules/shell/toolset/btop.nix b/modules/home/shell/toolset/btop.nix similarity index 91% rename from modules/shell/toolset/btop.nix rename to modules/home/shell/toolset/btop.nix index 74a71d3..5e5f934 100644 --- a/modules/shell/toolset/btop.nix +++ b/modules/home/shell/toolset/btop.nix @@ -1,15 +1,15 @@ -{ config, options, lib, pkgs, ... }: +{ config, options, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf; inherit (lib.strings) concatStringsSep; in { - options.modules.shell.toolset.btop = let + options.modules.${user}.shell.toolset.btop = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "system-monitor"; }; - config = mkIf config.modules.shell.toolset.btop.enable { - hm.programs.btop = let + config = mkIf config.modules.${user}.shell.toolset.btop.enable { + home-manager.users.${user}.programs.btop = let inherit (config.modules.themes) active; in { @@ -25,7 +25,6 @@ in background_update = true; disks_filter = "exclude=/boot"; -# color_theme = "${active}"; rounded_corners = true; theme_background = false; truecolor = true; diff --git a/modules/shell/toolset/fzf.nix b/modules/home/shell/toolset/fzf.nix similarity index 84% rename from modules/shell/toolset/fzf.nix rename to modules/home/shell/toolset/fzf.nix index 65ba711..749cff0 100644 --- a/modules/shell/toolset/fzf.nix +++ b/modules/home/shell/toolset/fzf.nix @@ -4,12 +4,12 @@ let inherit (lib.modules) mkIf; in { - options.modules.shell.toolset.fzf = let + options.modules.${user}.shell.toolset.fzf = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "TUI Fuzzy Finder."; }; - config = mkIf config.modules.shell.toolset.fzf.enable { - hm.programs.fzf = let + config = mkIf config.modules.${user}.shell.toolset.fzf.enable { + home-manager.users.${user}.programs.fzf = let defShell = config.modules.shell.default; in { enable = true; diff --git a/modules/shell/toolset/git.nix b/modules/home/shell/toolset/git.nix similarity index 92% rename from modules/shell/toolset/git.nix rename to modules/home/shell/toolset/git.nix index 507a803..2d79838 100644 --- a/modules/shell/toolset/git.nix +++ b/modules/home/shell/toolset/git.nix @@ -1,15 +1,15 @@ -{ config, options, lib, pkgs, ... }: +{ config, options, lib, pkgs, user, ... }: let inherit (builtins) readFile; inherit (lib.attrsets) attrValues optionalAttrs; inherit (lib.modules) mkIf; in { - options.modules.shell.toolset.git = let + options.modules.${user}.shell.toolset.git = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "version-control system"; }; - config = mkIf config.modules.shell.toolset.git.enable { + config = mkIf config.modules.${user}.shell.toolset.git.enable { user.packages = attrValues ({ inherit (pkgs) act dura lazygit; inherit (pkgs.gitAndTools) gh git-open; @@ -18,12 +18,9 @@ in inherit (pkgs.gitAndTools) git-crypt; }); - # Prevent x11 askPass prompt on git push: - programs.ssh.askPassword = ""; - environment.sessionVariables.GITHUB_TOKEN = "$(cat /run/agenix/tokenGH)"; - hm.programs = { + home-manager.users.${user}.programs = { zsh.initExtra = '' # -------===[ Helpful Git Fn's ]===------- # gitignore() { diff --git a/modules/shell/toolset/gnupg.nix b/modules/home/shell/toolset/gnupg.nix similarity index 80% rename from modules/shell/toolset/gnupg.nix rename to modules/home/shell/toolset/gnupg.nix index 008666b..39ff3b5 100644 --- a/modules/shell/toolset/gnupg.nix +++ b/modules/home/shell/toolset/gnupg.nix @@ -3,17 +3,17 @@ let inherit (builtins) getEnv; inherit (lib.modules) mkIf; - cfg = config.modules.shell.toolset.gnupg; + cfg = config.modules.${user}.shell.toolset.gnupg; in { - options.modules.shell.toolset.gnupg = let + options.modules.${user}.shell.toolset.gnupg = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "cryptographic suite"; }; config = mkIf config.modules.shell.toolset.gnupg.enable { environment.variables.GNUPGHOME = "$XDG_CONFIG_HOME/gnupg"; - programs.gnupg.agent = { + home-manager.users.${user}.programs.gnupg.agent = { enable = true; enableSSHSupport = true; pinentryPackage = pkgs.pinentry-gnome3; diff --git a/modules/shell/toolset/starship.nix b/modules/home/shell/toolset/starship.nix similarity index 89% rename from modules/shell/toolset/starship.nix rename to modules/home/shell/toolset/starship.nix index be9c11a..8907bff 100644 --- a/modules/shell/toolset/starship.nix +++ b/modules/home/shell/toolset/starship.nix @@ -1,14 +1,14 @@ -{ config, options, lib, pkgs, ... }: +{ config, options, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf; in { - options.modules.shell.toolset.starship = let + options.modules.${user}.shell.toolset.starship = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "minimal shell ricing"; }; - config = mkIf config.modules.shell.toolset.starship.enable { - hm.programs.starship = { + config = mkIf config.modules.${user}.shell.toolset.starship.enable { + home-manager.users.${user}.programs.starship = { enable = true; settings = let inherit (config.lib.stylix.colors) cyan red magenta yellow green blue; diff --git a/modules/shell/toolset/tmux.nix b/modules/home/shell/toolset/tmux.nix similarity index 93% rename from modules/shell/toolset/tmux.nix rename to modules/home/shell/toolset/tmux.nix index 7c1b3e8..a018187 100644 --- a/modules/shell/toolset/tmux.nix +++ b/modules/home/shell/toolset/tmux.nix @@ -1,14 +1,14 @@ -{ config, options, lib, pkgs, ... }: +{ config, options, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf; in { - options.modules.shell.toolset.tmux = let + options.modules.${user}.shell.toolset.tmux = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "terminal multiplexer"; }; - config = mkIf config.modules.shell.toolset.tmux.enable { - hm.programs.tmux = { + config = mkIf config.modules.${user}.shell.toolset.tmux.enable { + home-manager.users.${user}.programs.tmux = { enable = true; secureSocket = true; keyMode = "vi"; diff --git a/modules/home/shell/zsh.nix b/modules/home/shell/zsh.nix new file mode 100644 index 0000000..cfb0509 --- /dev/null +++ b/modules/home/shell/zsh.nix @@ -0,0 +1,99 @@ +{ config, options, pkgs, lib, ... }: +let + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.modules) mkIf; + inherit (lib.strings) concatStrings escapeNixString; + + cfg = config.modules.shell; +in +{ + config = mkIf (cfg.default == "zsh") { + modules.shell = { + corePkgs.enable = true; + toolset = { + starship.enable = true; + }; + }; + + home-manager.users.${user}.programs.starship.enableZshIntegration = true; + + # Enable completion for sys-packages: + environment.pathsToLink = ["/share/zsh"]; + + home-manager.users.${user}.programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + + history = { + size = 10000; + path = "$XDG_CONFIG_HOME/zsh/history"; + }; + + oh-my-zsh = { + enable = true; + plugins = ["git" "docker-compose" "zoxide"]; + }; + + plugins = let + mkZshPlugin = { + pkg, + file ? "${pkg.pname}.plugin.zsh", + }: { + name = pkg.pname; + src = pkg.src; + inherit file; + }; + in + with pkgs; [ + (mkZshPlugin {pkg = zsh-abbr;}) + (mkZshPlugin {pkg = zsh-autopair;}) + (mkZshPlugin {pkg = zsh-you-should-use;}) + (mkZshPlugin { + pkg = zsh-nix-shell; + file = "nix-shell.plugin.zsh"; + }) + + { + name = "zsh-autosuggestion"; + src = pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-autosuggestions"; + rev = "v0.7.0"; + sha256 = "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98"; + }; + } + { + name = "zsh-completions"; + src = pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-completions"; + rev = "0.34.0"; + sha256 = "0jjgvzj3v31yibjmq50s80s3sqi4d91yin45pvn3fpnihcrinam9"; + }; + } + { + name = "zsh-syntax-highlighting"; + src = pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-syntax-highlighting"; + rev = "0.7.0"; + sha256 = "0s1z3whzwli5452h2yzjzzj27pf1hd45g223yv0v6hgrip9f853r"; + }; + } + ]; + }; + + home-manager.users.${user}.xdg.configFile."zsh-abbreviations" = { + target = "zsh/abbreviations"; + text = let + abbrevs = import "${config.sneeuwvlok.configDir}/shell-abbr"; + in '' + ${concatStrings (mapAttrsToList + (k: v: "abbr ${k}=${escapeNixString v}") + abbrevs + )} + ''; + }; + }; +} diff --git a/modules/themes/catppuccin-latte.jpg b/modules/home/themes/catppuccin-latte.jpg similarity index 100% rename from modules/themes/catppuccin-latte.jpg rename to modules/home/themes/catppuccin-latte.jpg diff --git a/modules/themes/default.nix b/modules/home/themes/default.nix similarity index 90% rename from modules/themes/default.nix rename to modules/home/themes/default.nix index 6994746..17d58d0 100644 --- a/modules/themes/default.nix +++ b/modules/home/themes/default.nix @@ -1,4 +1,4 @@ -{ inputs, config, options, lib, pkgs, ... }: +{ inputs, config, options, lib, pkgs, user, ... }: let inherit (builtins) getEnv map; inherit (lib.attrsets) attrValues mapAttrsToList; @@ -6,14 +6,14 @@ let inherit (lib.modules) mkIf mkMerge; inherit (lib.strings) concatStringsSep optionalString; - cfg = config.modules.themes; - desktop = config.modules.desktop; + cfg = config.modules.${user}.themes; + desktop = config.modules.${user}.desktop; in { imports = [ inputs.stylix.nixosModules.stylix ]; - options.modules.themes = let + options.modules.${user}.themes = let inherit (lib.options) mkOption mkEnableOption; inherit (lib.types) nullOr enum; in { diff --git a/modules/themes/everforest.jpg b/modules/home/themes/everforest.jpg similarity index 100% rename from modules/themes/everforest.jpg rename to modules/home/themes/everforest.jpg diff --git a/modules/xgd.nix b/modules/home/xgd.nix similarity index 92% rename from modules/xgd.nix rename to modules/home/xgd.nix index aa27891..4af3989 100644 --- a/modules/xgd.nix +++ b/modules/home/xgd.nix @@ -1,6 +1,6 @@ -{ config, ... }: +{ config, user, ... }: { - hm.xdg.enable = true; + home-manager.users.${user}.xdg.enable = true; environment = { sessionVariables = { diff --git a/modules/shell/zsh.nix b/modules/shell/zsh.nix deleted file mode 100644 index d2b8a2a..0000000 --- a/modules/shell/zsh.nix +++ /dev/null @@ -1,174 +0,0 @@ -{ config, options, pkgs, lib, ... }: -let - inherit (lib.attrsets) mapAttrsToList; - inherit (lib.modules) mkIf; - inherit (lib.strings) concatStrings escapeNixString; - - cfg = config.modules.shell; -in -{ - config = mkIf (cfg.default == "zsh") { - modules.shell = { - corePkgs.enable = true; - toolset = { - starship.enable = true; - }; - }; - - hm.programs.starship.enableZshIntegration = true; - - # Enable completion for sys-packages: - environment.pathsToLink = ["/share/zsh"]; - - programs.zsh.enable = true; - - hm.programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestion.enable = true; - - history = { - size = 10000; - path = "$XDG_CONFIG_HOME/zsh/history"; - }; - - oh-my-zsh = { - enable = true; - plugins = ["git" "docker-compose" "zoxide"]; - }; - - plugins = let - mkZshPlugin = { - pkg, - file ? "${pkg.pname}.plugin.zsh", - }: { - name = pkg.pname; - src = pkg.src; - inherit file; - }; - in - with pkgs; [ - (mkZshPlugin {pkg = zsh-abbr;}) - (mkZshPlugin {pkg = zsh-autopair;}) - (mkZshPlugin {pkg = zsh-you-should-use;}) - (mkZshPlugin { - pkg = zsh-nix-shell; - file = "nix-shell.plugin.zsh"; - }) - - { - name = "zsh-autosuggestion"; - src = pkgs.fetchFromGitHub { - owner = "zsh-users"; - repo = "zsh-autosuggestions"; - rev = "v0.7.0"; - sha256 = "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98"; - }; - } - { - name = "zsh-completions"; - src = pkgs.fetchFromGitHub { - owner = "zsh-users"; - repo = "zsh-completions"; - rev = "0.34.0"; - sha256 = "0jjgvzj3v31yibjmq50s80s3sqi4d91yin45pvn3fpnihcrinam9"; - }; - } - { - name = "zsh-syntax-highlighting"; - src = pkgs.fetchFromGitHub { - owner = "zsh-users"; - repo = "zsh-syntax-highlighting"; - rev = "0.7.0"; - sha256 = "0s1z3whzwli5452h2yzjzzj27pf1hd45g223yv0v6hgrip9f853r"; - }; - } - ]; - -# syntaxHighlighting = let -# inherit (config.modules.themes) active; -# in -# mkIf (active != null) { -# enable = true; -# highlighters = ["main" "brackets" "pattern" "cursor" "regexp" "root" "line"]; -# patterns = { -# "sudo " = "fg=red,bold"; -# "rm -rf *" = "fg=red,bold"; -# }; -# styles = { -# # -------===[ Comments ]===------- # -# comment = "fg=black"; -# -# # -------===[ Functions/Methods ]===------- # -# alias = "fg=magenta"; -# "suffix-alias" = "fg=magenta"; -# "global-alias" = "fg=magenta"; -# function = "fg=blue"; -# command = "fg=green"; -# precommand = "fg=green,italic"; -# autodirectory = "fg=yellow,italic"; -# "single-hyphen-option" = "fg=yellow"; -# "double-hyphen-option" = "fg=yellow"; -# "back-quoted-argument" = "fg=magenta"; -# -# # -------===[ Built-ins ]===------- # -# builtin = "fg=blue"; -# "reserved-word" = "fg=green"; -# "hashed-command" = "fg=green"; -# -# # -------===[ Punctuation ]===------- # -# commandseparator = "fg=brightRed"; -# "command-substitution-delimiter" = "fg=border"; -# "command-substitution-delimiter-unquoted" = "fg=border"; -# "process-substitution-delimiter" = "fg=border"; -# "back-quoted-argument-delimiter" = "fg=brightRed"; -# "back-double-quoted-argument" = "fg=brightRed"; -# "back-dollar-quoted-argument" = "fg=brightRed"; -# -# # -------===[ Strings ]===------- # -# "command-substitution-quoted" = "fg=brightYellow"; -# "command-substitution-delimiter-quoted" = "fg=brightYellow"; -# "single-quoted-argument" = "fg=brightYellow"; -# "single-quoted-argument-unclosed" = "fg=red"; -# "double-quoted-argument" = "fg=brightYellow"; -# "double-quoted-argument-unclosed" = "fg=red"; -# "rc-quote" = "fg=brightYellow"; -# -# # -------===[ Variables ]===------- # -# "dollar-quoted-argument" = "fg=highlight"; -# "dollar-quoted-argument-unclosed" = "fg=brightRed"; -# "dollar-double-quoted-argument" = "fg=highlight"; -# assign = "fg=highlight"; -# "named-fd" = "fg=highlight"; -# "numeric-fd" = "fg=highlight"; -# -# # -------===[ Non-Exclusive ]===------- # -# "unknown-token" = "fg=red"; -# path = "fg=highlight,underline"; -# path_pathseparator = "fg=brightRed,underline"; -# path_prefix = "fg=highlight,underline"; -# path_prefix_pathseparator = "fg=brightRed,underline"; -# globbing = "fg=highlight"; -# "history-expansion" = "fg=magenta"; -# "back-quoted-argument-unclosed" = "fg=red"; -# redirection = "fg=highlight"; -# arg0 = "fg=highlight"; -# default = "fg=highlight"; -# cursor = "fg=highlight"; -# }; -# }; - }; - - hm.xdg.configFile."zsh-abbreviations" = { - target = "zsh/abbreviations"; - text = let - abbrevs = import "${config.sneeuwvlok.configDir}/shell-abbr"; - in '' - ${concatStrings (mapAttrsToList - (k: v: "abbr ${k}=${escapeNixString v}") - abbrevs - )} - ''; - }; - }; -} diff --git a/modules/common/qbittorrent.nix b/modules/system/common/qbittorrent.nix similarity index 100% rename from modules/common/qbittorrent.nix rename to modules/system/common/qbittorrent.nix diff --git a/modules/networking/default.nix b/modules/system/networking/default.nix similarity index 100% rename from modules/networking/default.nix rename to modules/system/networking/default.nix diff --git a/modules/networking/samba.nix b/modules/system/networking/samba.nix similarity index 100% rename from modules/networking/samba.nix rename to modules/system/networking/samba.nix diff --git a/modules/networking/ssh.nix b/modules/system/networking/ssh.nix similarity index 100% rename from modules/networking/ssh.nix rename to modules/system/networking/ssh.nix diff --git a/modules/options.nix b/modules/system/options.nix similarity index 74% rename from modules/options.nix rename to modules/system/options.nix index 39a87af..2db64fb 100644 --- a/modules/options.nix +++ b/modules/system/options.nix @@ -24,20 +24,20 @@ in }; config = { - user = { - name = "chris"; - description = "Chris Kruining"; - extraGroups = [ "wheel" ]; - isNormalUser = true; - home = "/home/chris"; - group = "users"; - uid = 1000; - }; + # user = { + # name = "chris"; + # description = "Chris Kruining"; + # extraGroups = [ "wheel" ]; + # isNormalUser = true; + # home = "/home/chris"; + # group = "users"; + # uid = 1000; + # }; - users.users.${config.user.name} = mkAliasDefinitions options.user; + # users.users.${config.user.name} = mkAliasDefinitions options.user; # Temp solution... - home-manager.users.${config.user.name}.home.stateVersion = "23.11"; + # home-manager.users.${config.user.name}.home.stateVersion = "23.11"; nix.settings = let inherit (lib) elem attrNames filterAttrs; diff --git a/modules/services/auth.nix b/modules/system/services/auth.nix similarity index 100% rename from modules/services/auth.nix rename to modules/system/services/auth.nix diff --git a/modules/services/default.nix b/modules/system/services/default.nix similarity index 100% rename from modules/services/default.nix rename to modules/system/services/default.nix diff --git a/modules/services/games/minecraft.nix b/modules/system/services/games/minecraft.nix similarity index 100% rename from modules/services/games/minecraft.nix rename to modules/system/services/games/minecraft.nix diff --git a/modules/services/games/palworld.nix b/modules/system/services/games/palworld.nix similarity index 100% rename from modules/services/games/palworld.nix rename to modules/system/services/games/palworld.nix diff --git a/modules/services/media.nix b/modules/system/services/media.nix similarity index 100% rename from modules/services/media.nix rename to modules/system/services/media.nix diff --git a/modules/services/nextcloud.nix b/modules/system/services/nextcloud.nix similarity index 100% rename from modules/services/nextcloud.nix rename to modules/system/services/nextcloud.nix diff --git a/modules/services/oidc_clients.yml b/modules/system/services/oidc_clients.yml similarity index 100% rename from modules/services/oidc_clients.yml rename to modules/system/services/oidc_clients.yml diff --git a/modules/system/audio.nix b/modules/system/system/audio.nix similarity index 100% rename from modules/system/audio.nix rename to modules/system/system/audio.nix diff --git a/modules/system/boot.nix b/modules/system/system/boot.nix similarity index 100% rename from modules/system/boot.nix rename to modules/system/system/boot.nix diff --git a/modules/system/graphics.nix b/modules/system/system/graphics.nix similarity index 100% rename from modules/system/graphics.nix rename to modules/system/system/graphics.nix diff --git a/modules/system/networking.nix b/modules/system/system/networking.nix similarity index 100% rename from modules/system/networking.nix rename to modules/system/system/networking.nix diff --git a/modules/system/security.nix b/modules/system/system/security.nix similarity index 100% rename from modules/system/security.nix rename to modules/system/system/security.nix diff --git a/modules/system/zsa_voyager.nix b/modules/system/system/zsa_voyager.nix similarity index 100% rename from modules/system/zsa_voyager.nix rename to modules/system/system/zsa_voyager.nix diff --git a/modules/virtualisation/default.nix b/modules/system/virtualisation/default.nix similarity index 100% rename from modules/virtualisation/default.nix rename to modules/system/virtualisation/default.nix diff --git a/modules/virtualisation/podman.nix b/modules/system/virtualisation/podman.nix similarity index 100% rename from modules/virtualisation/podman.nix rename to modules/system/virtualisation/podman.nix