summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2025-08-30 12:31:28 -0500
committerTim Keller <tjk@tjkeller.xyz>2025-08-30 12:31:28 -0500
commit9da942ba47d34210e86a1a709e802eda5c3b95db (patch)
treef7434c4b4c9b8e5271220c11f9b802815c3519c7
parentc3c3d6f1fd19a5da015c9a9d3ae5c54f2d177be0 (diff)
downloadnixos-9da942ba47d34210e86a1a709e802eda5c3b95db.tar.xz
nixos-9da942ba47d34210e86a1a709e802eda5c3b95db.zip
refactor users activation. refactor home manager config to match nixos conf and move tjkeller archetypes to users/timmy. update many of the exising home manager configs to be nicer and better organized. profile archetypes now include homeconfigs which can be enabled per user, and are setup using a new mkProfileArchetype function.
-rw-r--r--.sops.yaml4
-rw-r--r--archetypes/default.nix2
-rw-r--r--archetypes/profiles/desktop/default.nix46
-rw-r--r--archetypes/profiles/headless/default.nix19
-rw-r--r--archetypes/tjkeller/default.nix10
-rw-r--r--archetypes/users/primary.nix37
-rw-r--r--flake.nix36
-rw-r--r--home-manager/clone-repos.nix47
-rw-r--r--home-manager/default.nix25
-rw-r--r--home-manager/firefox.nix159
-rw-r--r--home-manager/git.nix7
-rw-r--r--home-manager/gtk-bookmarks.nix17
-rw-r--r--home-manager/home-cleanup.nix3
-rw-r--r--home-manager/htop.nix82
-rw-r--r--home-manager/initial-home-setup.nix22
-rw-r--r--home-manager/mint-theme.nix43
-rw-r--r--home-manager/pcmanfm.nix17
-rw-r--r--home-manager/qt-gtk-theme.nix15
-rw-r--r--home-manager/resources/activation-scripts/clone-repos.sh17
-rw-r--r--home-manager/theme-st.nix49
-rw-r--r--home-manager/theme.nix101
-rw-r--r--home-manager/userdirs.nix5
-rw-r--r--home-manager/wallpapers.nix13
-rw-r--r--hosts/optiplex/configuration.nix37
-rw-r--r--hosts/optiplex/home.nix4
-rw-r--r--lib/default.nix3
-rw-r--r--lib/mkprofile.nix22
-rw-r--r--nixos/secrets.nix6
-rw-r--r--nixos/services/cgit.nix76
-rw-r--r--nixos/services/gitea.nix28
-rw-r--r--nixos/services/searxng.nix11
-rw-r--r--users/default.nix5
-rw-r--r--users/timmy/default.nix100
-rw-r--r--users/timmy/hosts.nix (renamed from archetypes/tjkeller/hosts.nix)0
-rw-r--r--users/timmy/localization.nix (renamed from archetypes/tjkeller/localization.nix)0
-rw-r--r--users/timmy/nas.nix (renamed from archetypes/tjkeller/nas.nix)4
-rw-r--r--users/timmy/printing.nix (renamed from archetypes/tjkeller/printing.nix)0
-rw-r--r--users/timmy/resources/secrets/hashed-root-password.yaml (renamed from archetypes/tjkeller/resources/secrets/hashed-root-password.yaml)0
-rw-r--r--users/timmy/resources/secrets/wpa_supplicant-conf.yaml (renamed from archetypes/tjkeller/resources/secrets/wpa_supplicant-conf.yaml)0
-rw-r--r--users/timmy/user.nix (renamed from archetypes/tjkeller/user.nix)0
-rw-r--r--users/timmy/wifi.nix (renamed from archetypes/tjkeller/wifi.nix)4
41 files changed, 582 insertions, 494 deletions
diff --git a/.sops.yaml b/.sops.yaml
index 897d7c7..2a6aa9b 100644
--- a/.sops.yaml
+++ b/.sops.yaml
@@ -2,13 +2,13 @@ keys:
- &general age1w80rc0dnuu8nw99gw64c596qqetm78jdnsqajr0u7ephykekr39qfz8vnv
- &flex-wg-router age1f0tmpy2nam58skmznjyqd3zf54rxtfrk6fda0vlpq9y3yg6wac7sjf0vja
creation_rules:
- - path_regex: secrets/hashed-root-password.yaml
+ - path_regex: timmy/resources/secrets/hashed-root-password.yaml
key_groups:
- age:
- *general
- *flex-wg-router
- - path_regex: secrets/wpa_supplicant-conf.yaml
+ - path_regex: timmy/resources/secrets/wpa_supplicant-conf.yaml
key_groups:
- age:
- *general
diff --git a/archetypes/default.nix b/archetypes/default.nix
index f201fc3..52e5eaa 100644
--- a/archetypes/default.nix
+++ b/archetypes/default.nix
@@ -9,7 +9,5 @@
./profiles/desktop
./profiles/headless
-
- ./users/primary.nix
];
}
diff --git a/archetypes/profiles/desktop/default.nix b/archetypes/profiles/desktop/default.nix
index d9a7dc7..7ca1e7c 100644
--- a/archetypes/profiles/desktop/default.nix
+++ b/archetypes/profiles/desktop/default.nix
@@ -1,12 +1,7 @@
{ lib, config, pkgs, ... }: let
mkDesktop = lib.mkOverride 920;
- cfg = config._archetypes.profiles.desktop;
-in {
- options._archetypes.profiles.desktop = {
- enable = lib.mkEnableOption "enable desktop profile";
- };
- config = lib.mkIf cfg.enable {
+ nixosConfig = {
_archetypes.collections = {
desktop = {
utilities.enable = mkDesktop true;
@@ -22,10 +17,6 @@ in {
fonts.enable = mkDesktop true;
};
- _archetypes.users.primary = {
- enable = mkDesktop true;
- };
-
security = {
_doas.enable = mkDesktop true;
};
@@ -45,9 +36,42 @@ in {
tlp.enable = mkDesktop true;
# Ensure video group can change backlight
- udev.extraRules = ''
+ udev.extraRules = mkDesktop ''
SUBSYSTEM=="backlight", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chgrp video /sys/class/backlight/%k/brightness", RUN+="${pkgs.coreutils}/bin/chmod g+w /sys/class/backlight/%k/brightness"
'';
};
};
+
+ homeConfig = {
+ gtk = {
+ enable = mkDesktop true;
+ _mintTheme.enable = mkDesktop true;
+ font.name = mkDesktop "sans-serif";
+ cursorTheme.name = mkDesktop "Adwaita";
+ };
+
+ qt._gtkPlatformTheme.enable = mkDesktop true;
+
+ fonts.fontconfig = {
+ enable = mkDesktop true;
+ defaultFonts = {
+ # These fonts are added above in fonts collection
+ sansSerif = mkDesktop [ "Inter" ];
+ monospace = mkDesktop [ "CommitMono" ];
+ };
+ };
+
+ programs = {
+ _pcmanfm.openAsRootOption.enable = mkDesktop true;
+ firefox._configure = mkDesktop true;
+ htop._configure = mkDesktop true;
+ };
+
+ home._repos = {
+ enable = mkDesktop true;
+ desktop = mkDesktop true;
+ };
+ };
+in {
+ imports = [ (lib._mkProfileArchetype "desktop" nixosConfig homeConfig) ];
}
diff --git a/archetypes/profiles/headless/default.nix b/archetypes/profiles/headless/default.nix
index ef17db0..b391076 100644
--- a/archetypes/profiles/headless/default.nix
+++ b/archetypes/profiles/headless/default.nix
@@ -1,22 +1,13 @@
{ lib, config, ... }: let
mkHeadless = lib.mkOverride 910;
- cfg = config._archetypes.profiles.headless;
-in {
- options._archetypes.profiles.headless = {
- enable = lib.mkEnableOption "enable headless profile";
- };
- config = lib.mkIf cfg.enable {
+ nixosConfig = {
_archetypes.collections = {
development = {
utilities.enable = mkHeadless true;
};
};
- _archetypes.users = {
- primary.enable = mkHeadless true;
- };
-
security = {
_doas.enable = mkHeadless true;
};
@@ -29,4 +20,12 @@ in {
_ssh.enable = mkHeadless true;
};
};
+
+ homeConfig = {
+ home._repos = {
+ enable = mkHeadless true;
+ };
+ };
+in {
+ imports = [ (lib._mkProfileArchetype "headless" nixosConfig homeConfig) ];
}
diff --git a/archetypes/tjkeller/default.nix b/archetypes/tjkeller/default.nix
deleted file mode 100644
index 6a9bbd9..0000000
--- a/archetypes/tjkeller/default.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- imports = [
- ./hosts.nix
- ./localization.nix
- ./nas.nix
- ./printing.nix
- ./user.nix
- ./wifi.nix
- ];
-}
diff --git a/archetypes/users/primary.nix b/archetypes/users/primary.nix
deleted file mode 100644
index a29c3b8..0000000
--- a/archetypes/users/primary.nix
+++ /dev/null
@@ -1,37 +0,0 @@
-{ lib, config, pkgs, userDetails, ... }: let
- cfg = config._archetypes.users.primary;
-in {
- options._archetypes.users.primary = {
- enable = lib.mkEnableOption "create primary user";
- autologin.enable = lib.mkEnableOption "enables getty automatic login";
- };
-
- config = lib.mkIf cfg.enable {
- # Enable zsh
- programs.zsh.enable = true;
-
- # Setup normal user
- users.users.${userDetails.username} = {
- home = userDetails.home;
- description = userDetails.fullname;
- isNormalUser = true;
- shell = pkgs.zsh;
- extraGroups = [
- "nixbld"
- "video"
- "wheel"
- ] ++ lib.optionals config.hardware.i2c.enable [
- "i2c"
- ] ++ lib.optionals config.virtualisation.libvirtd.enable [
- "libvirtd"
- ] ++ lib.optionals config.virtualisation.docker.enable [
- "docker"
- ];
- };
-
- # Configure automatic login with getty
- services.getty = lib.mkIf cfg.autologin.enable {
- autologinUser = userDetails.username;
- };
- };
-}
diff --git a/flake.nix b/flake.nix
index 007bd8e..c9e7d41 100644
--- a/flake.nix
+++ b/flake.nix
@@ -18,49 +18,33 @@ rec {
};
};
- outputs = { nixpkgs, home-manager, arkenfox, ... }@inputs :
+ outputs = { nixpkgs, ... }@inputs :
let
system = "x86_64-linux";
- #pkgs = nixpkgs.legacyPackages.${system};
- userDetails = {
- username = "timmy";
- email = "tjk@tjkeller.xyz";
- fullname = "Tim Keller";
- home = "/home/${userDetails.username}";
- userDirs = with userDetails; {
- desktop = "${home}";
- download = "${home}/dls";
- documents = "${home}/docs";
- pictures = "${home}/pics";
- };
- sshPublicKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDnsnAWcz46OVi1MWSxpOIUtUvwalijDwvW+oEvNjzep" ];
- };
- homeStateVersion = "24.05"; # Lowest of systems is fine
+ extLib = nixpkgs.lib.extend (final: prev: import ./lib);
mkNixosConfiguration = hostname: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit hostname;
- inherit userDetails;
+ lib = extLib;
};
modules = [
./hosts/${hostname}/configuration.nix
- ./nixos
+ ./hosts/${hostname}/hardware-configuration.nix
./archetypes
+ ./nixos
./pkgs
- home-manager.nixosModules.home-manager {
+ ./users
+ inputs.sops-nix.nixosModules.sops
+ inputs.home-manager.nixosModules.home-manager {
home-manager = {
backupFileExtension = "backup"; # In case file is overwritten
useGlobalPkgs = true;
useUserPackages = true;
- users.${userDetails.username} = import ./home-manager;
- extraSpecialArgs = {
- inherit userDetails;
- inherit homeStateVersion;
- };
sharedModules = [
- arkenfox.hmModules.arkenfox
- ./hosts/${hostname}/home.nix
+ inputs.arkenfox.hmModules.arkenfox
+ ./home-manager
];
};
}
diff --git a/home-manager/clone-repos.nix b/home-manager/clone-repos.nix
new file mode 100644
index 0000000..8499760
--- /dev/null
+++ b/home-manager/clone-repos.nix
@@ -0,0 +1,47 @@
+{ config, lib, pkgs, ... }: let
+ cfg = config.home._repos;
+ # TODO MAKE OPTIONS
+ server = "https://git.tjkeller.xyz/";
+ docs = config.xdg.userDirs.documents;
+ dotConfig = config.xdg.configHome;
+ bin = "$HOME/.local/bin";
+ cloneMissing = repo: source: target: ''clonemissing "${repo}" "${source}" "${target}"'';
+in {
+ options.home._repos = {
+ enable = lib.mkEnableOption "clone git repos";
+ desktop = lib.mkEnableOption "clone repos that are for desktop use";
+ };
+
+ config = lib.mkIf cfg.enable {
+ # TODO look into xdg.configFile.<name>
+ home.activation = {
+ cloneRepos = lib.hm.dag.entryAfter ["writeBoundary"] (''
+ export PATH="${pkgs.git}/bin:$PATH"
+ ${builtins.readFile ./resources/activation-scripts/clone-repos.sh}
+ '' + lib.strings.concatStringsSep "\n" ([
+ (cloneMissing "${server}dotconfig" "${docs}/config" dotConfig)
+ (cloneMissing "${server}nixos" "${docs}/nixos" "")
+ (cloneMissing "${server}nvim" "${dotConfig}/nvim" "")
+ (cloneMissing "${server}zsh" "${dotConfig}/zsh" "")
+ ] ++ lib.optionals cfg.desktop [
+ (cloneMissing "${server}scripts" "${docs}/scripts" bin)
+ (cloneMissing "${server}userscripts" "${docs}/userscripts" "")
+ (cloneMissing "${server}awesome" "${dotConfig}/awesome" "")
+ ]));
+ linkZshProfile = lib.hm.dag.entryAfter ["writeBoundary"] ''
+ run ln -sf $VERBOSE_ARG ${dotConfig}/zsh/zprofile $HOME/.zprofile
+ '';
+
+ # TODO look into xdg.mimeApps.defaultApplications
+ #mimewiz = lib.mkIf cfg.desktop (lib.hm.dag.entryAfter ["writeBoundary"] ''
+ # export PATH="${pkgs.xdg-utils}/bin:$PATH"
+ # export PATH="${dotConfig}/misc:$PATH"
+ # run mimewiz -i # already verbose
+ #'');
+ };
+ #home.file.Zprofile = {
+ # source = "${dotConfig}/zsh/zprofile";
+ # target = ".zprofile";
+ #};
+ };
+}
diff --git a/home-manager/default.nix b/home-manager/default.nix
index bcd99eb..26c97c2 100644
--- a/home-manager/default.nix
+++ b/home-manager/default.nix
@@ -1,25 +1,16 @@
-{ lib, userDetails, homeStateVersion, ... }: {
- home = {
- username = userDetails.username;
- homeDirectory = lib.mkForce userDetails.home;
- stateVersion = homeStateVersion;
- };
-
+{
imports = [
+ ./clone-repos.nix
./firefox.nix
- ./git.nix
- ./gtk-bookmarks.nix
+ ./home-cleanup.nix
./htop.nix
- ./initial-home-setup.nix
- ./pcmanfm.nix # TODO mk name changeable & doesn't seem to work right now
+ ./mint-theme.nix
+ ./pcmanfm.nix
+ ./qt-gtk-theme.nix
./theme-st.nix
- ./theme.nix
- ./userdirs.nix
./wallpapers.nix
];
- theme.enable = lib.mkDefault true;
- theme.st.enable = lib.mkDefault false;
- theme.mint.enable = lib.mkDefault true;
- wallpapers.enable = lib.mkDefault false;
+ # Let Home Manager install and manage itself.
+ programs.home-manager.enable = true;
}
diff --git a/home-manager/firefox.nix b/home-manager/firefox.nix
index 8aa1af3..811b811 100644
--- a/home-manager/firefox.nix
+++ b/home-manager/firefox.nix
@@ -1,82 +1,89 @@
-{ lib, pkgs, userDetails, ... }: {
- programs.firefox = {
- enable = lib.mkDefault true;
- arkenfox.enable = true;
- profiles = let
- search = {
- engines = {
- "Timmy Search" = {
- urls = [{
- template = "https://search.tjkeller.xyz/search";
- params = [ { name = "q"; value = "{searchTerms}"; } ];
- }];
- iconURI = "https://search.tjkeller.xyz/static/themes/simple/img/favicon.svg"; # TODO doesn't seem to work
- };
- "Nix Packages" = {
- urls = [{
- template = "https://search.nixos.org/packages";
- params = [ { name = "query"; value = "{searchTerms}"; } ];
- }];
- icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
- definedAliases = [ "@np" ];
- };
- "NixOS Options" = {
- urls = [{
- template = "https://search.nixos.org/options";
- params = [ { name = "query"; value = "{searchTerms}"; } ];
- }];
- icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
- definedAliases = [ "@no" ];
- };
- };
- default = "Timmy Search";
- privateDefault = "Timmy Search";
- force = true; # Overwrite old
- };
- userChrome = builtins.readFile ./resources/firefox/userChrome.css;
- arkenfox = {
- enable = true;
- enableAllSections = true;
- "0100"."0102"."browser.startup.page".value = 3; # 0=blank, 1=home, 2=last visited page, 3=resume previous session
- "0100"."0103"."browser.startup.homepage".enable = false;
- "0100"."0104"."browser.newtabpage.enabled".enable = false;
- #"2800"."2811"."privacy.clearOnShutdown.history".enable = false;
- };
- settings = {
- "browser.compactmode.show" = true;
- "browser.uiCustomization.state" = builtins.readFile ./resources/firefox/uiCustomization.json; # Toolbar etc.
- "browser.uidensity" = 1; # Compact
- "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # userchrome
-
- "app.normandy.first_run" = false;
- "browser.aboutConfig.showWarning" = false; # arkenfox does
- #"browser.download.dir" = userDetails.userDirs.downloads;
- "browser.newtabpage.activity-stream.feeds.section.topstories" = false;
- "browser.newtabpage.activity-stream.feeds.topsites" = false;
- "browser.urlbar.suggest.topsites" = false;
- "devtools.toolbox.host" = "window";
- "dom.push.enabled" = false; #
- "extensions.pocket.enabled" = false;
- "general.smoothScroll" = false;
+{ config, lib, pkgs, ... }: let
+ cfg = config.programs.firefox;
+ search = {
+ engines = {
+ "Timmy Search" = {
+ urls = [{
+ template = "https://search.tjkeller.xyz/search";
+ params = [ { name = "q"; value = "{searchTerms}"; } ];
+ }];
+ iconURI = "https://search.tjkeller.xyz/static/themes/simple/img/favicon.svg"; # TODO doesn't seem to work
};
- workSettings = settings // {
- "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # Use builtin dark theme instead of system theme
+ "Nix Packages" = {
+ urls = [{
+ template = "https://search.nixos.org/packages";
+ params = [ { name = "query"; value = "{searchTerms}"; } ];
+ }];
+ icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
+ definedAliases = [ "@np" ];
};
- in {
- Personal = {
- id = 0;
- isDefault = true;
- inherit search;
- inherit userChrome;
- inherit arkenfox;
- inherit settings;
+ "NixOS Options" = {
+ urls = [{
+ template = "https://search.nixos.org/options";
+ params = [ { name = "query"; value = "{searchTerms}"; } ];
+ }];
+ icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
+ definedAliases = [ "@no" ];
};
- Work = {
- id = 1;
- inherit search;
- inherit userChrome;
- inherit arkenfox;
- settings = workSettings;
+ };
+ default = "Timmy Search";
+ privateDefault = "Timmy Search";
+ force = true; # Overwrite old
+ };
+ userChrome = builtins.readFile ./resources/firefox/userChrome.css;
+ arkenfox = {
+ enable = true;
+ enableAllSections = true;
+ "0100"."0102"."browser.startup.page".value = 3; # 0=blank, 1=home, 2=last visited page, 3=resume previous session
+ "0100"."0103"."browser.startup.homepage".enable = false;
+ "0100"."0104"."browser.newtabpage.enabled".enable = false;
+ #"2800"."2811"."privacy.clearOnShutdown.history".enable = false;
+ };
+ settings = {
+ "browser.compactmode.show" = true;
+ "browser.uiCustomization.state" = builtins.readFile ./resources/firefox/uiCustomization.json; # Toolbar etc.
+ "browser.uidensity" = 1; # Compact
+ "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # userchrome
+
+ "app.normandy.first_run" = false;
+ "browser.aboutConfig.showWarning" = false; # arkenfox does
+ #"browser.download.dir" = userDetails.userDirs.downloads;
+ "browser.newtabpage.activity-stream.feeds.section.topstories" = false;
+ "browser.newtabpage.activity-stream.feeds.topsites" = false;
+ "browser.urlbar.suggest.topsites" = false;
+ "devtools.toolbox.host" = "window";
+ "dom.push.enabled" = false; #
+ "extensions.pocket.enabled" = false;
+ "general.smoothScroll" = false;
+ };
+ workSettings = settings // {
+ "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # Use builtin dark theme instead of system theme
+ };
+in {
+ options.programs.firefox = {
+ _configure = lib.mkEnableOption "configure firefox profiles";
+ };
+
+ config = lib.mkIf cfg._configure {
+ programs.firefox = {
+ enable = lib.mkDefault true;
+ arkenfox.enable = lib.mkDefault true;
+ profiles = {
+ Personal = {
+ id = 0;
+ isDefault = true;
+ inherit search;
+ inherit userChrome;
+ inherit arkenfox;
+ inherit settings;
+ };
+ Work = {
+ id = 1;
+ inherit search;
+ inherit userChrome;
+ inherit arkenfox;
+ settings = workSettings;
+ };
};
};
};
diff --git a/home-manager/git.nix b/home-manager/git.nix
deleted file mode 100644
index 9d15a90..0000000
--- a/home-manager/git.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-{ userDetails, ... }: {
- programs.git = {
- enable = true;
- userName = userDetails.fullname;
- userEmail = userDetails.email;
- };
-}
diff --git a/home-manager/gtk-bookmarks.nix b/home-manager/gtk-bookmarks.nix
deleted file mode 100644
index 24c6563..0000000
--- a/home-manager/gtk-bookmarks.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{ config, lib, userDetails, ... }: {
- options = {
- additional-gtk-bookmarks = lib.mkOption {
- type = with lib.types; listOf str;
- default = [];
- description = "gtk bookmarks for file managers, etc.";
- };
- };
-
- config = {
- gtk.gtk3.bookmarks = (
- lib.mapAttrsToList (name: path:
- "file://${path} ${lib.toUpper (lib.substring 0 1 name)}${lib.substring 1 (-1) name}"
- ) userDetails.userDirs
- ) ++ config.additional-gtk-bookmarks;
- };
-}
diff --git a/home-manager/home-cleanup.nix b/home-manager/home-cleanup.nix
new file mode 100644
index 0000000..b124342
--- /dev/null
+++ b/home-manager/home-cleanup.nix
@@ -0,0 +1,3 @@
+{ config, ... }: {
+ gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
+}
diff --git a/home-manager/htop.nix b/home-manager/htop.nix
index 523fee8..36ccbac 100644
--- a/home-manager/htop.nix
+++ b/home-manager/htop.nix
@@ -1,38 +1,46 @@
-{ config, ... }: {
- programs.htop.enable = true;
- programs.htop.settings = {
- fields = with config.lib.htop.fields; [
- PID
- USER
- 124 # EXE
- PERCENT_CPU
- PERCENT_MEM
- STARTTIME
- ELAPSED # time elapsed since process start
- IO_READ_RATE
- RBYTES # num read bytes
- IO_WRITE_RATE
- WBYTES # num written bytes
- TIME
- STIME # sys time
- CSTIME # child sys time
- NICE
- STATE
- PRIORITY
- 125 # CWD
- ];
- } // (with config.lib.htop; leftMeters [
- (bar "AllCPUs2")
- (bar "CPU")
- (bar "Memory")
- (bar "DiskIO")
- (bar "NetworkIO")
- ]) // (with config.lib.htop; rightMeters [
- (text "Hostname")
- (text "Clock")
- (text "Uptime")
- (text "Battery")
- (text "LoadAverage")
- (text "Tasks")
- ]);
+{ config, lib, ... }: let
+ cfg = config.programs.htop;
+in {
+ options.programs.htop = {
+ _configure = lib.mkEnableOption "apply sensible defaults to htop";
+ };
+
+ config = lib.mkIf cfg._configure {
+ programs.htop.enable = lib.mkDefault true;
+ programs.htop.settings = {
+ fields = with config.lib.htop.fields; [
+ PID
+ USER
+ 124 # EXE
+ PERCENT_CPU
+ PERCENT_MEM
+ STARTTIME
+ ELAPSED # time elapsed since process start
+ IO_READ_RATE
+ RBYTES # num read bytes
+ IO_WRITE_RATE
+ WBYTES # num written bytes
+ TIME
+ STIME # sys time
+ CSTIME # child sys time
+ NICE
+ STATE
+ PRIORITY
+ 125 # CWD
+ ];
+ } // (with config.lib.htop; leftMeters [
+ (bar "AllCPUs2")
+ (bar "CPU")
+ (bar "Memory")
+ (bar "DiskIO")
+ (bar "NetworkIO")
+ ]) // (with config.lib.htop; rightMeters [
+ (text "Hostname")
+ (text "Clock")
+ (text "Uptime")
+ (text "Battery")
+ (text "LoadAverage")
+ (text "Tasks")
+ ]);
+ };
}
diff --git a/home-manager/initial-home-setup.nix b/home-manager/initial-home-setup.nix
deleted file mode 100644
index 4132386..0000000
--- a/home-manager/initial-home-setup.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ config, lib, pkgs, userDetails, ... }: {
- home.activation = {
- cloneRepos = lib.hm.dag.entryAfter ["writeBoundary"] ''
- export PATH="${config.home.path}/bin:$PATH"
- ${builtins.readFile ./resources/activation-scripts/clone-repos.sh}
- '';
- linkZshProfile = lib.hm.dag.entryAfter ["writeBoundary"] ''
- run ln -sf $VERBOSE_ARG $HOME/.config/zsh/zprofile $HOME/.zprofile
- '';
- cleanupHome = lib.hm.dag.entryAfter ["writeBoundary"] ''
- run rm -f $VERBOSE_ARG $HOME/{.zcompdump,.zshrc,.zsh_history,.bash_history}
- '';
- mimewiz = lib.hm.dag.entryAfter ["writeBoundary"] ''
- export PATH="${pkgs.xdg-utils}/bin:$PATH"
- export PATH="$HOME/.local/bin/misc:$PATH"
- run mimewiz -i # already verbose
- '';
- createDirs = lib.hm.dag.entryAfter ["writeBoundary"] ''
- run mkdir -p $VERBOSE_ARG ${ lib.concatStringsSep " " (lib.attrValues userDetails.userDirs) }
- '';
- };
-}
diff --git a/home-manager/mint-theme.nix b/home-manager/mint-theme.nix
new file mode 100644
index 0000000..a77be6a
--- /dev/null
+++ b/home-manager/mint-theme.nix
@@ -0,0 +1,43 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.gtk._mintTheme; # gtk.theme type is null or submodule under the hood so gtk.theme._mint, etc. can't be used
+ transformColorValue = color: dark:
+ "Mint-Y" + lib.optionalString dark "-Dark"
+ + lib.optionalString (color != "Green") ("-" + color)
+ ;
+in {
+ options.gtk._mintTheme = {
+ enable = lib.mkEnableOption "enables mint theme";
+ color = lib.mkOption {
+ type = lib.types.enum [
+ "Aqua" "Blue" "Green" "Grey" "Orange"
+ "Pink" "Purple" "Red" "Sand" "Teal"
+ ];
+ default = "Green";
+ description = "mint-y theme color";
+ };
+ dark = lib.mkEnableOption "whether to use dark variant of mint theme";
+ icons.color = lib.mkOption {
+ type = lib.types.enum [
+ "Aqua" "Blue" "Green" "Grey" "Orange" "Pink" "Purple" "Red"
+ "Sand" "Teal"
+ ];
+ default = "Aqua";
+ description = "mint-y icons color eg. 'Aqua' or 'Red'";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ gtk = {
+ enable = true;
+ theme = {
+ package = pkgs.mint-themes;
+ name = transformColorValue cfg.color cfg.dark;
+ };
+ iconTheme = {
+ package = pkgs.mint-y-icons;
+ name = transformColorValue cfg.icons.color false;
+ };
+ };
+ };
+}
diff --git a/home-manager/pcmanfm.nix b/home-manager/pcmanfm.nix
index 3c70521..a99fb15 100644
--- a/home-manager/pcmanfm.nix
+++ b/home-manager/pcmanfm.nix
@@ -1,6 +1,15 @@
-{
- home.file.pcmanfm-root = {
- target = ".local/share/file-manager/actions/root.desktop";
- source = ./resources/pcmanfm/root.desktop;
+{ config, lib, ... }: let
+ cfg = config.programs._pcmanfm.openAsRootOption;
+in {
+ options.programs._pcmanfm.openAsRootOption = {
+ enable = lib.mkEnableOption "enable 'open as root' option in pcmanfm right-click menu";
+ };
+
+ config = lib.mkIf cfg.enable {
+ home.file.pcmanfm-root = {
+ target = ".local/share/file-manager/actions/root.desktop";
+ # FIXME this action uses an absolute path pls fix
+ source = ./resources/pcmanfm/root.desktop;
+ };
};
}
diff --git a/home-manager/qt-gtk-theme.nix b/home-manager/qt-gtk-theme.nix
new file mode 100644
index 0000000..2e53ccc
--- /dev/null
+++ b/home-manager/qt-gtk-theme.nix
@@ -0,0 +1,15 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.qt._gtkPlatformTheme;
+in {
+ options.qt._gtkPlatformTheme = {
+ enable = lib.mkEnableOption "use gtk theme in qt";
+ };
+
+ config = lib.mkIf cfg.enable {
+ qt = {
+ enable = lib.mkDefault true;
+ platformTheme.name = "gtk3";
+ };
+ };
+}
diff --git a/home-manager/resources/activation-scripts/clone-repos.sh b/home-manager/resources/activation-scripts/clone-repos.sh
index eaee4dc..adf8fd7 100644
--- a/home-manager/resources/activation-scripts/clone-repos.sh
+++ b/home-manager/resources/activation-scripts/clone-repos.sh
@@ -1,7 +1,5 @@
#!/bin/sh
-server="https://git.tjkeller.xyz/"
-
clonemissing() {
# pull and return if already existing
if [ -d "$2"/.git ]; then
@@ -10,21 +8,12 @@ clonemissing() {
return
fi
- # clone to $2
+ # clone $1 to $2
run mkdir -p $VERBOSE_ARG "$2"
- run git clone $VERBOSE_ARG "$server$1" "$2"
+ run git clone $VERBOSE_ARG "$1" "$2"
- # link to $3
+ # link files to $3
[ -z "$3" ] && return
run mkdir -p $VERBOSE_ARG "$3"
run ln -sf $VERBOSE_ARG "$2"/* "$3"
}
-
-# # repo # clone to # link to
-clonemissing scripts $HOME/docs/src/scripts $HOME/.local/bin
-clonemissing dotconfig $HOME/docs/src/config $HOME/.config
-clonemissing userscripts $HOME/docs/src/userscripts ''
-clonemissing nixos $HOME/docs/src/nixos ''
-clonemissing awesome $HOME/.config/awesome ''
-clonemissing nvim $HOME/.config/nvim ''
-clonemissing zsh $HOME/.config/zsh ''
diff --git a/home-manager/theme-st.nix b/home-manager/theme-st.nix
index 0a06cd0..aa4ddbb 100644
--- a/home-manager/theme-st.nix
+++ b/home-manager/theme-st.nix
@@ -1,22 +1,41 @@
-{ config, lib, pkgs, ... }: {
- options = {
- theme.st = {
- enable = lib.mkEnableOption "enables theming st with home manager";
- font = lib.mkOption {
+{ config, lib, pkgs, ... }: let
+ cfg = config.programs._st;
+ generateXftFontString = name: attrs:
+ name + lib.optionalString lib.attrIsEmpty attrs (
+ ":" + builtins.concatStringsSep ":" (
+ lib.mapAttrsToList (key: value: "${key}=${value}") attrs
+ )
+ )
+ ;
+ themed-st = pkgs.st.overrideAttrs (old: {
+ buildInputs = old.buildInputs or [] ++ [ pkgs.makeWrapper ];
+ postInstall = old.postInstall or "" + ''
+ wrapProgram $out/bin/st \
+ --add-flags '-f"${generateXftFontString cfg.font.name cfg.font.attrs}"'
+ '';
+ });
+in {
+ options.programs._st = {
+ enable = lib.mkEnableOption "enables theming st with home manager";
+ font = {
+ name = lib.mkOption {
type = lib.types.str;
- default = "JetBrainsMonoNL Nerd Font Mono:size=12:antialias=true:autohint=true";
+ example = "JetBrainsMonoNL Nerd Font Mono";
+ default = "monospace";
+ };
+ attrs = {
+ type = lib.types.attrs;
+ default = {};
+ example = {
+ size = 12;
+ antialias = true;
+ autohint = true;
+ };
};
};
};
- config = let
- themed-st = pkgs.st.overrideAttrs (old: {
- buildInputs = old.buildInputs or [] ++ [ pkgs.makeWrapper ];
- postInstall = old.postInstall or "" + ''
- wrapProgram $out/bin/st \
- --add-flags '-f"${config.theme.st.font}"'
- '';
- });
- in lib.mkIf config.theme.enable {
+
+ config = lib.mkIf cfg.enable {
home.packages = [ themed-st ];
};
}
diff --git a/home-manager/theme.nix b/home-manager/theme.nix
deleted file mode 100644
index 9e4edae..0000000
--- a/home-manager/theme.nix
+++ /dev/null
@@ -1,101 +0,0 @@
-{ config, lib, pkgs, ... }:
-let
- transformColorValue = color :
- if color == "Green" then "Mint-Y"
- else if color == "Dark-Green" then "Mint-Y-Dark"
- else "Mint-Y-${color}"
- ;
-in {
- options = {
- theme.enable = lib.mkEnableOption "enables theming";
- theme.mint = {
- enable = lib.mkEnableOption "enables mint theme";
- # TODO add theme.dark option instead of specifying Dark-Color
- theme.color = lib.mkOption {
- type = lib.types.enum [
- "Aqua" "Blue" "Green" "Grey" "Orange" "Pink" "Purple" "Red"
- "Sand" "Teal" "Dark-Aqua" "Dark-Blue" "Dark-Green"
- "Dark-Grey" "Dark-Orange" "Dark-Pink" "Dark-Purple"
- "Dark-Red" "Dark-Sand" "Dark-Teal"
- ];
- default = "Dark-Aqua";
- description = "mint-y theme color eg. 'Dark-Aqua' or 'Red'";
- };
- icons.color = lib.mkOption {
- type = lib.types.enum [
- "Aqua" "Blue" "Green" "Grey" "Orange" "Pink" "Purple" "Red"
- "Sand" "Teal"
- ];
- default = "Aqua";
- description = "mint-y icons color eg. 'Aqua' or 'Red'";
- };
- };
- theme.font = {
- sansSerif = lib.mkOption {
- type = lib.types.str;
- default = "Inter";
- description = "default sans serif font";
- };
- monospace = lib.mkOption {
- type = lib.types.str;
- default = "CommitMono";
- description = "default monospace font";
- };
- gtk = {
- name = lib.mkOption {
- type = lib.types.str;
- default = "sans-serif";
- description = "default gtk font";
- };
- size = lib.mkOption {
- type = with lib.types; nullOr int;
- default = null;
- description = "default gtk font size";
- };
- };
- };
- theme.cursor = {
- name = lib.mkOption {
- type = lib.types.str;
- default = "Adwaita";
- description = "gtk cursor theme";
- };
- size = lib.mkOption {
- type = with lib.types; nullOr int;
- default = null;
- description = "gtk cursor size";
- };
- };
- };
-
- config = lib.mkIf config.theme.enable {
- gtk = {
- enable = true;
- theme = lib.mkIf config.theme.mint.enable {
- package = pkgs.mint-themes;
- name = transformColorValue config.theme.mint.theme.color;
- };
- iconTheme = lib.mkIf config.theme.mint.enable {
- package = pkgs.mint-y-icons;
- name = transformColorValue config.theme.mint.icons.color;
- };
- font = {
- name = config.theme.font.gtk.name;
- size = config.theme.font.gtk.size;
- };
- cursorTheme = {
- name = config.theme.cursor.name;
- size = config.theme.cursor.size;
- };
- gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
- };
- qt = {
- enable = true;
- platformTheme.name = "gtk3";
- };
- fonts.fontconfig.defaultFonts = {
- sansSerif = [ config.theme.font.sansSerif ];
- monospace = [ config.theme.font.monospace ];
- };
- };
-}
diff --git a/home-manager/userdirs.nix b/home-manager/userdirs.nix
deleted file mode 100644
index 58c1d59..0000000
--- a/home-manager/userdirs.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{ userDetails, ... }: {
- xdg.userDirs = {
- enable = true;
- } // userDetails.userDirs;
-}
diff --git a/home-manager/wallpapers.nix b/home-manager/wallpapers.nix
index d7e067a..de64d76 100644
--- a/home-manager/wallpapers.nix
+++ b/home-manager/wallpapers.nix
@@ -1,10 +1,13 @@
-{ lib, config, pkgs, ... }: {
- options = {
- wallpapers.enable = lib.mkEnableOption "enables all wallpapers";
+{ lib, config, pkgs, ... }: let
+ cfg = config.programs._seasonalwallpaper.wallpapers;
+in {
+ options.programs._seasonalwallpaper.wallpapers = {
+ download = lib.mkEnableOption "enables all wallpapers";
};
- config = lib.mkIf config.wallpapers.enable {
- home.file.".local/share/wallpaper" = {
+ config = lib.mkIf cfg.download {
+ home.file.wallpapers = {
+ target = ".local/share/wallpaper";
source = pkgs.fetchzip {
url = "https://tjkeller.xyz/permalinks/wallpapers.tar";
hash = "sha256-lhj9wUMZfd0XOrUtWY9HB64oXrS/EjsvsaJHzu4ucFg=";
diff --git a/hosts/optiplex/configuration.nix b/hosts/optiplex/configuration.nix
index 8a06294..b92b580 100644
--- a/hosts/optiplex/configuration.nix
+++ b/hosts/optiplex/configuration.nix
@@ -1,16 +1,14 @@
-{ config, lib, pkgs, ... }: {
- imports = [
- ./hardware-configuration.nix
- ../../archetypes/tjkeller
- ];
-
+{ config, lib, pkgs, home-manager, ... }: {
# Setup bootloader
boot._loader.enable = true;
# Enable common options
_archetypes = {
# Use desktop profile
- profiles.desktop.enable = true;
+ profiles.desktop = {
+ enable = true;
+ home.users.timmy.enable = true;
+ };
# Install software
collections = {
desktop = {
@@ -35,14 +33,13 @@
};
};
};
- # Setup user
- users.primary = {
- enable = true;
- autologin.enable = true;
- };
- tjkeller = {
- nas.enable = true;
- };
+ };
+
+ # Enable user timmy
+ _users.timmy = {
+ enable = true;
+ autologin.enable = true;
+ nas.enable = true;
};
# Disable suspend
@@ -69,5 +66,15 @@
forceFullCompositionPipeline = true; # Enables vsync
};
+ # Configure home
+ home-manager.users.timmy = {
+ gtk._mintTheme = {
+ dark = true;
+ color = "Green";
+ icons.color = "Green";
+ };
+ programs._seasonalwallpaper.wallpapers.download = true;
+ };
+
system.stateVersion = "24.11";
}
diff --git a/hosts/optiplex/home.nix b/hosts/optiplex/home.nix
index d293ae0..38646b1 100644
--- a/hosts/optiplex/home.nix
+++ b/hosts/optiplex/home.nix
@@ -1,6 +1,4 @@
-{ ... }: {
- imports = [ ../../home-manager ];
-
+{
theme.mint.theme.color = "Dark-Green";
theme.mint.icons.color = "Green";
wallpapers.enable = true;
diff --git a/lib/default.nix b/lib/default.nix
new file mode 100644
index 0000000..01801a2
--- /dev/null
+++ b/lib/default.nix
@@ -0,0 +1,3 @@
+{
+ _mkProfileArchetype = import ./mkprofile.nix;
+}
diff --git a/lib/mkprofile.nix b/lib/mkprofile.nix
new file mode 100644
index 0000000..ec851de
--- /dev/null
+++ b/lib/mkprofile.nix
@@ -0,0 +1,22 @@
+profileName: nixosConfig: homeConfig: { config, lib, ... }: let
+ cfg = config._archetypes.profiles.${profileName};
+ enabledUsers = lib.filterAttrs (user: userCfg: userCfg.enable) cfg.home.users;
+ homeConfigs = {
+ home-manager.users = lib.mapAttrs (user: userCfg: homeConfig) enabledUsers;
+ };
+in {
+ options._archetypes.profiles.${profileName} = {
+ enable = lib.mkEnableOption "enable nixos profile ${profileName}";
+ home.users = lib.mkOption {
+ type = lib.types.attrsOf (lib.types.submodule {
+ options = {
+ enable = lib.mkEnableOption "home-manager profile ${profileName} for user";
+ };
+ });
+ default = {};
+ description = "enable home-manager profile ${profileName} for user the specified user";
+ };
+ };
+
+ config = lib.mkIf cfg.enable (lib.mkMerge [ nixosConfig homeConfigs ]);
+}
diff --git a/nixos/secrets.nix b/nixos/secrets.nix
index 46d8f1e..0691255 100644
--- a/nixos/secrets.nix
+++ b/nixos/secrets.nix
@@ -1,10 +1,8 @@
-{ inputs, config, pkgs, userDetails, ... }: {
- imports = [ inputs.sops-nix.nixosModules.sops ];
-
+{ inputs, config, pkgs, ... }: {
environment.systemPackages = with pkgs; [ age sops ];
sops = {
defaultSopsFormat = "yaml";
- age.sshKeyPaths = [ "${userDetails.home}/.ssh/id_ed25519" "/root/.ssh/id_ed25519" ];
+ age.sshKeyPaths = [ "/root/.ssh/id_ed25519" ];
};
}
diff --git a/nixos/services/cgit.nix b/nixos/services/cgit.nix
index 366c1f8..66de1d8 100644
--- a/nixos/services/cgit.nix
+++ b/nixos/services/cgit.nix
@@ -1,34 +1,50 @@
-{ lib, pkgs, config, userDetails, ... }:
+{ lib, pkgs, config, ... }:
let
- cfg = config.cgit;
+ cfg = config.services._cgit;
in {
- options = {
- cgit = {
- enable = lib.mkEnableOption "enables cgit service";
- hostAddress = lib.mkOption {
- type = lib.types.str;
- description = "hostAddress for the container";
- default = "10.0.1.1";
- };
- localAddress = lib.mkOption {
- type = lib.types.str;
- description = "localAddress for the container";
- default = "10.0.1.2";
- };
- rootTitle = lib.mkOption {
- type = lib.types.str;
- description = "cgit site title";
- default = "";
- };
- rootDesc = lib.mkOption {
- type = lib.types.str;
- description = "cgit site description";
- default = "";
+ options.services._cgit = {
+ enable = lib.mkEnableOption "enables cgit service";
+ hostAddress = lib.mkOption {
+ type = lib.types.str;
+ description = "hostAddress for the container";
+ default = "10.0.1.1";
+ };
+ localAddress = lib.mkOption {
+ type = lib.types.str;
+ description = "localAddress for the container";
+ default = "10.0.1.2";
+ };
+ rootTitle = lib.mkOption {
+ type = lib.types.str;
+ description = "cgit site title";
+ default = "";
+ };
+ rootDesc = lib.mkOption {
+ type = lib.types.str;
+ description = "cgit site description";
+ default = "";
+ };
+ extraConfig = lib.mkOption {
+ type = lib.types.str;
+ description = "cgitrc lines inserted verbatim at the end";
+ default = "";
+ };
+ ssh.authorizedKeys = {
+ keys = lib.mkOption {
+ type = lib.types.listOf lib.types.singleLineStr;
+ default = [ ];
+ description = ''
+ see `options.openssh.authorizedKeys.keys`.
+ ssh authorized keys for git user in container.
+ '';
};
- extraConfig = lib.mkOption {
- type = lib.types.str;
- description = "cgitrc lines inserted verbatim at the end";
- default = "";
+ keyFiles = lib.mkOption {
+ type = lib.types.listOf lib.types.path;
+ default = [ ];
+ description = ''
+ see `options.openssh.authorizedKeys.keyFiles`.
+ ssh authorized keys for git user in container.
+ '';
};
};
};
@@ -42,7 +58,7 @@ in {
localAddress = cfg.localAddress;
specialArgs = {
- authorizedKeys = userDetails.sshPublicKeys;
+ authorizedKeys = cfg.ssh.authorizedKeys;
cgitrc = with cfg; {
inherit rootTitle;
inherit rootDesc;
@@ -59,7 +75,7 @@ in {
createHome = true;
homeMode = "750"; # Allow read permissions for group members
shell = pkgs.bash;
- openssh.authorizedKeys.keys = authorizedKeys;
+ openssh = { inherit authorizedKeys; };
};
users.groups.git.members = [ "lighttpd" ]; # Create the git group and add lighttpd user as a member so /srv/git can be served by cgit
diff --git a/nixos/services/gitea.nix b/nixos/services/gitea.nix
index 32c56db..5586979 100644
--- a/nixos/services/gitea.nix
+++ b/nixos/services/gitea.nix
@@ -1,20 +1,18 @@
-{ lib, pkgs, config, userDetails, ... }:
+{ lib, pkgs, config, ... }:
let
- cfg = config.gitea;
+ cfg = config.services._gitea;
in {
- options = {
- gitea = {
- enable = lib.mkEnableOption "enables gitea service";
- hostAddress = lib.mkOption {
- type = lib.types.str;
- description = "hostAddress for the container";
- default = "10.0.1.1";
- };
- localAddress = lib.mkOption {
- type = lib.types.str;
- description = "localAddress for the container";
- default = "10.0.1.3";
- };
+ options.services._gitea = {
+ enable = lib.mkEnableOption "enables gitea service";
+ hostAddress = lib.mkOption {
+ type = lib.types.str;
+ description = "hostAddress for the container";
+ default = "10.0.1.1";
+ };
+ localAddress = lib.mkOption {
+ type = lib.types.str;
+ description = "localAddress for the container";
+ default = "10.0.1.3";
};
};
diff --git a/nixos/services/searxng.nix b/nixos/services/searxng.nix
index 8ed632e..f90ad4e 100644
--- a/nixos/services/searxng.nix
+++ b/nixos/services/searxng.nix
@@ -1,4 +1,5 @@
{ pkgs, lib, config, ... }: let
+ cfg = config.services._searxng;
environmentFile = "/run/searx/searxng.env";
generateEnvironmentFile = ''
umask 077
@@ -6,12 +7,12 @@
ls /run/searx
'';
in {
- options = {
- searxng.enable = lib.mkEnableOption "enables searxng service";
- searxng.uwsgi.enable = lib.mkEnableOption "enables searxng uwsgi";
+ options.services._searxng = {
+ enable = lib.mkEnableOption "enables searxng service";
+ uwsgi.enable = lib.mkEnableOption "enables searxng uwsgi";
};
- config = lib.mkIf config.searxng.enable {
+ config = lib.mkIf cfg.enable {
# Generate secret key
systemd.services.searx-environment-file = {
description = "Generate environment file with secret key for searx";
@@ -37,7 +38,7 @@ in {
inherit environmentFile; # Provides secret key
# UWSGI configuration
- runInUwsgi = config.searxng.uwsgi.enable;
+ runInUwsgi = cfg.uwsgi.enable;
uwsgiConfig = {
socket = "/run/searx/searx.sock";
diff --git a/users/default.nix b/users/default.nix
new file mode 100644
index 0000000..8eb5373
--- /dev/null
+++ b/users/default.nix
@@ -0,0 +1,5 @@
+{
+ imports = [
+ ./timmy
+ ];
+}
diff --git a/users/timmy/default.nix b/users/timmy/default.nix
new file mode 100644
index 0000000..313449d
--- /dev/null
+++ b/users/timmy/default.nix
@@ -0,0 +1,100 @@
+{ lib, config, pkgs, home-manager, ... }: let
+ cfg = config._users.timmy;
+ username = "timmy";
+ email = "tjk@tjkeller.xyz";
+ fullname = "Tim Keller";
+ home = "/home/${username}";
+ userDirs = {
+ desktop = "${home}";
+ download = "${home}/dls";
+ documents = "${home}/docs";
+ pictures = "${home}/pics";
+ };
+ sshKeyPaths = [ "${home}/.ssh/id_ed25519" ];
+ sshPublicKeyPaths = lib.map (keyPath: keyPath + ".pub") sshKeyPaths;
+ sshPublicKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDnsnAWcz46OVi1MWSxpOIUtUvwalijDwvW+oEvNjzep" ];
+in {
+ imports = [
+ ./hosts.nix
+ ./localization.nix
+ ./nas.nix
+ ./printing.nix
+ ./user.nix
+ ./wifi.nix
+ ];
+
+ options._users.timmy = {
+ enable = lib.mkEnableOption "create user timmy";
+ autologin.enable = lib.mkEnableOption "enables getty automatic login";
+ };
+
+ #config = lib.mkIf cfg.enable {
+ config = {
+ # Setup zsh
+ programs.zsh.enable = true;
+ #environment.systemPackages = [ pkgs.zsh-fast-syntax-highlighting ]; # TODO
+
+ # Setup normal user
+ users.users.timmy = {
+ home = home;
+ description = fullname;
+ isNormalUser = true;
+ shell = pkgs.zsh;
+ extraGroups = [
+ "nixbld"
+ "video"
+ "wheel"
+ ] ++ lib.optionals config.hardware.i2c.enable [
+ "i2c"
+ ] ++ lib.optionals config.virtualisation.libvirtd.enable [
+ "libvirtd"
+ ] ++ lib.optionals config.virtualisation.docker.enable [
+ "docker"
+ ];
+ };
+
+ # Configure automatic login with getty
+ services.getty = lib.mkIf cfg.autologin.enable {
+ autologinUser = username;
+ };
+
+ # Configure sops age key paths since age keys are generated via ssh private key
+ sops.age = { inherit sshKeyPaths; };
+
+ # Add authorizedKeys to cgit service
+ services._cgit.ssh.authorizedKeys = {
+ keys = sshPublicKeys;
+ keyFiles = sshPublicKeyPaths;
+ };
+
+ # Configure user home
+ home-manager.users.timmy = {
+ # Setup home-manager
+ home = {
+ username = username;
+ homeDirectory = home;
+ stateVersion = "24.05";
+ };
+
+ # Setup userdirs
+ xdg.userDirs = {
+ enable = true;
+ createDirectories = true;
+ } // userDirs;
+
+ # Setup git
+ programs.git = {
+ enable = true;
+ userName = fullname;
+ userEmail = email;
+ };
+
+ # Setup gtk bookmarks
+ gtk.gtk3.bookmarks = (
+ lib.mapAttrsToList (name: path:
+ "file://${path} ${lib.toUpper (lib.substring 0 1 name)}${lib.substring 1 (-1) name}" # Make first letter upper case
+ ) userDirs
+ );
+ };
+ };
+}
diff --git a/archetypes/tjkeller/hosts.nix b/users/timmy/hosts.nix
index 66c6ccc..66c6ccc 100644
--- a/archetypes/tjkeller/hosts.nix
+++ b/users/timmy/hosts.nix
diff --git a/archetypes/tjkeller/localization.nix b/users/timmy/localization.nix
index 8313f07..8313f07 100644
--- a/archetypes/tjkeller/localization.nix
+++ b/users/timmy/localization.nix
diff --git a/archetypes/tjkeller/nas.nix b/users/timmy/nas.nix
index 1ed0ca3..8fa28c3 100644
--- a/archetypes/tjkeller/nas.nix
+++ b/users/timmy/nas.nix
@@ -1,13 +1,13 @@
{ lib, config, ... } :
let
- cfg = config._archetypes.tjkeller.nas;
+ cfg = config._users.timmy.nas;
mkNetworkFileSystem = device: automount: {
device = "${device}";
fsType = "nfs";
options = [ "defaults" ] ++ lib.optionals (!automount) [ "noauto" ];
};
in {
- options._archetypes.tjkeller.nas = {
+ options._users.timmy.nas = {
enable = lib.mkEnableOption "enable network shares";
home = {
enable = lib.mkEnableOption "enable home network shares";
diff --git a/archetypes/tjkeller/printing.nix b/users/timmy/printing.nix
index d5cceab..d5cceab 100644
--- a/archetypes/tjkeller/printing.nix
+++ b/users/timmy/printing.nix
diff --git a/archetypes/tjkeller/resources/secrets/hashed-root-password.yaml b/users/timmy/resources/secrets/hashed-root-password.yaml
index a42fd42..a42fd42 100644
--- a/archetypes/tjkeller/resources/secrets/hashed-root-password.yaml
+++ b/users/timmy/resources/secrets/hashed-root-password.yaml
diff --git a/archetypes/tjkeller/resources/secrets/wpa_supplicant-conf.yaml b/users/timmy/resources/secrets/wpa_supplicant-conf.yaml
index 2fd7a0e..2fd7a0e 100644
--- a/archetypes/tjkeller/resources/secrets/wpa_supplicant-conf.yaml
+++ b/users/timmy/resources/secrets/wpa_supplicant-conf.yaml
diff --git a/archetypes/tjkeller/user.nix b/users/timmy/user.nix
index 2695549..2695549 100644
--- a/archetypes/tjkeller/user.nix
+++ b/users/timmy/user.nix
diff --git a/archetypes/tjkeller/wifi.nix b/users/timmy/wifi.nix
index 32b6ef8..9afcbc7 100644
--- a/archetypes/tjkeller/wifi.nix
+++ b/users/timmy/wifi.nix
@@ -1,7 +1,7 @@
{ lib, config, ... }: let
- cfg = config._archetypes.tjkeller.wifi;
+ cfg = config._users.timmy.wifi;
in {
- options._archetypes.tjkeller.wifi = {
+ options._users.timmy.wifi = {
enable = lib.mkEnableOption "enables wifi";
};