diff --git a/hosts/manwe/default.nix b/hosts/manwe/default.nix index 585d9de..9574d38 100644 --- a/hosts/manwe/default.nix +++ b/hosts/manwe/default.nix @@ -12,64 +12,10 @@ }; 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; - }; - # EXPERIMENTS - # services.games.minecraft.enable = true; services.auth.enable = true; - - desktop = { - plasma.enable = true; - - applications = { - communication.enable = true; - email.enable = true; - office.enable = true; - steam.enable = true; - recording.enable = true; - }; - - terminal = { - default = "ghostty"; - alacritty.enable = true; - ghostty.enable = true; - }; - - editors = { - default = "zed"; - vscodium.enable = true; - zed.enable = true; - nvim.enable = true; - nano.enable = true; - kate.enable = true; - }; - - browsers = { - default = "chromium"; - firefox.enable = true; - chrome.enable = true; - }; - - games = { - minecraft.enable = true; - }; - }; - - shell = { - default = "zsh"; - }; }; } diff --git a/hosts/manwe/users/chris/default.nix b/hosts/manwe/users/chris/default.nix index e288dfc..1a6704e 100644 --- a/hosts/manwe/users/chris/default.nix +++ b/hosts/manwe/users/chris/default.nix @@ -1,5 +1,58 @@ -{}: +{ ... }: { - full_name = "WOOOP WOOOP"; - is_trusted = false; + # full_name = "WOOOP WOOOP"; + # is_trusted = false; + + themes = { + enable = true; + theme = "everforest"; + polarity = "dark"; + }; + + develop = { + rust.enable = true; + js.enable = true; + dotnet.enable = true; + }; + + desktop = { + plasma.enable = true; + + applications = { + communication.enable = true; + email.enable = true; + office.enable = true; + steam.enable = true; + recording.enable = true; + }; + + terminal = { + default = "ghostty"; + alacritty.enable = true; + ghostty.enable = true; + }; + + editors = { + default = "zed"; + vscodium.enable = true; + zed.enable = true; + nvim.enable = true; + nano.enable = true; + kate.enable = true; + }; + + browsers = { + default = "chromium"; + firefox.enable = true; + chrome.enable = true; + }; + + games = { + minecraft.enable = true; + }; + }; + + shell = { + default = "zsh"; + }; } diff --git a/hosts/manwe/users/chris/test.nix b/hosts/manwe/users/chris/test.nix new file mode 100644 index 0000000..0fe32ba --- /dev/null +++ b/hosts/manwe/users/chris/test.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + kaas = true; +} diff --git a/lib/nixos.nix b/lib/nixos.nix index 80f1ba0..6c7688f 100644 --- a/lib/nixos.nix +++ b/lib/nixos.nix @@ -7,7 +7,7 @@ args@{ }: let inherit (inputs.nixpkgs.lib) nixosSystem; inherit (builtins) baseNameOf elem map; - inherit (lib.attrsets) filterAttrs; + inherit (lib) filterAttrs attrValues attrNames; inherit (lib.modules) mkAliasOptionModule mkDefault mkIf; inherit (lib.strings) removeSuffix; inherit (self.modules) mapModules mapModulesRec'; @@ -23,6 +23,8 @@ in rec modules = let stateVersion = "23.11"; + + users = attrNames (mapModules "${path}/users" (p: p)); in [ inputs.nixos-boot.nixosModules.default { @@ -38,7 +40,7 @@ in rec inputs.home-manager.nixosModules.home-manager "${path}/hardware.nix" ] - ++ (mapModulesRec' (toString ../modules/system) import); + ++ (mapModulesRec' ../modules/system import); users = { mutableUsers = true; # Set this to false when I get sops with passwords set up properly @@ -55,22 +57,20 @@ in rec users = mapModules "${path}/users" (p: mkHmUser p stateVersion); }; } - { - _module.args.user = "chris"; - - imports = [] - ++ (mapModulesRec' ../modules/home (file: file)); - # ++ (mapModulesRec' ../modules/home (file: file)); - # ++ (mapModulesRec' ../modules/home (file: import file (args // { user = "chris"; }))) - # ++ (mapModulesRec' ../modules/home (file: import file (args // { user = "kaas"; }))); - - modules.chris = (import "${path}/users/chris/default.nix" args); - # modules.kaas = (import "${path}/users/kaas/default.nix" args); - } (filterAttrs (n: v: !elem n ["system"]) attrs) ../. # ../default.nix (import path) - ]; + ] + ++ (map (user: { + _module.args.user = user; + + imports = [ + "${path}/users/${user}/test.nix" + ] + ++ (mapModulesRec' ../modules/home (file: file)); + + modules.${user} = (import "${path}/users/${user}/default.nix" args); + }) users); }; mapHosts = dir: attrs @ {system ? system, ...}: diff --git a/lib/user.nix b/lib/user.nix index 9b850b1..81d77c8 100644 --- a/lib/user.nix +++ b/lib/user.nix @@ -22,7 +22,7 @@ in rec }; mkHmUser = path: stateVersion: let - user = import path {}; + # user = import path {}; name = removeSuffix ".nix" (baseNameOf path); in { diff --git a/modules/home/desktop/browsers/chrome.nix b/modules/home/desktop/browsers/chrome.nix index 3273be6..4171ca9 100644 --- a/modules/home/desktop/browsers/chrome.nix +++ b/modules/home/desktop/browsers/chrome.nix @@ -16,7 +16,7 @@ in { }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ + user.packages = with pkgs; [ (ungoogled-chromium.override { commandLineArgs = [ "--enable-features=AcceleratedVideoEncoder" @@ -28,7 +28,7 @@ in { }) ]; - home-manager.users.${user}.programs.chromium = { + programs.chromium = { enable = true; enablePlasmaBrowserIntegration = true; extensions = [ diff --git a/modules/home/desktop/browsers/firefox.nix b/modules/home/desktop/browsers/firefox.nix index f8c228d..8be1e9d 100644 --- a/modules/home/desktop/browsers/firefox.nix +++ b/modules/home/desktop/browsers/firefox.nix @@ -6,6 +6,7 @@ let inherit (lib.strings) concatStrings; cfg = config.modules.${user}.desktop.browsers.firefox; + usr = config.users.users.${user}; in { options.modules.${user}.desktop.browsers.firefox = let inherit (lib.options) mkEnableOption; @@ -15,7 +16,7 @@ in { enable = mkEnableOption "Gecko-based libre browser"; privacy.enable = mkEnableOption "Privacy Focused Firefox fork"; - profileName = mkOpt str config.user.name; + profileName = mkOpt str usr.name; settings = mkOpt' (attrsOf (oneOf [bool int str])) {} '' Firefox preferences set in user.js ''; @@ -69,7 +70,7 @@ in { # Enables userContent.css and userChrome.css for our theme modules "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Stop creating ~/Downloads! - "browser.download.dir" = "${config.user.home}/downloads"; + "browser.download.dir" = "${usr.home}/downloads"; # Disables built-in password manager -> use external PM! "signon.rememberSignons" = false; # Firefox, DO NOT CHECK if you are the default browser.. diff --git a/modules/home/desktop/editors/nano.nix b/modules/home/desktop/editors/nano.nix index 54030f0..969f104 100644 --- a/modules/home/desktop/editors/nano.nix +++ b/modules/home/desktop/editors/nano.nix @@ -11,7 +11,11 @@ in in { enable = mkEnableOption "nano"; }; config = mkIf cfg.enable { - home-manager.users.${user}.programs.nano = { + user.packages = with pkgs; [ + nano + ]; + + programs.nano = { enable = true; syntaxHighlight = true; nanorc = '' diff --git a/modules/home/desktop/editors/nvim.nix b/modules/home/desktop/editors/nvim.nix index 693a31a..dd33342 100644 --- a/modules/home/desktop/editors/nvim.nix +++ b/modules/home/desktop/editors/nvim.nix @@ -15,7 +15,7 @@ in config = mkIf cfg.enable { modules.desktop.editors.nvim.enable = true; - home-manager.users.${user}.programs.nvf = { + programs.nvf = { enable = true; settings = { vim = { diff --git a/modules/home/desktop/plasma.nix b/modules/home/desktop/plasma.nix index 1fcf0e5..7bb1c06 100644 --- a/modules/home/desktop/plasma.nix +++ b/modules/home/desktop/plasma.nix @@ -1,14 +1,14 @@ { config, options, lib, pkgs, user, ... }: let inherit (lib.meta) getExe; - inherit (lib.modules) mkOption mkIf; + inherit (lib.modules) mkIf; cfg = config.modules.${user}.desktop.plasma; in { options.modules.${user}.desktop.plasma = let - inherit (lib.options) mkEnableOption; - in { + inherit (lib.options) mkEnableOption mkOption; + in { enable = mkEnableOption "plasma 6"; autoLogin = mkOption { @@ -42,18 +42,20 @@ in ]; # should enable theme integration with gtk apps (i.e. firefox, thunderbird) - home-manager.users.${user}.programs.dconf.enable = true; + programs.dconf.enable = true; - home-manager.users.${user}.programs.plasma = { - enable = true; + home-manager.users.${user}.programs = { + plasma = { + enable = true; - kwin = { - edgeBarrier = 0; - cornerBarrier = false; - }; + kwin = { + edgeBarrier = 0; + cornerBarrier = false; + }; - spectacle.shortcuts = { - captureRectangularRegion = "Meta+Shift+S"; + spectacle.shortcuts = { + captureRectangularRegion = "Meta+Shift+S"; + }; }; }; }; diff --git a/modules/home/develop/default.nix b/modules/home/develop/default.nix index 2dec8bb..ddc886a 100644 --- a/modules/home/develop/default.nix +++ b/modules/home/develop/default.nix @@ -1,16 +1,16 @@ -{ config, options, lib, pkgs, ... }: +{ config, options, lib, pkgs, user, ... }: let inherit (lib.modules) mkIf; in { - options.modules.develop = let + options.modules.${user}.develop = let inherit (lib.options) mkEnableOption; in { xdg.enable = mkEnableOption "XDG-related conf" // { default = true; }; }; - config = mkIf config.modules.develop.xdg.enable { + config = mkIf config.modules.${user}.develop.xdg.enable { }; } diff --git a/modules/home/develop/dotnet.nix b/modules/home/develop/dotnet.nix index 63cf6b2..5ce6dcc 100644 --- a/modules/home/develop/dotnet.nix +++ b/modules/home/develop/dotnet.nix @@ -1,16 +1,16 @@ -{ inputs, config, options, lib, pkgs, ... }: +{ inputs, config, options, lib, pkgs, user, ... }: let inherit (lib.attrsets) attrValues; inherit (lib.modules) mkIf mkMerge; in { - options.modules.develop.dotnet = let + options.modules.${user}.develop.dotnet = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption ".NET developmnt"; }; - config = mkIf config.modules.develop.dotnet.enable { + config = mkIf config.modules.${user}.develop.dotnet.enable { user.packages = attrValues { inherit (pkgs) dotnet-sdk_8; }; diff --git a/modules/home/develop/js.nix b/modules/home/develop/js.nix index ddcdcfe..cb0b81c 100644 --- a/modules/home/develop/js.nix +++ b/modules/home/develop/js.nix @@ -1,17 +1,17 @@ -{ inputs, config, options, lib, pkgs, ... }: +{ inputs, config, options, lib, pkgs, user, ... }: let inherit (lib.attrsets) attrValues; inherit (lib.modules) mkIf mkMerge; in { - options.modules.develop.js = let + options.modules.${user}.develop.js = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "JS developmnt"; }; config = mkMerge [ - (mkIf config.modules.develop.js.enable { + (mkIf config.modules.${user}.develop.js.enable { user.packages = with pkgs; [ bun nodejs @@ -20,7 +20,7 @@ in }) - (mkIf config.modules.develop.xdg.enable { + (mkIf config.modules.${user}.develop.xdg.enable { # home = { # }; }) diff --git a/modules/home/develop/rust.nix b/modules/home/develop/rust.nix index 29ec559..70b2ee8 100644 --- a/modules/home/develop/rust.nix +++ b/modules/home/develop/rust.nix @@ -1,18 +1,18 @@ -{ inputs, config, options, lib, pkgs, ... }: +{ inputs, config, options, lib, pkgs, user, ... }: let inherit (lib.attrsets) attrValues; inherit (lib.modules) mkIf mkMerge; inherit (lib.meta) getExe; in { - options.modules.develop.rust = let + options.modules.${user}.develop.rust = let inherit (lib.options) mkEnableOption; in { enable = mkEnableOption "Rust developmnt"; }; config = mkMerge [ -# (mkIf config.modules.develop.rust.enable { +# (mkIf config.modules.${user}.develop.rust.enable { # # nixpkgs.overlays = [inputs.rust.overlays.default]; # # user.packages = attrValues { @@ -26,7 +26,7 @@ in # }; # }) # -# (mkIf config.modules.develop.xdg.enable { +# (mkIf config.module.${user}s.develop.xdg.enable { # home = { # sessionVariables.CARGO_HOME = "$XDG_DATA_HOME/cargo"; # sessionPath = ["$CARGO_HOME/bin"]; diff --git a/modules/home/options.nix b/modules/home/options.nix new file mode 100644 index 0000000..41a7702 --- /dev/null +++ b/modules/home/options.nix @@ -0,0 +1,18 @@ +{ lib, user, config, ... }: +{ + options = let + inherit (lib) mkOption; + in + { + kaas = mkOption { + type = lib.types.bool; + default = false; + example = true; + description = ""; + }; + }; + + config = { + modules.${user}.themes.enable = config.kaas; + }; +}