mkModule
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib.mjallen.file)
|
inherit (lib.${namespace}.file)
|
||||||
readFile
|
readFile
|
||||||
pathExists
|
pathExists
|
||||||
safeImport
|
safeImport
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
namespace,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib.mjallen.module) mkModule mkOpt;
|
inherit (lib.${namespace}.module) mkModule mkOpt;
|
||||||
in
|
in
|
||||||
mkModule {
|
mkModule {
|
||||||
name = "sops";
|
name = "sops";
|
||||||
@@ -23,13 +24,13 @@ mkModule {
|
|||||||
];
|
];
|
||||||
|
|
||||||
sops = {
|
sops = {
|
||||||
inherit (config.mjallen.sops) defaultSopsFile;
|
inherit (config.${namespace}.sops) defaultSopsFile;
|
||||||
defaultSopsFormat = "yaml";
|
defaultSopsFormat = "yaml";
|
||||||
|
|
||||||
age = {
|
age = {
|
||||||
generateKey = true;
|
generateKey = true;
|
||||||
keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
|
keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
|
||||||
sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ] ++ config.mjallen.sops.sshKeyPaths;
|
sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ] ++ config.${namespace}.sops.sshKeyPaths;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Example usage of the reverse proxy utilities
|
# Example usage of the reverse proxy utilities
|
||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib.mjallen-lib.reverseproxy)
|
inherit (lib.${namespace}-lib.reverseproxy)
|
||||||
mkReverseProxy
|
mkReverseProxy
|
||||||
mkReverseProxies
|
mkReverseProxies
|
||||||
templates
|
templates
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, namespace, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib.mjallen.module) mkModule mkOpt mkBoolOpt;
|
inherit (lib.${namespace}.module) mkModule mkOpt mkBoolOpt;
|
||||||
in
|
in
|
||||||
mkModule {
|
mkModule {
|
||||||
name = "sops";
|
name = "sops";
|
||||||
@@ -22,18 +22,18 @@ mkModule {
|
|||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
sops = {
|
sops = {
|
||||||
inherit (config.mjallen.sops) defaultSopsFile validateSopsFiles;
|
inherit (config.${namespace}.sops) defaultSopsFile validateSopsFiles;
|
||||||
|
|
||||||
age = {
|
age = {
|
||||||
inherit (config.mjallen.sops) generateAgeKey;
|
inherit (config.${namespace}.sops) generateAgeKey;
|
||||||
|
|
||||||
keyFile =
|
keyFile =
|
||||||
if config.mjallen.sops.ageKeyPath != null then
|
if config.${namespace}.sops.ageKeyPath != null then
|
||||||
config.mjallen.sops.ageKeyPath
|
config.${namespace}.sops.ageKeyPath
|
||||||
else
|
else
|
||||||
"${config.users.users.${config.mjallen.user.name}.home}/.config/sops/age/keys.txt";
|
"${config.users.users.${config.${namespace}.user.name}.home}/.config/sops/age/keys.txt";
|
||||||
|
|
||||||
sshKeyPaths = config.mjallen.sops.sshKeyPaths;
|
sshKeyPaths = config.${namespace}.sops.sshKeyPaths;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, namespace, ... }:
|
||||||
let
|
let
|
||||||
inherit (inputs.self.mjallen-lib.system.common)
|
inherit (inputs.self.${namespace}-lib.system.common)
|
||||||
mkExtendedLib
|
mkExtendedLib
|
||||||
mkNixpkgsConfig
|
mkNixpkgsConfig
|
||||||
mkHomeConfigs
|
mkHomeConfigs
|
||||||
@@ -13,10 +13,10 @@ in
|
|||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
let
|
let
|
||||||
# Get all systems
|
# Get all systems
|
||||||
allSystems = inputs.self.mjallen-lib.file.scanSystems ../systems;
|
allSystems = inputs.self.${namespace}-lib.file.scanSystems ../systems;
|
||||||
|
|
||||||
# Filter for NixOS systems
|
# Filter for NixOS systems
|
||||||
nixosSystems = inputs.self.mjallen-lib.file.filterNixOSSystems allSystems;
|
nixosSystems = inputs.self.${namespace}-lib.file.filterNixOSSystems allSystems;
|
||||||
in
|
in
|
||||||
inputs.nixpkgs.lib.mapAttrs' (
|
inputs.nixpkgs.lib.mapAttrs' (
|
||||||
_name:
|
_name:
|
||||||
@@ -74,7 +74,7 @@ in
|
|||||||
# Import all nixos modules recursively
|
# Import all nixos modules recursively
|
||||||
../${system}/${hostname}
|
../${system}/${hostname}
|
||||||
]
|
]
|
||||||
++ (extendedLib.mjallen.file.importModulesRecursive ../modules/nixos);
|
++ (extendedLib.${namespace}.file.importModulesRecursive ../modules/nixos);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
) nixosSystems;
|
) nixosSystems;
|
||||||
@@ -83,7 +83,7 @@ in
|
|||||||
homeConfigurations =
|
homeConfigurations =
|
||||||
let
|
let
|
||||||
# Get all homes
|
# Get all homes
|
||||||
allHomes = inputs.self.mjallen-lib.file.scanHomes ../homes;
|
allHomes = inputs.self.${namespace}-lib.file.scanHomes ../homes;
|
||||||
in
|
in
|
||||||
inputs.nixpkgs.lib.mapAttrs' (
|
inputs.nixpkgs.lib.mapAttrs' (
|
||||||
_name:
|
_name:
|
||||||
@@ -125,7 +125,7 @@ in
|
|||||||
# Import the home configuration
|
# Import the home configuration
|
||||||
path
|
path
|
||||||
]
|
]
|
||||||
++ (extendedLib.mjallen.file.importModulesRecursive ../modules/home);
|
++ (extendedLib.${namespace}.file.importModulesRecursive ../modules/home);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
) allHomes;
|
) allHomes;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ inputs }:
|
{ inputs, lib, namespace }:
|
||||||
let
|
let
|
||||||
inherit (inputs.nixpkgs.lib)
|
inherit (inputs.nixpkgs.lib)
|
||||||
mapAttrs
|
mapAttrs
|
||||||
@@ -28,23 +28,69 @@ rec {
|
|||||||
name,
|
name,
|
||||||
description ? "",
|
description ? "",
|
||||||
options ? { },
|
options ? { },
|
||||||
config ? { },
|
moduleConfig ? { },
|
||||||
|
domain ? "services",
|
||||||
|
config
|
||||||
}:
|
}:
|
||||||
{ lib, ... }:
|
let
|
||||||
|
cfg = config.${namespace}.${domain}.${name};
|
||||||
|
|
||||||
|
# Create reverse proxy configuration using mkReverseProxy
|
||||||
|
reverseProxyConfig = lib.${namespace}.mkReverseProxy {
|
||||||
|
inherit name;
|
||||||
|
subdomain = cfg.reverseProxy.subdomain;
|
||||||
|
url = "http://${config.${namespace}.network.ipv4.address}:${toString cfg.port}"; # TODO: address
|
||||||
|
middlewares = cfg.reverseProxy.middlewares;
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultConfig = {
|
||||||
|
${namespace}.services.traefik = lib.mkIf cfg.reverseProxy.enable {
|
||||||
|
reverseProxies = [ reverseProxyConfig ];
|
||||||
|
};
|
||||||
|
|
||||||
|
users = lib.mkIf cfg.createUser {
|
||||||
|
users.${name} = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = name;
|
||||||
|
home = cfg.configDir;
|
||||||
|
};
|
||||||
|
groups.${name} = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d ${cfg.configDir} 0700 ${name} ${name} - -"
|
||||||
|
"d ${cfg.configDir}/server-files 0700 ${name} ${name} - -"
|
||||||
|
"d ${cfg.configDir}/user-files 0700 ${name} ${name} - -"
|
||||||
|
];
|
||||||
|
} // moduleConfig;
|
||||||
|
in
|
||||||
|
{ config, lib, ... }:
|
||||||
{
|
{
|
||||||
options.mjallen.${name} = lib.mkOption {
|
options.${namespace}.${domain}.${name} = lib.mkOption {
|
||||||
type = lib.types.submodule {
|
type = lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
enable = lib.mkEnableOption description;
|
enable = lib.mkEnableOption description;
|
||||||
|
|
||||||
|
port = mkOpt types.int 80 "Port for ${name} to be hosted on";
|
||||||
|
|
||||||
|
configDir = mkOpt types.str "/media/nas/main/nix-app-data/${name}" "Path to the config dir";
|
||||||
|
|
||||||
|
dataDir = mkOpt types.str "/media/nas/main/${name}" "Path to the data dir";
|
||||||
|
|
||||||
|
createUser = mkBoolOpt false "create a user for this module/service";
|
||||||
|
|
||||||
|
reverseProxy = mkReverseProxyOpt;
|
||||||
}
|
}
|
||||||
// options;
|
// options;
|
||||||
};
|
};
|
||||||
default = { };
|
default = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.mjallen.${name}.enable config;
|
config = lib.mkIf cfg.enable defaultConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
# container
|
||||||
mkContainer =
|
mkContainer =
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ inputs }:
|
{ inputs, namespace }:
|
||||||
let
|
let
|
||||||
inherit (inputs.nixpkgs.lib) filterAttrs mapAttrs';
|
inherit (inputs.nixpkgs.lib) filterAttrs mapAttrs';
|
||||||
in
|
in
|
||||||
@@ -7,7 +7,7 @@ in
|
|||||||
flake: nixpkgs:
|
flake: nixpkgs:
|
||||||
nixpkgs.lib.extend (
|
nixpkgs.lib.extend (
|
||||||
_final: _prev: {
|
_final: _prev: {
|
||||||
mjallen = flake.mjallen-lib;
|
mjallen = flake.${namespace}-lib;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ in
|
|||||||
hostname,
|
hostname,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (flake.mjallen-lib.file) scanHomes;
|
inherit (flake.${namespace}-lib.file) scanHomes;
|
||||||
homesPath = ../../homes;
|
homesPath = ../../homes;
|
||||||
allHomes = scanHomes homesPath;
|
allHomes = scanHomes homesPath;
|
||||||
in
|
in
|
||||||
@@ -59,7 +59,7 @@ in
|
|||||||
sharedModules = [
|
sharedModules = [
|
||||||
{ _module.args.lib = extendedLib; }
|
{ _module.args.lib = extendedLib; }
|
||||||
]
|
]
|
||||||
++ (extendedLib.mjallen.file.importModulesRecursive ../../modules/home);
|
++ (extendedLib.${namespace}.file.importModulesRecursive ../../modules/home);
|
||||||
users = mapAttrs' (_name: homeConfig: {
|
users = mapAttrs' (_name: homeConfig: {
|
||||||
name = homeConfig.username;
|
name = homeConfig.username;
|
||||||
value = {
|
value = {
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
namespace,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.desktop.gnome;
|
cfg = config.${namespace}.desktop.gnome;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./options.nix ];
|
imports = [ ./options.nix ];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.desktop.gnome = {
|
options.${namespace}.desktop.gnome = {
|
||||||
enable = mkEnableOption "enable gnome settings";
|
enable = mkEnableOption "enable gnome settings";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.btop;
|
cfg = config.${namespace}.programs.btop;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./options.nix ];
|
imports = [ ./options.nix ];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.programs.btop = {
|
options.${namespace}.programs.btop = {
|
||||||
enable = mkEnableOption "enable btop";
|
enable = mkEnableOption "enable btop";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
namespace,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
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}";
|
drawer = "nwg-drawer -fm nautilus -term kitty -mb 10 -mt 10 -ml 10 -mr 10 -pbuseicontheme -i ${config.stylix.icons.dark}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -66,7 +67,7 @@ in
|
|||||||
xsettingsd
|
xsettingsd
|
||||||
xwayland
|
xwayland
|
||||||
|
|
||||||
pkgs.mjallen.pipewire-python
|
pkgs.${namespace}.pipewire-python
|
||||||
]
|
]
|
||||||
++ (if cfg.notificationDaemon == "mako" then [ mako ] else [ dunst ])
|
++ (if cfg.notificationDaemon == "mako" then [ mako ] else [ dunst ])
|
||||||
++ (if cfg.launcher == "wofi" then [ wofi ] else [ rofi ])
|
++ (if cfg.launcher == "wofi" then [ wofi ] else [ rofi ])
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.programs.hyprland = {
|
options.${namespace}.programs.hyprland = {
|
||||||
enable = mkEnableOption "enable hyprland";
|
enable = mkEnableOption "enable hyprland";
|
||||||
|
|
||||||
primaryDisplay = mkOption {
|
primaryDisplay = mkOption {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, config, ... }:
|
{ lib, config, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.kitty;
|
cfg = config.${namespace}.programs.kitty;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./options.nix ];
|
imports = [ ./options.nix ];
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ let
|
|||||||
inherit (lib.${namespace}) mkOpt;
|
inherit (lib.${namespace}) mkOpt;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.mjallen.programs.kitty = {
|
options.${namespace}.programs.kitty = {
|
||||||
enable = mkEnableOption "enable kitty terminal";
|
enable = mkEnableOption "enable kitty terminal";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.mako;
|
cfg = config.${namespace}.programs.mako;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./options.nix ];
|
imports = [ ./options.nix ];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.programs.mako = {
|
options.${namespace}.programs.mako = {
|
||||||
enable = mkEnableOption "enable mako";
|
enable = mkEnableOption "enable mako";
|
||||||
|
|
||||||
fontName = mkOption {
|
fontName = mkOption {
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
namespace,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.nwg-dock;
|
cfg = config.${namespace}.programs.nwg-dock;
|
||||||
palette = import cfg.theme.file;
|
palette = import cfg.theme.file;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.programs.nwg-dock = {
|
options.${namespace}.programs.nwg-dock = {
|
||||||
enable = mkEnableOption "enable nwg-dock";
|
enable = mkEnableOption "enable nwg-dock";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
namespace,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.nwg-drawer;
|
cfg = config.${namespace}.programs.nwg-drawer;
|
||||||
palette = import cfg.theme.file;
|
palette = import cfg.theme.file;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.programs.nwg-drawer = {
|
options.${namespace}.programs.nwg-drawer = {
|
||||||
enable = mkEnableOption "enable nwg-drawer";
|
enable = mkEnableOption "enable nwg-drawer";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.nwg-panel;
|
cfg = config.${namespace}.programs.nwg-panel;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./options.nix ];
|
imports = [ ./options.nix ];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.programs.nwg-panel = {
|
options.${namespace}.programs.nwg-panel = {
|
||||||
enable = mkEnableOption "enable nwg-panel";
|
enable = mkEnableOption "enable nwg-panel";
|
||||||
|
|
||||||
defaultApps = mkOption {
|
defaultApps = mkOption {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.waybar;
|
cfg = config.${namespace}.programs.waybar;
|
||||||
|
|
||||||
baseStyle =
|
baseStyle =
|
||||||
if cfg.style.file != null then
|
if cfg.style.file != null then
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
inherit (types)
|
inherit (types)
|
||||||
@@ -13,7 +13,7 @@ let
|
|||||||
;
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.mjallen.programs.waybar = {
|
options.${namespace}.programs.waybar = {
|
||||||
enable = mkEnableOption "Waybar status bar";
|
enable = mkEnableOption "Waybar status bar";
|
||||||
|
|
||||||
# Legacy/compat options (kept for backwards compatibility)
|
# Legacy/compat options (kept for backwards compatibility)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.waybar;
|
cfg = config.${namespace}.programs.waybar;
|
||||||
|
|
||||||
pythonEnv = pkgs.python3.withPackages (_ps: [
|
pythonEnv = pkgs.python3.withPackages (_ps: [
|
||||||
pkgs.${namespace}.homeassistant-api
|
pkgs.${namespace}.homeassistant-api
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
namespace,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.waybar;
|
cfg = config.${namespace}.programs.waybar;
|
||||||
|
|
||||||
waybar-weather = pkgs.writeScriptBin "waybar-weather" ''
|
waybar-weather = pkgs.writeScriptBin "waybar-weather" ''
|
||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.wlogout;
|
cfg = config.${namespace}.programs.wlogout;
|
||||||
palette = import cfg.theme.file;
|
palette = import cfg.theme.file;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.programs.wlogout = {
|
options.${namespace}.programs.wlogout = {
|
||||||
enable = mkEnableOption "enable wlogout";
|
enable = mkEnableOption "enable wlogout";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.programs.wofi;
|
cfg = config.${namespace}.programs.wofi;
|
||||||
palette = import cfg.theme.file;
|
palette = import cfg.theme.file;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.programs.wofi = {
|
options.${namespace}.programs.wofi = {
|
||||||
enable = mkEnableOption "enable wofi";
|
enable = mkEnableOption "enable wofi";
|
||||||
|
|
||||||
fontName = mkOption {
|
fontName = mkOption {
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
namespace,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.mjallen.shell-aliases;
|
cfg = config.${namespace}.shell-aliases;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.mjallen.shell-aliases = {
|
options.${namespace}.shell-aliases = {
|
||||||
enable = lib.mkEnableOption "Common shell aliases";
|
enable = lib.mkEnableOption "Common shell aliases";
|
||||||
|
|
||||||
buildHost = lib.mkOption {
|
buildHost = lib.mkOption {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ let
|
|||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.mjallen.desktop.hyprland = {
|
options.${namespace}.desktop.hyprland = {
|
||||||
enable = mkEnableOption "enable hyprland desktop environment";
|
enable = mkEnableOption "enable hyprland desktop environment";
|
||||||
|
|
||||||
wallpaperSource = mkOpt (types.enum [
|
wallpaperSource = mkOpt (types.enum [
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ let
|
|||||||
{ }
|
{ }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
address = cfg.ipv4.address;
|
address = "${cfg.ipv4.address}\\24";
|
||||||
gateway = cfg.ipv4.gateway;
|
gateway = cfg.ipv4.gateway;
|
||||||
dns = cfg.ipv4.dns;
|
dns = cfg.ipv4.dns;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,59 +7,42 @@
|
|||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.${namespace}.services.actual;
|
name = "actual";
|
||||||
|
cfg = config.${namespace}.services.${name};
|
||||||
|
|
||||||
actualConfig = {
|
actualConfig = lib.${namespace}.mkModule rec {
|
||||||
services.actual = {
|
inherit name;
|
||||||
enable = true;
|
description = "Actual Personal Finance Planner";
|
||||||
openFirewall = true;
|
options = { };
|
||||||
settings = {
|
moduleConfig = {
|
||||||
trustedProxies = [ "10.0.1.3" ];
|
services.actual = {
|
||||||
port = cfg.port;
|
enable = true;
|
||||||
dataDir = cfg.dataDir;
|
openFirewall = true;
|
||||||
serverFiles = "${cfg.dataDir}/server-files";
|
settings = {
|
||||||
userFiles = "${cfg.dataDir}/user-files";
|
trustedProxies = [ config.${namespace}.network.ipv4.address ];
|
||||||
|
port = cfg.port;
|
||||||
|
configDir = cfg.configDir;
|
||||||
|
serverFiles = "${cfg.configDir}/server-files";
|
||||||
|
userFiles = "${cfg.configDir}/user-files";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services = {
|
systemd.services = lib.mkIf cfg.createUser {
|
||||||
actual = {
|
actual = {
|
||||||
environment.ACTUAL_CONFIG_PATH = lib.mkForce "${cfg.dataDir}/config.json";
|
environment.ACTUAL_CONFIG_PATH = lib.mkForce "${cfg.configDir}/config.json";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = lib.mkForce "${lib.getExe pkgs.actual-server} --config ${cfg.dataDir}/config.json";
|
ExecStart = lib.mkForce "${lib.getExe pkgs.actual-server} --config ${cfg.configDir}/config.json";
|
||||||
WorkingDirectory = lib.mkForce cfg.dataDir;
|
WorkingDirectory = lib.mkForce cfg.configDir;
|
||||||
StateDirectoryMode = lib.mkForce 700;
|
StateDirectoryMode = lib.mkForce 700;
|
||||||
DynamicUser = lib.mkForce false;
|
DynamicUser = lib.mkForce false;
|
||||||
ProtectSystem = lib.mkForce "full";
|
ProtectSystem = lib.mkForce "full";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
inherit config;
|
||||||
users.users.actual = {
|
|
||||||
isSystemUser = true;
|
|
||||||
group = "actual";
|
|
||||||
home = cfg.dataDir;
|
|
||||||
};
|
|
||||||
users.groups.actual = { };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# 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
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./options.nix ];
|
imports = [ actualConfig ];
|
||||||
|
|
||||||
config = mkIf cfg.enable fullConfig;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.${namespace}.services.gitea;
|
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;
|
mailerPasswordFile = config.sops.secrets."jallen-nas/gitea/mail-key".path;
|
||||||
metricsTokenFile = config.sops.secrets."jallen-nas/gitea/metrics-key".path;
|
metricsTokenFile = config.sops.secrets."jallen-nas/gitea/metrics-key".path;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ lib, ... }:
|
{ lib, namespace, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
options.mjallen.sops = {
|
options.${namespace}.sops = {
|
||||||
enable = mkEnableOption "enable sops";
|
enable = mkEnableOption "enable sops";
|
||||||
|
|
||||||
defaultSopsFile = mkOption {
|
defaultSopsFile = mkOption {
|
||||||
|
|||||||
@@ -27,8 +27,7 @@
|
|||||||
actual = {
|
actual = {
|
||||||
enable = true;
|
enable = true;
|
||||||
port = 3333;
|
port = 3333;
|
||||||
localAddress = "10.0.1.3";
|
createUser = true;
|
||||||
dataDir = "/media/nas/main/nix-app-data/actual";
|
|
||||||
reverseProxy = {
|
reverseProxy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
subdomain = "actual";
|
subdomain = "actual";
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ in
|
|||||||
network = {
|
network = {
|
||||||
hostName = "jallen-nas";
|
hostName = "jallen-nas";
|
||||||
ipv4 = {
|
ipv4 = {
|
||||||
address = "10.0.1.3/24";
|
address = "10.0.1.3";
|
||||||
method = "manual";
|
method = "manual";
|
||||||
gateway = "10.0.1.1";
|
gateway = "10.0.1.1";
|
||||||
interface = "enp197s0";
|
interface = "enp197s0";
|
||||||
|
|||||||
Reference in New Issue
Block a user