From a3ea8e873a21bb9aec9dceb85e4e2c702965c4c9 Mon Sep 17 00:00:00 2001 From: Hendrik Sokolowski Date: Fri, 10 Nov 2023 16:07:54 +0100 Subject: [PATCH] rewrite user profile to user module --- .../user}/.config/dircolors | 0 .../user}/.config/git/config.nix | 0 .../user}/.config/git/gitmessage.nix | 0 .../user}/.config/git/global_gitignore.nix | 0 .../user}/.config/libinput-gestures.conf | 0 .../user}/.config/mako/config | 0 .../user}/.config/mimeapps.list | 0 .../user}/.config/mutt/base16.muttrc | 0 .../user}/.config/mutt/mailcap | 0 .../user}/.config/mutt/muttrc | 0 .../user}/.config/offlineimap/functions.py | 0 .../user}/.config/user-dirs.dirs | 0 .../user}/.config/user-dirs.locale | 0 .../user}/.config/waybar/colorscheme.css | 0 .../user}/.config/waybar/config | 0 .../user}/.config/waybar/style.css | 0 .../user}/.config/xmodmap | 0 .../user}/.config/xsettingsd/xsettingsd.conf | 0 .../share/nvim/json-schemas/caddy_schema.json | 0 .../user}/.local/share/scripts/base16.sh | 0 {profiles/base-user => modules/user}/.xinitrc | 0 .../user}/assets/wallpaper.jpg | Bin modules/user/default.nix | 43 ++++++++++++++++-- {profiles/base-user => modules/user}/home.nix | 1 + .../base-user => modules/user}/mimeapps.nix | 0 .../user}/session-variables.nix | 0 profiles/base-user/default.nix | 41 ----------------- 27 files changed, 41 insertions(+), 44 deletions(-) rename {profiles/base-user => modules/user}/.config/dircolors (100%) rename {profiles/base-user => modules/user}/.config/git/config.nix (100%) rename {profiles/base-user => modules/user}/.config/git/gitmessage.nix (100%) rename {profiles/base-user => modules/user}/.config/git/global_gitignore.nix (100%) rename {profiles/base-user => modules/user}/.config/libinput-gestures.conf (100%) rename {profiles/base-user => modules/user}/.config/mako/config (100%) rename {profiles/base-user => modules/user}/.config/mimeapps.list (100%) rename {profiles/base-user => modules/user}/.config/mutt/base16.muttrc (100%) rename {profiles/base-user => modules/user}/.config/mutt/mailcap (100%) rename {profiles/base-user => modules/user}/.config/mutt/muttrc (100%) rename {profiles/base-user => modules/user}/.config/offlineimap/functions.py (100%) rename {profiles/base-user => modules/user}/.config/user-dirs.dirs (100%) rename {profiles/base-user => modules/user}/.config/user-dirs.locale (100%) rename {profiles/base-user => modules/user}/.config/waybar/colorscheme.css (100%) rename {profiles/base-user => modules/user}/.config/waybar/config (100%) rename {profiles/base-user => modules/user}/.config/waybar/style.css (100%) rename {profiles/base-user => modules/user}/.config/xmodmap (100%) rename {profiles/base-user => modules/user}/.config/xsettingsd/xsettingsd.conf (100%) rename {profiles/base-user => modules/user}/.local/share/nvim/json-schemas/caddy_schema.json (100%) rename {profiles/base-user => modules/user}/.local/share/scripts/base16.sh (100%) rename {profiles/base-user => modules/user}/.xinitrc (100%) rename {profiles/base-user => modules/user}/assets/wallpaper.jpg (100%) rename {profiles/base-user => modules/user}/home.nix (99%) rename {profiles/base-user => modules/user}/mimeapps.nix (100%) rename {profiles/base-user => modules/user}/session-variables.nix (100%) delete mode 100644 profiles/base-user/default.nix diff --git a/profiles/base-user/.config/dircolors b/modules/user/.config/dircolors similarity index 100% rename from profiles/base-user/.config/dircolors rename to modules/user/.config/dircolors diff --git a/profiles/base-user/.config/git/config.nix b/modules/user/.config/git/config.nix similarity index 100% rename from profiles/base-user/.config/git/config.nix rename to modules/user/.config/git/config.nix diff --git a/profiles/base-user/.config/git/gitmessage.nix b/modules/user/.config/git/gitmessage.nix similarity index 100% rename from profiles/base-user/.config/git/gitmessage.nix rename to modules/user/.config/git/gitmessage.nix diff --git a/profiles/base-user/.config/git/global_gitignore.nix b/modules/user/.config/git/global_gitignore.nix similarity index 100% rename from profiles/base-user/.config/git/global_gitignore.nix rename to modules/user/.config/git/global_gitignore.nix diff --git a/profiles/base-user/.config/libinput-gestures.conf b/modules/user/.config/libinput-gestures.conf similarity index 100% rename from profiles/base-user/.config/libinput-gestures.conf rename to modules/user/.config/libinput-gestures.conf diff --git a/profiles/base-user/.config/mako/config b/modules/user/.config/mako/config similarity index 100% rename from profiles/base-user/.config/mako/config rename to modules/user/.config/mako/config diff --git a/profiles/base-user/.config/mimeapps.list b/modules/user/.config/mimeapps.list similarity index 100% rename from profiles/base-user/.config/mimeapps.list rename to modules/user/.config/mimeapps.list diff --git a/profiles/base-user/.config/mutt/base16.muttrc b/modules/user/.config/mutt/base16.muttrc similarity index 100% rename from profiles/base-user/.config/mutt/base16.muttrc rename to modules/user/.config/mutt/base16.muttrc diff --git a/profiles/base-user/.config/mutt/mailcap b/modules/user/.config/mutt/mailcap similarity index 100% rename from profiles/base-user/.config/mutt/mailcap rename to modules/user/.config/mutt/mailcap diff --git a/profiles/base-user/.config/mutt/muttrc b/modules/user/.config/mutt/muttrc similarity index 100% rename from profiles/base-user/.config/mutt/muttrc rename to modules/user/.config/mutt/muttrc diff --git a/profiles/base-user/.config/offlineimap/functions.py b/modules/user/.config/offlineimap/functions.py similarity index 100% rename from profiles/base-user/.config/offlineimap/functions.py rename to modules/user/.config/offlineimap/functions.py diff --git a/profiles/base-user/.config/user-dirs.dirs b/modules/user/.config/user-dirs.dirs similarity index 100% rename from profiles/base-user/.config/user-dirs.dirs rename to modules/user/.config/user-dirs.dirs diff --git a/profiles/base-user/.config/user-dirs.locale b/modules/user/.config/user-dirs.locale similarity index 100% rename from profiles/base-user/.config/user-dirs.locale rename to modules/user/.config/user-dirs.locale diff --git a/profiles/base-user/.config/waybar/colorscheme.css b/modules/user/.config/waybar/colorscheme.css similarity index 100% rename from profiles/base-user/.config/waybar/colorscheme.css rename to modules/user/.config/waybar/colorscheme.css diff --git a/profiles/base-user/.config/waybar/config b/modules/user/.config/waybar/config similarity index 100% rename from profiles/base-user/.config/waybar/config rename to modules/user/.config/waybar/config diff --git a/profiles/base-user/.config/waybar/style.css b/modules/user/.config/waybar/style.css similarity index 100% rename from profiles/base-user/.config/waybar/style.css rename to modules/user/.config/waybar/style.css diff --git a/profiles/base-user/.config/xmodmap b/modules/user/.config/xmodmap similarity index 100% rename from profiles/base-user/.config/xmodmap rename to modules/user/.config/xmodmap diff --git a/profiles/base-user/.config/xsettingsd/xsettingsd.conf b/modules/user/.config/xsettingsd/xsettingsd.conf similarity index 100% rename from profiles/base-user/.config/xsettingsd/xsettingsd.conf rename to modules/user/.config/xsettingsd/xsettingsd.conf diff --git a/profiles/base-user/.local/share/nvim/json-schemas/caddy_schema.json b/modules/user/.local/share/nvim/json-schemas/caddy_schema.json similarity index 100% rename from profiles/base-user/.local/share/nvim/json-schemas/caddy_schema.json rename to modules/user/.local/share/nvim/json-schemas/caddy_schema.json diff --git a/profiles/base-user/.local/share/scripts/base16.sh b/modules/user/.local/share/scripts/base16.sh similarity index 100% rename from profiles/base-user/.local/share/scripts/base16.sh rename to modules/user/.local/share/scripts/base16.sh diff --git a/profiles/base-user/.xinitrc b/modules/user/.xinitrc similarity index 100% rename from profiles/base-user/.xinitrc rename to modules/user/.xinitrc diff --git a/profiles/base-user/assets/wallpaper.jpg b/modules/user/assets/wallpaper.jpg similarity index 100% rename from profiles/base-user/assets/wallpaper.jpg rename to modules/user/assets/wallpaper.jpg diff --git a/modules/user/default.nix b/modules/user/default.nix index 72f9fe0e..f5715a07 100644 --- a/modules/user/default.nix +++ b/modules/user/default.nix @@ -1,12 +1,16 @@ { - lib, config, pkgs, + lib, ... }: with lib; let - cfg = config.pub-solar; -in { + psCfg = config.pub-solar; +in +with lib; { + imports = [ + ./home.nix + ]; options.pub-solar = { user = { name = mkOption { @@ -56,4 +60,37 @@ in { }; }; }; + + config = { + users = { + mutableUsers = false; + + users = with pkgs; + pkgs.lib.setAttrByPath [psCfg.user.name] { + # Indicates whether this is an account for a “real” user. + # This automatically sets group to users, createHome to true, + # home to /home/username, useDefaultShell to true, and isSystemUser to false. + isNormalUser = true; + description = psCfg.user.description; + extraGroups = [ + "input" + "lp" + "networkmanager" + "scanner" + "video" + "dialout" + "wheel" + ]; + shell = pkgs.bash; + initialHashedPassword = + if psCfg.user.password != null + then psCfg.user.password + else ""; + openssh.authorizedKeys.keys = + if psCfg.user.publicKeys != null + then psCfg.user.publicKeys + else []; + }; + }; + }; } diff --git a/profiles/base-user/home.nix b/modules/user/home.nix similarity index 99% rename from profiles/base-user/home.nix rename to modules/user/home.nix index 5b5b5877..4653ca76 100644 --- a/profiles/base-user/home.nix +++ b/modules/user/home.nix @@ -20,6 +20,7 @@ in { # paths it should manage. home.username = psCfg.user.name; home.homeDirectory = "/home/${psCfg.user.name}"; + home.stateVersion = "22.11"; home.packages = with pkgs; []; diff --git a/profiles/base-user/mimeapps.nix b/modules/user/mimeapps.nix similarity index 100% rename from profiles/base-user/mimeapps.nix rename to modules/user/mimeapps.nix diff --git a/profiles/base-user/session-variables.nix b/modules/user/session-variables.nix similarity index 100% rename from profiles/base-user/session-variables.nix rename to modules/user/session-variables.nix diff --git a/profiles/base-user/default.nix b/profiles/base-user/default.nix deleted file mode 100644 index bd8815b0..00000000 --- a/profiles/base-user/default.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: let - psCfg = config.pub-solar; -in { - imports = [ - ./home.nix - ]; - - users = { - mutableUsers = false; - - users = with pkgs; - pkgs.lib.setAttrByPath [psCfg.user.name] { - # Indicates whether this is an account for a “real” user. - # This automatically sets group to users, createHome to true, - # home to /home/username, useDefaultShell to true, and isSystemUser to false. - isNormalUser = true; - description = psCfg.user.description; - extraGroups = [ - "input" - "lp" - "networkmanager" - "scanner" - "video" - "wheel" - ]; - initialHashedPassword = - if psCfg.user.password != null - then psCfg.user.password - else ""; - openssh.authorizedKeys.keys = - if psCfg.user.publicKeys != null - then psCfg.user.publicKeys - else []; - }; - }; -}