mwahahahaha, have the orome config building! on to manwe

This commit is contained in:
Chris Kruining 2025-03-18 21:06:40 +01:00
parent 3a2f52f45e
commit af58cfb4ab
30 changed files with 259 additions and 199 deletions

View file

@ -1,3 +0,0 @@
{
ls = "eza -al";
}

View file

@ -6,23 +6,21 @@ let
in in
{ {
imports = [ imports = [
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
# (mkAliasOptionModule ["hm"] ["home-manager" "users" config.user.name]) ];
# (mkAliasOptionModule ["home"] ["hm" "home"])
];
# ++ (mapModulesRec' (toString ./modules) import);
nix.settings.experimental-features = [ "nix-command" "flakes" ]; config = {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.variables = { environment.variables = {
SNEEUWVLOK = config.sneeuwvlok.dir; NIXPKGS_ALLOW_UNFREE = "1";
NIXPKGS_ALLOW_UNFREE = "1"; };
};
sops = { sops = {
defaultSopsFile = ./secrets/secrets.yml; defaultSopsFile = ./secrets/secrets.yml;
defaultSopsFormat = "yml"; defaultSopsFormat = "yml";
age.keyFile = "/home/"; age.keyFile = "/home/";
};
}; };
} }

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
user.name = "chris";
fileSystems."/home/chris/games" = { fileSystems."/home/chris/games" = {
device = "/dev/disk/by-label/games"; device = "/dev/disk/by-label/games";
fsType = "ext4"; fsType = "ext4";
@ -72,7 +70,6 @@
shell = { shell = {
default = "zsh"; default = "zsh";
corePkgs.enable = true;
}; };
}; };
} }

View file

@ -2,9 +2,13 @@
{ {
# full_name = "Chris Kruining"; # full_name = "Chris Kruining";
# is_trusted = true; # is_trusted = true;
themes = {
enable = true;
theme = "everforest";
polarity = "dark";
};
shell = { shell = {
default = "zsh"; default = "zsh";
corePkgs.enable = true;
}; };
} }

View file

@ -5,6 +5,5 @@
shell = { shell = {
default = "fish"; default = "fish";
corePkgs.enable = true;
}; };
} }

View file

@ -1,10 +0,0 @@
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,13 +37,12 @@ in rec
imports = [ imports = [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
"${path}/hardware.nix" "${path}/hardware.nix"
./_users.nix
] ]
++ (mapModulesRec' (toString ../modules/system) import); ++ (mapModulesRec' (toString ../modules/system) import);
users = { users = {
mutableUsers = true; # Set this to false when I get sops with passwords set up properly mutableUsers = true; # Set this to false when I get sops with passwords set up properly
# users = mapModules "${path}/users" mkSysUser; users = mapModules "${path}/users" mkSysUser;
}; };
home-manager = { home-manager = {
@ -53,12 +52,20 @@ in rec
inputs.plasma-manager.homeManagerModules.plasma-manager inputs.plasma-manager.homeManagerModules.plasma-manager
]; ];
# users = mapModules "${path}/users" (p: mkHmUser p stateVersion); users = mapModules "${path}/users" (p: mkHmUser p stateVersion);
}; };
} }
{ {
modules.chris = (import "${path}/user/chris/default.nix"); _module.args.user = "chris";
modules.kaas = (import "${path}/user/kaas/default.nix");
imports = []
++ (mapModulesRec' ../modules/home (file: file));
# ++ (mapModulesRec' ../modules/home (file: file));
# ++ (mapModulesRec' ../modules/home (file: import file (args // { user = "chris"; })))
# ++ (mapModulesRec' ../modules/home (file: import file (args // { user = "kaas"; })));
modules.chris = (import "${path}/users/chris/default.nix" args);
# modules.kaas = (import "${path}/users/kaas/default.nix" args);
} }
(filterAttrs (n: v: !elem n ["system"]) attrs) (filterAttrs (n: v: !elem n ["system"]) attrs)
../. # ../default.nix ../. # ../default.nix

View file

@ -5,7 +5,10 @@
in rec in rec
{ {
mkSysUser = path: let mkSysUser = path: let
user = import path {}; user = {
full_name = "TODO";
is_trusted = true;
};
name = removeSuffix ".nix" (baseNameOf path); name = removeSuffix ".nix" (baseNameOf path);
in in
{ {

View file

@ -27,7 +27,7 @@ in {
}; };
config = mkMerge [ config = mkMerge [
(mkIf (config.modules.desktop.type == "wayland") { (mkIf (config.modules.${user}.desktop.type == "wayland") {
environment.variables.MOZ_ENABLE_WAYLAND = "1"; environment.variables.MOZ_ENABLE_WAYLAND = "1";
}) })

View file

@ -27,7 +27,7 @@ in {
}; };
config = mkMerge [ config = mkMerge [
(mkIf (config.modules.desktop.type == "wayland") { (mkIf (config.modules.${user}.desktop.type == "wayland") {
environment.variables.MOZ_ENABLE_WAYLAND = "1"; environment.variables.MOZ_ENABLE_WAYLAND = "1";
}) })

View file

@ -3,18 +3,18 @@ let
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
cfg = options.modules.${user}.desktop.editors.nvim; cfg = config.modules.${user}.desktop.editors.nvim;
in in
{ {
imports = [
inputs.nvf.nixosModules.default
];
options.modules.${user}.desktop.editors.nvim = let options.modules.${user}.desktop.editors.nvim = let
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
in { enable = mkEnableOption "neo-vim (nixvim)"; }; in {
enable = mkEnableOption "neo-vim (nixvim)";
};
config = mkIf cfg.enable { config = mkIf cfg.enable {
modules.desktop.editors.nvim.enable = true;
home-manager.users.${user}.programs.nvf = { home-manager.users.${user}.programs.nvf = {
enable = true; enable = true;
settings = { settings = {

View file

@ -14,8 +14,8 @@ in {
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
in { enable = mkEnableOption "OpenGL terminal emulator"; }; in { enable = mkEnableOption "OpenGL terminal emulator"; };
config = mkIf config.${user}.modules.desktop.terminal.alacritty.enable { config = mkIf config.modules.${user}.desktop.terminal.alacritty.enable {
modules.shell.toolset.tmux.enable = true; modules.${user}.shell.toolset.tmux.enable = true;
home-manager.users.${user}.programs.alacritty = { home-manager.users.${user}.programs.alacritty = {
enable = true; enable = true;

View file

@ -21,8 +21,8 @@ in
}) })
(mkIf config.modules.develop.xdg.enable { (mkIf config.modules.develop.xdg.enable {
home = { # home = {
}; # };
}) })
]; ];
} }

View file

@ -22,23 +22,17 @@ in
(mkIf (cfg.default != null) { (mkIf (cfg.default != null) {
users.defaultUserShell = pkgs."${cfg.default}"; users.defaultUserShell = pkgs."${cfg.default}";
modules.shell.toolset.gnupg.enable = true; # modules.${user}.shell.toolset.gnupg.enable = true;
}) })
(mkIf cfg.corePkgs.enable { (mkIf cfg.corePkgs.enable {
modules.shell.toolset = { modules.${user}.shell.toolset = {
btop.enable = true; btop.enable = true;
fzf.enable = true; fzf.enable = true;
starship.enable = true; starship.enable = true;
tmux.enable = true; tmux.enable = true;
}; };
home-manager.users.${user}.programs.direnv = {
enable = true;
nix-direnv.enable = true;
config.whitelist.prefix = ["/home"];
};
user.packages = attrValues { user.packages = attrValues {
inherit (pkgs) any-nix-shell pwgen yt-dlp ripdrag yazi; inherit (pkgs) any-nix-shell pwgen yt-dlp ripdrag yazi;
inherit (pkgs) bat fd zoxide; inherit (pkgs) bat fd zoxide;
@ -47,6 +41,12 @@ in
}; };
home-manager.users.${user}.programs = { home-manager.users.${user}.programs = {
direnv = {
enable = true;
nix-direnv.enable = true;
config.whitelist.prefix = ["/home"];
};
bat.enable = true; bat.enable = true;
eza.enable = true; eza.enable = true;
fzf.enable = true; fzf.enable = true;

View file

@ -1,4 +1,4 @@
{ config, options, lib, pkgs, ... }: { config, options, lib, pkgs, user, ... }:
let let
inherit (lib.attrsets) optionalAttrs; inherit (lib.attrsets) optionalAttrs;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
@ -10,7 +10,7 @@ in
config = mkIf config.modules.${user}.shell.toolset.fzf.enable { config = mkIf config.modules.${user}.shell.toolset.fzf.enable {
home-manager.users.${user}.programs.fzf = let home-manager.users.${user}.programs.fzf = let
defShell = config.modules.shell.default; defShell = config.modules.${user}.shell.default;
in { in {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = true;

View file

@ -14,7 +14,7 @@ in
inherit (pkgs) act dura lazygit; inherit (pkgs) act dura lazygit;
inherit (pkgs.gitAndTools) gh git-open; inherit (pkgs.gitAndTools) gh git-open;
} }
// optionalAttrs config.modules.shell.toolset.gnupg.enable { // optionalAttrs config.modules.${user}.shell.toolset.gnupg.enable {
inherit (pkgs.gitAndTools) git-crypt; inherit (pkgs.gitAndTools) git-crypt;
}); });

View file

@ -1,4 +1,4 @@
{ config, options, lib, pkgs, ... }: { config, options, lib, pkgs, user, ... }:
let let
inherit (builtins) getEnv; inherit (builtins) getEnv;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
@ -8,23 +8,31 @@ in
{ {
options.modules.${user}.shell.toolset.gnupg = let options.modules.${user}.shell.toolset.gnupg = let
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
in { enable = mkEnableOption "cryptographic suite"; }; in {
enable = mkEnableOption "cryptographic suite";
};
config = mkIf cfg.enable {
user.package = with pkgs; [ gnupg ];
config = mkIf config.modules.shell.toolset.gnupg.enable {
environment.variables.GNUPGHOME = "$XDG_CONFIG_HOME/gnupg"; environment.variables.GNUPGHOME = "$XDG_CONFIG_HOME/gnupg";
home-manager.users.${user}.programs.gnupg.agent = { home-manager.users.${user}.programs.gnupg = {
enable = true; enable = true;
enableSSHSupport = true;
pinentryPackage = pkgs.pinentry-gnome3;
settings = let agent = {
cacheTTL = 86400; enable = true;
in { enableSSHSupport = true;
default-cache-ttl = cacheTTL; pinentryPackage = pkgs.pinentry-gnome3;
default-cache-ttl-ssh = cacheTTL;
max-cache-ttl = cacheTTL; settings = let
max-cache-ttl-ssh = cacheTTL; cacheTTL = 86400;
in {
default-cache-ttl = cacheTTL;
default-cache-ttl-ssh = cacheTTL;
max-cache-ttl = cacheTTL;
max-cache-ttl-ssh = cacheTTL;
};
}; };
}; };
}; };

View file

@ -1,99 +1,104 @@
{ config, options, pkgs, lib, ... }: { config, options, pkgs, lib, user, ... }:
let let
inherit (lib.attrsets) mapAttrsToList; inherit (lib.attrsets) mapAttrsToList;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.strings) concatStrings escapeNixString; inherit (lib.strings) concatStrings escapeNixString;
cfg = config.modules.shell; cfg = config.modules.${user}.shell;
in in
{ {
config = mkIf (cfg.default == "zsh") { config = mkIf (cfg.default == "zsh") {
modules.shell = { modules.shell.zsh.enable = true;
corePkgs.enable = true;
toolset = {
starship.enable = true;
};
};
home-manager.users.${user}.programs.starship.enableZshIntegration = true; modules.${user}.shell = {
corePkgs.enable = true;
};
# Enable completion for sys-packages: # Enable completion for sys-packages:
environment.pathsToLink = ["/share/zsh"]; environment.pathsToLink = ["/share/zsh"];
home-manager.users.${user}.programs.zsh = { home-manager.users.${user} = {
enable = true; xdg.configFile."zsh-abbreviations" = {
enableCompletion = true; target = "zsh/abbreviations";
autosuggestion.enable = true; text = let
abbrevs = {
history = { ls = "eza -al";
size = 10000; };
path = "$XDG_CONFIG_HOME/zsh/history"; in ''
${concatStrings (mapAttrsToList
(k: v: "abbr ${k}=${escapeNixString v}")
abbrevs
)}
'';
}; };
oh-my-zsh = { programs = {
enable = true; starship.enableZshIntegration = true;
plugins = ["git" "docker-compose" "zoxide"];
};
plugins = let zsh = {
mkZshPlugin = { enable = true;
pkg, enableCompletion = true;
file ? "${pkg.pname}.plugin.zsh", autosuggestion.enable = true;
}: {
name = pkg.pname; history = {
src = pkg.src; size = 10000;
inherit file; 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";
};
}
];
}; };
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

@ -9,9 +9,6 @@ let
cfg = config.modules.${user}.themes; cfg = config.modules.${user}.themes;
desktop = config.modules.${user}.desktop; desktop = config.modules.${user}.desktop;
in { in {
imports = [
inputs.stylix.nixosModules.stylix
];
options.modules.${user}.themes = let options.modules.${user}.themes = let
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
@ -34,6 +31,8 @@ in {
}; };
config = mkIf (cfg.enable) { config = mkIf (cfg.enable) {
modules.theming.enable = true;
stylix = { stylix = {
enable = true; enable = true;

View file

@ -0,0 +1,22 @@
{ inputs, config, options, lib, pkgs, ... }:
let
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf;
cfg = options.modules.desktop.editors.nvim;
in
{
imports = [
inputs.nvf.nixosModules.default
];
options.modules.desktop.editors.nvim = let
inherit (lib.options) mkEnableOption;
in {
enable = mkEnableOption "neo-vim (nixvim)";
};
config = mkIf cfg.enable {
};
}

View file

@ -27,7 +27,5 @@ in {
wifi.backend = "wpa_supplicant"; wifi.backend = "wpa_supplicant";
}; };
}; };
hm.services.network-manager-applet.enable = true;
}; };
} }

View file

@ -11,34 +11,9 @@ in
in in
{ {
user = mkOpt attrs {}; user = mkOpt attrs {};
sneeuwvlok = {
dir = mkOpt path (findFirst pathExists (toString ../.) [
"${config.user.home}/Github/sneeuwvlok"
]);
hostDir = mkOpt path "${config.sneeuwvlok.dir}/hosts/${config.networking.hostName}";
configDir = mkOpt path "${config.sneeuwvlok.dir}/config";
modulesDir = mkOpt path "${config.sneeuwvlok.dir}/modules";
themesDir = mkOpt path "${config.sneeuwvlok.modulesDir}/themes";
};
}; };
config = { config = {
# 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;
# Temp solution...
# home-manager.users.${config.user.name}.home.stateVersion = "23.11";
nix.settings = let nix.settings = let
inherit (lib) elem attrNames filterAttrs; inherit (lib) elem attrNames filterAttrs;

View file

@ -5,7 +5,5 @@ in
{ {
options.modules.services = let options.modules.services = let
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
in { in {};
enable = mkEnableOption "Enable all services";
};
} }

View file

@ -125,10 +125,7 @@ in
networking.firewall.allowedTCPPorts = [ 80 443 ]; networking.firewall.allowedTCPPorts = [ 80 443 ];
modules.virtualisation = { modules.virtualisation.podman.enable = true;
enable = true;
podman.enable = true;
};
virtualisation = { virtualisation = {
oci-containers = { oci-containers = {

View file

@ -1,6 +1,8 @@
{ config, options, lib, pkgs, ... }: { config, options, lib, pkgs, ... }:
let let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
user = "nextcloud";
in in
{ {
options.modules.services.nextcloud = let options.modules.services.nextcloud = let
@ -10,7 +12,14 @@ in
}; };
config = mkIf config.modules.services.nextcloud.enable { config = mkIf config.modules.services.nextcloud.enable {
home.file.".netrc".text = '' users.users.${user} = {
name = user;
isSystemUser = true;
home = "/home/${user}";
group = user;
};
home-manager.users.${user}.home.file.".netrc".text = ''
login root login root
password KaasIsAwesome! password KaasIsAwesome!
''; '';
@ -23,7 +32,7 @@ in
}; };
Service = { Service = {
Type = "simple"; Type = "simple";
ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h -n --path /var/music /home/chris/Music https://cloud.kruining.eu"; ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h -n --path /var/music /home/${user}/Music https://cloud.kruining.eu";
TimeoutStopSec = "180"; TimeoutStopSec = "180";
KillMode = "process"; KillMode = "process";
KillSignal = "SIGINT"; KillSignal = "SIGINT";

View file

@ -0,0 +1,15 @@
{ config, options, lib, pkgs, ... }:
let
inherit (lib.attrsets) attrValues;
inherit (lib.modules) mkIf;
cfg = config.modules.shell;
in
{
options.modules.shell = let
inherit (lib.options) mkEnableOption;
in
{};
config = mkIf cfg.enable {};
}

View file

@ -0,0 +1,19 @@
{ config, options, lib, pkgs, ... }:
let
inherit (lib.attrsets) attrValues;
inherit (lib.modules) mkIf;
cfg = config.modules.shell.zsh;
in
{
options.modules.shell.zsh = let
inherit (lib.options) mkEnableOption;
in
{
enable = mkEnableOption "enable ZSH";
};
config = mkIf cfg.enable {
programs.zsh.enable = true;
};
}

View file

@ -0,0 +1,22 @@
{ inputs, config, options, lib, pkgs, ... }:
let
inherit (lib) mkIf;
cfg = config.modules.theming;
in
{
imports = [
inputs.stylix.nixosModules.stylix
];
options.modules.theming = let
inherit (lib.options) mkEnableOption;
in
{
enable = mkEnableOption "enable theming";
};
config = mkIf cfg.enable {
};
}

View file

@ -6,7 +6,5 @@ in
options.modules.virtualisation = let options.modules.virtualisation = let
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
in in
{ {};
enable = mkEnableOption "enable virtualisation";
};
} }