progress in multi user config

This commit is contained in:
Chris Kruining 2025-03-18 16:43:07 +01:00
parent f7891e1f30
commit 3a2f52f45e
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
68 changed files with 384 additions and 663 deletions

View file

@ -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;
};
};
}

View file

@ -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;
};
}

View file

@ -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;
};
}

10
lib/_users.nix Normal file
View file

@ -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 = {};
}

View file

@ -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)

View file

@ -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 <filename>user.js</filename>
'';
extraConfig = mkOpt' lines "" ''
Extra lines to add to <filename>user.js</filename>
'';
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;
# };
# };
})
];
}

View file

@ -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 = {};
# };
# };
};
}

View file

@ -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";
};
};
};
}

View file

@ -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];
})
];
}

View file

@ -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)";

View file

@ -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";

View file

@ -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)";

View file

@ -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)";

View file

@ -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)";

View file

@ -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";

View file

@ -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 = [

View file

@ -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;
};
}

View file

@ -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 = {

View file

@ -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 <filename>user.js</filename>
'';
extraConfig = mkOpt' lines "" ''
Extra lines to add to <filename>user.js</filename>
'';
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
];
})
];
}

View file

@ -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 {

View file

@ -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;
};
})

View file

@ -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;
};
}

View file

@ -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 = ''

View file

@ -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 = {

View file

@ -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"; };

View file

@ -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 ];

View file

@ -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)";

View file

@ -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";
};
};
};
}

View file

@ -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 [

View file

@ -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;
}
];
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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() {

View file

@ -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;

View file

@ -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;

View file

@ -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";

View file

@ -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
)}
'';
};
};
}

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

View file

@ -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 {

View file

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 183 KiB

Before After
Before After

View file

@ -1,6 +1,6 @@
{ config, ... }:
{ config, user, ... }:
{
hm.xdg.enable = true;
home-manager.users.${user}.xdg.enable = true;
environment = {
sessionVariables = {

View file

@ -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
)}
'';
};
};
}

View file

@ -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;