This commit is contained in:
mjallen18
2025-12-14 21:50:50 -06:00
parent 0012a019fc
commit 34539045e5
41 changed files with 164 additions and 251 deletions

View File

@@ -2,10 +2,11 @@
config,
lib,
pkgs,
namespace,
...
}:
let
cfg = config.mjallen.desktop.gnome;
cfg = config.${namespace}.desktop.gnome;
in
{
imports = [ ./options.nix ];

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{ lib, namespace, ... }:
with lib;
{
options.mjallen.desktop.gnome = {
options.${namespace}.desktop.gnome = {
enable = mkEnableOption "enable gnome settings";
};
}

View File

@@ -1,7 +1,7 @@
{ config, lib, ... }:
{ config, lib, namespace, ... }:
with lib;
let
cfg = config.mjallen.programs.btop;
cfg = config.${namespace}.programs.btop;
in
{
imports = [ ./options.nix ];

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{ lib, namespace, ... }:
with lib;
{
options.mjallen.programs.btop = {
options.${namespace}.programs.btop = {
enable = mkEnableOption "enable btop";
};
}

View File

@@ -2,11 +2,12 @@
config,
lib,
pkgs,
namespace,
...
}:
with lib;
let
cfg = config.mjallen.programs.hyprland;
cfg = config.${namespace}.programs.hyprland;
drawer = "nwg-drawer -fm nautilus -term kitty -mb 10 -mt 10 -ml 10 -mr 10 -pbuseicontheme -i ${config.stylix.icons.dark}";
in
{
@@ -66,7 +67,7 @@ in
xsettingsd
xwayland
pkgs.mjallen.pipewire-python
pkgs.${namespace}.pipewire-python
]
++ (if cfg.notificationDaemon == "mako" then [ mako ] else [ dunst ])
++ (if cfg.launcher == "wofi" then [ wofi ] else [ rofi ])

View File

@@ -1,7 +1,7 @@
{ lib, pkgs, ... }:
{ lib, pkgs, namespace, ... }:
with lib;
{
options.mjallen.programs.hyprland = {
options.${namespace}.programs.hyprland = {
enable = mkEnableOption "enable hyprland";
primaryDisplay = mkOption {

View File

@@ -1,7 +1,7 @@
{ lib, config, ... }:
{ lib, config, namespace, ... }:
with lib;
let
cfg = config.mjallen.programs.kitty;
cfg = config.${namespace}.programs.kitty;
in
{
imports = [ ./options.nix ];

View File

@@ -4,7 +4,7 @@ let
inherit (lib.${namespace}) mkOpt;
in
{
options.mjallen.programs.kitty = {
options.${namespace}.programs.kitty = {
enable = mkEnableOption "enable kitty terminal";
};
}

View File

@@ -1,7 +1,7 @@
{ config, lib, ... }:
{ config, lib, namespace, ... }:
with lib;
let
cfg = config.mjallen.programs.mako;
cfg = config.${namespace}.programs.mako;
in
{
imports = [ ./options.nix ];

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{ lib, namespace, ... }:
with lib;
{
options.mjallen.programs.mako = {
options.${namespace}.programs.mako = {
enable = mkEnableOption "enable mako";
fontName = mkOption {

View File

@@ -2,11 +2,12 @@
config,
lib,
pkgs,
namespace,
...
}:
with lib;
let
cfg = config.mjallen.programs.nwg-dock;
cfg = config.${namespace}.programs.nwg-dock;
palette = import cfg.theme.file;
in
{

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{ lib, namespace, ... }:
with lib;
{
options.mjallen.programs.nwg-dock = {
options.${namespace}.programs.nwg-dock = {
enable = mkEnableOption "enable nwg-dock";
};
}

View File

@@ -2,11 +2,12 @@
config,
lib,
pkgs,
namespace,
...
}:
with lib;
let
cfg = config.mjallen.programs.nwg-drawer;
cfg = config.${namespace}.programs.nwg-drawer;
palette = import cfg.theme.file;
in
{

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{ lib, namespace, ... }:
with lib;
{
options.mjallen.programs.nwg-drawer = {
options.${namespace}.programs.nwg-drawer = {
enable = mkEnableOption "enable nwg-drawer";
};
}

View File

@@ -1,7 +1,7 @@
{ config, lib, ... }:
{ config, lib, namespace, ... }:
with lib;
let
cfg = config.mjallen.programs.nwg-panel;
cfg = config.${namespace}.programs.nwg-panel;
in
{
imports = [ ./options.nix ];

View File

@@ -1,7 +1,7 @@
{ lib, pkgs, ... }:
{ lib, pkgs, namespace, ... }:
with lib;
{
options.mjallen.programs.nwg-panel = {
options.${namespace}.programs.nwg-panel = {
enable = mkEnableOption "enable nwg-panel";
defaultApps = mkOption {

View File

@@ -1,7 +1,7 @@
{ config, lib, ... }:
{ config, lib, namespace, ... }:
with lib;
let
cfg = config.mjallen.programs.waybar;
cfg = config.${namespace}.programs.waybar;
baseStyle =
if cfg.style.file != null then

View File

@@ -1,4 +1,4 @@
{ lib, ... }:
{ lib, namespace, ... }:
with lib;
let
inherit (types)
@@ -13,7 +13,7 @@ let
;
in
{
options.mjallen.programs.waybar = {
options.${namespace}.programs.waybar = {
enable = mkEnableOption "Waybar status bar";
# Legacy/compat options (kept for backwards compatibility)

View File

@@ -6,7 +6,7 @@
...
}:
let
cfg = config.mjallen.programs.waybar;
cfg = config.${namespace}.programs.waybar;
pythonEnv = pkgs.python3.withPackages (_ps: [
pkgs.${namespace}.homeassistant-api

View File

@@ -2,10 +2,11 @@
config,
lib,
pkgs,
namespace,
...
}:
let
cfg = config.mjallen.programs.waybar;
cfg = config.${namespace}.programs.waybar;
waybar-weather = pkgs.writeScriptBin "waybar-weather" ''
#!/usr/bin/env nix-shell

View File

@@ -1,7 +1,7 @@
{ config, lib, ... }:
{ config, lib, namespace, ... }:
with lib;
let
cfg = config.mjallen.programs.wlogout;
cfg = config.${namespace}.programs.wlogout;
palette = import cfg.theme.file;
in
{

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{ lib, namespace, ... }:
with lib;
{
options.mjallen.programs.wlogout = {
options.${namespace}.programs.wlogout = {
enable = mkEnableOption "enable wlogout";
};
}

View File

@@ -1,7 +1,7 @@
{ config, lib, ... }:
{ config, lib, namespace, ... }:
with lib;
let
cfg = config.mjallen.programs.wofi;
cfg = config.${namespace}.programs.wofi;
palette = import cfg.theme.file;
in
{

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{ lib, namespace, ... }:
with lib;
{
options.mjallen.programs.wofi = {
options.${namespace}.programs.wofi = {
enable = mkEnableOption "enable wofi";
fontName = mkOption {

View File

@@ -1,13 +1,14 @@
{
config,
lib,
namespace,
...
}:
let
cfg = config.mjallen.shell-aliases;
cfg = config.${namespace}.shell-aliases;
in
{
options.mjallen.shell-aliases = {
options.${namespace}.shell-aliases = {
enable = lib.mkEnableOption "Common shell aliases";
buildHost = lib.mkOption {

View File

@@ -15,7 +15,7 @@ let
'';
in
{
options.mjallen.desktop.hyprland = {
options.${namespace}.desktop.hyprland = {
enable = mkEnableOption "enable hyprland desktop environment";
wallpaperSource = mkOpt (types.enum [

View File

@@ -29,7 +29,7 @@ let
{ }
else
{
address = cfg.ipv4.address;
address = "${cfg.ipv4.address}\\24";
gateway = cfg.ipv4.gateway;
dns = cfg.ipv4.dns;
}

View File

@@ -7,59 +7,42 @@
}:
with lib;
let
cfg = config.${namespace}.services.actual;
name = "actual";
cfg = config.${namespace}.services.${name};
actualConfig = {
services.actual = {
enable = true;
openFirewall = true;
settings = {
trustedProxies = [ "10.0.1.3" ];
port = cfg.port;
dataDir = cfg.dataDir;
serverFiles = "${cfg.dataDir}/server-files";
userFiles = "${cfg.dataDir}/user-files";
actualConfig = lib.${namespace}.mkModule rec {
inherit name;
description = "Actual Personal Finance Planner";
options = { };
moduleConfig = {
services.actual = {
enable = true;
openFirewall = true;
settings = {
trustedProxies = [ config.${namespace}.network.ipv4.address ];
port = cfg.port;
configDir = cfg.configDir;
serverFiles = "${cfg.configDir}/server-files";
userFiles = "${cfg.configDir}/user-files";
};
};
};
systemd.services = {
actual = {
environment.ACTUAL_CONFIG_PATH = lib.mkForce "${cfg.dataDir}/config.json";
serviceConfig = {
ExecStart = lib.mkForce "${lib.getExe pkgs.actual-server} --config ${cfg.dataDir}/config.json";
WorkingDirectory = lib.mkForce cfg.dataDir;
StateDirectoryMode = lib.mkForce 700;
DynamicUser = lib.mkForce false;
ProtectSystem = lib.mkForce "full";
systemd.services = lib.mkIf cfg.createUser {
actual = {
environment.ACTUAL_CONFIG_PATH = lib.mkForce "${cfg.configDir}/config.json";
serviceConfig = {
ExecStart = lib.mkForce "${lib.getExe pkgs.actual-server} --config ${cfg.configDir}/config.json";
WorkingDirectory = lib.mkForce cfg.configDir;
StateDirectoryMode = lib.mkForce 700;
DynamicUser = lib.mkForce false;
ProtectSystem = lib.mkForce "full";
};
};
};
};
users.users.actual = {
isSystemUser = true;
group = "actual";
home = cfg.dataDir;
};
users.groups.actual = { };
inherit config;
};
# Create reverse proxy configuration using mkReverseProxy
reverseProxyConfig = lib.${namespace}.mkReverseProxy {
name = "actual";
subdomain = cfg.reverseProxy.subdomain;
url = "http://${cfg.localAddress}:${toString cfg.port}";
middlewares = cfg.reverseProxy.middlewares;
};
fullConfig = {
"${namespace}".services.traefik = lib.mkIf cfg.reverseProxy.enable {
reverseProxies = [ reverseProxyConfig ];
};
}
// actualConfig;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable fullConfig;
imports = [ actualConfig ];
}

View File

@@ -1,104 +0,0 @@
{
config,
pkgs,
lib,
namespace,
...
}:
with lib;
let
cfg = config.${namespace}.services.actual;
dataDir = "/data";
hostAddress = "10.0.1.3";
actualUserId = config.users.users.nix-apps.uid;
actualGroupId = config.users.groups.jallen-nas.gid;
actualConfig = {
services.actual = {
enable = true;
openFirewall = true;
settings = {
trustedProxies = [ hostAddress ];
port = cfg.port;
dataDir = dataDir;
serverFiles = "${dataDir}/server-files";
userFiles = "${dataDir}/user-files";
};
};
users.users.actual = {
isSystemUser = true;
uid = lib.mkForce actualUserId;
group = "actual";
};
users.groups = {
actual = {
gid = lib.mkForce actualGroupId;
};
};
# System packages
environment.systemPackages = with pkgs; [
sqlite
];
# Create and set permissions for required directories
system.activationScripts.actual-dirs = ''
mkdir -p ${dataDir}
chown -R actual:actual ${dataDir}
chmod -R 0700 ${dataDir}
'';
systemd.services = {
actual = {
environment.ACTUAL_CONFIG_PATH = lib.mkForce "${dataDir}/config.json";
serviceConfig = {
ExecStart = lib.mkForce "${lib.getExe pkgs.actual-server} --config ${dataDir}/config.json";
WorkingDirectory = lib.mkForce dataDir;
StateDirectory = lib.mkForce dataDir;
StateDirectoryMode = lib.mkForce 700;
DynamicUser = lib.mkForce false;
ProtectSystem = lib.mkForce null;
};
};
};
};
bindMounts = {
"${dataDir}" = {
hostPath = cfg.dataDir;
isReadOnly = false;
};
};
# Create reverse proxy configuration using mkReverseProxy
reverseProxyConfig = lib.${namespace}.mkReverseProxy {
name = "actual";
subdomain = cfg.reverseProxy.subdomain;
url = "http://${cfg.localAddress}:${toString cfg.port}";
middlewares = cfg.reverseProxy.middlewares;
};
actualContainer =
(lib.${namespace}.mkContainer {
name = "actual";
localAddress = cfg.localAddress;
ports = [ cfg.port ];
bindMounts = bindMounts;
config = actualConfig;
})
{ inherit lib; };
fullConfig = {
"${namespace}".services.traefik = lib.mkIf cfg.reverseProxy.enable {
reverseProxies = [ reverseProxyConfig ];
};
}
// actualContainer;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable fullConfig;
}

View File

@@ -1,18 +0,0 @@
{ lib, namespace, ... }:
let
inherit (lib.${namespace}) mkOpt mkReverseProxyOpt;
in
with lib;
{
options.${namespace}.services.actual = {
enable = mkEnableOption "actual service";
port = mkOpt types.int 80 "Port for Actual to be hosted on";
localAddress = mkOpt types.str "127.0.0.1" "local address of the service";
dataDir = mkOpt types.str "" "Path to the data dir";
reverseProxy = mkReverseProxyOpt;
};
}

View File

@@ -7,7 +7,7 @@
with lib;
let
cfg = config.${namespace}.services.gitea;
rootUrl = "https://gitea.mjallen.dev/";
rootUrl = "https://gitea.${namespace}.dev/";
mailerPasswordFile = config.sops.secrets."jallen-nas/gitea/mail-key".path;
metricsTokenFile = config.sops.secrets."jallen-nas/gitea/metrics-key".path;

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{ lib, namespace, ... }:
with lib;
{
options.mjallen.sops = {
options.${namespace}.sops = {
enable = mkEnableOption "enable sops";
defaultSopsFile = mkOption {