Merge pull request #40 from wi11-holdsworth/enhancement/38

refactor: switch from modules to import arrays
This commit is contained in:
Will 2025-10-22 01:23:08 +11:00 committed by GitHub
commit c852bc2676
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
75 changed files with 1870 additions and 2541 deletions

View file

@ -39,6 +39,9 @@
userName ? "will",
system ? "x86_64-linux",
}:
let
util = import ./util.nix;
in
nixpkgs.lib.nixosSystem {
modules = [
./hosts/${hostName}/configuration.nix
@ -52,8 +55,7 @@
];
backupFileExtension = "backup";
extraSpecialArgs = {
inherit userName;
inherit hostName;
inherit userName hostName util;
};
useGlobalPkgs = true;
useUserPackages = true;
@ -61,10 +63,13 @@
}
];
specialArgs = {
inherit inputs;
inherit hostName;
inherit userName;
inherit system;
inherit
inputs
hostName
userName
system
util
;
};
inherit system;
};

View file

@ -1,25 +1,32 @@
{
# keep-sorted start
userName,
util,
# keep-sorted end
...
}:
{
imports = [
# keep-sorted start
../../modules/nixos/default.nix
./hardware-configuration.nix
];
# reusable modules
# keep-sorted start
amd-gpu.enable = true;
desktop.enable = true;
dev.enable = true;
external-speakers.enable = true;
gaming.enable = true;
link2c.enable = true;
plasma.enable = true;
# keep-sorted end
# config
]
++ (util.toImports ../../modules/nixos/features [
# keep-sorted start
"amd-gpu"
"external-speakers"
"gaming"
"link2c"
"plasma"
# keep-sorted end
])
++ (util.toImports ../../modules/nixos/bundles [
# keep-sorted start
"desktop"
"dev"
# keep-sorted end
]);
boot.initrd.luks.devices."luks-b164af31-c1c3-4b4e-83c8-eb39802c2027".device =
"/dev/disk/by-uuid/b164af31-c1c3-4b4e-83c8-eb39802c2027";

View file

@ -1,18 +1,20 @@
{
# keep-sorted start
userName,
util,
# keep-sorted end
...
}:
{
imports = [ ../../modules/home-manager/default.nix ];
# reusable modules
imports = [
../../modules/home-manager/default.nix
]
++ (util.toImports ../../modules/home-manager/bundles [
# keep-sorted start
desktop.enable = true;
dev.enable = true;
"desktop"
"dev"
# keep-sorted end
# config
]);
age.secrets."protonmail-desktop-password".file = ../../secrets/protonmail-desktop-password.age;

View file

@ -1,24 +1,30 @@
{
# keep-sorted start
userName,
util,
# keep-sorted end
...
}:
{
imports = [
# keep-sorted start
../../modules/nixos/default.nix
./hardware-configuration.nix
];
# reusable modules
# keep-sorted start
amd-gpu.enable = true;
desktop.enable = true;
dev.enable = true;
gnome.enable = true;
tlp.enable = true;
# keep-sorted end
# config
]
++ (util.toImports ../../modules/nixos/features [
# keep-sorted start
"amd-gpu"
"gnome"
"tlp"
# keep-sorted end
])
++ (util.toImports ../../modules/nixos/bundles [
# keep-sorted start
"desktop"
"dev"
# keep-sorted end
]);
boot.initrd.luks.devices."luks-a7726a9d-535f-44bc-9c0e-adc501fad371".device =
"/dev/disk/by-uuid/a7726a9d-535f-44bc-9c0e-adc501fad371";

View file

@ -1,18 +1,20 @@
{
# keep-sorted start
userName,
util,
# keep-sorted end
...
}:
{
imports = [ ../../modules/home-manager/default.nix ];
# reusable modules
imports = [
../../modules/home-manager/default.nix
]
++ (util.toImports ../../modules/home-manager/bundles [
# keep-sorted start
desktop.enable = true;
dev.enable = true;
"desktop"
"dev"
# keep-sorted end
# config
]);
age.secrets."protonmail-laptop-password".file = ../../secrets/protonmail-laptop-password.age;

View file

@ -1,23 +1,27 @@
{
# keep-sorted start
hostName,
userName,
util,
# keep-sorted end
...
}:
{
imports = [
# keep-sorted start
../../modules/nixos/default.nix
./hardware-configuration.nix
];
# reusable modules
# keep-sorted start
borgmatic.enable = true;
intel-gpu.enable = true;
server.enable = true;
# keep-sorted end
# config
]
++ (util.toImports ../../modules/nixos/features [
# keep-sorted start
"borgmatic"
"intel-gpu"
# keep-sorted end
])
++ (util.toImports ../../modules/nixos/bundles [
"server"
]);
networking.hostName = "${hostName}";

View file

@ -3,7 +3,9 @@
...
}:
{
imports = [ ../../modules/home-manager/default.nix ];
imports = [
../../modules/home-manager/default.nix
];
home = {
username = "${userName}";

View file

@ -1,24 +1,16 @@
{
config,
lib,
util,
...
}:
let
feature = "desktop";
in
{
config = lib.mkIf config.${feature}.enable {
imports = util.toImports ../features [
# keep-sorted start
aerc.enable = true;
kitty.enable = true;
mail.enable = true;
obsidian.enable = true;
zellij.enable = true;
zen-browser.enable = true;
"aerc"
"kitty"
"mail"
"obsidian"
"zellij"
"zen-browser"
# keep-sorted end
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
];
}

View file

@ -1,19 +1,9 @@
{
config,
lib,
util,
...
}:
let
feature = "dev";
in
{
config = lib.mkIf config.${feature}.enable {
# keep-sorted start
zed-editor.enable = lib.mkDefault true;
# keep-sorted end
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
imports = util.toImports ../features [
"zed-editor"
];
}

View file

@ -1,22 +1,20 @@
{ lib, ... }:
let
featureBundler =
featuresDir:
map (name: featuresDir + "/${name}") (builtins.attrNames (builtins.readDir featuresDir));
in
{
imports = (featureBundler ./bundles) ++ (featureBundler ./features);
util,
...
}:
{
imports = util.toImports ./features [
# keep-sorted start
agenix.enable = lib.mkDefault true;
bat.enable = lib.mkDefault true;
direnv.enable = lib.mkDefault true;
eza.enable = lib.mkDefault true;
fish.enable = lib.mkDefault true;
gh.enable = lib.mkDefault true;
git.enable = lib.mkDefault true;
starship.enable = lib.mkDefault true;
yazi.enable = lib.mkDefault true;
zoxide.enable = lib.mkDefault true;
"agenix"
"bat"
"direnv"
"eza"
"fish"
"gh"
"git"
"starship"
"yazi"
"zoxide"
# keep-sorted end
];
}

View file

@ -1,13 +1,4 @@
{
config,
lib,
...
}:
let
feature = "aerc";
in
{
config = lib.mkIf config.${feature}.enable {
accounts.email.accounts.personal.aerc.enable = true;
programs.aerc = {
enable = true;
@ -59,9 +50,4 @@ in
};
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,16 +1,8 @@
{
config,
lib,
userName,
...
}:
let
feature = "agenix";
in
{
config = lib.mkIf config.${feature}.enable {
age.identityPaths = [ "/home/${userName}/.ssh/id_ed25519" ];
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,22 +1,8 @@
{
config,
lib,
...
}:
let
feature = "bat";
in
{
config = lib.mkIf config.${feature}.enable {
programs.bat = {
enable = true;
config = {
theme = "Dracula";
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,3 @@
{
config,
lib,
...
}:
let
feature = "direnv";
in
{
config = lib.mkIf config.${feature}.enable { programs.direnv.enable = true; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
programs.direnv.enable = true;
}

View file

@ -1,20 +1,6 @@
{
config,
lib,
...
}:
let
feature = "espanso";
in
{
config = lib.mkIf config.${feature}.enable {
services.espanso = {
enable = true;
configs = { };
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,4 @@
{
config,
lib,
...
}:
let
feature = "eza";
in
{
config = lib.mkIf config.${feature}.enable {
programs.eza = {
enable = true;
extraOptions = [
@ -289,9 +280,4 @@ in
};
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "fish";
in
{
config = lib.mkIf config.${feature}.enable {
home.shell.enableFishIntegration = true;
programs.fish = {
enable = true;
@ -66,9 +60,4 @@ in
fi
'';
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,4 @@
{
config,
lib,
...
}:
let
feature = "gh";
in
{
config = lib.mkIf config.${feature}.enable {
programs.gh = {
enable = true;
settings = {
@ -15,9 +6,4 @@ in
editor = "nvim";
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,5 @@
{
config,
lib,
...
}:
let
feature = "git";
in
{
config = lib.mkIf config.${feature}.enable {
programs.${feature} = {
programs.git = {
enable = true;
delta = {
@ -50,7 +41,4 @@ in
pull.rebase = false;
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "kitty";
in
{
config = lib.mkIf config.${feature}.enable {
programs.kitty = {
enable = true;
enableGitIntegration = true;
@ -24,9 +18,4 @@ in
confirm_os_window_close = 0;
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,11 @@
{
# keep-sorted start
config,
lib,
hostName,
# keep-sorted end
...
}:
let
feature = "mail";
in
{
config = lib.mkIf config.${feature}.enable {
accounts.email =
let
certificatesFile = config.age.secrets.protonmail-cert.path;
@ -54,9 +51,4 @@ in
};
};
age.secrets."protonmail-cert".file = ../../../secrets/protonmail-cert.age;
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,9 +1,4 @@
{ config, lib, ... }:
let
feature = "obsidian";
in
{
config = lib.mkIf config.${feature}.enable {
programs.obsidian = {
enable = true;
defaultSettings = {
@ -118,9 +113,4 @@ in
};
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,4 @@
{
config,
lib,
...
}:
let
feature = "starship";
in
{
config = lib.mkIf config.${feature}.enable {
programs.starship = {
enable = true;
settings.character = {
@ -15,7 +6,4 @@ in
error_symbol = "[%](bold red) ";
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "yazi";
in
{
config = lib.mkIf config.${feature}.enable {
programs.yazi = {
enable = true;
plugins = {
@ -27,9 +21,4 @@ in
# keep-sorted end
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,11 @@
{
config,
# keep-sorted start
lib,
pkgs,
# keep-sorted end
...
}:
let
feature = "zed-editor";
in
{
config = lib.mkIf config.${feature}.enable {
programs.zed-editor = {
enable = true;
package = pkgs.zed-editor-fhs;
@ -89,9 +86,4 @@ in
# keep-sorted end
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,4 @@
{
config,
lib,
...
}:
let
feature = "zellij";
in
{
config = lib.mkIf config.${feature}.enable {
programs.zellij = {
enable = true;
settings = {
@ -16,9 +7,4 @@ in
default_shell = "fish";
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,4 @@
{
config,
lib,
...
}:
let
feature = "zen-browser";
in
{
config = lib.mkIf config.${feature}.enable {
programs.zen-browser =
let
profileName = "fmnikwnj.Default Profile";
@ -73,7 +64,4 @@ in
# keep-sorted end
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,4 @@
{
config,
lib,
...
}:
let
feature = "zoxide";
in
{
config = lib.mkIf config.${feature}.enable {
programs.zoxide = {
enable = true;
enableBashIntegration = true;
@ -15,9 +6,4 @@ in
"--cmd j"
];
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,19 +1,18 @@
{
config,
lib,
# keep-sorted start
pkgs,
util,
# keep-sorted end
...
}:
let
feature = "desktop";
in
{
config = lib.mkIf config.${feature}.enable {
imports = util.toImports ../features [
# keep-sorted start
pipewire.enable = true;
print-and-scan.enable = true;
protonmail-bridge.enable = true;
"pipewire"
"print-and-scan"
"protonmail-bridge"
# keep-sorted end
];
environment.systemPackages = with pkgs; [
# keep-sorted start
@ -26,9 +25,4 @@ in
textsnatcher
# keep-sorted end
];
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "dev";
in
{
config = lib.mkIf config.${feature}.enable {
environment.systemPackages = with pkgs; [
# keep-sorted start
bacon
@ -20,7 +14,5 @@ in
vscode
# keep-sorted end
];
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,39 +1,31 @@
{
config,
lib,
util,
...
}:
let
feature = "server";
in
{
config = lib.mkIf config.${feature}.enable {
imports = util.toImports ../features [
# keep-sorted start
copyparty.enable = true;
couchdb.enable = true;
flaresolverr.enable = true;
homepage-dashboard.enable = true;
immich.enable = true;
jellyfin.enable = true;
lidarr.enable = true;
miniflux.enable = true;
nginx.enable = true;
ntfy-sh.enable = true;
paperless.enable = true;
prowlarr.enable = true;
qbittorrent.enable = true;
radarr.enable = true;
sonarr.enable = true;
syncthing.enable = true;
vaultwarden.enable = true;
"copyparty"
"couchdb"
"flaresolverr"
"homepage-dashboard"
"immich"
"jellyfin"
"lidarr"
"miniflux"
"nginx"
"ntfy-sh"
"paperless"
"prowlarr"
"qbittorrent"
"radarr"
"sonarr"
"syncthing"
"vaultwarden"
# keep-sorted end
];
users.groups.media = { };
services.borgmatic.settings.source_directories = [ "/srv" ];
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,28 +1,26 @@
{
lib,
# keep-sorted start
pkgs,
util,
# keep-sorted end
...
}:
let
featureBundler =
featuresDir:
map (name: featuresDir + "/${name}") (builtins.attrNames (builtins.readDir featuresDir));
in
{
imports = (featureBundler ./bundles) ++ (featureBundler ./features);
imports = util.toImports ./features [
# keep-sorted start
agenix.enable = lib.mkDefault true;
fonts.enable = lib.mkDefault true;
localisation.enable = lib.mkDefault true;
network.enable = lib.mkDefault true;
nh.enable = lib.mkDefault true;
nix-settings.enable = lib.mkDefault true;
nixpkgs.enable = lib.mkDefault true;
nixvim.enable = lib.mkDefault true;
syncthing.enable = lib.mkDefault true;
systemd-boot.enable = lib.mkDefault true;
tailscale.enable = lib.mkDefault true;
"agenix"
"fonts"
"localisation"
"network"
"nh"
"nix-settings"
"nixpkgs"
"nixvim"
"syncthing"
"systemd-boot"
"tailscale"
# keep-sorted end
];
environment.systemPackages =
with pkgs;

View file

@ -1,21 +1,14 @@
{
config,
# keep-sorted start
inputs,
lib,
system,
userName,
# keep-sorted end
...
}:
let
feature = "agenix";
in
{
config = lib.mkIf config.${feature}.enable {
environment.systemPackages = [ inputs.agenix.packages.${system}.default ];
age.identityPaths = [ "/home/${userName}/.ssh/id_ed25519" ];
};
imports = [ inputs.agenix.nixosModules.default ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,15 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "amd-gpu";
in
{
config = lib.mkIf config.${feature}.enable {
# load graphics drivers before anything else
boot.initrd.kernelModules = [ "amdgpu" ];
@ -20,7 +13,4 @@ in
};
services.xserver.videoDrivers = [ "amdgpu" ];
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,11 @@
{
# keep-sorted start
config,
lib,
# keep-sorted end
...
}:
let
feature = "borgmatic";
in
{
config = lib.mkIf config.${feature}.enable {
# service
services.borgmatic = {
enable = true;
@ -86,7 +84,4 @@ in
"borgmatic".file = ../../../secrets/borgmatic.age;
"borgmatic-pg".file = ../../../secrets/borgmatic-pg.age;
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,19 +1,18 @@
{
# keep-sorted start
config,
lib,
inputs,
lib,
# keep-sorted end
...
}:
let
feature = "copyparty";
port = "5000";
in
{
imports = [ inputs.copyparty.nixosModules.default ];
config = lib.mkIf config.${feature}.enable {
services = {
# service
copyparty = {
enable = true;
settings = {
@ -24,14 +23,9 @@ in
p = lib.toInt port;
};
accounts = {
will = {
passwordFile = config.age.secrets.copyparty-will.path;
};
};
accounts.will.passwordFile = config.age.secrets.copyparty-will.path;
volumes = {
"/" = {
volumes."/" = {
path = "/srv/copyparty";
access = {
r = "*";
@ -39,18 +33,11 @@ in
};
};
};
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."copyparty.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
};
locations."/".proxyPass = "http://localhost:${port}";
};
};
@ -61,7 +48,4 @@ in
};
nixpkgs.overlays = [ inputs.copyparty.overlays.default ];
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,16 +1,12 @@
{
config,
lib,
...
}:
let
feature = "couchdb";
port = "5984";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
couchdb = {
enable = true;
databaseDir = "/srv/couchdb";
@ -42,19 +38,10 @@ in
};
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."couchdb.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
locations."/".proxyPass = "http://localhost:${port}";
};
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,17 +1,5 @@
{
config,
lib,
...
}:
let
feature = "external-speakers";
in
{
config = lib.mkIf config.${feature}.enable {
boot.extraModprobeConfig = ''
options snd_hda_intel power_save=0
'';
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,34 +1,21 @@
{
config,
lib,
...
}:
let
feature = "flaresolverr";
port = "5011";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
flaresolverr = {
enable = true;
port = lib.toInt port;
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."flaresolverr.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
locations."/".proxyPass = "http://localhost:${port}";
};
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,21 +1,10 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "fonts";
in
{
config = lib.mkIf config.${feature}.enable {
fonts.packages = with pkgs; [
nerd-fonts.jetbrains-mono
inter-nerdfont
];
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "gaming";
in
{
config = lib.mkIf config.${feature}.enable {
environment.systemPackages = with pkgs; [
# keep-sorted start
heroic
@ -38,7 +32,4 @@ in
# latest kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "gnome";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
@ -53,7 +47,4 @@ in
bibata-cursors
];
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,11 +1,12 @@
{
# keep-sorted start
config,
lib,
pkgs,
# keep-sorted end
...
}:
let
feature = "homepage-dashboard";
port = "5004";
genSecrets =
secrets:
@ -34,9 +35,7 @@ let
];
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
homepage-dashboard = {
enable = true;
listenPort = lib.toInt port;
@ -291,23 +290,14 @@ in
];
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."homepage-dashboard.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
};
locations."/".proxyPass = "http://localhost:${port}";
};
};
# secrets
age.secrets = genSecrets secrets;
system.activationScripts = insertSecrets secrets;
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,24 +1,19 @@
{
config,
lib,
...
}:
let
feature = "immich";
port = "2283";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
immich = {
enable = true;
port = builtins.fromJSON "${port}";
port = lib.toInt "${port}";
mediaLocation = "/srv/immich";
};
# database backup
borgmatic.settings = {
postgresql_databases = [
borgmatic.settings.postgresql_databases = [
{
name = "immich";
hostname = "localhost";
@ -26,11 +21,10 @@ in
password = "{credential systemd borgmatic-pg}";
}
];
};
nginx = {
clientMaxBodySize = "50000M";
virtualHosts."${feature}.fi33.buzz" = {
virtualHosts."immich.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
@ -40,7 +34,4 @@ in
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "intel-gpu";
in
{
config = lib.mkIf config.${feature}.enable {
hardware = {
enableAllFirmware = true;
graphics = {
@ -24,9 +18,4 @@ in
];
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,24 +1,15 @@
{
config,
lib,
...
}:
let
feature = "jellyfin";
port = "8096";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
jellyfin = {
enable = true;
dataDir = "/srv/jellyfin";
group = "media";
};
# reverse proxy
nginx.virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."jellyfin.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}";
@ -30,7 +21,4 @@ in
environment.sessionVariables = {
LIBVA_DRIVER_NAME = "iHD";
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,16 +1,12 @@
{
config,
lib,
...
}:
let
feature = "lidarr";
port = "5012";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
lidarr = {
enable = true;
dataDir = "/srv/lidarr";
@ -18,19 +14,10 @@ in
group = "media";
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."lidarr.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
locations."/".proxyPass = "http://localhost:${port}";
};
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,17 +1,5 @@
{
config,
lib,
...
}:
let
feature = "link2c";
in
{
config = lib.mkIf config.${feature}.enable {
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="2e1a", ATTR{idProduct}=="4c03", TEST=="power/control", ATTR{power/control}="on"
'';
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,9 +1,4 @@
{ config, lib, ... }:
let
feature = "localisation";
in
{
config = lib.mkIf config.${feature}.enable {
i18n = {
defaultLocale = "en_AU.UTF-8";
supportedLocales = [
@ -13,9 +8,4 @@ in
};
time.timeZone = "Australia/Melbourne";
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,16 +1,12 @@
{
config,
lib,
...
}:
let
feature = "miniflux";
port = "5010";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
miniflux = {
enable = true;
adminCredentialsFile = config.age.secrets.miniflux-creds.path;
@ -20,9 +16,7 @@ in
};
};
# database backup
borgmatic.settings = {
postgresql_databases = [
borgmatic.settings.postgresql_databases = [
{
name = "miniflux";
hostname = "localhost";
@ -30,25 +24,13 @@ in
password = "{credential systemd borgmatic-pg}";
}
];
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."miniflux.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
};
locations."/".proxyPass = "http://localhost:${port}";
};
};
# secrets
age.secrets."miniflux-creds".file = ../../../secrets/miniflux-creds.age;
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,21 +1,10 @@
{
config,
lib,
hostName,
...
}:
let
feature = "network";
in
{
config = lib.mkIf config.${feature}.enable {
networking = {
hostName = "${hostName}";
networkmanager.enable = true;
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,8 @@
{
config,
lib,
...
}:
let
feature = "nginx";
in
{
config = lib.mkIf config.${feature}.enable {
services.nginx = {
enable = true;
@ -36,13 +31,7 @@ in
};
};
# secrets
age.secrets."porkbun-api" = {
file = ../../../secrets/porkbun-api.age;
};
age.secrets."porkbun-api".file = ../../../secrets/porkbun-api.age;
users.users.nginx.extraGroups = [ "acme" ];
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,20 +1,11 @@
{
config,
lib,
userName,
...
}:
let
feature = "nh";
in
{
config = lib.mkIf config.${feature}.enable {
programs.nh = {
enable = true;
# clean.enable = true;
flake = "/home/${userName}/.dots";
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,9 +1,4 @@
{ config, lib, ... }:
let
feature = "nix-settings";
in
{
config = lib.mkIf config.${feature}.enable {
nix = {
gc = {
automatic = true;
@ -26,9 +21,4 @@ in
];
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,3 @@
{ config, lib, ... }:
let
feature = "nixpkgs";
in
{
config = lib.mkIf config.${feature}.enable {
nixpkgs.config.allowUnfree = true;
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
inputs,
lib,
...
}:
let
feature = "nixvim";
in
{
config = lib.mkIf config.${feature}.enable {
environment.variables.EDITOR = "nvim";
programs.nixvim = {
enable = true;
@ -72,8 +66,6 @@ in
inlayHints = true;
servers = {
nixd.enable = true;
}
// lib.optionalAttrs config.dev.enable {
rust_analyzer = {
enable = true;
installCargo = true;
@ -100,9 +92,6 @@ in
treesitter.enable = true;
};
};
};
imports = [ inputs.nixvim.nixosModules.nixvim ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,16 +1,8 @@
{
config,
lib,
...
}:
let
feature = "ntfy-sh";
port = "5002";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
ntfy-sh = {
enable = true;
settings = {
@ -20,9 +12,7 @@ in
};
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."ntfy-sh.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
@ -31,8 +21,4 @@ in
};
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -4,13 +4,10 @@
...
}:
let
feature = "paperless";
port = "5013";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
paperless = {
enable = true;
dataDir = "/srv/paperless";
@ -22,7 +19,6 @@ in
};
};
# database backup
borgmatic.settings = {
postgresql_databases = [
{
@ -34,16 +30,10 @@ in
];
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."miniflux.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
};
locations."/".proxyPass = "http://localhost:${port}";
};
};
@ -51,7 +41,4 @@ in
file = ../../../secrets/paperless.age;
owner = "paperless";
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,9 +1,4 @@
{ config, lib, ... }:
let
feature = "pipewire";
in
{
config = lib.mkIf config.${feature}.enable {
security.rtkit.enable = true;
services.pipewire = {
@ -13,7 +8,4 @@ in
jack.enable = true;
pulse.enable = true;
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "plasma";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
desktopManager.plasma6.enable = true;
displayManager.sddm = {
@ -30,7 +24,4 @@ in
haruna
# keep-sorted end
]);
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,8 @@
{
config,
lib,
pkgs,
...
}:
let
feature = "print-and-scan";
in
{
config = lib.mkIf config.${feature}.enable {
hardware.sane = {
enable = true;
extraBackends = [ pkgs.hplip ];
@ -24,7 +18,4 @@ in
drivers = [ pkgs.hplip ];
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,17 +1,3 @@
{
config,
lib,
...
}:
let
feature = "protonmail-bridge";
in
{
config = lib.mkIf config.${feature}.enable {
services.protonmail-bridge.enable = true;
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,25 +1,20 @@
{
config,
lib,
...
}:
let
feature = "prowlarr";
port = "5009";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
prowlarr = {
enable = true;
dataDir = "/srv/prowlarr";
settings.server.port = lib.toInt port;
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
virtualHosts."prowlarr.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
@ -29,7 +24,4 @@ in
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,12 @@
{ config, lib, ... }:
{
lib,
...
}:
let
feature = "qbittorrent";
port = "5005";
in
{
config = lib.mkIf config.${feature}.enable {
users.users.qbittorrent.extraGroups = [ "media" ];
services = {
# service
qbittorrent = {
enable = true;
webuiPort = lib.toInt port;
@ -19,19 +17,12 @@ in
];
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."qbittorrent.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
};
};
locations."/".proxyPass = "http://localhost:${port}";
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
users.users.qbittorrent.extraGroups = [ "media" ];
}

View file

@ -1,37 +1,23 @@
{
config,
lib,
...
}:
let
feature = "radarr";
port = "5007";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
radarr = {
enable = true;
dataDir = "/srv/radarr";
settings.server.port = lib.toInt port;
group = "media";
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."radarr.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
locations."/".proxyPass = "http://localhost:${port}";
};
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,37 +1,23 @@
{
config,
lib,
...
}:
let
feature = "sonarr";
port = "5006";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
sonarr = {
enable = true;
dataDir = "/srv/sonarr";
settings.server.port = lib.toInt port;
group = "media";
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."sonarr.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
locations."/".proxyPass = "http://localhost:${port}";
};
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,15 +1,10 @@
{
config,
lib,
pkgs,
userName,
hostName,
...
}:
let
feature = "syncthing";
port = "5008";
devicesList = [
# keep-sorted start block=yes
{
@ -30,7 +25,6 @@ let
}
# keep-sorted end
];
devices = builtins.listToAttrs (
map (
{ device, id }:
@ -48,9 +42,7 @@ let
);
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
syncthing = {
enable = true;
guiAddress = "0.0.0.0:${port}";
@ -74,19 +66,10 @@ in
else
null;
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."syncthing.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
locations."/".proxyPass = "http://localhost:${port}";
};
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,6 @@
{ config, lib, ... }:
let
feature = "systemd-boot";
in
{
config = lib.mkIf config.${feature}.enable {
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,13 +1,4 @@
{
config,
lib,
...
}:
let
feature = "tailscale";
in
{
config = lib.mkIf config.${feature}.enable {
services.tailscale = {
enable = true;
extraSetFlags = [
@ -16,7 +7,4 @@ in
};
networking.firewall.trustedInterfaces = [ "tailscale0" ];
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,9 +1,4 @@
{ config, lib, ... }:
let
feature = "tlp";
in
{
config = lib.mkIf config.${feature}.enable {
# Disable if devices take long to unsuspend (keyboard, mouse, etc)
powerManagement.powertop.enable = true;
services = {
@ -21,9 +16,4 @@ in
};
};
};
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,14 +1,11 @@
{
config,
lib,
...
}:
let
feature = "vaultwarden";
port = "5001";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
vaultwarden = {
enable = true;
@ -24,10 +21,8 @@ in
adminTokenFile = "${config.age.secrets.vaultwarden-admin.path}";
};
};
};
# reverse proxy
services.nginx.virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."vaultwarden.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
@ -35,13 +30,10 @@ in
proxyWebsockets = true;
};
};
};
# secrets
age.secrets."vaultwarden-admin" = {
file = ../../../secrets/vaultwarden-admin.age;
owner = "vaultwarden";
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -0,0 +1,9 @@
{
util,
...
}:
{
imports = util.toImports ./features [
];
}

View file

@ -1,17 +1,6 @@
{
config,
lib,
...
}:
let
feature = "replace";
in
{
config = lib.mkIf config.${feature}.enable {
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

View file

@ -1,34 +1,18 @@
{
config,
lib,
...
}:
let
feature = "replace";
port = "port";
in
{
config = lib.mkIf config.${feature}.enable {
services = {
# service
replace = {
feature = {
enable = true;
};
# backup
borgbackup.jobs = feature { };
# reverse proxy
nginx.virtualHosts."${feature}.fi33.buzz" = {
nginx.virtualHosts."feature.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
locations."/".proxyPass = "http://localhost:${port}";
};
};
};
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
}

3
util.nix Normal file
View file

@ -0,0 +1,3 @@
{
toImports = basedir: modules: map (module: basedir + "/${module}.nix") modules;
}