refactor(flake): add user registry and multi-user host support
Separate user identity (data) from the reusable modules, and let a host declare any number of users instead of exactly one. - users/registry.nix: per-user identity (name, email, groups, authorized and signing keys) as the single source of identity; no user data is hardcoded in the modules. - mkHost takes a `users` set keyed by username; per-user identity is injected into each home config via the `identity` module arg (extraSpecialArgs is per-host, so it cannot carry per-user data). - modules/users.nix builds accounts from the registry; modules/ssh.nix no longer defines authorized keys (the registry owns them); home/git.nix and home/desktop.nix read `identity`; users/emmathorpe/work.nix drops its now-redundant git identity override. - Restructure the tree: users/, home/, modules/, hosts/, lib/ replace the former lyrathorpe/ and system/ layout. - Add standalone homeConfigurations (the portable subset: shell, git, editor, claude) and an exported homeModules output for use on machines not managed by this flake, or as an input to other flakes. Behaviour-preserving for existing hosts: lyrathorpe-mbp and emmathorpe-edaas evaluate to identical derivations; lyrathorpe-t400, lyrathorpe-macpro31 and lyrathorpe-rpi5 differ only by de-duplicating a repeated authorized_keys entry. Fixes the SSH authorized-key leak (one user's key was applied to every account), the hardcoded default git identity, and the hardcoded EDaaS linger setting.
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
# Graphical desktop layer: GUI apps, Wayland session env, and cursor theme.
|
||||
# Imported only on hosts that run Sway (MBP, T400, Mac Pro); never pulled onto
|
||||
# the headless WSL host. Login (and the Sway session launch) is handled by the
|
||||
# greetd/ReGreet greeter -- see ../modules/sway.nix -- so there is no tty1
|
||||
# autostart.
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
inputs,
|
||||
identity,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./sway.nix
|
||||
];
|
||||
|
||||
home.packages = [
|
||||
pkgs.element-desktop
|
||||
pkgs.legcord
|
||||
pkgs.nemo # file manager (launched via Mod+e, see ./sway.nix)
|
||||
#pkgs.plex-desktop
|
||||
#pkgs.plexamp
|
||||
];
|
||||
|
||||
home.sessionVariables = {
|
||||
MOZ_USE_XINPUT2 = "1";
|
||||
XDG_CURRENT_DESKTOP = "sway";
|
||||
};
|
||||
|
||||
# Default apps for the desktop (writes ~/.config/mimeapps.list). Firefox owns
|
||||
# the web; nemo owns directories/file URIs; images, PDFs and plain text open
|
||||
# in Firefox too -- no dedicated GUI viewer/editor is installed and vim is
|
||||
# terminal-only (no usable GUI .desktop for double-click handoff). Kept
|
||||
# minimal -- only the handlers actually present on these hosts.
|
||||
xdg.mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications = {
|
||||
"text/html" = "firefox.desktop";
|
||||
"x-scheme-handler/http" = "firefox.desktop";
|
||||
"x-scheme-handler/https" = "firefox.desktop";
|
||||
"x-scheme-handler/about" = "firefox.desktop";
|
||||
"x-scheme-handler/unknown" = "firefox.desktop";
|
||||
"inode/directory" = "nemo.desktop";
|
||||
"image/png" = "firefox.desktop";
|
||||
"image/jpeg" = "firefox.desktop";
|
||||
"image/gif" = "firefox.desktop";
|
||||
"image/webp" = "firefox.desktop";
|
||||
"image/svg+xml" = "firefox.desktop";
|
||||
"application/pdf" = "firefox.desktop";
|
||||
"text/plain" = "firefox.desktop";
|
||||
};
|
||||
};
|
||||
|
||||
# Theme GTK apps (nemo, etc.) to match the Catppuccin Mocha desktop. Under
|
||||
# Sway there is no XSettings daemon, so GTK reads these from the generated
|
||||
# ~/.config/gtk-{3,4}.0/settings.ini directly. The Mocha theme is dark by
|
||||
# design, so no separate prefer-dark hint is needed.
|
||||
gtk = {
|
||||
enable = true;
|
||||
# Theme GTK4 apps too (for any added later). GTK4 ignores gtk-theme-name,
|
||||
# but home-manager turns this into an `@import` of the theme's
|
||||
# gtk-4.0/gtk.css into ~/.config/gtk-4.0/gtk.css -- which even libadwaita
|
||||
# honours, since that file overrides the named colours it uses
|
||||
# (window_bg_color, accent_bg_color, ...). Set explicitly (same value as the
|
||||
# legacy default) so it also silences the stateVersion<26.05 warning.
|
||||
gtk4.theme = config.gtk.theme;
|
||||
theme = {
|
||||
name = "catppuccin-mocha-blue-standard";
|
||||
package = pkgs.catppuccin-gtk.override {
|
||||
accents = [ "blue" ];
|
||||
variant = "mocha";
|
||||
};
|
||||
};
|
||||
iconTheme = {
|
||||
name = "Adwaita";
|
||||
package = pkgs.adwaita-icon-theme;
|
||||
};
|
||||
};
|
||||
|
||||
home.pointerCursor = {
|
||||
gtk.enable = true;
|
||||
x11 = {
|
||||
enable = true;
|
||||
defaultCursor = "Adwaita";
|
||||
};
|
||||
package = pkgs.adwaita-icon-theme;
|
||||
name = "Adwaita";
|
||||
size = 24;
|
||||
};
|
||||
|
||||
# Firefox is themed at the browser level (it does not follow the GTK theme).
|
||||
# The system installs the binary (programs.firefox in ../modules/users.nix); here
|
||||
# home-manager owns only the profile, hence package = null. Apply the
|
||||
# Catppuccin Mocha theme add-on (only the mauve accent is packaged upstream;
|
||||
# the rest of the desktop uses blue) and make content + UI dark.
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
package = null;
|
||||
# Keep the legacy profile location (~/.mozilla/firefox) -- that is where the
|
||||
# system Firefox actually looks; pin it explicitly to silence the
|
||||
# stateVersion<26.05 default-change warning (the new XDG path depends on
|
||||
# Firefox's own profile support).
|
||||
configPath = ".mozilla/firefox";
|
||||
profiles.${identity.username} = {
|
||||
id = 0;
|
||||
isDefault = true;
|
||||
extensions = {
|
||||
force = true;
|
||||
packages = [
|
||||
inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system}.catppuccin-mocha-mauve
|
||||
];
|
||||
};
|
||||
settings = {
|
||||
# Enable bundled add-ons automatically so the theme applies on first run.
|
||||
"extensions.autoDisableScopes" = 0;
|
||||
# Dark chrome + dark page content.
|
||||
"ui.systemUsesDarkTheme" = 1;
|
||||
"layout.css.prefers-color-scheme.content-override" = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user