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", 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
]; # keep-sorted end
]
# reusable modules ++ (util.toImports ../../modules/nixos/features [
# keep-sorted start
# keep-sorted start "amd-gpu"
amd-gpu.enable = true; "external-speakers"
desktop.enable = true; "gaming"
dev.enable = true; "link2c"
external-speakers.enable = true; "plasma"
gaming.enable = true; # keep-sorted end
link2c.enable = true; ])
plasma.enable = true; ++ (util.toImports ../../modules/nixos/bundles [
# keep-sorted end # keep-sorted start
# config "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
]; # keep-sorted end
]
# reusable modules ++ (util.toImports ../../modules/nixos/features [
# keep-sorted start
# keep-sorted start "amd-gpu"
amd-gpu.enable = true; "gnome"
desktop.enable = true; "tlp"
dev.enable = true; # keep-sorted end
gnome.enable = true; ])
tlp.enable = true; ++ (util.toImports ../../modules/nixos/bundles [
# keep-sorted end # keep-sorted start
"desktop"
# config "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
]; # keep-sorted end
]
# reusable modules ++ (util.toImports ../../modules/nixos/features [
# keep-sorted start
# keep-sorted start "borgmatic"
borgmatic.enable = true; "intel-gpu"
intel-gpu.enable = true; # keep-sorted end
server.enable = true; ])
# keep-sorted end ++ (util.toImports ../../modules/nixos/bundles [
"server"
# config ]);
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,
...
# keep-sorted start }:
agenix.enable = lib.mkDefault true; {
bat.enable = lib.mkDefault true; imports = util.toImports ./features [
direnv.enable = lib.mkDefault true; # keep-sorted start
eza.enable = lib.mkDefault true; "agenix"
fish.enable = lib.mkDefault true; "bat"
gh.enable = lib.mkDefault true; "direnv"
git.enable = lib.mkDefault true; "eza"
starship.enable = lib.mkDefault true; "fish"
yazi.enable = lib.mkDefault true; "gh"
zoxide.enable = lib.mkDefault true; "git"
# keep-sorted end "starship"
"yazi"
"zoxide"
# keep-sorted end
];
} }

View file

@ -1,67 +1,53 @@
{ {
config, accounts.email.accounts.personal.aerc.enable = true;
lib, programs.aerc = {
... enable = true;
}: extraAccounts.personal = {
let default = "INBOX";
feature = "aerc"; folders-sort = "INBOX, Starred, Drafts, Sent, Trash, Archive, Spam";
in };
{ extraConfig = {
config = lib.mkIf config.${feature}.enable { general.unsafe-accounts-conf = true;
accounts.email.accounts.personal.aerc.enable = true; filters = {
programs.aerc = { "text/plain" = "colorize";
enable = true; "text/calendar" = "calendar | colorize";
extraAccounts.personal = { "text/html" = "html | colorize";
default = "INBOX";
folders-sort = "INBOX, Starred, Drafts, Sent, Trash, Archive, Spam";
}; };
extraConfig = { ui = {
general.unsafe-accounts-conf = true; styleset-name = "catppuccin-mocha";
filters = { sort = "-r date";
"text/plain" = "colorize";
"text/calendar" = "calendar | colorize";
"text/html" = "html | colorize";
};
ui = {
styleset-name = "catppuccin-mocha";
sort = "-r date";
};
}; };
stylesets = { };
catppuccin-mocha = { stylesets = {
"*.default" = true; catppuccin-mocha = {
"*.normal" = true; "*.default" = true;
"default.fg" = "#cdd6f4"; "*.normal" = true;
"error.fg" = "#f38ba8"; "default.fg" = "#cdd6f4";
"warning.fg" = "#fab387"; "error.fg" = "#f38ba8";
"success.fg" = "#a6e3a1"; "warning.fg" = "#fab387";
"tab.fg" = "#6c7086"; "success.fg" = "#a6e3a1";
"tab.bg" = "#181825"; "tab.fg" = "#6c7086";
"tab.selected.fg" = "#cdd6f4"; "tab.bg" = "#181825";
"tab.selected.bg" = "#1e1e2e"; "tab.selected.fg" = "#cdd6f4";
"tab.selected.bold" = true; "tab.selected.bg" = "#1e1e2e";
"border.fg" = "#11111b"; "tab.selected.bold" = true;
"border.bold" = true; "border.fg" = "#11111b";
"msglist_unread.bold" = true; "border.bold" = true;
"msglist_flagged.fg" = "#f9e2af"; "msglist_unread.bold" = true;
"msglist_flagged.bold" = true; "msglist_flagged.fg" = "#f9e2af";
"msglist_result.fg" = "#89b4fa"; "msglist_flagged.bold" = true;
"msglist_result.bold" = true; "msglist_result.fg" = "#89b4fa";
"msglist_*.selected.bold" = true; "msglist_result.bold" = true;
"msglist_*.selected.bg" = "#313244"; "msglist_*.selected.bold" = true;
"dirlist_*.selected.bold" = true; "msglist_*.selected.bg" = "#313244";
"dirlist_*.selected.bg" = "#313244"; "dirlist_*.selected.bold" = true;
"statusline_default.fg" = "#9399b2"; "dirlist_*.selected.bg" = "#313244";
"statusline_default.bg" = "#313244"; "statusline_default.fg" = "#9399b2";
"statusline_error.bold" = true; "statusline_default.bg" = "#313244";
"statusline_success.bold" = true; "statusline_error.bold" = true;
"completion_default.selected.bg" = "#313244"; "statusline_success.bold" = true;
}; "completion_default.selected.bg" = "#313244";
}; };
}; };
}; };
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, programs.bat = {
lib, enable = true;
... config = {
}: theme = "Dracula";
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, 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, services.espanso = {
lib, enable = true;
... configs = { };
}:
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,297 +1,283 @@
{ {
config, programs.eza = {
lib, enable = true;
... extraOptions = [
}: "--long"
let "--header"
feature = "eza"; "--group-directories-first"
in ];
{ git = true;
config = lib.mkIf config.${feature}.enable { icons = "always";
programs.eza = { theme = {
enable = true; colourful = true;
extraOptions = [
"--long"
"--header"
"--group-directories-first"
];
git = true;
icons = "always";
theme = {
colourful = true;
filekinds = { filekinds = {
normal = { normal = {
foreground = "#BAC2DE"; foreground = "#BAC2DE";
};
directory = {
foreground = "#89B4FA";
};
symlink = {
foreground = "#89DCEB";
};
pipe = {
foreground = "#7F849C";
};
block_device = {
foreground = "#EBA0AC";
};
char_device = {
foreground = "#EBA0AC";
};
socket = {
foreground = "#585B70";
};
special = {
foreground = "#CBA6F7";
};
executable = {
foreground = "#A6E3A1";
};
mount_point = {
foreground = "#74C7EC";
};
}; };
directory = {
perms = { foreground = "#89B4FA";
user_read = {
foreground = "#CDD6F4";
};
user_write = {
foreground = "#F9E2AF";
};
user_execute_file = {
foreground = "#A6E3A1";
};
user_execute_other = {
foreground = "#A6E3A1";
};
group_read = {
foreground = "#BAC2DE";
};
group_write = {
foreground = "#F9E2AF";
};
group_execute = {
foreground = "#A6E3A1";
};
other_read = {
foreground = "#A6ADC8";
};
other_write = {
foreground = "#F9E2AF";
};
other_execute = {
foreground = "#A6E3A1";
};
special_user_file = {
foreground = "#CBA6F7";
};
special_other = {
foreground = "#585B70";
};
attribute = {
foreground = "#A6ADC8";
};
}; };
symlink = {
size = {
major = {
foreground = "#A6ADC8";
};
minor = {
foreground = "#89DCEB";
};
number_byte = {
foreground = "#CDD6F4";
};
number_kilo = {
foreground = "#BAC2DE";
};
number_mega = {
foreground = "#89B4FA";
};
number_giga = {
foreground = "#CBA6F7";
};
number_huge = {
foreground = "#CBA6F7";
};
unit_byte = {
foreground = "#A6ADC8";
};
unit_kilo = {
foreground = "#89B4FA";
};
unit_mega = {
foreground = "#CBA6F7";
};
unit_giga = {
foreground = "#CBA6F7";
};
unit_huge = {
foreground = "#74C7EC";
};
};
users = {
user_you = {
foreground = "#CDD6F4";
};
user_root = {
foreground = "#F38BA8";
};
user_other = {
foreground = "#CBA6F7";
};
group_yours = {
foreground = "#BAC2DE";
};
group_other = {
foreground = "#7F849C";
};
group_root = {
foreground = "#F38BA8";
};
};
links = {
normal = {
foreground = "#89DCEB";
};
multi_link_file = {
foreground = "#74C7EC";
};
};
git = {
new = {
foreground = "#A6E3A1";
};
modified = {
foreground = "#F9E2AF";
};
deleted = {
foreground = "#F38BA8";
};
renamed = {
foreground = "#94E2D5";
};
typechange = {
foreground = "#F5C2E7";
};
ignored = {
foreground = "#7F849C";
};
conflicted = {
foreground = "#EBA0AC";
};
};
git_repo = {
branch_main = {
foreground = "#CDD6F4";
};
branch_other = {
foreground = "#CBA6F7";
};
git_clean = {
foreground = "#A6E3A1";
};
git_dirty = {
foreground = "#F38BA8";
};
};
security_context = {
colon = {
foreground = "#7F849C";
};
user = {
foreground = "#BAC2DE";
};
role = {
foreground = "#CBA6F7";
};
typ = {
foreground = "#585B70";
};
range = {
foreground = "#CBA6F7";
};
};
file_type = {
image = {
foreground = "#F9E2AF";
};
video = {
foreground = "#F38BA8";
};
music = {
foreground = "#A6E3A1";
};
lossless = {
foreground = "#94E2D5";
};
crypto = {
foreground = "#585B70";
};
document = {
foreground = "#CDD6F4";
};
compressed = {
foreground = "#F5C2E7";
};
temp = {
foreground = "#EBA0AC";
};
compiled = {
foreground = "#74C7EC";
};
build = {
foreground = "#585B70";
};
source = {
foreground = "#89B4FA";
};
};
punctuation = {
foreground = "#7F849C";
};
date = {
foreground = "#F9E2AF";
};
inode = {
foreground = "#A6ADC8";
};
blocks = {
foreground = "#9399B2";
};
header = {
foreground = "#CDD6F4";
};
octal = {
foreground = "#94E2D5";
};
flags = {
foreground = "#CBA6F7";
};
symlink_path = {
foreground = "#89DCEB"; foreground = "#89DCEB";
}; };
control_char = { pipe = {
foreground = "#74C7EC"; foreground = "#7F849C";
}; };
broken_symlink = { block_device = {
foreground = "#F38BA8"; foreground = "#EBA0AC";
}; };
broken_path_overlay = { char_device = {
foreground = "#EBA0AC";
};
socket = {
foreground = "#585B70"; foreground = "#585B70";
}; };
special = {
foreground = "#CBA6F7";
};
executable = {
foreground = "#A6E3A1";
};
mount_point = {
foreground = "#74C7EC";
};
};
perms = {
user_read = {
foreground = "#CDD6F4";
};
user_write = {
foreground = "#F9E2AF";
};
user_execute_file = {
foreground = "#A6E3A1";
};
user_execute_other = {
foreground = "#A6E3A1";
};
group_read = {
foreground = "#BAC2DE";
};
group_write = {
foreground = "#F9E2AF";
};
group_execute = {
foreground = "#A6E3A1";
};
other_read = {
foreground = "#A6ADC8";
};
other_write = {
foreground = "#F9E2AF";
};
other_execute = {
foreground = "#A6E3A1";
};
special_user_file = {
foreground = "#CBA6F7";
};
special_other = {
foreground = "#585B70";
};
attribute = {
foreground = "#A6ADC8";
};
};
size = {
major = {
foreground = "#A6ADC8";
};
minor = {
foreground = "#89DCEB";
};
number_byte = {
foreground = "#CDD6F4";
};
number_kilo = {
foreground = "#BAC2DE";
};
number_mega = {
foreground = "#89B4FA";
};
number_giga = {
foreground = "#CBA6F7";
};
number_huge = {
foreground = "#CBA6F7";
};
unit_byte = {
foreground = "#A6ADC8";
};
unit_kilo = {
foreground = "#89B4FA";
};
unit_mega = {
foreground = "#CBA6F7";
};
unit_giga = {
foreground = "#CBA6F7";
};
unit_huge = {
foreground = "#74C7EC";
};
};
users = {
user_you = {
foreground = "#CDD6F4";
};
user_root = {
foreground = "#F38BA8";
};
user_other = {
foreground = "#CBA6F7";
};
group_yours = {
foreground = "#BAC2DE";
};
group_other = {
foreground = "#7F849C";
};
group_root = {
foreground = "#F38BA8";
};
};
links = {
normal = {
foreground = "#89DCEB";
};
multi_link_file = {
foreground = "#74C7EC";
};
};
git = {
new = {
foreground = "#A6E3A1";
};
modified = {
foreground = "#F9E2AF";
};
deleted = {
foreground = "#F38BA8";
};
renamed = {
foreground = "#94E2D5";
};
typechange = {
foreground = "#F5C2E7";
};
ignored = {
foreground = "#7F849C";
};
conflicted = {
foreground = "#EBA0AC";
};
};
git_repo = {
branch_main = {
foreground = "#CDD6F4";
};
branch_other = {
foreground = "#CBA6F7";
};
git_clean = {
foreground = "#A6E3A1";
};
git_dirty = {
foreground = "#F38BA8";
};
};
security_context = {
colon = {
foreground = "#7F849C";
};
user = {
foreground = "#BAC2DE";
};
role = {
foreground = "#CBA6F7";
};
typ = {
foreground = "#585B70";
};
range = {
foreground = "#CBA6F7";
};
};
file_type = {
image = {
foreground = "#F9E2AF";
};
video = {
foreground = "#F38BA8";
};
music = {
foreground = "#A6E3A1";
};
lossless = {
foreground = "#94E2D5";
};
crypto = {
foreground = "#585B70";
};
document = {
foreground = "#CDD6F4";
};
compressed = {
foreground = "#F5C2E7";
};
temp = {
foreground = "#EBA0AC";
};
compiled = {
foreground = "#74C7EC";
};
build = {
foreground = "#585B70";
};
source = {
foreground = "#89B4FA";
};
};
punctuation = {
foreground = "#7F849C";
};
date = {
foreground = "#F9E2AF";
};
inode = {
foreground = "#A6ADC8";
};
blocks = {
foreground = "#9399B2";
};
header = {
foreground = "#CDD6F4";
};
octal = {
foreground = "#94E2D5";
};
flags = {
foreground = "#CBA6F7";
};
symlink_path = {
foreground = "#89DCEB";
};
control_char = {
foreground = "#74C7EC";
};
broken_symlink = {
foreground = "#F38BA8";
};
broken_path_overlay = {
foreground = "#585B70";
}; };
}; };
}; };
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,74 +1,63 @@
{ {
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; interactiveShellInit = ''
interactiveShellInit = '' set fish_greeting
set fish_greeting '';
''; shellAliases = {
shellAliases = { # keep-sorted start
# keep-sorted start cat = "bat";
cat = "bat"; # cd = "j";
# cd = "j"; cut = "choose";
cut = "choose"; df = "duf";
df = "duf"; du = "dua";
du = "dua"; # find = "fd";
# find = "fd"; g = "lazygit";
g = "lazygit"; l = "eza";
l = "eza"; la = "eza -a";
la = "eza -a"; ls = "eza";
ls = "eza"; ns = "nh os switch";
ns = "nh os switch"; # curl = "xh";
# curl = "xh"; ping = "gping";
ping = "gping"; ps = "procs";
ps = "procs"; # sed = "sd";
# sed = "sd"; # grep = "rga";
# grep = "rga"; top = "btm";
top = "btm"; unzip = "ripunzip";
unzip = "ripunzip"; vi = "nvim";
vi = "nvim"; vim = "nvim";
vim = "nvim"; # keep-sorted end
# keep-sorted end
};
plugins = [
# INFO: Using this to get shell completion for programs added to the path through nix+direnv.
# Issue to upstream into direnv:Add commentMore actions
# https://github.com/direnv/direnv/issues/443
{
name = "completion-sync";
src = pkgs.fetchFromGitHub {
owner = "iynaix";
repo = "fish-completion-sync";
rev = "4f058ad2986727a5f510e757bc82cbbfca4596f0";
sha256 = "sha256-kHpdCQdYcpvi9EFM/uZXv93mZqlk1zCi2DRhWaDyK5g=";
};
}
];
};
# https://nixos.wiki/wiki/Fish#Setting_fish_as_your_shell
programs.bash = {
enable = true;
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
}; };
plugins = [
# INFO: Using this to get shell completion for programs added to the path through nix+direnv.
# Issue to upstream into direnv:Add commentMore actions
# https://github.com/direnv/direnv/issues/443
{
name = "completion-sync";
src = pkgs.fetchFromGitHub {
owner = "iynaix";
repo = "fish-completion-sync";
rev = "4f058ad2986727a5f510e757bc82cbbfca4596f0";
sha256 = "sha256-kHpdCQdYcpvi9EFM/uZXv93mZqlk1zCi2DRhWaDyK5g=";
};
}
];
}; };
imports = [ ]; # https://nixos.wiki/wiki/Fish#Setting_fish_as_your_shell
programs.bash = {
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; enable = true;
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
};
} }

View file

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

View file

@ -1,56 +1,44 @@
{ {
config, programs.git = {
lib, enable = true;
...
}: delta = {
let
feature = "git";
in
{
config = lib.mkIf config.${feature}.enable {
programs.${feature} = {
enable = true; enable = true;
options.theme = "Dracula";
};
delta = { userName = "wi11-holdsworth";
enable = true; userEmail = "83637728+wi11-holdsworth@users.noreply.github.com";
options.theme = "Dracula";
};
userName = "wi11-holdsworth"; aliases = {
userEmail = "83637728+wi11-holdsworth@users.noreply.github.com"; # keep-sorted start
a = "add";
aa = "add .";
ap = "add -p";
c = "commit --verbose";
ca = "commit -a --verbose";
cam = "commit -a -m";
cm = "commit -m";
co = "checkout";
cob = "checkout -b";
d = "diff";
dc = "diff --cached";
ds = "diff --stat";
m = "commit --amend --verbose";
pl = "pull";
ps = "push";
s = "status -s";
# keep-sorted end
};
aliases = { extraConfig = {
# keep-sorted start init.defaultBranch = "main";
a = "add";
aa = "add .";
ap = "add -p";
c = "commit --verbose";
ca = "commit -a --verbose";
cam = "commit -a -m";
cm = "commit -m";
co = "checkout";
cob = "checkout -b";
d = "diff";
dc = "diff --cached";
ds = "diff --stat";
m = "commit --amend --verbose";
pl = "pull";
ps = "push";
s = "status -s";
# keep-sorted end
};
extraConfig = { core.editor = "nvim";
init.defaultBranch = "main";
core.editor = "nvim"; push.autoSetupRemote = true;
push.autoSetupRemote = true; pull.rebase = false;
pull.rebase = false;
};
}; };
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,32 +1,21 @@
{ {
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; font = {
font = { package = pkgs.nerd-fonts.jetbrains-mono;
package = pkgs.nerd-fonts.jetbrains-mono; name = "JetBrainsMono Nerd Font";
name = "JetBrainsMono Nerd Font"; size = 13;
size = 13; };
}; themeFile = "Catppuccin-Mocha";
themeFile = "Catppuccin-Mocha"; settings = {
settings = { shell = "zellij -l welcome";
shell = "zellij -l welcome"; remember_window_size = true;
remember_window_size = true; confirm_os_window_close = 0;
confirm_os_window_close = 0;
};
}; };
}; };
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,62 +1,54 @@
{ {
# 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; in
in {
{ inherit certificatesFile;
inherit certificatesFile; accounts =
accounts = let
let # keep-sorted start block=yes
# keep-sorted start block=yes address = "willholdsworth@pm.me";
address = "willholdsworth@pm.me"; authentication = "login";
authentication = "login"; host = "127.0.0.1";
host = "127.0.0.1"; tls = {
tls = { enable = false;
enable = false; useStartTls = true;
useStartTls = true; inherit certificatesFile;
inherit certificatesFile;
};
# keep-sorted end
in
{
personal = {
enable = true;
# keep-sorted start block=yes
imap = {
port = 1143;
inherit tls;
inherit authentication;
inherit host;
};
inherit address;
passwordCommand = "cat ${config.age.secrets."protonmail-${hostName}-password".path}";
primary = true;
realName = "Will Holdsworth";
smtp = {
port = 1025;
inherit tls;
inherit authentication;
inherit host;
};
userName = address;
# keep-sorted end
};
}; };
}; # keep-sorted end
age.secrets."protonmail-cert".file = ../../../secrets/protonmail-cert.age; in
}; {
personal = {
imports = [ ]; enable = true;
# keep-sorted start block=yes
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; imap = {
port = 1143;
inherit tls;
inherit authentication;
inherit host;
};
inherit address;
passwordCommand = "cat ${config.age.secrets."protonmail-${hostName}-password".path}";
primary = true;
realName = "Will Holdsworth";
smtp = {
port = 1025;
inherit tls;
inherit authentication;
inherit host;
};
userName = address;
# keep-sorted end
};
};
};
age.secrets."protonmail-cert".file = ../../../secrets/protonmail-cert.age;
} }

View file

@ -1,126 +1,116 @@
{ config, lib, ... }:
let
feature = "obsidian";
in
{ {
config = lib.mkIf config.${feature}.enable { programs.obsidian = {
programs.obsidian = { enable = true;
enable = true; defaultSettings = {
defaultSettings = { app = {
app = { tabSize = 2;
tabSize = 2; trashOption = "local";
trashOption = "local"; alwaysUpdateLinks = true;
alwaysUpdateLinks = true; attachmentFolderPath = "/";
attachmentFolderPath = "/"; defaultViewMode = "preview";
defaultViewMode = "preview"; vimMode = true;
vimMode = true; showLineNumber = true;
showLineNumber = true; };
}; appearance = {
appearance = { monospaceFontFamily = "JetBrainsMono Nerd Font";
monospaceFontFamily = "JetBrainsMono Nerd Font"; interfaceFontFamily = "JetBrainsMono Nerd Font";
interfaceFontFamily = "JetBrainsMono Nerd Font"; textFontFamily = "JetBrainsMono Nerd Font";
textFontFamily = "JetBrainsMono Nerd Font"; nativeMenus = false;
nativeMenus = false; cssTheme = "Catppuccin";
cssTheme = "Catppuccin"; showRibbon = false;
showRibbon = false; };
}; communityPlugins = [
communityPlugins = [ # keep-sorted start
# keep-sorted start "obsidian-editor-shortcuts"
"obsidian-editor-shortcuts" "obsidian-excalidraw-plugin"
"obsidian-excalidraw-plugin" "obsidian-livesync"
"obsidian-livesync" "obsidian-relative-line-numbers"
"obsidian-relative-line-numbers" "oz-clear-unused-images"
"oz-clear-unused-images" "pdf-plus"
"pdf-plus" "tag-wrangler"
"tag-wrangler" "virtual-linker"
"virtual-linker" # keep-sorted end
# keep-sorted end ];
corePlugins = [
# keep-sorted start
"backlink"
"bases"
"bookmarks"
"canvas"
"command-palette"
"daily-notes"
"editor-status"
"file-explorer"
"file-recovery"
"global-search"
"graph"
"markdown-importer"
"note-composer"
"outgoing-link"
"outline"
"page-preview"
"properties"
"random-note"
"slash-command"
"slides"
"switcher"
"tag-pane"
"templates"
"word-count"
"workspaces"
"zk-prefixer"
# keep-sorted end
];
hotkeys = {
"editor:swap-line-down" = [
{
"modifiers" = [ "Alt" ];
"key" = "ArrowDown";
}
]; ];
corePlugins = [ "editor:swap-line-up" = [
# keep-sorted start {
"backlink" "modifiers" = [ "Alt" ];
"bases" "key" = "ArrowUp";
"bookmarks" }
"canvas" ];
"command-palette" "app:toggle-left-sidebar" = [
"daily-notes" {
"editor-status" "modifiers" = [
"file-explorer" "Mod"
"file-recovery" "Shift"
"global-search" ];
"graph" "key" = "/";
"markdown-importer" }
"note-composer" ];
"outgoing-link" "app:toggle-right-sidebar" = [
"outline" {
"page-preview" "modifiers" = [
"properties" "Mod"
"random-note" "Shift"
"slash-command" ];
"slides" "key" = "\\";
"switcher" }
"tag-pane" ];
"templates" "window:reset-zoom" = [
"word-count" {
"workspaces" "modifiers" = [ "Mod" ];
"zk-prefixer" "key" = "0";
# keep-sorted end }
];
"app:go-back" = [
{
"modifiers" = [ "Alt" ];
"key" = "ArrowLeft";
}
];
"app:go-forward" = [
{
"modifiers" = [ "Alt" ];
"key" = "ArrowRight";
}
]; ];
hotkeys = {
"editor:swap-line-down" = [
{
"modifiers" = [ "Alt" ];
"key" = "ArrowDown";
}
];
"editor:swap-line-up" = [
{
"modifiers" = [ "Alt" ];
"key" = "ArrowUp";
}
];
"app:toggle-left-sidebar" = [
{
"modifiers" = [
"Mod"
"Shift"
];
"key" = "/";
}
];
"app:toggle-right-sidebar" = [
{
"modifiers" = [
"Mod"
"Shift"
];
"key" = "\\";
}
];
"window:reset-zoom" = [
{
"modifiers" = [ "Mod" ];
"key" = "0";
}
];
"app:go-back" = [
{
"modifiers" = [ "Alt" ];
"key" = "ArrowLeft";
}
];
"app:go-forward" = [
{
"modifiers" = [ "Alt" ];
"key" = "ArrowRight";
}
];
};
}; };
}; };
}; };
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

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

View file

@ -1,35 +1,24 @@
{ {
config,
lib,
pkgs, pkgs,
... ...
}: }:
let
feature = "yazi";
in
{ {
config = lib.mkIf config.${feature}.enable { programs.yazi = {
programs.yazi = { enable = true;
enable = true; plugins = {
plugins = { # keep-sorted start
# keep-sorted start diff = pkgs.yaziPlugins.diff;
diff = pkgs.yaziPlugins.diff; git = pkgs.yaziPlugins.git;
git = pkgs.yaziPlugins.git; mediainfo = pkgs.yaziPlugins.mediainfo;
mediainfo = pkgs.yaziPlugins.mediainfo; mount = pkgs.yaziPlugins.mount;
mount = pkgs.yaziPlugins.mount; ouch = pkgs.yaziPlugins.ouch;
ouch = pkgs.yaziPlugins.ouch; relative-motions = pkgs.yaziPlugins.relative-motions;
relative-motions = pkgs.yaziPlugins.relative-motions; restore = pkgs.yaziPlugins.restore;
restore = pkgs.yaziPlugins.restore; rich-preview = pkgs.yaziPlugins.rich-preview;
rich-preview = pkgs.yaziPlugins.rich-preview; starship = pkgs.yaziPlugins.starship;
starship = pkgs.yaziPlugins.starship; vcs-files = pkgs.yaziPlugins.vcs-files;
vcs-files = pkgs.yaziPlugins.vcs-files; yatline-githead = pkgs.yaziPlugins.yatline-githead;
yatline-githead = pkgs.yaziPlugins.yatline-githead; # keep-sorted end
# keep-sorted end
};
}; };
}; };
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,97 +1,89 @@
{ {
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; extensions = [
extensions = [ # keep-sorted start
# keep-sorted start "catppuccin"
"catppuccin" "catppuccin-icons"
"catppuccin-icons" "codebook"
"codebook" "emmet"
"emmet" "git-firefly"
"git-firefly" "haskell"
"haskell" "html"
"html" "nix"
"nix" # keep-sorted end
# keep-sorted end ];
]; extraPackages = with pkgs; [
extraPackages = with pkgs; [ # keep-sorted start
# keep-sorted start haskell-language-server
haskell-language-server nil
nil nixd
nixd package-version-server
package-version-server rust-analyzer
rust-analyzer # keep-sorted end
# keep-sorted end ];
]; installRemoteServer = true;
installRemoteServer = true; userSettings = {
userSettings = { # keep-sorted start block=yes
# keep-sorted start block=yes base_keymap = "VSCode";
base_keymap = "VSCode"; buffer_font_family = "JetBrainsMono Nerd Font";
buffer_font_family = "JetBrainsMono Nerd Font"; buffer_font_size = 15;
buffer_font_size = 15; disable_ai = true;
disable_ai = true; icon_theme = "Catppuccin Mocha";
icon_theme = "Catppuccin Mocha"; inlay_hints = {
inlay_hints = { enabled = true;
enabled = true; show_value_hints = true;
show_value_hints = true; show_type_hints = true;
show_type_hints = true; show_parameter_hints = true;
show_parameter_hints = true; show_other_hints = true;
show_other_hints = true; show_background = false;
show_background = false; edit_debounce_ms = 700;
edit_debounce_ms = 700; scroll_debounce_ms = 50;
scroll_debounce_ms = 50; toggle_on_modifiers_press = {
toggle_on_modifiers_press = { control = false;
control = false; alt = false;
alt = false; shift = false;
shift = false; platform = false;
platform = false; function = false;
function = false;
};
}; };
# https://wiki.nixos.org/wiki/Zed#rust-analyzer
lsp.rust-analyzer.binary.path = lib.getExe pkgs.rust-analyzer;
minimap = {
show = "auto";
};
preferred_line_length = 80;
relative_line_numbers = true;
soft_wrap = "preferred_line_length";
tab_bar = {
show_nav_history_buttons = false;
};
tab_size = 2;
tabs = {
file_icons = true;
git_status = true;
};
telemetry = {
diagnostics = false;
metrics = false;
};
theme = {
mode = "system";
light = "One Light";
dark = "Catppuccin Mocha";
};
ui_font_family = "JetBrainsMono Nerd Font";
ui_font_size = 16;
vim_mode = true;
# keep-sorted end
}; };
# https://wiki.nixos.org/wiki/Zed#rust-analyzer
lsp.rust-analyzer.binary.path = lib.getExe pkgs.rust-analyzer;
minimap = {
show = "auto";
};
preferred_line_length = 80;
relative_line_numbers = true;
soft_wrap = "preferred_line_length";
tab_bar = {
show_nav_history_buttons = false;
};
tab_size = 2;
tabs = {
file_icons = true;
git_status = true;
};
telemetry = {
diagnostics = false;
metrics = false;
};
theme = {
mode = "system";
light = "One Light";
dark = "Catppuccin Mocha";
};
ui_font_family = "JetBrainsMono Nerd Font";
ui_font_size = 16;
vim_mode = true;
# keep-sorted end
}; };
}; };
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,24 +1,10 @@
{ {
config, programs.zellij = {
lib, enable = true;
... settings = {
}: theme = "catppuccin-mocha";
let show_startup_tips = false;
feature = "zellij"; default_shell = "fish";
in
{
config = lib.mkIf config.${feature}.enable {
programs.zellij = {
enable = true;
settings = {
theme = "catppuccin-mocha";
show_startup_tips = false;
default_shell = "fish";
};
}; };
}; };
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,79 +1,67 @@
{ {
config, programs.zen-browser =
lib, let
... profileName = "fmnikwnj.Default Profile";
}: in
let {
feature = "zen-browser"; enable = true;
in profiles.${profileName}.settings = {
{ zen.tabs.vertical.right-side = true;
config = lib.mkIf config.${feature}.enable {
programs.zen-browser =
let
profileName = "fmnikwnj.Default Profile";
in
{
enable = true;
profiles.${profileName}.settings = {
zen.tabs.vertical.right-side = true;
};
policies =
let
mkLockedAttrs = builtins.mapAttrs (
_: value: {
Value = value;
Status = "locked";
}
);
mkExtensionSettings = builtins.mapAttrs (
_: pluginId: {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/${pluginId}/latest.xpi";
installation_mode = "force_installed";
}
);
in
{
# keep-sorted start block=yes
AutofillCreditCardEnabled = false;
EnableTrackingProtection = {
Value = true;
Category = "strict";
};
ExtensionSettings = mkExtensionSettings {
"uBlock0@raymondhill.net" = "ublock-origin";
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = "bitwarden-password-manager";
"sponsorBlocker@ajay.app" = "sponsor-block";
"{762f9885-5a13-4abd-9c77-433dcd38b8fd}" = "return-youtube-dislikes";
"deArrow@ajay.app" = "dearrow";
};
HttpsOnlyMode = "enabled";
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
Preferences = mkLockedAttrs {
"intl.accept_languages" = "en-AU,en-GB,en-US,en";
"general.autoScroll" = true;
# disable google safebrowsing
"browser.safebrowsing.malware.enabled" = false;
"browser.safebrowsing.phishing.enabled" = false;
"browser.warnOnQuit" = false;
"browser.tabs.warnOnClose" = false;
# continue where you left off
"browser.startup.page" = 3;
};
RequestedLocales = [
"en-AU"
"en-GB"
"en-US"
];
SearchEngines = {
Default = "duckduckgo";
DefaultPrivate = "duckduckgo";
};
SearchSuggestEnabled = true;
# keep-sorted end
};
}; };
}; policies =
let
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; mkLockedAttrs = builtins.mapAttrs (
_: value: {
Value = value;
Status = "locked";
}
);
mkExtensionSettings = builtins.mapAttrs (
_: pluginId: {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/${pluginId}/latest.xpi";
installation_mode = "force_installed";
}
);
in
{
# keep-sorted start block=yes
AutofillCreditCardEnabled = false;
EnableTrackingProtection = {
Value = true;
Category = "strict";
};
ExtensionSettings = mkExtensionSettings {
"uBlock0@raymondhill.net" = "ublock-origin";
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = "bitwarden-password-manager";
"sponsorBlocker@ajay.app" = "sponsor-block";
"{762f9885-5a13-4abd-9c77-433dcd38b8fd}" = "return-youtube-dislikes";
"deArrow@ajay.app" = "dearrow";
};
HttpsOnlyMode = "enabled";
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
Preferences = mkLockedAttrs {
"intl.accept_languages" = "en-AU,en-GB,en-US,en";
"general.autoScroll" = true;
# disable google safebrowsing
"browser.safebrowsing.malware.enabled" = false;
"browser.safebrowsing.phishing.enabled" = false;
"browser.warnOnQuit" = false;
"browser.tabs.warnOnClose" = false;
# continue where you left off
"browser.startup.page" = 3;
};
RequestedLocales = [
"en-AU"
"en-GB"
"en-US"
];
SearchEngines = {
Default = "duckduckgo";
DefaultPrivate = "duckduckgo";
};
SearchSuggestEnabled = true;
# keep-sorted end
};
};
} }

View file

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

View file

@ -1,34 +1,28 @@
{ {
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
beeper beeper
calibre calibre
cameractrls-gtk3 cameractrls-gtk3
# https://github.com/NixOS/nixpkgs/issues/437865 # https://github.com/NixOS/nixpkgs/issues/437865
# jellyfin-media-player # jellyfin-media-player
onlyoffice-desktopeditors onlyoffice-desktopeditors
textsnatcher textsnatcher
# keep-sorted end # keep-sorted end
]; ];
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,26 +1,18 @@
{ {
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 cargo-info
cargo-info devenv
devenv just
just mask
mask rusty-man
rusty-man 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,26 +1,16 @@
{ {
config,
lib,
pkgs, pkgs,
... ...
}: }:
let
feature = "amd-gpu";
in
{ {
config = lib.mkIf config.${feature}.enable { # load graphics drivers before anything else
boot.initrd.kernelModules = [ "amdgpu" ];
# load graphics drivers before anything else hardware.graphics = {
boot.initrd.kernelModules = [ "amdgpu" ]; enable = true;
enable32Bit = true;
hardware.graphics = { extraPackages = with pkgs; [ amdvlk ];
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [ amdvlk ];
};
services.xserver.videoDrivers = [ "amdgpu" ];
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; services.xserver.videoDrivers = [ "amdgpu" ];
} }

View file

@ -1,92 +1,87 @@
{ {
# 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; settings = {
settings = { # keep-sorted start block=yes
# keep-sorted start block=yes compression = "auto,zlib";
compression = "auto,zlib"; encryption_passcommand = "cat ${config.age.secrets.borgmatic.path}";
encryption_passcommand = "cat ${config.age.secrets.borgmatic.path}"; keep_daily = 7;
keep_daily = 7; keep_monthly = 6;
keep_monthly = 6; keep_weekly = 4;
keep_weekly = 4; keep_yearly = 1;
keep_yearly = 1; ntfy = {
ntfy = { topic = "backups";
topic = "backups"; server = config.services.ntfy-sh.settings.base-url;
server = config.services.ntfy-sh.settings.base-url; finish = {
finish = { title = "Ping!";
title = "Ping!"; message = "Your backups have succeeded :)";
message = "Your backups have succeeded :)"; tags = "tada,BorgBackup,Server";
tags = "tada,BorgBackup,Server";
};
fail = {
title = "Ping!";
message = "Your backups have failed :(";
tags = "rotating_light,BorgBackup,Server";
};
states = [
"finish"
"fail"
];
}; };
repositories = [ fail = {
{ title = "Ping!";
path = "/backup/repo"; message = "Your backups have failed :(";
label = "onsite"; tags = "rotating_light,BorgBackup,Server";
# encryption = "repokey-blake2"; };
} states = [
{ "finish"
path = "ssh://vuc5c3xq@vuc5c3xq.repo.borgbase.com/./repo"; "fail"
label = "offsite";
# encryption = "repokey-blake2";
}
]; ];
retries = 3;
retry_wait = 10;
ssh_command = "ssh -i /home/srv/.ssh/id_ed25519";
# keep-sorted end
}; };
}; repositories = [
{
# postgres path = "/backup/repo";
services.postgresql.ensureUsers = [ label = "onsite";
{ # encryption = "repokey-blake2";
name = "root"; }
} {
]; path = "ssh://vuc5c3xq@vuc5c3xq.repo.borgbase.com/./repo";
systemd.services.postgresql.postStart = lib.mkAfter '' label = "offsite";
/run/current-system/sw/bin/psql postgres -c "GRANT pg_read_all_data TO root" # encryption = "repokey-blake2";
''; }
systemd.services.borgmatic.path = [ ];
config.services.postgresql.package retries = 3;
]; retry_wait = 10;
ssh_command = "ssh -i /home/srv/.ssh/id_ed25519";
# credentials # keep-sorted end
systemd.services.borgmatic.serviceConfig.LoadCredential = [
"borgmatic-pg:${config.age.secrets.borgmatic-pg.path}"
];
# onsite drive
services.udisks2.enable = true;
fileSystems."/backup" = {
device = "/dev/disk/by-uuid/d3b3d7dc-d634-4327-9ea2-9d8daa4ecf4e";
fsType = "ext4";
};
# secrets
age.secrets = {
"borgmatic".file = ../../../secrets/borgmatic.age;
"borgmatic-pg".file = ../../../secrets/borgmatic-pg.age;
}; };
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; # postgres
services.postgresql.ensureUsers = [
{
name = "root";
}
];
systemd.services.postgresql.postStart = lib.mkAfter ''
/run/current-system/sw/bin/psql postgres -c "GRANT pg_read_all_data TO root"
'';
systemd.services.borgmatic.path = [
config.services.postgresql.package
];
# credentials
systemd.services.borgmatic.serviceConfig.LoadCredential = [
"borgmatic-pg:${config.age.secrets.borgmatic-pg.path}"
];
# onsite drive
services.udisks2.enable = true;
fileSystems."/backup" = {
device = "/dev/disk/by-uuid/d3b3d7dc-d634-4327-9ea2-9d8daa4ecf4e";
fsType = "ext4";
};
# secrets
age.secrets = {
"borgmatic".file = ../../../secrets/borgmatic.age;
"borgmatic-pg".file = ../../../secrets/borgmatic-pg.age;
};
} }

View file

@ -1,67 +1,51 @@
{ {
# 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 = { copyparty = {
# service enable = true;
copyparty = { settings = {
enable = true; z = true;
settings = { e2dsa = true;
z = true; e2ts = true;
e2dsa = true; e2vu = true;
e2ts = true; p = lib.toInt port;
e2vu = true;
p = lib.toInt port;
};
accounts = {
will = {
passwordFile = config.age.secrets.copyparty-will.path;
};
};
volumes = {
"/" = {
path = "/srv/copyparty";
access = {
r = "*";
A = [ "will" ];
};
};
};
}; };
# reverse proxy accounts.will.passwordFile = config.age.secrets.copyparty-will.path;
nginx = {
virtualHosts."${feature}.fi33.buzz" = { volumes."/" = {
forceSSL = true; path = "/srv/copyparty";
useACMEHost = "fi33.buzz"; access = {
locations."/" = { r = "*";
proxyPass = "http://localhost:${port}"; A = [ "will" ];
# proxyWebsockets = true;
};
}; };
}; };
}; };
# secrets nginx.virtualHosts."copyparty.fi33.buzz" = {
age.secrets."copyparty-will" = { forceSSL = true;
file = ../../../secrets/copyparty-will.age; useACMEHost = "fi33.buzz";
owner = "copyparty"; locations."/".proxyPass = "http://localhost:${port}";
}; };
nixpkgs.overlays = [ inputs.copyparty.overlays.default ];
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; # secrets
age.secrets."copyparty-will" = {
file = ../../../secrets/copyparty-will.age;
owner = "copyparty";
};
nixpkgs.overlays = [ inputs.copyparty.overlays.default ];
} }

View file

@ -1,60 +1,47 @@
{ {
config,
lib, lib,
... ...
}: }:
let let
feature = "couchdb";
port = "5984"; port = "5984";
in in
{ {
config = lib.mkIf config.${feature}.enable { services = {
services = { couchdb = {
# service enable = true;
couchdb = { databaseDir = "/srv/couchdb";
enable = true; viewIndexDir = "/srv/couchdb";
databaseDir = "/srv/couchdb"; configFile = "/srv/couchdb";
viewIndexDir = "/srv/couchdb"; port = lib.toInt port;
configFile = "/srv/couchdb"; extraConfig = {
port = lib.toInt port; chttpd = {
extraConfig = { require_valid_user = true;
chttpd = { enable_cors = true;
require_valid_user = true; max_http_request_size = 4294967296;
enable_cors = true;
max_http_request_size = 4294967296;
};
chttpd_auth.require_valid_user = true;
httpd = {
WWW-Authenticate = ''Basic realm="couchdb"'';
enable_cors = true;
};
couchdb.max_document_size = 50000000;
cors = {
credentials = true;
origins = ''
app://obsidian.md,capacitor://localhost,http://localhost,https://localhost,capacitor://couchdb.fi33.buzz,http://couchdb.fi33.buzz,https://couchdb.fi33.buzz
'';
};
}; };
};
# reverse proxy chttpd_auth.require_valid_user = true;
nginx = {
virtualHosts."${feature}.fi33.buzz" = { httpd = {
forceSSL = true; WWW-Authenticate = ''Basic realm="couchdb"'';
useACMEHost = "fi33.buzz"; enable_cors = true;
locations."/" = { };
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true; couchdb.max_document_size = 50000000;
};
cors = {
credentials = true;
origins = ''
app://obsidian.md,capacitor://localhost,http://localhost,https://localhost,capacitor://couchdb.fi33.buzz,http://couchdb.fi33.buzz,https://couchdb.fi33.buzz
'';
}; };
}; };
}; };
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; nginx.virtualHosts."couchdb.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}";
};
};
} }

View file

@ -1,17 +1,5 @@
{ {
config, boot.extraModprobeConfig = ''
lib, options snd_hda_intel power_save=0
... '';
}:
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, lib,
... ...
}: }:
let let
feature = "flaresolverr";
port = "5011"; port = "5011";
in in
{ {
config = lib.mkIf config.${feature}.enable { services = {
services = { flaresolverr = {
# service enable = true;
flaresolverr = { port = lib.toInt port;
enable = true; };
port = lib.toInt port;
};
# reverse proxy nginx.virtualHosts."flaresolverr.fi33.buzz" = {
nginx = { forceSSL = true;
virtualHosts."${feature}.fi33.buzz" = { useACMEHost = "fi33.buzz";
forceSSL = true; locations."/".proxyPass = "http://localhost:${port}";
useACMEHost = "fi33.buzz";
locations."/" = {
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,44 +1,35 @@
{ {
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 lutris
lutris mangohud
mangohud nexusmods-app
nexusmods-app prismlauncher
prismlauncher protonup-qt
protonup-qt wine
wine wine64
wine64 winetricks
winetricks # keep-sorted end
# keep-sorted end ];
];
programs = { programs = {
gamemode.enable = true; gamemode.enable = true;
steam = { steam = {
enable = true;
gamescopeSession.enable = true;
};
};
services.lact = {
enable = true; enable = true;
settings = { }; gamescopeSession.enable = true;
}; };
# latest kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; services.lact = {
enable = true;
settings = { };
};
# latest kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
} }

View file

@ -1,59 +1,50 @@
{ {
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;
};
environment = {
# https://discourse.nixos.org/t/howto-disable-most-gnome-default-applications-and-what-they-are/13505
gnome.excludePackages = with pkgs; [
# keep-sorted start
# baobab # disk usage analyzer
# cheese # photo booth
# eog # image viewer
epiphany # web browser
evince # document viewer
# file-roller # archive manager
geary # email client
gedit # text editor
gnome-calculator
gnome-calendar
gnome-characters
gnome-clocks
# gnome-disk-utility
gnome-connections
gnome-contacts
gnome-font-viewer
gnome-logs
gnome-maps
gnome-music
gnome-photos
# gnome-screenshot
# gnome-system-monitor
gnome-terminal
gnome-weather
seahorse # password manager
# simple-scan # document scanner
totem # video player
yelp # help viewer
# keep-sorted end
];
systemPackages = with pkgs; [
gnome-tweaks
bibata-cursors
];
};
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; environment = {
# https://discourse.nixos.org/t/howto-disable-most-gnome-default-applications-and-what-they-are/13505
gnome.excludePackages = with pkgs; [
# keep-sorted start
# baobab # disk usage analyzer
# cheese # photo booth
# eog # image viewer
epiphany # web browser
evince # document viewer
# file-roller # archive manager
geary # email client
gedit # text editor
gnome-calculator
gnome-calendar
gnome-characters
gnome-clocks
# gnome-disk-utility
gnome-connections
gnome-contacts
gnome-font-viewer
gnome-logs
gnome-maps
gnome-music
gnome-photos
# gnome-screenshot
# gnome-system-monitor
gnome-terminal
gnome-weather
seahorse # password manager
# simple-scan # document scanner
totem # video player
yelp # help viewer
# keep-sorted end
];
systemPackages = with pkgs; [
gnome-tweaks
bibata-cursors
];
};
} }

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,280 +35,269 @@ let
]; ];
in in
{ {
config = lib.mkIf config.${feature}.enable { services = {
services = { homepage-dashboard = {
# service enable = true;
homepage-dashboard = { listenPort = lib.toInt port;
enable = true; allowedHosts = "homepage-dashboard.fi33.buzz";
listenPort = lib.toInt port; services = [
allowedHosts = "homepage-dashboard.fi33.buzz"; # keep-sorted start block=yes
services = [ {
# keep-sorted start block=yes "Cloud Services" = [
{
"Cloud Services" = [
{
"copyparty" = {
"description" = "Cloud file manager";
"icon" = "sh-copyparty.svg";
"href" = "https://copyparty.fi33.buzz/";
};
}
{
"CouchDB" = {
"description" = "Obsidian sync database";
"icon" = "couchdb.svg";
"href" = "https://couchdb.fi33.buzz/_utils/";
};
}
{
"ntfy" = {
"description" = "Notification service";
"icon" = "ntfy.svg";
"href" = "https://ntfy-sh.fi33.buzz/";
};
}
{
"Syncthing" = {
"description" = "Decentralised file synchronisation";
"icon" = "syncthing.svg";
"href" = "https://syncthing.fi33.buzz/";
};
}
{
"qBittorrent" = {
"description" = "BitTorrent client";
"icon" = "qbittorrent.svg";
"href" = "https://qbittorrent.fi33.buzz/";
};
}
{
"Vaultwarden" = {
"description" = "Password manager";
"icon" = "vaultwarden.svg";
"href" = "https://vaultwarden.fi33.buzz/";
};
}
];
}
{
"Media Management" = [
{
"Lidarr" = {
"description" = "Music collection manager";
"icon" = "lidarr.svg";
"href" = "https://lidarr.fi33.buzz/";
"widget" = {
"type" = "lidarr";
"url" = "https://lidarr.fi33.buzz/";
"key" = "@lidarr@";
"enableQueue" = true;
};
};
}
{
"Prowlarr" = {
"description" = "Indexer management tool";
"icon" = "prowlarr.svg";
"href" = "https://prowlarr.fi33.buzz/";
"widget" = {
"type" = "prowlarr";
"url" = "https://prowlarr.fi33.buzz/";
"key" = "@prowlarr@";
};
};
}
{
"Radarr" = {
"description" = "Movie collection manager";
"icon" = "radarr.svg";
"href" = "https://radarr.fi33.buzz/";
"widget" = {
"type" = "radarr";
"url" = "https://radarr.fi33.buzz/";
"key" = "@radarr@";
"enableQueue" = true;
};
};
}
{
"Sonarr" = {
"description" = "TV show collection manager";
"icon" = "sonarr.svg";
"href" = "https://sonarr.fi33.buzz/";
"widget" = {
"type" = "sonarr";
"url" = "https://sonarr.fi33.buzz/";
"key" = "@sonarr@";
"enableQueue" = true;
};
};
}
];
}
{
"Media Streaming" = [
{
"Immich" = {
"description" = "Photo backup";
"icon" = "immich.svg";
"href" = "https://immich.fi33.buzz/";
"widget" = {
"type" = "immich";
"fields" = [
"users"
"photos"
"videos"
"storage"
];
"url" = "https://immich.fi33.buzz/";
"version" = 2;
"key" = "@immich@";
};
};
}
{
"Jellyfin" = {
"description" = "Media streaming";
"icon" = "jellyfin.svg";
"href" = "https://jellyfin.fi33.buzz/";
"widget" = {
"type" = "jellyfin";
"url" = "https://jellyfin.fi33.buzz/";
"key" = "@jellyfin@";
"enableBlocks" = true;
"enableNowPlaying" = true;
"enableUser" = true;
"showEpisodeNumber" = true;
"expandOneStreamToTwoRows" = false;
};
};
}
{
"Miniflux" = {
"description" = "RSS aggregator";
"icon" = "miniflux.svg";
"href" = "https://miniflux.fi33.buzz/";
"widget" = {
"type" = "miniflux";
"url" = "https://miniflux.fi33.buzz/";
"key" = "@miniflux@";
};
};
}
{
"Paperless" = {
"description" = "Digital filing cabinet";
"icon" = "paperless.svg";
"href" = "https://paperless.fi33.buzz/";
"widget" = {
"type" = "paperlessngx";
"url" = "https://paperless.fi33.buzz/";
"username" = "admin";
"password" = "@paperless@";
};
};
}
];
}
{
"Utilities" = [
{
"NanoKVM" = {
"description" = "Remote KVM switch";
"icon" = "mdi-console.svg";
"href" = "http://nano-kvm/";
};
}
];
}
# keep-sorted end
];
settings = {
title = "Mission Control";
theme = "dark";
color = "neutral";
headerStyle = "clean";
layout = [
{ {
"Media Streaming" = { "copyparty" = {
style = "row"; "description" = "Cloud file manager";
columns = 4; "icon" = "sh-copyparty.svg";
useEqualHeights = true; "href" = "https://copyparty.fi33.buzz/";
}; };
} }
{ {
"Media Management" = { "CouchDB" = {
style = "row"; "description" = "Obsidian sync database";
columns = 4; "icon" = "couchdb.svg";
useEqualHeights = true; "href" = "https://couchdb.fi33.buzz/_utils/";
}; };
} }
{ {
"Cloud Services" = { "ntfy" = {
style = "row"; "description" = "Notification service";
columns = 3; "icon" = "ntfy.svg";
"href" = "https://ntfy-sh.fi33.buzz/";
}; };
} }
{ {
"Utilities" = { "Syncthing" = {
style = "row"; "description" = "Decentralised file synchronisation";
columns = 3; "icon" = "syncthing.svg";
"href" = "https://syncthing.fi33.buzz/";
};
}
{
"qBittorrent" = {
"description" = "BitTorrent client";
"icon" = "qbittorrent.svg";
"href" = "https://qbittorrent.fi33.buzz/";
};
}
{
"Vaultwarden" = {
"description" = "Password manager";
"icon" = "vaultwarden.svg";
"href" = "https://vaultwarden.fi33.buzz/";
}; };
} }
]; ];
quicklaunch.searchDescriptions = true; }
disableUpdateCheck = true; {
showStats = true; "Media Management" = [
statusStyle = "dot"; {
}; "Lidarr" = {
widgets = [ "description" = "Music collection manager";
"icon" = "lidarr.svg";
"href" = "https://lidarr.fi33.buzz/";
"widget" = {
"type" = "lidarr";
"url" = "https://lidarr.fi33.buzz/";
"key" = "@lidarr@";
"enableQueue" = true;
};
};
}
{
"Prowlarr" = {
"description" = "Indexer management tool";
"icon" = "prowlarr.svg";
"href" = "https://prowlarr.fi33.buzz/";
"widget" = {
"type" = "prowlarr";
"url" = "https://prowlarr.fi33.buzz/";
"key" = "@prowlarr@";
};
};
}
{
"Radarr" = {
"description" = "Movie collection manager";
"icon" = "radarr.svg";
"href" = "https://radarr.fi33.buzz/";
"widget" = {
"type" = "radarr";
"url" = "https://radarr.fi33.buzz/";
"key" = "@radarr@";
"enableQueue" = true;
};
};
}
{
"Sonarr" = {
"description" = "TV show collection manager";
"icon" = "sonarr.svg";
"href" = "https://sonarr.fi33.buzz/";
"widget" = {
"type" = "sonarr";
"url" = "https://sonarr.fi33.buzz/";
"key" = "@sonarr@";
"enableQueue" = true;
};
};
}
];
}
{
"Media Streaming" = [
{
"Immich" = {
"description" = "Photo backup";
"icon" = "immich.svg";
"href" = "https://immich.fi33.buzz/";
"widget" = {
"type" = "immich";
"fields" = [
"users"
"photos"
"videos"
"storage"
];
"url" = "https://immich.fi33.buzz/";
"version" = 2;
"key" = "@immich@";
};
};
}
{
"Jellyfin" = {
"description" = "Media streaming";
"icon" = "jellyfin.svg";
"href" = "https://jellyfin.fi33.buzz/";
"widget" = {
"type" = "jellyfin";
"url" = "https://jellyfin.fi33.buzz/";
"key" = "@jellyfin@";
"enableBlocks" = true;
"enableNowPlaying" = true;
"enableUser" = true;
"showEpisodeNumber" = true;
"expandOneStreamToTwoRows" = false;
};
};
}
{
"Miniflux" = {
"description" = "RSS aggregator";
"icon" = "miniflux.svg";
"href" = "https://miniflux.fi33.buzz/";
"widget" = {
"type" = "miniflux";
"url" = "https://miniflux.fi33.buzz/";
"key" = "@miniflux@";
};
};
}
{
"Paperless" = {
"description" = "Digital filing cabinet";
"icon" = "paperless.svg";
"href" = "https://paperless.fi33.buzz/";
"widget" = {
"type" = "paperlessngx";
"url" = "https://paperless.fi33.buzz/";
"username" = "admin";
"password" = "@paperless@";
};
};
}
];
}
{
"Utilities" = [
{
"NanoKVM" = {
"description" = "Remote KVM switch";
"icon" = "mdi-console.svg";
"href" = "http://nano-kvm/";
};
}
];
}
# keep-sorted end
];
settings = {
title = "Mission Control";
theme = "dark";
color = "neutral";
headerStyle = "clean";
layout = [
{ {
search = { "Media Streaming" = {
provider = [ style = "row";
"duckduckgo" columns = 4;
"brave" useEqualHeights = true;
];
focus = true;
showSearchSuggestions = true;
target = "_blank";
}; };
} }
{ {
resources = { "Media Management" = {
cpu = true; style = "row";
memory = true; columns = 4;
disk = [ useEqualHeights = true;
"/" };
"/backup" }
]; {
cputemp = true; "Cloud Services" = {
tempmin = 0; style = "row";
tempmax = 100; columns = 3;
units = "metric"; };
network = true; }
uptime = true; {
"Utilities" = {
style = "row";
columns = 3;
}; };
} }
]; ];
quicklaunch.searchDescriptions = true;
disableUpdateCheck = true;
showStats = true;
statusStyle = "dot";
}; };
widgets = [
# reverse proxy {
nginx = { search = {
virtualHosts."${feature}.fi33.buzz" = { provider = [
forceSSL = true; "duckduckgo"
useACMEHost = "fi33.buzz"; "brave"
locations."/" = { ];
proxyPass = "http://localhost:${port}"; focus = true;
# proxyWebsockets = true; showSearchSuggestions = true;
target = "_blank";
}; };
}; }
}; {
resources = {
cpu = true;
memory = true;
disk = [
"/"
"/backup"
];
cputemp = true;
tempmin = 0;
tempmax = 100;
units = "metric";
network = true;
uptime = true;
};
}
];
}; };
# secrets nginx.virtualHosts."homepage-dashboard.fi33.buzz" = {
age.secrets = genSecrets secrets; forceSSL = true;
system.activationScripts = insertSecrets secrets; useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}";
};
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; # secrets
age.secrets = genSecrets secrets;
system.activationScripts = insertSecrets secrets;
} }

View file

@ -1,46 +1,37 @@
{ {
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 = lib.toInt "${port}";
port = builtins.fromJSON "${port}"; mediaLocation = "/srv/immich";
mediaLocation = "/srv/immich"; };
};
# database backup borgmatic.settings.postgresql_databases = [
borgmatic.settings = { {
postgresql_databases = [ name = "immich";
{ hostname = "localhost";
name = "immich"; username = "root";
hostname = "localhost"; password = "{credential systemd borgmatic-pg}";
username = "root"; }
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."/" = {
proxyPass = "http://[::1]:${port}"; proxyPass = "http://[::1]:${port}";
proxyWebsockets = true; proxyWebsockets = true;
};
}; };
}; };
}; };
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,32 +1,21 @@
{ {
config,
lib,
pkgs, pkgs,
... ...
}: }:
let
feature = "intel-gpu";
in
{ {
config = lib.mkIf config.${feature}.enable { hardware = {
hardware = { enableAllFirmware = true;
enableAllFirmware = true; graphics = {
graphics = { enable = true;
enable = true; extraPackages = with pkgs; [
extraPackages = with pkgs; [ # keep-sorted start
# keep-sorted start intel-compute-runtime
intel-compute-runtime intel-media-driver
intel-media-driver intel-ocl
intel-ocl libva-vdpau-driver
libva-vdpau-driver vpl-gpu-rt
vpl-gpu-rt # keep-sorted end
# keep-sorted end ];
];
};
}; };
}; };
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

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

View file

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

View file

@ -1,17 +1,5 @@
{ {
config, services.udev.extraRules = ''
lib, ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="2e1a", ATTR{idProduct}=="4c03", TEST=="power/control", ATTR{power/control}="on"
... '';
}:
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,21 +1,11 @@
{ 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 = [ "en_US.UTF-8/UTF-8"
"en_US.UTF-8/UTF-8" "en_AU.UTF-8/UTF-8"
"en_AU.UTF-8/UTF-8" ];
];
};
time.timeZone = "Australia/Melbourne";
}; };
imports = [ ]; time.timeZone = "Australia/Melbourne";
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,54 +1,36 @@
{ {
config, config,
lib,
... ...
}: }:
let let
feature = "miniflux";
port = "5010"; port = "5010";
in in
{ {
config = lib.mkIf config.${feature}.enable { services = {
services = { miniflux = {
# service enable = true;
miniflux = { adminCredentialsFile = config.age.secrets.miniflux-creds.path;
enable = true; config = {
adminCredentialsFile = config.age.secrets.miniflux-creds.path; BASE_URL = "https://miniflux.fi33.buzz";
config = { LISTEN_ADDR = "localhost:${port}";
BASE_URL = "https://miniflux.fi33.buzz";
LISTEN_ADDR = "localhost:${port}";
};
};
# database backup
borgmatic.settings = {
postgresql_databases = [
{
name = "miniflux";
hostname = "localhost";
username = "root";
password = "{credential systemd borgmatic-pg}";
}
];
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
};
}; };
}; };
# secrets borgmatic.settings.postgresql_databases = [
age.secrets."miniflux-creds".file = ../../../secrets/miniflux-creds.age; {
name = "miniflux";
hostname = "localhost";
username = "root";
password = "{credential systemd borgmatic-pg}";
}
];
nginx.virtualHosts."miniflux.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}";
};
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; age.secrets."miniflux-creds".file = ../../../secrets/miniflux-creds.age;
} }

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,48 +1,37 @@
{ {
config, config,
lib,
... ...
}: }:
let
feature = "nginx";
in
{ {
config = lib.mkIf config.${feature}.enable { services.nginx = {
services.nginx = { enable = true;
enable = true;
recommendedProxySettings = true; recommendedProxySettings = true;
recommendedTlsSettings = true; recommendedTlsSettings = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
recommendedOptimisation = true; recommendedOptimisation = true;
virtualHosts."*.fi33.buzz" = { virtualHosts."*.fi33.buzz" = {
forceSSL = true; forceSSL = true;
useACMEHost = "fi33.buzz"; useACMEHost = "fi33.buzz";
locations."/".index = "index.html"; locations."/".index = "index.html";
};
}; };
security.acme = {
acceptTerms = true;
defaults.email = "wi11@duck.com";
certs."fi33.buzz" = {
domain = "fi33.buzz";
extraDomainNames = [ "*.fi33.buzz" ];
group = "nginx";
dnsProvider = "porkbun";
dnsPropagationCheck = true;
credentialsFile = config.age.secrets."porkbun-api".path;
};
};
# secrets
age.secrets."porkbun-api" = {
file = ../../../secrets/porkbun-api.age;
};
users.users.nginx.extraGroups = [ "acme" ];
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; security.acme = {
acceptTerms = true;
defaults.email = "wi11@duck.com";
certs."fi33.buzz" = {
domain = "fi33.buzz";
extraDomainNames = [ "*.fi33.buzz" ];
group = "nginx";
dnsProvider = "porkbun";
dnsPropagationCheck = true;
credentialsFile = config.age.secrets."porkbun-api".path;
};
};
age.secrets."porkbun-api".file = ../../../secrets/porkbun-api.age;
users.users.nginx.extraGroups = [ "acme" ];
} }

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,34 +1,24 @@
{ config, lib, ... }:
let
feature = "nix-settings";
in
{ {
config = lib.mkIf config.${feature}.enable { nix = {
nix = { gc = {
gc = { automatic = true;
automatic = true; dates = "weekly";
dates = "weekly"; options = "--delete-older-than 20d";
options = "--delete-older-than 20d"; persistent = true;
persistent = true; };
}; optimise = {
optimise = { automatic = true;
automatic = true; persistent = true;
persistent = true; };
}; settings = {
settings = { experimental-features = [
experimental-features = [ "nix-command"
"nix-command" "flakes"
"flakes" ];
]; trusted-users = [
trusted-users = [ "will"
"will" "srv"
"srv" ];
];
};
}; };
}; };
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,108 +1,97 @@
{ {
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;
clipboard = {
providers.wl-copy.enable = true;
register = "unnamedplus";
};
colorschemes.catppuccin = {
enable = true; enable = true;
clipboard = { settings.background.dark = "mocha";
providers.wl-copy.enable = true; };
register = "unnamedplus"; dependencies = {
}; tree-sitter.enable = true;
colorschemes.catppuccin = { gcc.enable = true;
};
diagnostic.settings.virtual_lines = true;
opts = {
autoindent = true;
expandtab = true;
number = true;
relativenumber = true;
shiftwidth = 2;
tabstop = 2;
colorcolumn = "80";
};
plugins = {
# autoclose brackets
autoclose.enable = true;
# completion window
cmp = {
enable = true; enable = true;
settings.background.dark = "mocha"; autoEnableSources = true;
settings = {
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
};
sources = [
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "buffer"; }
];
};
}; };
dependencies = {
tree-sitter.enable = true;
gcc.enable = true;
};
diagnostic.settings.virtual_lines = true;
opts = {
autoindent = true;
expandtab = true;
number = true;
relativenumber = true;
shiftwidth = 2;
tabstop = 2;
colorcolumn = "80";
};
plugins = {
# autoclose brackets
autoclose.enable = true;
# completion window # git changes in margin
cmp = { gitsigns.enable = true;
enable = true;
autoEnableSources = true; # opens last edit position
settings = { lastplace.enable = true;
mapping = {
"<C-Space>" = "cmp.mapping.complete()"; # lsp servers
"<C-d>" = "cmp.mapping.scroll_docs(-4)"; lsp = {
"<C-e>" = "cmp.mapping.close()"; enable = true;
"<C-f>" = "cmp.mapping.scroll_docs(4)"; inlayHints = true;
"<CR>" = "cmp.mapping.confirm({ select = true })"; servers = {
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; nixd.enable = true;
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; rust_analyzer = {
}; enable = true;
sources = [ installCargo = true;
{ name = "nvim_lsp"; } installRustc = true;
{ name = "path"; } };
{ name = "buffer"; } hls = {
]; enable = true;
installGhc = true;
}; };
}; };
# git changes in margin
gitsigns.enable = true;
# opens last edit position
lastplace.enable = true;
# lsp servers
lsp = {
enable = true;
inlayHints = true;
servers = {
nixd.enable = true;
}
// lib.optionalAttrs config.dev.enable {
rust_analyzer = {
enable = true;
installCargo = true;
installRustc = true;
};
hls = {
enable = true;
installGhc = true;
};
};
};
lsp-format.enable = true;
lsp-lines.enable = true;
lsp-signature.enable = true;
lspkind.enable = true;
# status bar
lualine.enable = true;
# perform file system operations inside of neovim
oil.enable = true;
# syntax highlighting
treesitter.enable = true;
}; };
lsp-format.enable = true;
lsp-lines.enable = true;
lsp-signature.enable = true;
lspkind.enable = true;
# status bar
lualine.enable = true;
# perform file system operations inside of neovim
oil.enable = true;
# syntax highlighting
treesitter.enable = true;
}; };
}; };
imports = [ inputs.nixvim.nixosModules.nixvim ]; imports = [ inputs.nixvim.nixosModules.nixvim ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,38 +1,24 @@
{
config,
lib,
...
}:
let let
feature = "ntfy-sh";
port = "5002"; port = "5002";
in in
{ {
config = lib.mkIf config.${feature}.enable { services = {
services = { ntfy-sh = {
# service enable = true;
ntfy-sh = { settings = {
enable = true; base-url = "https://ntfy-sh.fi33.buzz";
settings = { listen-http = ":${port}";
base-url = "https://ntfy-sh.fi33.buzz"; behind-proxy = true;
listen-http = ":${port}";
behind-proxy = true;
};
}; };
};
# reverse proxy nginx.virtualHosts."ntfy-sh.fi33.buzz" = {
nginx = { forceSSL = true;
virtualHosts."${feature}.fi33.buzz" = { useACMEHost = "fi33.buzz";
forceSSL = true; locations."/" = {
useACMEHost = "fi33.buzz"; proxyPass = "http://localhost:${port}";
locations."/" = { proxyWebsockets = true;
proxyPass = "http://localhost:${port}";
proxyWebsockets = true;
};
};
}; };
}; };
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -4,54 +4,41 @@
... ...
}: }:
let let
feature = "paperless";
port = "5013"; port = "5013";
in in
{ {
config = lib.mkIf config.${feature}.enable { services = {
services = { paperless = {
# service enable = true;
paperless = { dataDir = "/srv/paperless";
enable = true; database.createLocally = true;
dataDir = "/srv/paperless"; passwordFile = config.age.secrets.paperless.path;
database.createLocally = true; port = lib.toInt port;
passwordFile = config.age.secrets.paperless.path; settings = {
port = lib.toInt port; PAPERLESS_URL = "https://paperless.fi33.buzz";
settings = {
PAPERLESS_URL = "https://paperless.fi33.buzz";
};
};
# database backup
borgmatic.settings = {
postgresql_databases = [
{
name = "paperless";
hostname = "localhost";
username = "root";
password = "{credential systemd borgmatic-pg}";
}
];
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
};
}; };
}; };
age.secrets."paperless" = { borgmatic.settings = {
file = ../../../secrets/paperless.age; postgresql_databases = [
owner = "paperless"; {
name = "paperless";
hostname = "localhost";
username = "root";
password = "{credential systemd borgmatic-pg}";
}
];
};
nginx.virtualHosts."miniflux.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}";
}; };
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; age.secrets."paperless" = {
file = ../../../secrets/paperless.age;
owner = "paperless";
};
} }

View file

@ -1,19 +1,11 @@
{ config, lib, ... }:
let
feature = "pipewire";
in
{ {
config = lib.mkIf config.${feature}.enable { security.rtkit.enable = true;
security.rtkit.enable = true;
services.pipewire = { services.pipewire = {
alsa.enable = true; alsa.enable = true;
alsa.support32Bit = true; alsa.support32Bit = true;
enable = true; enable = true;
jack.enable = true; jack.enable = true;
pulse.enable = true; pulse.enable = true;
};
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,36 +1,27 @@
{ {
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 = { enable = true;
enable = true; wayland.enable = true;
wayland.enable = true;
};
}; };
environment.systemPackages =
with pkgs.kdePackages;
[
# keep-sorted start
ktorrent
kzones
# keep-sorted end
]
++ (with pkgs; [
# keep-sorted start
haruna
# keep-sorted end
]);
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; environment.systemPackages =
with pkgs.kdePackages;
[
# keep-sorted start
ktorrent
kzones
# keep-sorted end
]
++ (with pkgs; [
# keep-sorted start
haruna
# keep-sorted end
]);
} }

View file

@ -1,30 +1,21 @@
{ {
config,
lib,
pkgs, pkgs,
... ...
}: }:
let
feature = "print-and-scan";
in
{ {
config = lib.mkIf config.${feature}.enable { hardware.sane = {
hardware.sane = { enable = true;
extraBackends = [ pkgs.hplip ];
};
services = {
avahi = {
enable = true; enable = true;
extraBackends = [ pkgs.hplip ]; nssmdns4 = true;
openFirewall = true;
}; };
services = { printing = {
avahi = { enable = true;
enable = true; drivers = [ pkgs.hplip ];
nssmdns4 = true;
openFirewall = true;
};
printing = {
enable = true;
drivers = [ pkgs.hplip ];
};
}; };
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,17 +1,3 @@
{ {
config, services.protonmail-bridge.enable = true;
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,35 +1,27 @@
{ {
config,
lib, lib,
... ...
}: }:
let let
feature = "prowlarr";
port = "5009"; port = "5009";
in in
{ {
config = lib.mkIf config.${feature}.enable { services = {
services = { prowlarr = {
# service enable = true;
prowlarr = { dataDir = "/srv/prowlarr";
enable = true; settings.server.port = lib.toInt port;
dataDir = "/srv/prowlarr"; };
settings.server.port = lib.toInt port;
};
# reverse proxy nginx = {
nginx = { virtualHosts."prowlarr.fi33.buzz" = {
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;
# proxyWebsockets = true;
};
}; };
}; };
}; };
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,37 +1,28 @@
{ config, lib, ... }: {
lib,
...
}:
let let
feature = "qbittorrent";
port = "5005"; port = "5005";
in in
{ {
config = lib.mkIf config.${feature}.enable { services = {
users.users.qbittorrent.extraGroups = [ "media" ]; qbittorrent = {
enable = true;
webuiPort = lib.toInt port;
profileDir = "/srv";
group = "media";
extraArgs = [
"--confirm-legal-notice"
];
};
services = { nginx.virtualHosts."qbittorrent.fi33.buzz" = {
# service forceSSL = true;
qbittorrent = { useACMEHost = "fi33.buzz";
enable = true; locations."/".proxyPass = "http://localhost:${port}";
webuiPort = lib.toInt port;
profileDir = "/srv";
group = "media";
extraArgs = [
"--confirm-legal-notice"
];
};
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
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 = { radarr = {
# service enable = true;
radarr = { dataDir = "/srv/radarr";
enable = true; settings.server.port = lib.toInt port;
dataDir = "/srv/radarr"; group = "media";
settings.server.port = lib.toInt port; };
group = "media";
}; nginx.virtualHosts."radarr.fi33.buzz" = {
forceSSL = true;
# reverse proxy useACMEHost = "fi33.buzz";
nginx = { locations."/".proxyPass = "http://localhost:${port}";
virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
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 = { sonarr = {
# service enable = true;
sonarr = { dataDir = "/srv/sonarr";
enable = true; settings.server.port = lib.toInt port;
dataDir = "/srv/sonarr"; group = "media";
settings.server.port = lib.toInt port; };
group = "media";
}; nginx.virtualHosts."sonarr.fi33.buzz" = {
forceSSL = true;
# reverse proxy useACMEHost = "fi33.buzz";
nginx = { locations."/".proxyPass = "http://localhost:${port}";
virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
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,45 +42,34 @@ let
); );
in in
{ {
config = lib.mkIf config.${feature}.enable { services = {
services = { syncthing = {
# service enable = true;
syncthing = { guiAddress = "0.0.0.0:${port}";
enable = true; openDefaultPorts = true;
guiAddress = "0.0.0.0:${port}"; user = "${userName}";
openDefaultPorts = true; dataDir = "/home/${userName}";
user = "${userName}"; overrideDevices = true;
dataDir = "/home/${userName}"; settings = {
overrideDevices = true; inherit devices;
settings = {
inherit devices;
};
};
borgmatic.settings =
if userName == "srv" then
{
source_directories = [
"/home/srv/.config/syncthing"
"/home/srv/Sync"
];
}
else
null;
# reverse proxy
nginx = {
virtualHosts."${feature}.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/" = {
proxyPass = "http://localhost:${port}";
# proxyWebsockets = true;
};
};
}; };
}; };
};
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; borgmatic.settings =
if userName == "srv" then
{
source_directories = [
"/home/srv/.config/syncthing"
"/home/srv/Sync"
];
}
else
null;
nginx.virtualHosts."syncthing.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${port}";
};
};
} }

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,22 +1,10 @@
{ {
config, services.tailscale = {
lib, enable = true;
... extraSetFlags = [
}: "--accept-dns=true"
let ];
feature = "tailscale";
in
{
config = lib.mkIf config.${feature}.enable {
services.tailscale = {
enable = true;
extraSetFlags = [
"--accept-dns=true"
];
};
networking.firewall.trustedInterfaces = [ "tailscale0" ];
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; networking.firewall.trustedInterfaces = [ "tailscale0" ];
} }

View file

@ -1,29 +1,19 @@
{ 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 = { power-profiles-daemon.enable = false;
power-profiles-daemon.enable = false; tlp = {
tlp = { enable = true;
enable = true; settings = {
settings = { # keep-sorted start
# keep-sorted start CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_AC = 1; CPU_BOOST_ON_BAT = 0;
CPU_BOOST_ON_BAT = 0; CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_AC = "performance"; CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; STOP_CHARGE_THRESH_BAT0 = 95;
STOP_CHARGE_THRESH_BAT0 = 95; # keep-sorted end
# keep-sorted end
};
}; };
}; };
}; };
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
} }

View file

@ -1,33 +1,28 @@
{ {
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; backupDir = "/srv/vaultwarden";
backupDir = "/srv/vaultwarden"; config = {
config = { rocketPort = "${port}";
rocketPort = "${port}"; domain = "https://vaultwarden.fi33.buzz";
domain = "https://vaultwarden.fi33.buzz"; signupsAllowed = false;
signupsAllowed = false; invitationsAllowed = false;
invitationsAllowed = false; showPasswordHint = false;
showPasswordHint = false; useSyslog = true;
useSyslog = true; extendedLogging = true;
extendedLogging = true; 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" = {
file = ../../../secrets/vaultwarden-admin.age;
owner = "vaultwarden";
};
}; };
options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; age.secrets."vaultwarden-admin" = {
file = ../../../secrets/vaultwarden-admin.age;
owner = "vaultwarden";
};
} }

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 = { feature = {
# service enable = true;
replace = { };
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."/".proxyPass = "http://localhost:${port}";
locations."/" = {
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;
}