Do some minor refactoring

This commit is contained in:
SebastianStork 2025-07-27 20:23:43 +02:00
parent ea509959ff
commit 472d0eea96
9 changed files with 29 additions and 21 deletions

View file

@ -29,6 +29,8 @@
jsonConfig = { creation_rules = hostCreationRules ++ userCreationRules; } |> lib.strings.toJSON; jsonConfig = { creation_rules = hostCreationRules ++ userCreationRules; } |> lib.strings.toJSON;
in in
pkgs.runCommand "sops-config" { buildInputs = [ pkgs.yj ]; } "echo '${jsonConfig}' | yj -jy > $out"; pkgs.runCommand "sops.yaml" { buildInputs = [ pkgs.yj ]; } ''
echo '${jsonConfig}' | yj -jy > $out^
'';
}; };
} }

View file

@ -12,7 +12,7 @@
enable = true; enable = true;
agePublicKey = "age1qz04yg4h4g22wxqca2pd5k0z574223f6m5c9jy5ny37nlgcd6u4styf06t"; agePublicKey = "age1qz04yg4h4g22wxqca2pd5k0z574223f6m5c9jy5ny37nlgcd6u4styf06t";
}; };
boot.loader.systemdBoot.enable = true; boot.loader.systemd-boot.enable = true;
users.seb.enable = true; users.seb.enable = true;
services = { services = {

View file

@ -9,7 +9,7 @@
agePublicKey = "age1sywwrwse76x8yskrsfpwk38fu2cmyx5s9qkf2pgc68cta0vj9psql7dp6e"; agePublicKey = "age1sywwrwse76x8yskrsfpwk38fu2cmyx5s9qkf2pgc68cta0vj9psql7dp6e";
}; };
boot = { boot = {
loader.systemdBoot.enable = true; loader.systemd-boot.enable = true;
silent = true; silent = true;
}; };
users.seb = { users.seb = {

View file

@ -9,7 +9,7 @@
agePublicKey = "age18x6herevmcuhcmeh47ll6p9ck9zk4ga6gfxwlc8yl49rwjxm7qusylwfgc"; agePublicKey = "age18x6herevmcuhcmeh47ll6p9ck9zk4ga6gfxwlc8yl49rwjxm7qusylwfgc";
}; };
boot = { boot = {
loader.systemdBoot.enable = true; loader.systemd-boot.enable = true;
silent = true; silent = true;
}; };
users.seb = { users.seb = {

View file

@ -13,7 +13,7 @@
settings = settings =
let let
theme-name = themeName =
{ {
dark = "default"; dark = "default";
light = "GitHub_Light"; light = "GitHub_Light";
@ -21,7 +21,7 @@
.${config.custom.theme}; .${config.custom.theme};
in in
{ {
include = "${pkgs.kitty-themes}/share/kitty-themes/themes/${theme-name}.conf"; include = "${pkgs.kitty-themes}/share/kitty-themes/themes/${themeName}.conf";
font_family = "JetBrainsMono Nerd Font"; font_family = "JetBrainsMono Nerd Font";
background_opacity = "0.85"; background_opacity = "0.85";
cursor_shape = "beam"; cursor_shape = "beam";

View file

@ -5,7 +5,7 @@
... ...
}: }:
let let
cfgTheme = config.custom.theme; inherit (config.custom) theme;
in in
{ {
options.custom.theme = lib.mkOption { options.custom.theme = lib.mkOption {
@ -22,8 +22,10 @@ in
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
theme.package = pkgs.gnome-themes-extra; theme.package = pkgs.gnome-themes-extra;
iconTheme.package = pkgs.papirus-icon-theme; iconTheme.package = pkgs.papirus-icon-theme;
font.name = "Open Sans"; font = {
font.package = pkgs.open-sans; name = "Open Sans";
package = pkgs.open-sans;
};
}; };
qt = { qt = {
enable = true; enable = true;
@ -37,18 +39,22 @@ in
}; };
} }
(lib.mkIf (cfgTheme == "dark") { (lib.mkIf (theme == "dark") {
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
gtk.theme.name = "Adwaita-dark"; gtk = {
gtk.iconTheme.name = "Papirus-Dark"; theme.name = "Adwaita-dark";
iconTheme.name = "Papirus-Dark";
};
qt.style.name = "adwaita-dark"; qt.style.name = "adwaita-dark";
home.pointerCursor.name = "Bibata-Original-Classic"; home.pointerCursor.name = "Bibata-Original-Classic";
}) })
(lib.mkIf (cfgTheme == "light") { (lib.mkIf (theme == "light") {
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-light"; dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-light";
gtk.theme.name = "Adwaita"; gtk = {
gtk.iconTheme.name = "Papirus"; theme.name = "Adwaita";
iconTheme.name = "Papirus";
};
qt.style.name = "adwaita"; qt.style.name = "adwaita";
home.pointerCursor.name = "Bibata-Original-Ice"; home.pointerCursor.name = "Bibata-Original-Ice";
}) })

View file

@ -1,8 +1,8 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
options.custom.boot.loader.systemdBoot.enable = lib.mkEnableOption ""; options.custom.boot.loader.systemd-boot.enable = lib.mkEnableOption "";
config = lib.mkIf config.custom.boot.loader.systemdBoot.enable { config = lib.mkIf config.custom.boot.loader.systemd-boot.enable {
boot = { boot = {
tmp.cleanOnBoot = true; tmp.cleanOnBoot = true;
loader = { loader = {

View file

@ -10,7 +10,7 @@ let
user = config.users.users.hedgedoc.name; user = config.users.users.hedgedoc.name;
dataDir = "/var/lib/hedgedoc"; dataDir = "/var/lib/hedgedoc";
manage_users = "CMD_CONFIG_FILE=/run/hedgedoc/config.json NODE_ENV=production ${lib.getExe' pkgs.hedgedoc "manage_users"}"; manageUsers = "CMD_CONFIG_FILE=/run/hedgedoc/config.json NODE_ENV=production ${lib.getExe' pkgs.hedgedoc "manage_users"}";
in in
{ {
options.custom.services.hedgedoc = { options.custom.services.hedgedoc = {
@ -76,14 +76,14 @@ in
let let
manageUserSeb = manageUserSeb =
mode: mode:
"${manage_users} --${mode} sebastian.stork@pm.me --pass \"$(cat ${ "${manageUsers} --${mode} sebastian.stork@pm.me --pass \"$(cat ${
config.sops.secrets."hedgedoc/seb-password".path config.sops.secrets."hedgedoc/seb-password".path
})\""; })\"";
in in
"${manageUserSeb "add"} || ${manageUserSeb "reset"}"; "${manageUserSeb "add"} || ${manageUserSeb "reset"}";
}; };
environment.shellAliases.hedgedoc-manage-users = "sudo --user=${user} ${manage_users}"; environment.shellAliases.hedgedoc-manage-users = "sudo --user=${user} ${manageUsers}";
custom.services.resticBackups.hedgedoc = lib.mkIf cfg.doBackups { custom.services.resticBackups.hedgedoc = lib.mkIf cfg.doBackups {
conflictingService = "hedgedoc.service"; conflictingService = "hedgedoc.service";

View file

@ -1,6 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
let let
resticBackups = lib.filterAttrs (_: value: value.enable) config.custom.services.resticBackups; resticBackups = config.custom.services.resticBackups |> lib.filterAttrs (_: value: value.enable);
in in
{ {
options.custom.services.resticBackups = lib.mkOption { options.custom.services.resticBackups = lib.mkOption {