refactor: switch from modules to import arrays

This commit is contained in:
wi11-holdsworth 2025-10-22 01:22:05 +11:00
parent d893750c09
commit 41eaa38d31
75 changed files with 1870 additions and 2541 deletions

View file

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

View file

@ -1,25 +1,32 @@
{ {
# keep-sorted start
userName, userName,
util,
# keep-sorted end
... ...
}: }:
{ {
imports = [ imports = [
# keep-sorted start
../../modules/nixos/default.nix ../../modules/nixos/default.nix
./hardware-configuration.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 # 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 = boot.initrd.luks.devices."luks-b164af31-c1c3-4b4e-83c8-eb39802c2027".device =
"/dev/disk/by-uuid/b164af31-c1c3-4b4e-83c8-eb39802c2027"; "/dev/disk/by-uuid/b164af31-c1c3-4b4e-83c8-eb39802c2027";

View file

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

View file

@ -1,24 +1,30 @@
{ {
# keep-sorted start
userName, userName,
util,
# keep-sorted end
... ...
}: }:
{ {
imports = [ imports = [
# keep-sorted start
../../modules/nixos/default.nix ../../modules/nixos/default.nix
./hardware-configuration.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 # 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 = boot.initrd.luks.devices."luks-a7726a9d-535f-44bc-9c0e-adc501fad371".device =
"/dev/disk/by-uuid/a7726a9d-535f-44bc-9c0e-adc501fad371"; "/dev/disk/by-uuid/a7726a9d-535f-44bc-9c0e-adc501fad371";

View file

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

View file

@ -1,23 +1,27 @@
{ {
# keep-sorted start
hostName, hostName,
userName, userName,
util,
# keep-sorted end
... ...
}: }:
{ {
imports = [ imports = [
# keep-sorted start
../../modules/nixos/default.nix ../../modules/nixos/default.nix
./hardware-configuration.nix ./hardware-configuration.nix
];
# reusable modules
# keep-sorted start
borgmatic.enable = true;
intel-gpu.enable = true;
server.enable = true;
# keep-sorted end # 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}"; networking.hostName = "${hostName}";

View file

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

View file

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

View file

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

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 # keep-sorted start
agenix.enable = lib.mkDefault true; "agenix"
bat.enable = lib.mkDefault true; "bat"
direnv.enable = lib.mkDefault true; "direnv"
eza.enable = lib.mkDefault true; "eza"
fish.enable = lib.mkDefault true; "fish"
gh.enable = lib.mkDefault true; "gh"
git.enable = lib.mkDefault true; "git"
starship.enable = lib.mkDefault true; "starship"
yazi.enable = lib.mkDefault true; "yazi"
zoxide.enable = lib.mkDefault true; "zoxide"
# keep-sorted end # 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; accounts.email.accounts.personal.aerc.enable = true;
programs.aerc = { programs.aerc = {
enable = true; enable = true;
@ -59,9 +50,4 @@ in
}; };
}; };
}; };
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,16 +1,8 @@
{ {
config,
lib,
userName, userName,
... ...
}: }:
let
feature = "agenix";
in
{ {
config = lib.mkIf config.${feature}.enable {
age.identityPaths = [ "/home/${userName}/.ssh/id_ed25519" ]; 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 = { programs.bat = {
enable = true; enable = true;
config = { config = {
theme = "Dracula"; theme = "Dracula";
}; };
}; };
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

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

View file

@ -1,20 +1,6 @@
{ {
config,
lib,
...
}:
let
feature = "espanso";
in
{
config = lib.mkIf config.${feature}.enable {
services.espanso = { services.espanso = {
enable = true; enable = true;
configs = { }; 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 = { programs.eza = {
enable = true; enable = true;
extraOptions = [ extraOptions = [
@ -289,9 +280,4 @@ in
}; };
}; };
}; };
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,14 +1,8 @@
{ {
config,
lib,
pkgs, pkgs,
... ...
}: }:
let
feature = "fish";
in
{ {
config = lib.mkIf config.${feature}.enable {
home.shell.enableFishIntegration = true; home.shell.enableFishIntegration = true;
programs.fish = { programs.fish = {
enable = true; enable = true;
@ -66,9 +60,4 @@ in
fi 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 = { programs.gh = {
enable = true; enable = true;
settings = { settings = {
@ -15,9 +6,4 @@ in
editor = "nvim"; editor = "nvim";
}; };
}; };
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

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

View file

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

View file

@ -1,14 +1,11 @@
{ {
# keep-sorted start
config, config,
lib,
hostName, hostName,
# keep-sorted end
... ...
}: }:
let
feature = "mail";
in
{ {
config = lib.mkIf config.${feature}.enable {
accounts.email = accounts.email =
let let
certificatesFile = config.age.secrets.protonmail-cert.path; certificatesFile = config.age.secrets.protonmail-cert.path;
@ -54,9 +51,4 @@ in
}; };
}; };
age.secrets."protonmail-cert".file = ../../../secrets/protonmail-cert.age; 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 = { programs.obsidian = {
enable = true; enable = true;
defaultSettings = { 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 = { programs.starship = {
enable = true; enable = true;
settings.character = { settings.character = {
@ -15,7 +6,4 @@ in
error_symbol = "[%](bold red) "; error_symbol = "[%](bold red) ";
}; };
}; };
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

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

View file

@ -1,14 +1,11 @@
{ {
config, # keep-sorted start
lib, lib,
pkgs, pkgs,
# keep-sorted end
... ...
}: }:
let
feature = "zed-editor";
in
{ {
config = lib.mkIf config.${feature}.enable {
programs.zed-editor = { programs.zed-editor = {
enable = true; enable = true;
package = pkgs.zed-editor-fhs; package = pkgs.zed-editor-fhs;
@ -89,9 +86,4 @@ in
# keep-sorted end # 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 = { programs.zellij = {
enable = true; enable = true;
settings = { settings = {
@ -16,9 +7,4 @@ in
default_shell = "fish"; 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 = programs.zen-browser =
let let
profileName = "fmnikwnj.Default Profile"; profileName = "fmnikwnj.Default Profile";
@ -73,7 +64,4 @@ in
# keep-sorted end # 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 = { programs.zoxide = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = true;
@ -15,9 +6,4 @@ in
"--cmd j" "--cmd j"
]; ];
}; };
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

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

View file

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

View file

@ -1,39 +1,31 @@
{ {
config, util,
lib,
... ...
}: }:
let
feature = "server";
in
{ {
config = lib.mkIf config.${feature}.enable { imports = util.toImports ../features [
# keep-sorted start # keep-sorted start
copyparty.enable = true; "copyparty"
couchdb.enable = true; "couchdb"
flaresolverr.enable = true; "flaresolverr"
homepage-dashboard.enable = true; "homepage-dashboard"
immich.enable = true; "immich"
jellyfin.enable = true; "jellyfin"
lidarr.enable = true; "lidarr"
miniflux.enable = true; "miniflux"
nginx.enable = true; "nginx"
ntfy-sh.enable = true; "ntfy-sh"
paperless.enable = true; "paperless"
prowlarr.enable = true; "prowlarr"
qbittorrent.enable = true; "qbittorrent"
radarr.enable = true; "radarr"
sonarr.enable = true; "sonarr"
syncthing.enable = true; "syncthing"
vaultwarden.enable = true; "vaultwarden"
# keep-sorted end # keep-sorted end
];
users.groups.media = { }; users.groups.media = { };
services.borgmatic.settings.source_directories = [ "/srv" ]; 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, 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 # keep-sorted start
agenix.enable = lib.mkDefault true; "agenix"
fonts.enable = lib.mkDefault true; "fonts"
localisation.enable = lib.mkDefault true; "localisation"
network.enable = lib.mkDefault true; "network"
nh.enable = lib.mkDefault true; "nh"
nix-settings.enable = lib.mkDefault true; "nix-settings"
nixpkgs.enable = lib.mkDefault true; "nixpkgs"
nixvim.enable = lib.mkDefault true; "nixvim"
syncthing.enable = lib.mkDefault true; "syncthing"
systemd-boot.enable = lib.mkDefault true; "systemd-boot"
tailscale.enable = lib.mkDefault true; "tailscale"
# keep-sorted end # keep-sorted end
];
environment.systemPackages = environment.systemPackages =
with pkgs; with pkgs;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,16 +1,12 @@
{ {
config,
lib, lib,
... ...
}: }:
let let
feature = "lidarr";
port = "5012"; port = "5012";
in in
{ {
config = lib.mkIf config.${feature}.enable {
services = { services = {
# service
lidarr = { lidarr = {
enable = true; enable = true;
dataDir = "/srv/lidarr"; dataDir = "/srv/lidarr";
@ -18,19 +14,10 @@ in
group = "media"; group = "media";
}; };
# reverse proxy nginx.virtualHosts."lidarr.fi33.buzz" = {
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/" = { locations."/".proxyPass = "http://localhost:${port}";
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
}; };
}; };
};
};
};
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 = '' services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="2e1a", ATTR{idProduct}=="4c03", TEST=="power/control", ATTR{power/control}="on" 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 = { i18n = {
defaultLocale = "en_AU.UTF-8"; defaultLocale = "en_AU.UTF-8";
supportedLocales = [ supportedLocales = [
@ -13,9 +8,4 @@ in
}; };
time.timeZone = "Australia/Melbourne"; time.timeZone = "Australia/Melbourne";
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

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

View file

@ -1,13 +1,8 @@
{ {
config, config,
lib,
... ...
}: }:
let
feature = "nginx";
in
{ {
config = lib.mkIf config.${feature}.enable {
services.nginx = { services.nginx = {
enable = true; 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" ]; users.users.nginx.extraGroups = [ "acme" ];
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,20 +1,11 @@
{ {
config,
lib,
userName, userName,
... ...
}: }:
let
feature = "nh";
in
{ {
config = lib.mkIf config.${feature}.enable {
programs.nh = { programs.nh = {
enable = true; enable = true;
# clean.enable = true; # clean.enable = true;
flake = "/home/${userName}/.dots"; 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 = { nix = {
gc = { gc = {
automatic = true; 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; nixpkgs.config.allowUnfree = true;
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,15 +1,10 @@
{ {
config,
lib,
pkgs,
userName, userName,
hostName, hostName,
... ...
}: }:
let let
feature = "syncthing";
port = "5008"; port = "5008";
devicesList = [ devicesList = [
# keep-sorted start block=yes # keep-sorted start block=yes
{ {
@ -30,7 +25,6 @@ let
} }
# keep-sorted end # keep-sorted end
]; ];
devices = builtins.listToAttrs ( devices = builtins.listToAttrs (
map ( map (
{ device, id }: { device, id }:
@ -48,9 +42,7 @@ let
); );
in in
{ {
config = lib.mkIf config.${feature}.enable {
services = { services = {
# service
syncthing = { syncthing = {
enable = true; enable = true;
guiAddress = "0.0.0.0:${port}"; guiAddress = "0.0.0.0:${port}";
@ -74,19 +66,10 @@ in
else else
null; null;
# reverse proxy nginx.virtualHosts."syncthing.fi33.buzz" = {
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/" = { locations."/".proxyPass = "http://localhost:${port}";
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
}; };
}; };
};
};
};
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 = { boot.loader = {
systemd-boot.enable = true; systemd-boot.enable = true;
efi.canTouchEfiVariables = 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 = { services.tailscale = {
enable = true; enable = true;
extraSetFlags = [ extraSetFlags = [
@ -16,7 +7,4 @@ in
}; };
networking.firewall.trustedInterfaces = [ "tailscale0" ]; 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) # Disable if devices take long to unsuspend (keyboard, mouse, etc)
powerManagement.powertop.enable = true; powerManagement.powertop.enable = true;
services = { services = {
@ -21,9 +16,4 @@ in
}; };
}; };
}; };
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,14 +1,11 @@
{ {
config, config,
lib,
... ...
}: }:
let let
feature = "vaultwarden";
port = "5001"; port = "5001";
in in
{ {
config = lib.mkIf config.${feature}.enable {
services = { services = {
vaultwarden = { vaultwarden = {
enable = true; enable = true;
@ -24,10 +21,8 @@ in
adminTokenFile = "${config.age.secrets.vaultwarden-admin.path}"; adminTokenFile = "${config.age.secrets.vaultwarden-admin.path}";
}; };
}; };
};
# reverse proxy nginx.virtualHosts."vaultwarden.fi33.buzz" = {
services.nginx.virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/" = { locations."/" = {
@ -35,13 +30,10 @@ in
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };
};
# secrets
age.secrets."vaultwarden-admin" = { age.secrets."vaultwarden-admin" = {
file = ../../../secrets/vaultwarden-admin.age; file = ../../../secrets/vaultwarden-admin.age;
owner = "vaultwarden"; 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 let
feature = "replace";
port = "port"; port = "port";
in in
{ {
config = lib.mkIf config.${feature}.enable {
services = { services = {
# service feature = {
replace = {
enable = true; enable = true;
}; };
# backup
borgbackup.jobs = feature { }; borgbackup.jobs = feature { };
# reverse proxy nginx.virtualHosts."feature.fi33.buzz" = {
nginx.virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/" = { locations."/".proxyPass = "http://localhost:${port}";
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
}; };
}; };
};
};
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;
}