Compare commits

...

65 Commits

Author SHA1 Message Date
83164ef4f0 chore: update lockfile 2026-05-24 17:25:52 +02:00
4000be1722 fix(astyanax): resolve wol-andromache MAC import 2026-05-24 17:25:52 +02:00
87d1e973ba feat(astyanax): add intel-compute-runtime 2026-05-24 17:25:52 +02:00
7c92f57039 refactor(stylix): use stylix 'autoImport' 2026-05-24 17:25:52 +02:00
258ff2126c fix(tmux): enable extended keys passthrough 2026-05-24 17:25:52 +02:00
ab72f96d6a fix(work): set up auto upgrade for 'work' home manager host 2026-05-24 17:25:52 +02:00
71b084d2bc fix(colmena): resolve colmena warning 2026-05-24 17:25:52 +02:00
9e66a9e779 feat(common): add pathsToLink for xdg-portal 2026-05-24 17:25:52 +02:00
c62b11100c fix: resolve deprecated ssh nix home manager option 2026-05-24 17:25:52 +02:00
d7e4574c9e fix: resolve Nix 'boot.zfs.forceImportRoot' default value warning 2026-05-24 17:25:52 +02:00
41bf403247 chore(packages): add 'curl' and 'fd' to shared packages 2026-05-24 17:25:52 +02:00
a0f4edf5da fix: rename module descriptions 2026-05-24 17:25:52 +02:00
bd8a8f7942 chore(modules): add auto-import default.nix files 2026-05-24 17:25:52 +02:00
a9dc191c2f chore(hooks): enforce enable option on all home modules 2026-05-24 16:00:50 +02:00
692bc6acb3 feat(gnome): add enable option 2026-05-24 16:00:48 +02:00
461c90cc25 feat(x): add enable option 2026-05-24 16:00:47 +02:00
d152f990f4 feat(users): add enable option 2026-05-24 16:00:45 +02:00
e0e51558b7 feat(uptime-kuma): add enable option 2026-05-24 16:00:44 +02:00
7324873ef9 feat(syncthing): add enable option 2026-05-24 16:00:43 +02:00
6f98f066a0 feat(storage): add enable option 2026-05-24 16:00:41 +02:00
a7ad2b141e feat(printing): add enable option 2026-05-24 16:00:40 +02:00
c95913027a feat(nvidia): add enable option 2026-05-24 16:00:38 +02:00
aefae7cdf2 feat(networking): add enable option 2026-05-24 16:00:37 +02:00
a11e6b6a11 feat(localization): add enable option 2026-05-24 16:00:36 +02:00
ac4e8aacbd feat(keyboard): add enable option 2026-05-24 16:00:34 +02:00
c6ea1433d3 feat(k3s): add enable option 2026-05-24 16:00:33 +02:00
a3fd052204 feat(gaming): add enable option 2026-05-24 16:00:31 +02:00
cd1880e7c9 feat(fonts): add enable option 2026-05-24 16:00:30 +02:00
9c0e2be6b5 feat(bootloader): add enable option 2026-05-24 16:00:28 +02:00
95a4409494 feat(bluetooth): add enable option 2026-05-24 16:00:27 +02:00
4b6f4014b2 feat(ai-tools): add enable option 2026-05-24 16:00:26 +02:00
e994e540c1 fix(desktop): add enable option 2026-05-24 16:00:24 +02:00
6c9bbc27a0 feat(git): add enable option 2026-05-24 16:00:23 +02:00
1255083ad6 fix(secrets): add enable option 2026-05-24 16:00:21 +02:00
1f115f8738 feat(taskwarrior): add enable option 2026-05-24 16:00:20 +02:00
96c65fc991 feat(anki): add enable option 2026-05-24 16:00:19 +02:00
1158e855c2 feat(shell): add enable option 2026-05-24 16:00:17 +02:00
c3239c544a feat(stylix): add enable option 2026-05-24 16:00:16 +02:00
a191c89549 feat(k8s): add enable option 2026-05-24 16:00:14 +02:00
7d4e514f97 feat(browser): add enable option 2026-05-24 16:00:13 +02:00
086e091add feat(ssh): add enable option 2026-05-24 16:00:11 +02:00
a5adea70ea feat(music): add enable option 2026-05-24 16:00:10 +02:00
e84079647b feat(terminal): add enable option 2026-05-24 16:00:09 +02:00
a3c24382f8 feat(tmux): add enable option 2026-05-24 16:00:07 +02:00
2d4f428fd3 feat(waybar): add enable option 2026-05-24 16:00:06 +02:00
cff26bd47b feat(audio): add enable option 2026-05-24 16:00:05 +02:00
fef88cf1a4 feat(keepassxc): add enable option 2026-05-24 16:00:03 +02:00
9402c16df0 feat(mako): add enable option 2026-05-24 16:00:02 +02:00
98a62b262b feat(fuzzel): add enable option 2026-05-24 16:00:00 +02:00
87ff32bac3 feat(direnv): add enable option 2026-05-24 15:59:59 +02:00
0ecfe7d86d feat(nvim): add enable option 2026-05-24 15:59:57 +02:00
f2ffedfb76 feat(devenv): add enable option 2026-05-24 15:59:56 +02:00
bc2f0477ca feat(pandoc): add enable option 2026-05-24 15:59:55 +02:00
0826ac78e1 feat(dconf): add enable option 2026-05-24 15:59:53 +02:00
36948fa1e9 feat(nodejs): add enable option 2026-05-24 15:59:52 +02:00
e5fad8a398 feat(vscode): add enable option 2026-05-24 15:59:51 +02:00
adce0a0872 feat(bruno): add enable option 2026-05-24 15:59:49 +02:00
a9ae884349 feat(infra): add enable option 2026-05-24 15:59:48 +02:00
a906b9b89d feat(docker): add enable option 2026-05-24 15:59:46 +02:00
a74a184035 feat(go): add enable option 2026-05-24 15:59:45 +02:00
505aa1d356 feat(ticketing): add enable option 2026-05-24 15:59:43 +02:00
bf248d495b feat(nfc): add enable option, inline proxmark3 2026-05-24 15:59:41 +02:00
3dbd301925 feat(photography): add enable option 2026-05-22 11:40:20 +02:00
8665a36e3a feat(clipboard): add enable option 2026-05-22 11:33:51 +02:00
ba90329c81 fix(browser): resolve firefox 'configPath' home manager error 2026-05-20 09:28:17 +02:00
97 changed files with 1645 additions and 1028 deletions

View File

@@ -76,3 +76,5 @@ if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 4\) -o #
if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 2\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'set-option -g status-utf8 on' if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 2\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'set-option -g status-utf8 on'
set -g allow-passthrough on set -g allow-passthrough on
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'

36
flake.lock generated
View File

@@ -121,11 +121,11 @@
}, },
"locked": { "locked": {
"dir": "pkgs/firefox-addons", "dir": "pkgs/firefox-addons",
"lastModified": 1778904158, "lastModified": 1779595358,
"narHash": "sha256-xZ/zdpu9X8OI1jGqd4z6W1hKa+DQh8A9k3TH6w9tNbo=", "narHash": "sha256-wYTO3i1Xe1oh9lWP8cAcgtD4tJyWFQRcN1uxYpdcL1Q=",
"owner": "rycee", "owner": "rycee",
"repo": "nur-expressions", "repo": "nur-expressions",
"rev": "c31bafebd7e30517ead27149ad790802b998e98f", "rev": "3028f7f65d02928083359f8701507a8b35d8bf42",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@@ -342,11 +342,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1778921576, "lastModified": 1779627636,
"narHash": "sha256-jgIbBcGgKTtkp+lBas29hNFUU1t5O/2+GFvUjbiG0vM=", "narHash": "sha256-J6JGf42zNzLo/CrRdKb5dNznpLI+eGxN/5KTLG1Mo5s=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "32b42d71b4b22c4465963285bb6e462d7c93d45e", "rev": "044c30c19550c0557997dece4ce9e54d2fa77ba1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -398,10 +398,10 @@
"nix-secrets": { "nix-secrets": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1776723456, "lastModified": 1778944969,
"narHash": "sha256-GBbbm05oXYqSZ2EgxQPsNpTKl16wNhvrlUxdmv0FbSU=", "narHash": "sha256-wT4WiBUqfeajcaOWvSKmHGKXEGmnDVQsRg0v7NoZW5o=",
"ref": "main", "ref": "main",
"rev": "135b681d24af6ee4508bbf7c657982d7be8743d4", "rev": "aae027d8de9ae66ea29c9e6a5ff6ea0f4b735261",
"shallow": true, "shallow": true,
"type": "git", "type": "git",
"url": "ssh://git@github.com/hektor/nix-secrets" "url": "ssh://git@github.com/hektor/nix-secrets"
@@ -451,11 +451,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1778924461, "lastModified": 1779258371,
"narHash": "sha256-pDGhSCz+QxjHzP9gqYpK59k4Z1ZpVyYjzBgoXLFXh9s=", "narHash": "sha256-j1iZsLy6oFApqR1oiDmHhvkwxXqcNi0aoSJj643LuwU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "65a5c8f9c19d5f9d1b06d8942b04d790414ccfdd", "rev": "c97bc4d15bd3473dd095e8e8ba57330ab1943a77",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -467,11 +467,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1778443072, "lastModified": 1779508470,
"narHash": "sha256-zi7/fsqM/kFdNuED//4WOCUtezGtKKqRNORjMvfwjnA=", "narHash": "sha256-Ap9KJX+5xHIn3bPIpfNgT6MEXdAECECwo4/rmlQD74M=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "da5ad661ba4e5ef59ba743f0d112cbc30e474f32", "rev": "29916453413845e54a65b8a1cf996842300cd299",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -714,11 +714,11 @@
"tinted-zed": "tinted-zed" "tinted-zed": "tinted-zed"
}, },
"locked": { "locked": {
"lastModified": 1778776709, "lastModified": 1779378391,
"narHash": "sha256-YhnEcpiY6+l3RFA+cPmdTaeODGvNRuqE8B7VBjPVIxo=", "narHash": "sha256-IsDb9erotvx9npI94UDosvMeYQK17p7/vmU2v9batrY=",
"owner": "danth", "owner": "danth",
"repo": "stylix", "repo": "stylix",
"rev": "e8ea85b4f7dddda9603e0f1ac86cd92cee3b2819", "rev": "c1456cc4ba3c9485e7b4158c909eeca5a752cd59",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -138,6 +138,7 @@
}; };
modules = [ ./home/hosts/work ]; modules = [ ./home/hosts/work ];
extraSpecialArgs = { extraSpecialArgs = {
osConfig = null;
inherit inherit
inputs inputs
outputs outputs
@@ -148,7 +149,9 @@
}; };
}; };
apps.${system}.colmena = inputs.colmena.apps.${system}.default; apps.${system}.colmena = inputs.colmena.apps.${system}.default // {
meta.description = "colmena";
};
colmenaHive = import ./deploy/colmena.nix { colmenaHive = import ./deploy/colmena.nix {
inherit inherit

View File

@@ -8,31 +8,6 @@
{ {
imports = [ imports = [
../../modules ../../modules
../../modules/3d
../../modules/ai-tools
../../modules/anki
../../modules/audio
../../modules/browser
../../modules/cloud
../../modules/comms
../../modules/desktop/niri
../../modules/devenv
../../modules/direnv
../../modules/git
../../modules/k8s/k9s.nix
../../modules/keepassxc
../../modules/music
../../modules/nvim
../../modules/pandoc
../../modules/photography
../../modules/secrets
../../modules/shell
../../modules/ssh
../../modules/taskwarrior
../../modules/terminal
../../modules/torrenting
../../modules/yubikey
../../modules/zk
]; ];
home = { home = {
@@ -52,12 +27,32 @@
claude-code.enable = true; claude-code.enable = true;
opencode.enable = true; opencode.enable = true;
}; };
desktop.niri.enable = true;
browser.enable = true;
browser.primary = "librewolf"; browser.primary = "librewolf";
cloud.hetzner.enable = true; cloud.hetzner.enable = true;
comms.signal.enable = true; comms.signal.enable = true;
git.enable = true;
git.github.enable = true; git.github.enable = true;
shell.bash.aliases.lang-js = true; shell = {
shell.bash.addBinToPath = true; enable = true;
bash.aliases.lang-js = true;
bash.addBinToPath = true;
};
anki.enable = true;
k8s.k9s.enable = true;
secrets.enable = true;
taskwarrior.enable = true;
audio.enable = true;
ssh.enable = true;
music.enable = true;
terminal.enable = true;
devenv.enable = true;
keepassxc.enable = true;
direnv.enable = true;
nvim.enable = true;
pandoc.enable = true;
photography.enable = true;
torrenting.enable = true; torrenting.enable = true;
my.yubikey.enable = true; my.yubikey.enable = true;
zk.enable = true; zk.enable = true;

View File

@@ -7,29 +7,6 @@
{ {
imports = [ imports = [
../../modules ../../modules
../../modules/3d
../../modules/ai-tools
../../modules/anki
../../modules/audio
../../modules/browser
../../modules/cloud
../../modules/comms
../../modules/desktop/niri
../../modules/devenv
../../modules/direnv
../../modules/git
../../modules/k8s/k9s.nix
../../modules/keepassxc
../../modules/music
../../modules/nfc
../../modules/nvim
../../modules/pandoc
../../modules/secrets
../../modules/shell
../../modules/ssh
../../modules/taskwarrior
../../modules/terminal
../../modules/yubikey
]; ];
home = { home = {
@@ -48,13 +25,33 @@
claude-code.enable = true; claude-code.enable = true;
opencode.enable = true; opencode.enable = true;
}; };
anki.enable = true;
audio.enable = true;
browser.enable = true;
browser.primary = "librewolf"; browser.primary = "librewolf";
cloud.hetzner.enable = true; cloud.hetzner.enable = true;
comms.signal.enable = true; comms.signal.enable = true;
desktop.niri.enable = true;
devenv.enable = true;
direnv.enable = true;
git.enable = true;
git.github.enable = true; git.github.enable = true;
shell.bash.aliases.lang-js = true; k8s.k9s.enable = true;
shell.bash.addBinToPath = true; keepassxc.enable = true;
music.enable = true;
my.yubikey.enable = true; my.yubikey.enable = true;
nfc.enable = true;
nvim.enable = true;
pandoc.enable = true;
secrets.enable = true;
shell = {
enable = true;
bash.aliases.lang-js = true;
bash.addBinToPath = true;
};
ssh.enable = true;
taskwarrior.enable = true;
terminal.enable = true;
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;

View File

@@ -3,7 +3,9 @@
with pkgs; with pkgs;
[ [
bat bat
curl
entr entr
fd
feh feh
fzf fzf
htop htop

View File

@@ -8,36 +8,8 @@
{ {
imports = [ imports = [
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
inputs.stylix.homeModules.stylix
../../modules ../../modules
../../modules/ai-tools
../../modules/anki
../../modules/browser
../../modules/bruno
../../modules/cloud
../../modules/comms
../../modules/database
../../modules/dconf
../../modules/desktop/niri
../../modules/devenv
../../modules/direnv
../../modules/docker
../../modules/git
../../modules/go
../../modules/infra
../../modules/k8s
../../modules/k8s/k9s.nix
../../modules/keepassxc
../../modules/music
../../modules/nodejs
../../modules/nvim
../../modules/pandoc
../../modules/secrets
../../modules/shell
../../modules/stylix
../../modules/taskwarrior
../../modules/ticketing
../../modules/terminal
../../modules/vscode
]; ];
sops.age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; sops.age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
@@ -63,24 +35,57 @@
defaultWrapper = "mesa"; defaultWrapper = "mesa";
}; };
browser.primary = "firefox";
browser.secondary = "chromium";
cloud.azure.enable = true;
comms.signal.enable = true;
comms.teams.enable = true;
ai-tools = { ai-tools = {
claude-code.enable = true; claude-code.enable = true;
tirith.enable = true; tirith.enable = true;
opencode.enable = true; opencode.enable = true;
}; };
anki.enable = true;
browser = {
enable = true;
primary = "firefox";
secondary = "chromium";
};
bruno.enable = true;
cloud.azure.enable = true;
comms.signal.enable = true;
comms.teams.enable = true;
database = { database = {
mssql.enable = true; mssql.enable = true;
postgresql.enable = true; postgresql.enable = true;
redis.enable = true; redis.enable = true;
}; };
git.github.enable = true; desktop.niri.enable = true;
git.gitlab.enable = true; devenv.enable = true;
direnv.enable = true;
docker.enable = true;
git = {
enable = true;
github.enable = true;
gitlab.enable = true;
};
go.enable = true;
k8s.enable = true;
keepassxc.enable = true;
music.enable = true;
my.dconf.enable = true;
my.stylix.enable = true;
nvim.enable = true;
pandoc.enable = true;
shell.enable = true;
taskwarrior.enable = true;
terminal.enable = true;
infra.enable = true;
nodejs.enable = true;
secrets.enable = true;
secrets.vault.enable = true; secrets.vault.enable = true;
ticketing.enable = true;
vscode.enable = true;
services.home-manager.autoUpgrade = {
enable = true;
frequency = "weekly";
};
programs = { programs = {
gh.enable = true; gh.enable = true;

View File

@@ -9,7 +9,7 @@ let
in in
{ {
options.ai-tools.tirith = { options.ai-tools.tirith = {
enable = lib.mkEnableOption "tirith shell security guard"; enable = lib.mkEnableOption "tirith";
}; };
config = lib.mkMerge [ config = lib.mkMerge [

View File

@@ -9,9 +9,14 @@
}: }:
let let
cfg = config.anki;
sops = myUtils.sopsAvailability config osConfig; sops = myUtils.sopsAvailability config osConfig;
standalone = osConfig == null; standalone = osConfig == null;
in in
{
options.anki.enable = lib.mkEnableOption "Anki";
config = lib.mkIf cfg.enable (
lib.optionalAttrs standalone { lib.optionalAttrs standalone {
sops.secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null { sops.secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null {
anki = [ anki = [
@@ -22,7 +27,7 @@ lib.optionalAttrs standalone {
} }
// { // {
warnings = lib.optional ( warnings = lib.optional (
!sops.available && config.programs.anki.enable !sops.available
) "anki is enabled but sops secrets are not available. anki sync will not be configured."; ) "anki is enabled but sops secrets are not available. anki sync will not be configured.";
programs.anki = { programs.anki = {
@@ -39,3 +44,5 @@ lib.optionalAttrs standalone {
}; };
}; };
} }
);
}

View File

@@ -1,7 +1,19 @@
{ osConfig, pkgs, ... }:
{ {
home.packages = with pkgs; [ pulsemixer ]; config,
lib,
pkgs,
osConfig,
...
}:
let
cfg = config.audio;
in
{
options.audio.enable = lib.mkEnableOption "audio";
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ pulsemixer ];
services.mpris-proxy.enable = osConfig.hardware.bluetooth.enable or false; services.mpris-proxy.enable = osConfig.hardware.bluetooth.enable or false;
};
} }

View File

@@ -1,7 +1,19 @@
{ config, lib, ... }: {
config,
lib,
...
}:
{ {
imports = [
./firefox.nix
./librewolf.nix
./chromium.nix
];
options.browser = { options.browser = {
enable = lib.mkEnableOption "browser";
primary = lib.mkOption { primary = lib.mkOption {
type = lib.types.enum [ type = lib.types.enum [
"firefox" "firefox"
@@ -23,11 +35,7 @@
}; };
}; };
config.home.sessionVariables.BROWSER = config.browser.primary; config = lib.mkIf config.browser.enable {
home.sessionVariables.BROWSER = config.browser.primary;
imports = [ };
./firefox.nix
./librewolf.nix
./chromium.nix
];
} }

View File

@@ -10,6 +10,7 @@
config = lib.mkIf (config.browser.primary == "firefox" || config.browser.secondary == "firefox") { config = lib.mkIf (config.browser.primary == "firefox" || config.browser.secondary == "firefox") {
programs.firefox = { programs.firefox = {
enable = true; enable = true;
configPath = "${config.xdg.configHome}/mozilla/firefox";
} }
// (import ./firefox-base.nix { // (import ./firefox-base.nix {
inherit inherit

View File

@@ -1,7 +1,19 @@
{ config, pkgs, ... }:
{ {
config = { config,
lib,
pkgs,
...
}:
let
cfg = config.bruno;
in
{
options.bruno = {
enable = lib.mkEnableOption "Bruno";
};
config = lib.mkIf cfg.enable {
home.packages = [ (config.nixgl.wrap (config.wrapApp pkgs.bruno "--no-sandbox")) ]; home.packages = [ (config.nixgl.wrap (config.wrapApp pkgs.bruno "--no-sandbox")) ];
}; };
} }

View File

@@ -1,7 +1,21 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
let
cfg = config.clipboard;
in
{
options.clipboard = {
enable = lib.mkEnableOption "clipboard";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
wl-clipboard wl-clipboard
]; ];
};
} }

View File

@@ -3,10 +3,10 @@
{ {
options.cloud = { options.cloud = {
azure = { azure = {
enable = lib.mkEnableOption "azure CLI"; enable = lib.mkEnableOption "Azure CLI";
}; };
hetzner = { hetzner = {
enable = lib.mkEnableOption "hetzner CLI"; enable = lib.mkEnableOption "Hetzner CLI";
}; };
}; };

View File

@@ -1,11 +1,22 @@
{ config, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.my.dconf;
terminal = "kitty"; terminal = "kitty";
browser = config.browser.primary; browser = config.browser.primary;
font = "${config.stylix.fonts.monospace.name} ${toString config.stylix.fonts.sizes.applications}"; font = "${config.stylix.fonts.monospace.name} ${toString config.stylix.fonts.sizes.applications}";
in in
{ {
options.my.dconf = {
enable = lib.mkEnableOption "dconf";
};
config = lib.mkIf cfg.enable {
dconf.settings = { dconf.settings = {
"org/gnome/desktop/background" = { "org/gnome/desktop/background" = {
color-shading-type = "solid"; color-shading-type = "solid";
@@ -122,4 +133,5 @@ in
}; };
home.packages = with pkgs; [ dconf2nix ]; home.packages = with pkgs; [ dconf2nix ];
};
} }

View File

@@ -6,6 +6,13 @@
}: }:
{ {
imports =
let
dirs = lib.attrNames (lib.filterAttrs (_: v: v == "directory") (builtins.readDir ./.));
hasDef = name: builtins.pathExists ./${name}/default.nix;
in
map (name: ./${name}) (builtins.filter hasDef dirs);
options = { options = {
host.username = lib.mkOption { host.username = lib.mkOption {
type = lib.types.str; type = lib.types.str;

View File

@@ -0,0 +1,5 @@
{ ... }:
{
imports = [ ./niri ];
}

View File

@@ -179,4 +179,5 @@ binds {
Alt+Print { screenshot-window; } Alt+Print { screenshot-window; }
Mod+Shift+Delete { quit; } Mod+Shift+Delete { quit; }
} }

View File

@@ -1,4 +1,9 @@
{ pkgs, ... }: {
lib,
pkgs,
config,
...
}:
{ {
imports = [ imports = [
@@ -9,11 +14,20 @@
../../waybar ../../waybar
]; ];
options.desktop.niri.enable = lib.mkEnableOption "niri desktop";
config = lib.mkIf config.desktop.niri.enable {
clipboard.enable = lib.mkDefault true;
fuzzel.enable = lib.mkDefault true;
mako.enable = lib.mkDefault true;
shikane.enable = lib.mkDefault true;
waybar.enable = lib.mkDefault true;
home = { home = {
file.".config/niri/config.kdl".source = ./config.kdl; file.".config/niri/config.kdl".source = ./config.kdl;
packages = with pkgs; [ packages = with pkgs; [
brightnessctl brightnessctl
wlsunset xwayland-satellite
]; ];
}; };
@@ -23,4 +37,35 @@
latitude = 51.05; latitude = 51.05;
longitude = 3.71667; longitude = 3.71667;
}; };
xdg.configFile."electron-flags.conf".text = ''
--enable-features=UseOzonePlatform
--ozone-platform=wayland
'';
xdg.portal = {
enable = true;
config = {
niri = {
default = [
"gnome"
"gtk"
];
"org.freedesktop.impl.portal.Access" = "gtk";
"org.freedesktop.impl.portal.Notification" = "gtk";
"org.freedesktop.impl.portal.Secret" = "gnome-keyring";
"org.freedesktop.impl.portal.FileChooser" = "gtk";
"org.freedesktop.impl.portal.ScreenCast" = [ "gnome" ];
"org.freedesktop.impl.portal.Settings" = [
"gnome"
"gtk"
];
};
};
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-gnome
];
};
};
} }

View File

@@ -1,4 +1,19 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
let
cfg = config.devenv;
in
{
options.devenv = {
enable = lib.mkEnableOption "devenv";
};
config = lib.mkIf cfg.enable {
home.packages = [ pkgs.devenv ]; home.packages = [ pkgs.devenv ];
};
} }

View File

@@ -1,7 +1,20 @@
{ {
config,
lib,
...
}:
let
cfg = config.direnv;
in
{
options.direnv.enable = lib.mkEnableOption "direnv";
config = lib.mkIf cfg.enable {
programs.direnv = { programs.direnv = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = true;
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
};
} }

View File

@@ -1,7 +1,21 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
let
cfg = config.docker;
in
{
options.docker = {
enable = lib.mkEnableOption "Docker";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
dive dive
]; ];
};
} }

View File

@@ -1,4 +1,16 @@
{ {
config,
lib,
...
}:
let
cfg = config.fuzzel;
in
{
options.fuzzel.enable = lib.mkEnableOption "fuzzel";
config = lib.mkIf cfg.enable {
programs.fuzzel = { programs.fuzzel = {
enable = true; enable = true;
settings = { settings = {
@@ -12,4 +24,5 @@
}; };
}; };
}; };
};
} }

View File

@@ -8,11 +8,12 @@
{ {
options.git = { options.git = {
enable = lib.mkEnableOption "git";
github.enable = lib.mkEnableOption "Github CLI"; github.enable = lib.mkEnableOption "Github CLI";
gitlab.enable = lib.mkEnableOption "Gitlab CLI"; gitlab.enable = lib.mkEnableOption "Gitlab CLI";
}; };
config = { config = lib.mkIf config.git.enable {
programs.git.enable = true; programs.git.enable = true;
home.file = { home.file = {
".gitconfig".source = dotsPath + "/.gitconfig"; ".gitconfig".source = dotsPath + "/.gitconfig";

View File

@@ -1,7 +1,22 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
let
cfg = config.go;
in
{
options.go = {
enable = lib.mkEnableOption "Go";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
go go
gopls gopls
]; ];
};
} }

View File

@@ -1,7 +1,19 @@
{ pkgs, ... }:
{ {
config = { config,
lib,
pkgs,
...
}:
let
cfg = config.infra;
in
{
options.infra = {
enable = lib.mkEnableOption "infrastructure tools";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
opentofu opentofu
upbound upbound

View File

@@ -1,6 +1,25 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
let
cfg = config.k8s;
in
{
imports = [
./helm.nix
./k9s.nix
];
options.k8s.enable = lib.mkEnableOption "k8s";
config = lib.mkIf cfg.enable {
k8s.helm.enable = lib.mkDefault true;
k8s.k9s.enable = lib.mkDefault true;
home.packages = with pkgs; [ home.packages = with pkgs; [
argocd argocd
fluxcd fluxcd
@@ -21,9 +40,5 @@
home.shellAliases = { home.shellAliases = {
k = "kubectl"; k = "kubectl";
}; };
};
imports = [
./helm.nix
./k9s.nix
];
} }

View File

@@ -1,6 +1,17 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
let
cfg = config.k8s.helm;
in
{
options.k8s.helm.enable = lib.mkEnableOption "helm";
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
(wrapHelm kubernetes-helm { (wrapHelm kubernetes-helm {
plugins = with kubernetes-helmPlugins; [ plugins = with kubernetes-helmPlugins; [
@@ -12,4 +23,5 @@
]; ];
}) })
]; ];
};
} }

View File

@@ -1,4 +1,16 @@
{ {
config,
lib,
...
}:
let
cfg = config.k8s.k9s;
in
{
options.k8s.k9s.enable = lib.mkEnableOption "";
config = lib.mkIf cfg.enable {
programs.k9s = { programs.k9s = {
enable = true; enable = true;
settings.k9s = { settings.k9s = {
@@ -8,4 +20,5 @@
}; };
}; };
}; };
};
} }

View File

@@ -1,8 +1,21 @@
{ {
config,
lib,
...
}:
let
cfg = config.keepassxc;
in
{
options.keepassxc.enable = lib.mkEnableOption "KeePassXC";
config = lib.mkIf cfg.enable {
programs.keepassxc = { programs.keepassxc = {
enable = true; enable = true;
settings = { settings = {
Browser.Enabled = true; Browser.Enabled = true;
}; };
}; };
};
} }

View File

@@ -1,5 +1,16 @@
{ {
services.mako = { config,
enable = true; lib,
...
}:
let
cfg = config.mako;
in
{
options.mako.enable = lib.mkEnableOption "mako";
config = lib.mkIf cfg.enable {
services.mako.enable = true;
}; };
} }

View File

@@ -1,10 +1,13 @@
{ {
dotsPath, config,
lib,
pkgs, pkgs,
dotsPath,
... ...
}: }:
let let
cfg = config.music;
spotifyWithWayland = pkgs.symlinkJoin { spotifyWithWayland = pkgs.symlinkJoin {
name = "spotify"; name = "spotify";
paths = [ pkgs.spotify ]; paths = [ pkgs.spotify ];
@@ -16,12 +19,14 @@ let
}; };
in in
{ {
home.packages = with pkgs; [ options.music.enable = lib.mkEnableOption "music";
spotifyWithWayland
]; config = lib.mkIf cfg.enable {
home.packages = [ spotifyWithWayland ];
programs.ncspot = { programs.ncspot = {
enable = true; enable = true;
settings = builtins.fromTOML (builtins.readFile (dotsPath + "/.config/ncspot/config.toml")); settings = fromTOML (builtins.readFile (dotsPath + "/.config/ncspot/config.toml"));
};
}; };
} }

View File

@@ -1,5 +1,21 @@
{ {
imports = [ config,
./proxmark3.nix lib,
pkgs,
...
}:
let
cfg = config.nfc;
in
{
options.nfc = {
enable = lib.mkEnableOption "NFC tools";
};
config = lib.mkIf cfg.enable {
home.packages = [
(pkgs.proxmark3.override { withGeneric = true; })
]; ];
};
} }

View File

@@ -1,6 +0,0 @@
{ pkgs, ... }:
{
home.packages = [
(pkgs.proxmark3.override { withGeneric = true; })
];
}

View File

@@ -5,15 +5,21 @@
... ...
}: }:
let
cfg = config.nodejs;
in
{ {
options.nodejs.package = lib.mkOption { options.nodejs = {
enable = lib.mkEnableOption "Node.js";
package = lib.mkOption {
type = lib.types.package; type = lib.types.package;
default = pkgs.nodejs_24; default = pkgs.nodejs_24;
}; };
};
config = { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
config.nodejs.package cfg.package
pnpm pnpm
yarn yarn
biome biome

View File

@@ -1,7 +1,20 @@
{ pkgs, inputs, ... }:
{ {
config,
lib,
pkgs,
inputs,
...
}:
let
cfg = config.nvim;
in
{
options.nvim.enable = lib.mkEnableOption "nvim";
config = lib.mkIf cfg.enable {
home.packages = [ home.packages = [
inputs.nvim.packages.${pkgs.stdenv.hostPlatform.system}.nvim inputs.nvim.packages.${pkgs.stdenv.hostPlatform.system}.nvim
]; ];
};
} }

View File

@@ -1,8 +1,23 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
let
cfg = config.pandoc;
in
{
options.pandoc = {
enable = lib.mkEnableOption "pandoc";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
haskellPackages.pandoc-crossref haskellPackages.pandoc-crossref
pandoc pandoc
texliveSmall texliveSmall
]; ];
};
} }

View File

@@ -1,7 +1,21 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
let
cfg = config.photography;
in
{
options.photography = {
enable = lib.mkEnableOption "photography";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
darktable darktable
]; ];
};
} }

View File

@@ -1,13 +1,19 @@
{ {
config,
lib,
pkgs, pkgs,
... ...
}: }:
{ {
imports = [ ./vault.nix ]; imports = [ ./vault.nix ];
options.secrets.enable = lib.mkEnableOption "secrets";
config = lib.mkIf config.secrets.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
age age
age-plugin-yubikey # TODO: only needed when using Yubikey age-plugin-yubikey
sops sops
]; ];
};
} }

View File

@@ -4,13 +4,12 @@
dotsPath, dotsPath,
... ...
}: }:
let let
cfg = config.shell.bash; cfg = config.shell.bash;
inherit (config.home) username; inherit (config.home) username;
in in
{ {
imports = [ ./utils.nix ];
options.shell.bash = { options.shell.bash = {
aliases = { aliases = {
all = lib.mkOption { all = lib.mkOption {
@@ -34,7 +33,7 @@ in
}; };
}; };
config = { config = lib.mkIf config.shell.enable {
programs.bash = { programs.bash = {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;

View File

@@ -1,3 +1,9 @@
{
config,
lib,
...
}:
{ {
imports = [ imports = [
./bash.nix ./bash.nix
@@ -5,4 +11,10 @@
./prompt.nix ./prompt.nix
../tmux ../tmux
]; ];
options.shell.enable = lib.mkEnableOption "shell";
config = lib.mkIf config.shell.enable {
tmux.enable = lib.mkDefault true;
};
} }

View File

@@ -1,3 +1,11 @@
{ {
config,
lib,
...
}:
{
config = lib.mkIf config.shell.enable {
programs.starship.enable = true; programs.starship.enable = true;
};
} }

View File

@@ -1,9 +1,12 @@
{ {
config,
lib, lib,
pkgs, pkgs,
... ...
}: }:
{ {
config = lib.mkIf config.shell.enable {
programs.fzf = { programs.fzf = {
enable = true; enable = true;
enableBashIntegration = lib.mkDefault true; enableBashIntegration = lib.mkDefault true;
@@ -16,4 +19,5 @@
entr entr
parallel parallel
]; ];
};
} }

View File

@@ -1,6 +1,67 @@
{ pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
home.packages = with pkgs; [ wdisplays ]; options.shikane.enable = lib.mkEnableOption "shikane";
config = lib.mkIf config.shikane.enable {
home.packages = with pkgs; [ (config.nixgl.wrap wdisplays) ];
services.shikane.enable = true; services.shikane.enable = true;
home.file.".config/shikane/config.toml".text = ''
[[profile]]
name = "work"
[[profile.output]]
enable = true
search = ["m=Unknown", "s=", "v=Unknown"]
mode = "2880x1800@120Hz"
position = "288,3240"
scale = 1.5
transform = "normal"
adaptive_sync = false
[[profile.output]]
enable = true
search = ["m=Q27P1B", "s=GNXM2HA196769", "v=PNP(AOC)"]
mode = "2560x1440@59.951Hz"
position = "116,1800"
scale = 1.0
transform = "normal"
adaptive_sync = false
[[profile.output]]
enable = true
search = ["m=PHL 243S7", "s=UHB1923012753", "v=Philips Consumer Electronics Company"]
mode = "1920x1080@60Hz"
position = "2676,1800"
scale = 1.0
transform = "270"
adaptive_sync = false
[[profile]]
name = "home"
[[profile.output]]
enable = true
search = ["m=Unknown", "s=Unknown", "v=Unknown"]
mode = "2880x1800@60.001Hz"
position = "185,1440"
scale = 1.75
transform = "normal"
adaptive_sync = false
[[profile.output]]
enable = true
search = ["m=PHL 276E8V", "s=0x0000046D", "v=Philips Consumer Electronics Company"]
mode = "3840x2160@59.996Hz"
position = "1500,0"
scale = 1.5
transform = "normal"
adaptive_sync = false
'';
};
} }

View File

@@ -1,10 +1,13 @@
{ {
myUtils, config,
lib, lib,
pkgs, pkgs,
myUtils,
... ...
}: }:
let let
cfg = config.ssh;
hostDir = ../../hosts; hostDir = ../../hosts;
hostNames = myUtils.dirNames hostDir; hostNames = myUtils.dirNames hostDir;
hostsWithKeys = lib.filter ( hostsWithKeys = lib.filter (
@@ -12,30 +15,33 @@ let
) hostNames; ) hostNames;
in in
{ {
options.ssh.enable = lib.mkEnableOption "ssh";
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ sshfs ]; home.packages = with pkgs; [ sshfs ];
programs.ssh = { programs.ssh = {
enable = true; enable = true;
enableDefaultConfig = false; enableDefaultConfig = false;
matchBlocks = settings =
lib.genAttrs hostsWithKeys ( lib.genAttrs hostsWithKeys (
hostname: hostname:
let let
meta = myUtils.hostMeta (hostDir + "/${hostname}"); meta = myUtils.hostMeta (hostDir + "/${hostname}");
in in
{ {
host = hostname; User = meta.deployment.targetUser;
user = meta.deployment.targetUser;
} }
// lib.optionalAttrs (meta.deployment.targetHost != "") { // lib.optionalAttrs (meta.deployment.targetHost != "") {
hostname = meta.deployment.targetHost; HostName = meta.deployment.targetHost;
} }
) )
// { // {
"*" = { "*" = {
addKeysToAgent = "yes"; AddKeysToAgent = "yes";
forwardAgent = false; ForwardAgent = false;
};
}; };
}; };
}; };

View File

@@ -1,16 +1,18 @@
{ {
config, config,
inputs, lib,
pkgs, pkgs,
... ...
}: }:
let let
cfg = config.my.stylix;
theme = import ../../../modules/stylix/theme.nix { inherit pkgs; }; theme = import ../../../modules/stylix/theme.nix { inherit pkgs; };
in in
{ {
imports = [ inputs.stylix.homeModules.stylix ]; options.my.stylix.enable = lib.mkEnableOption "stylix";
config = lib.mkIf cfg.enable {
stylix = { stylix = {
enable = true; enable = true;
inherit (theme) inherit (theme)
@@ -27,4 +29,5 @@ in
}; };
targets = import ../../../modules/stylix/targets.nix; targets = import ../../../modules/stylix/targets.nix;
}; };
};
} }

View File

@@ -10,9 +10,14 @@
}: }:
let let
cfg = config.taskwarrior;
sops = myUtils.sopsAvailability config osConfig; sops = myUtils.sopsAvailability config osConfig;
standalone = osConfig == null; standalone = osConfig == null;
in in
{
options.taskwarrior.enable = lib.mkEnableOption "taskwarrior";
config = lib.mkIf cfg.enable (
lib.optionalAttrs standalone { lib.optionalAttrs standalone {
sops = { sops = {
secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null { secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null {
@@ -33,9 +38,8 @@ lib.optionalAttrs standalone {
}; };
} }
// { // {
warnings = warnings =
lib.optional (!sops.available && config.programs.taskwarrior.enable) lib.optional (!sops.available)
"taskwarrior is enabled, but sops templates are not available. taskwarrior sync will not be configured."; "taskwarrior is enabled, but sops templates are not available. taskwarrior sync will not be configured.";
home.packages = with pkgs; [ home.packages = with pkgs; [
@@ -70,10 +74,12 @@ lib.optionalAttrs standalone {
colorTheme = "dark-256"; colorTheme = "dark-256";
config = { config = {
recurrence = "off"; recurrence = "off";
reserved.lines = 3; # without this I would have to scroll up 3 lines reserved.lines = 3;
}; };
extraConfig = lib.optionalString sops.available '' extraConfig = lib.optionalString sops.available ''
include ${sops.templates."taskrc.d/sync".path} include ${sops.templates."taskrc.d/sync".path}
''; '';
}; };
} }
);
}

View File

@@ -1,12 +1,18 @@
{ {
pkgs,
config, config,
lib,
pkgs,
dotsPath, dotsPath,
... ...
}: }:
let
cfg = config.terminal;
in
{ {
config = { options.terminal.enable = lib.mkEnableOption "terminal";
config = lib.mkIf cfg.enable {
programs.bash.shellAliases = { programs.bash.shellAliases = {
icat = "kitty +kitten icat"; icat = "kitty +kitten icat";
}; };

View File

@@ -1,7 +1,21 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
let
cfg = config.ticketing;
in
{
options.ticketing = {
enable = lib.mkEnableOption "ticketing";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
jira-cli-go jira-cli-go
]; ];
};
} }

View File

@@ -1,7 +1,18 @@
{ pkgs, dotsPath, ... }:
{ {
config = { config,
lib,
pkgs,
dotsPath,
...
}:
let
cfg = config.tmux;
in
{
options.tmux.enable = lib.mkEnableOption "tmux";
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
tmuxp tmuxp
reptyr reptyr

View File

@@ -10,7 +10,7 @@ let
in in
{ {
options.torrenting = { options.torrenting = {
enable = lib.mkEnableOption "transmission torrent client"; enable = lib.mkEnableOption "torrenting";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {

View File

@@ -1,7 +1,19 @@
{ config, pkgs, ... }:
{ {
config = { config,
lib,
pkgs,
...
}:
let
cfg = config.vscode;
in
{
options.vscode = {
enable = lib.mkEnableOption "Visual Studio Code";
};
config = lib.mkIf cfg.enable {
home.packages = [ (config.nixgl.wrap (config.wrapApp pkgs.vscode "--no-sandbox")) ]; home.packages = [ (config.nixgl.wrap (config.wrapApp pkgs.vscode "--no-sandbox")) ];
}; };
} }

View File

@@ -1,11 +1,24 @@
{
config,
lib,
...
}:
let
cfg = config.waybar;
in
{ {
imports = [ imports = [
./settings.nix ./settings.nix
./style.nix ./style.nix
]; ];
options.waybar.enable = lib.mkEnableOption "waybar";
config = lib.mkIf cfg.enable {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
}; };
};
} }

View File

@@ -17,51 +17,57 @@ in
inputs.nixos-hardware.nixosModules.common-cpu-intel inputs.nixos-hardware.nixosModules.common-cpu-intel
inputs.nixos-hardware.nixosModules.common-pc inputs.nixos-hardware.nixosModules.common-pc
inputs.nixos-hardware.nixosModules.common-pc-ssd inputs.nixos-hardware.nixosModules.common-pc-ssd
../../modules/common ../../modules
../../modules/boot/bootloader.nix
(import ../../modules/disko/zfs-encrypted-root.nix { (import ../../modules/disko/zfs-encrypted-root.nix {
inherit lib config; inherit lib config;
device = "/dev/nvme1n1"; device = "/dev/nvme1n1";
}) })
../../modules/ai-tools
../../modules/anki
../../modules/audio
../../modules/backups
../../modules/bluetooth
../../modules/desktops/niri
../../modules/docker
../../modules/firewall
../../modules/fonts
../../modules/gaming
../../modules/git
../../modules/hcloud
../../modules/keyboard
../../modules/localization
../../modules/networking
../../modules/nvidia
../../modules/secrets
../../modules/ssh
../../modules/storage
../../modules/stylix
../../modules/syncthing
../../modules/tailscale
../../modules/taskwarrior
../../modules/users
../../modules/wol
../../modules/yubikey
]; ];
home-manager.users.${config.host.username} = import ../../home/hosts/${config.host.name}; home-manager.users.${config.host.username} = import ../../home/hosts/${config.host.name};
secrets.nixSigningKey.enable = true; "ai-tools".enable = true;
anki.enable = true;
restic-backup.enable = true; audio.enable = true;
tailscale.enable = true; bluetooth.enable = true;
bootloader.enable = true;
desktop.niri.enable = true;
firewall = {
enable = true;
allowedTCPPorts = [ 22 ];
};
gaming.enable = true;
git.enable = true;
keyboard.enable = true;
localization.enable = true;
my = {
fonts.enable = true;
stylix.enable = true;
users.enable = true;
yubikey = {
enable = true;
pam.enable = false;
};
};
desktop.ly.enable = true; desktop.ly.enable = true;
docker.enable = true; docker.enable = true;
hcloud.enable = true; hcloud.enable = true;
networking.enable = true;
nvidia.enable = true;
restic-backup.enable = true;
secrets = {
enable = true;
nixSigningKey.enable = true;
};
ssh.enable = true;
storage.enable = true;
syncthing.enable = true;
tailscale.enable = true;
taskwarrior.enable = true;
wol = {
enable = true;
interfaces.eno1 = { inherit (wolInterfaces.eno1) macAddress; };
};
disko.devices = { disko.devices = {
disk.data = { disk.data = {
@@ -91,25 +97,10 @@ in
inputs.colmena.packages.${pkgs.stdenv.hostPlatform.system}.colmena inputs.colmena.packages.${pkgs.stdenv.hostPlatform.system}.colmena
]; ];
my.yubikey = {
enable = true;
pam.enable = false;
};
services.locate = { services.locate = {
enable = true; enable = true;
package = pkgs.plocate; package = pkgs.plocate;
}; };
networking.hostId = "80eef97e"; networking.hostId = "80eef97e";
wol = {
enable = true;
interfaces.eno1 = { inherit (wolInterfaces.eno1) macAddress; };
};
firewall = {
enable = true;
allowedTCPPorts = [ 22 ];
};
} }

View File

@@ -5,9 +5,7 @@
pkgs, pkgs,
... ...
}: }:
let
wolInterfaces = import ../andromache/wol-interfaces.nix;
in
{ {
imports = [ imports = [
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
@@ -16,47 +14,50 @@ in
inputs.nixos-hardware.nixosModules.common-pc inputs.nixos-hardware.nixosModules.common-pc
inputs.nixos-hardware.nixosModules.common-pc-ssd inputs.nixos-hardware.nixosModules.common-pc-ssd
# inputs.nixos-hardware.nixosModules.lenovo-thinkpad-e14-intel-gen7 (not available yet?) # inputs.nixos-hardware.nixosModules.lenovo-thinkpad-e14-intel-gen7 (not available yet?)
inputs.sops-nix.nixosModules.sops ../../modules
../../modules/common
../../modules/boot/bootloader.nix
(import ../../modules/disko/zfs-encrypted-root.nix { (import ../../modules/disko/zfs-encrypted-root.nix {
inherit lib config; inherit lib config;
device = "/dev/nvme0n1"; device = "/dev/nvme0n1";
}) })
../../modules/ai-tools
../../modules/anki
../../modules/audio
../../modules/backups
../../modules/bluetooth
../../modules/desktops/niri
../../modules/docker
../../modules/firewall
../../modules/fonts
../../modules/git
../../modules/keyboard
../../modules/localization
../../modules/networking
../../modules/nfc
../../modules/secrets
../../modules/ssh
../../modules/storage
../../modules/stylix
../../modules/tailscale
../../modules/taskwarrior
../../modules/users
../../modules/yubikey
]; ];
home-manager.users.${config.host.username} = import ../../home/hosts/${config.host.name}; home-manager.users.${config.host.username} = import ../../home/hosts/${config.host.name};
secrets.nixSigningKey.enable = true; "ai-tools".enable = true;
anki.enable = true;
audio.enable = true;
bluetooth.enable = true;
bootloader.enable = true;
desktop.niri.enable = true;
git.enable = true;
keyboard.enable = true;
localization.enable = true;
my = {
fonts.enable = true;
stylix.enable = true;
users.enable = true;
yubikey = {
enable = true;
pam.enable = false;
};
};
networking.enable = true;
secrets.enable = true;
ssh.enable = true;
storage.enable = true;
taskwarrior.enable = true;
secrets.nixSigningKey.enable = true;
restic-backup.enable = true; restic-backup.enable = true;
tailscale.enable = true; tailscale.enable = true;
desktop.ly.enable = true;
docker.enable = true; docker.enable = true;
nfc.enable = true; nfc.enable = true;
desktop.ly.enable = true;
audio.automation.enable = true; firewall = {
enable = true;
allowedTCPPorts = [ 22 ];
};
hardware = { hardware = {
cpu.intel.updateMicrocode = true; cpu.intel.updateMicrocode = true;
@@ -66,6 +67,7 @@ in
extraPackages = with pkgs; [ extraPackages = with pkgs; [
intel-media-driver intel-media-driver
vpl-gpu-rt vpl-gpu-rt
intel-compute-runtime
]; ];
}; };
}; };
@@ -81,7 +83,7 @@ in
name = "wol-andromache"; name = "wol-andromache";
runtimeInputs = [ pkgs.wakeonlan ]; runtimeInputs = [ pkgs.wakeonlan ];
text = '' text = ''
wakeonlan ${wolInterfaces.eno1.macAddress} wakeonlan ${(import ../andromache/wol-interfaces.nix).eno1.macAddress}
''; '';
}) })
]; ];
@@ -90,18 +92,8 @@ in
hostId = "80eef97e"; hostId = "80eef97e";
}; };
firewall = {
enable = true;
allowedTCPPorts = [ 22 ];
};
boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
my.yubikey = {
enable = true;
pam.enable = false;
};
services = { services = {
fwupd.enable = true; fwupd.enable = true;
locate = { locate = {

View File

@@ -7,10 +7,11 @@
imports = [ imports = [
./hard.nix ./hard.nix
./host.nix ./host.nix
../../modules/common ../../modules
../../modules/ssh
]; ];
ssh.enable = true;
boot = { boot = {
kernelParams = [ kernelParams = [
"console=ttyS1,115200n8" "console=ttyS1,115200n8"

View File

@@ -7,12 +7,10 @@
imports = [ imports = [
./hard.nix ./hard.nix
./host.nix ./host.nix
../../modules/common ../../modules
../../modules/ssh
../../modules/tailscale
# ../../modules/uptime-kuma
]; ];
ssh.enable = true;
tailscale.enable = true; tailscale.enable = true;
boot.loader = { boot.loader = {

View File

@@ -12,14 +12,14 @@
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
./hard.nix ./hard.nix
./host.nix ./host.nix
../../modules/common ../../modules
../../modules/ssh
../../modules/docker
]; ];
networking.hostName = config.host.name; ssh.enable = true;
docker.enable = true; docker.enable = true;
networking.hostName = config.host.name;
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-label/nixos"; device = "/dev/disk/by-label/nixos";
fsType = "ext4"; fsType = "ext4";

View File

@@ -9,27 +9,30 @@
./hard.nix ./hard.nix
./host.nix ./host.nix
./disk.nix ./disk.nix
../../modules/common ../../modules
../../modules/anki
../../modules/audio
../../modules/boot/bootloader.nix
../../modules/fonts
../../modules/git
../../modules/keyboard
../../modules/localization
../../modules/networking
../../modules/ai-tools
../../modules/ssh
../../modules/storage
../../modules/stylix
../../modules/secrets
../../modules/taskwarrior
../../modules/users
../../modules/x
]; ];
home-manager.users.${config.host.username} = import ../../home/hosts/vm; home-manager.users.${config.host.username} = import ../../home/hosts/vm;
"ai-tools".enable = true;
anki.enable = true;
audio.enable = true;
bootloader.enable = true;
desktop.x.enable = true;
git.enable = true;
keyboard.enable = true;
localization.enable = true;
my = {
fonts.enable = true;
stylix.enable = true;
users.enable = true;
};
networking.enable = true;
secrets.enable = true;
ssh.enable = true;
storage.enable = true;
taskwarrior.enable = true;
disko = { disko = {
devices.disk.main = { devices.disk.main = {
device = "/dev/vda"; device = "/dev/vda";

View File

@@ -37,5 +37,6 @@ in
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
boot.zfs.forceImportRoot = false;
system.stateVersion = "26.05"; system.stateVersion = "26.05";
} }

View File

@@ -21,13 +21,11 @@ in
name = "raspberry-pi"; name = "raspberry-pi";
}; };
boot.kernelParams = [ boot = {
"console=ttyS1,115200n8" kernelParams = [ "console=ttyS1,115200n8" ];
]; kernelModules = [ "bcm2835-v4l2" ];
zfs.forceImportRoot = false;
boot.kernelModules = [ };
"bcm2835-v4l2"
];
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;

View File

@@ -1,11 +1,14 @@
{ config, ... }: { lib, config, ... }:
let let
cfg = config."ai-tools";
inherit (config.host) username; inherit (config.host) username;
inherit (config.secrets) owner; inherit (config.secrets) owner;
in in
{ {
config = { options."ai-tools".enable = lib.mkEnableOption "AI tools";
config = lib.mkIf cfg.enable {
nixpkgs.allowedUnfree = [ "claude-code" ]; nixpkgs.allowedUnfree = [ "claude-code" ];
secrets.groups.opencode = [ "api-key" ]; secrets.groups.opencode = [ "api-key" ];

View File

@@ -1,6 +1,15 @@
{ lib, config, ... }:
let
cfg = config.anki;
in
{ {
config.secrets.groups.anki = [ options.anki.enable = lib.mkEnableOption "anki";
config = lib.mkIf cfg.enable {
secrets.groups.anki = [
"sync-user" "sync-user"
"sync-key" "sync-key"
]; ];
};
} }

View File

@@ -1,17 +1,21 @@
{ ... }: { lib, config, ... }:
let
cfg = config.audio;
in
{ {
imports = [ imports = [ ./audio-automation.nix ];
./audio-automation.nix
];
config = { options.audio.enable = lib.mkEnableOption "audio";
config = lib.mkIf cfg.enable {
nixpkgs.allowedUnfree = [ nixpkgs.allowedUnfree = [
"spotify" "spotify"
"spotify-unwrapped" "spotify-unwrapped"
]; ];
security.rtkit.enable = true; security.rtkit.enable = true;
services = { services = {
pulseaudio.enable = false; pulseaudio.enable = false;
pipewire = { pipewire = {

View File

@@ -1,4 +1,12 @@
{ lib, config, ... }:
let
cfg = config.bluetooth;
in
{ {
options.bluetooth.enable = lib.mkEnableOption "bluetooth";
config = lib.mkIf cfg.enable {
hardware.bluetooth = { hardware.bluetooth = {
enable = true; enable = true;
powerOnBoot = true; powerOnBoot = true;
@@ -12,4 +20,5 @@
}; };
}; };
}; };
};
} }

18
modules/boot/default.nix Normal file
View File

@@ -0,0 +1,18 @@
{ lib, config, ... }:
let
cfg = config.bootloader;
in
{
options.bootloader.enable = lib.mkEnableOption "system bootloader";
config = lib.mkIf cfg.enable {
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
tmp.useTmpfs = config.host.highRam;
};
};
}

View File

@@ -23,6 +23,7 @@ in
config = { config = {
system.stateVersion = lib.mkDefault "25.05"; system.stateVersion = lib.mkDefault "25.05";
boot.zfs.forceImportRoot = lib.mkDefault false;
nix = { nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md
@@ -61,6 +62,10 @@ in
pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowedUnfree; pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowedUnfree;
environment.defaultPackages = lib.mkForce [ ]; environment.defaultPackages = lib.mkForce [ ];
environment.pathsToLink = [
"/share/applications"
"/share/xdg-desktop-portal"
];
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;

10
modules/default.nix Normal file
View File

@@ -0,0 +1,10 @@
{ lib, ... }:
{
imports =
let
dirs = lib.attrNames (lib.filterAttrs (_: v: v == "directory") (builtins.readDir ./.));
hasDef = name: builtins.pathExists ./${name}/default.nix;
in
map (name: ./${name}) (builtins.filter hasDef dirs);
}

View File

@@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./gnome
./niri
];
}

View File

@@ -1,9 +1,13 @@
{ lib, config, ... }:
{ {
options.desktop.gnome.enable = lib.mkEnableOption "GNOME desktop";
config = lib.mkIf config.desktop.gnome.enable {
services.xserver = { services.xserver = {
displayManager.gdm.enable = true; displayManager.gdm.enable = true;
displayManager.gdm.wayland = true; displayManager.gdm.wayland = true;
desktopManager.gnome.enable = true; desktopManager.gnome.enable = true;
}; };
};
# TODO: Declare monitors.xml
} }

View File

@@ -1,7 +1,13 @@
{ lib, config, ... }:
{ {
options.desktop.logind.enable = lib.mkEnableOption "logind desktop settings";
config = lib.mkIf config.desktop.logind.enable {
services.logind.settings.Login = { services.logind.settings.Login = {
HandleLidSwitch = "suspend"; HandleLidSwitch = "suspend";
IdleAction = "suspend"; IdleAction = "suspend";
IdleActionSec = 1800; IdleActionSec = 1800;
}; };
};
} }

View File

@@ -12,6 +12,9 @@ in
imports = [ ../logind.nix ]; imports = [ ../logind.nix ];
options.desktop = { options.desktop = {
niri = {
enable = lib.mkEnableOption "niri desktop";
};
ly = { ly = {
enable = lib.mkOption { enable = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
@@ -20,7 +23,8 @@ in
}; };
}; };
config = { config = lib.mkIf cfg.niri.enable {
desktop.logind.enable = lib.mkDefault true;
programs.niri = { programs.niri = {
enable = true; enable = true;
useNautilus = false; useNautilus = false;
@@ -44,15 +48,6 @@ in
]; ];
}; };
# error:
# Failed assertions:
# - h profile: xdg.portal: since you installed Home Manager via its NixOS module and
# 'home-manager.useUserPackages' is enabled, you need to add
#
# environment.pathsToLink = [ `/share/applications` `/share/xdg-desktop-portal` ];
#
# to your NixOS configuration so that the portal definitions and DE
# provided configurations get linked.
environment.pathsToLink = [ environment.pathsToLink = [
"/share/applications" "/share/applications"
"/share/xdg-desktop-portal" "/share/xdg-desktop-portal"

View File

@@ -1,12 +1,20 @@
{ pkgs, ... }:
{ {
imports = [ lib,
./iosevka.nix config,
]; pkgs,
...
}:
let
cfg = config.my.fonts;
in
{
imports = [ ./iosevka.nix ];
options.my.fonts.enable = lib.mkEnableOption "fonts";
config = lib.mkIf cfg.enable {
fonts = { fonts = {
# disable default font packages (see https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/fonts/packages.nix)
enableDefaultPackages = false; enableDefaultPackages = false;
packages = with pkgs; [ packages = with pkgs; [
dejavu_fonts dejavu_fonts
@@ -14,4 +22,5 @@
noto-fonts-color-emoji noto-fonts-color-emoji
]; ];
}; };
};
} }

View File

@@ -1,6 +1,12 @@
{ pkgs, ... }: {
lib,
config,
pkgs,
...
}:
{ {
config = lib.mkIf config.my.fonts.enable {
fonts = { fonts = {
packages = with pkgs; [ packages = with pkgs; [
(iosevka-bin.override { variant = "SGr-IosevkaTermSS08"; }) (iosevka-bin.override { variant = "SGr-IosevkaTermSS08"; })
@@ -11,4 +17,5 @@
}; };
}; };
}; };
};
} }

View File

@@ -1,11 +1,17 @@
{ {
config,
lib, lib,
config,
pkgs, pkgs,
... ...
}: }:
let
cfg = config.gaming;
in
{ {
options.gaming.enable = lib.mkEnableOption "gaming";
config = lib.mkIf cfg.enable {
nixpkgs.allowedUnfree = [ nixpkgs.allowedUnfree = [
"steam" "steam"
"steam-unwrapped" "steam-unwrapped"
@@ -29,7 +35,6 @@
programs.gamemode.enable = true; programs.gamemode.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# lutris
mangohud mangohud
]; ];
@@ -47,4 +52,5 @@
value = "524288"; value = "524288";
} }
]; ];
};
} }

View File

@@ -1,14 +1,15 @@
{ { lib, config, ... }:
config,
...
}:
let let
cfg = config.git;
inherit (config.host) username; inherit (config.host) username;
owner = config.users.users.${username}.name; owner = config.users.users.${username}.name;
in in
{ {
config.sops.templates = { options.git.enable = lib.mkEnableOption "git";
config = lib.mkIf cfg.enable {
sops.templates = {
".gitconfig.email" = { ".gitconfig.email" = {
inherit owner; inherit owner;
path = "/home/${username}/.gitconfig.email"; path = "/home/${username}/.gitconfig.email";
@@ -26,4 +27,5 @@ in
''; '';
}; };
}; };
};
} }

View File

@@ -1,27 +1,26 @@
{ pkgs, ... }:
{ {
# TODO: see if this works with podman lib,
# TODO: check if docker/podman is enabled config,
pkgs,
...
}:
# Rootless K3S let
cfg = config.k3s;
in
{
options.k3s.enable = lib.mkEnableOption "k3s rootless";
# FIXME config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
k3s k3s
rootlesskit rootlesskit
slirp4netns slirp4netns
]; ];
# running K3S on rootless docker was causing the following error: "failed to find cpuset cgroup (v2)" (in `docker logs k3d-lab-server-0` output)
#
# see <https://docs.k3s.io/advanced#known-issues-with-rootless-mode>
# see <https://rootlesscontaine.rs/getting-started/common/cgroup2/>
# see <https://discourse.nixos.org/t/declarative-rootless-k3s/49839>
systemd.services."user@".serviceConfig.Delegate = "cpu cpuset io memory pids"; systemd.services."user@".serviceConfig.Delegate = "cpu cpuset io memory pids";
# taken from <https://github.com/k3s-io/k3s/blob/main/k3s-rootless.service> as described in <https://docs.k3s.io/advanced#known-issues-with-rootless-mode#Rootless> systemd.user.services."k3s-rootless" = {
systemd.user.services."k3s-rootless" = with pkgs; {
path = with pkgs; [ path = with pkgs; [
"${rootlesskit}" "${rootlesskit}"
"${slirp4netns}" "${slirp4netns}"
@@ -29,32 +28,10 @@
"${fuse3}" "${fuse3}"
"/run/wrappers" "/run/wrappers"
]; ];
# systemd unit file for k3s (rootless)
#
# Usage:
# - [Optional] Enable cgroup v2 delegation, see https://rootlesscontaine.rs/getting-started/common/cgroup2/ .
# This step is optional, but highly recommended for enabling CPU and memory resource limtitation.
#
# - Copy this file as `~/.config/systemd/user/k3s-rootless.service`.
# Installing this file as a system-wide service (`/etc/systemd/...`) is not supported.
# Depending on the path of `k3s` binary, you might need to modify the `ExecStart=/usr/local/bin/k3s ...` line of this file.
#
# - Run `systemctl --user daemon-reload`
#
# - Run `systemctl --user enable --now k3s-rootless`
#
# - Run `KUBECONFIG=~/.kube/k3s.yaml kubectl get pods -A`, and make sure the pods are running.
#
# Troubleshooting:
# - See `systemctl --user status k3s-rootless` to check the daemon status
# - See `journalctl --user -f -u k3s-rootless` to see the daemon log
# - See also https://rootlesscontaine.rs/
enable = true; enable = true;
description = "k3s (Rootless)"; description = "k3s (Rootless)";
serviceConfig = { serviceConfig = {
# NOTE: Don't try to run `k3s server --rootless` on a terminal, as it doesn't enable cgroup v2 delegation. ExecStart = "${pkgs.k3s}/bin/k3s server --rootless --snapshotter=fuse-overlayfs";
# If you really need to try it on a terminal, prepend `systemd-run --user -p Delegate=yes --tty` to create a systemd scope.
ExecStart = "${k3s}/bin/k3s server --rootless --snapshotter=fuse-overlayfs";
ExecReload = "/run/current-system/sw/bin/kill -s HUP $MAINPID"; ExecReload = "/run/current-system/sw/bin/kill -s HUP $MAINPID";
TimeoutSec = 0; TimeoutSec = 0;
RestartSec = 2; RestartSec = 2;
@@ -69,11 +46,11 @@
Type = "simple"; Type = "simple";
KillMode = "mixed"; KillMode = "mixed";
}; };
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
}; };
boot.kernel.sysctl = { boot.kernel.sysctl = {
"net.ipv4.ip_forward" = 1; "net.ipv4.ip_forward" = 1;
}; };
};
} }

View File

@@ -1,11 +1,19 @@
{ pkgs, ... }: {
lib,
config,
pkgs,
...
}:
with pkgs;
let let
tools = interception-tools; cfg = config.keyboard;
inherit (interception-tools-plugins) caps2esc; tools = pkgs.interception-tools;
inherit (pkgs.interception-tools-plugins) caps2esc;
in in
{ {
options.keyboard.enable = lib.mkEnableOption "keyboard remapping";
config = lib.mkIf cfg.enable {
services.interception-tools = { services.interception-tools = {
enable = true; enable = true;
plugins = [ caps2esc ]; plugins = [ caps2esc ];
@@ -16,4 +24,5 @@ in
EV_KEY: [KEY_CAPSLOCK] EV_KEY: [KEY_CAPSLOCK]
''; '';
}; };
};
} }

View File

@@ -1,6 +1,13 @@
{ config, ... }: { lib, config, ... }:
let
cfg = config.localization;
in
{ {
options.localization.enable = lib.mkEnableOption "localization";
config = lib.mkIf cfg.enable {
time.timeZone = config.host.timezone; time.timeZone = config.host.timezone;
i18n.defaultLocale = config.host.locale; i18n.defaultLocale = config.host.locale;
};
} }

View File

@@ -1,6 +1,9 @@
{ config, ... }: { lib, config, ... }:
{ {
options.networking.enable = lib.mkEnableOption "network configuration";
config = lib.mkIf config.networking.enable {
networking = { networking = {
hostName = config.host.name; hostName = config.host.name;
wireless.iwd.enable = true; wireless.iwd.enable = true;
@@ -8,4 +11,5 @@
nftables.enable = true; nftables.enable = true;
firewall.enable = true; firewall.enable = true;
}; };
};
} }

View File

@@ -6,7 +6,7 @@ let
in in
{ {
options.nfc = { options.nfc = {
enable = lib.mkEnableOption "NFC device access"; enable = lib.mkEnableOption "NFC";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
users.users.${username}.extraGroups = [ "dialout" ]; users.users.${username}.extraGroups = [ "dialout" ];

View File

@@ -1,6 +1,9 @@
{ config, ... }: { lib, config, ... }:
{ {
options.nvidia.enable = lib.mkEnableOption "NVIDIA graphics";
config = lib.mkIf config.nvidia.enable {
nixpkgs.allowedUnfree = [ nixpkgs.allowedUnfree = [
"nvidia-x11" "nvidia-x11"
"nvidia-persistenced" "nvidia-persistenced"
@@ -19,4 +22,5 @@
}; };
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = [ "nvidia" ];
};
} }

View File

@@ -1,15 +1,9 @@
{ { lib, config, ... }:
# services.avahi = {
# enable = true;
# nssmdns4 = true;
# openFirewall = true;
# };
services.printing = { {
enable = true; options.printing.enable = lib.mkEnableOption "printing";
# drivers = with pkgs; [
# cups-filters config = lib.mkIf config.printing.enable {
# cups-browsed services.printing.enable = true;
# ];
}; };
} }

View File

@@ -18,6 +18,8 @@ in
options = { options = {
secrets = { secrets = {
enable = lib.mkEnableOption "secrets management";
sopsDir = lib.mkOption { sopsDir = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "${toString inputs.nix-secrets}/secrets"; default = "${toString inputs.nix-secrets}/secrets";
@@ -42,7 +44,7 @@ in
}; };
}; };
config = { config = lib.mkIf cfg.enable {
secrets = { secrets = {
inherit owner; inherit owner;
groups = { groups = {
@@ -55,10 +57,6 @@ in
}; };
sops = { sops = {
# for yubikey, generate as follows:
# ```
# age-plugin-yubikey --identity > <keyfile-path>
# ```
age.keyFile = "/home/${username}/.config/sops/age/keys.txt"; age.keyFile = "/home/${username}/.config/sops/age/keys.txt";
secrets = myUtils.mkSopsSecrets sopsDir owner cfg.groups; secrets = myUtils.mkSopsSecrets sopsDir owner cfg.groups;
}; };
@@ -68,7 +66,7 @@ in
]; ];
services = { services = {
pcscd.enable = true; # needed for age-plugin-yubikey? pcscd.enable = true;
udev.packages = lib.mkIf cfg.yubikey.enable [ udev.packages = lib.mkIf cfg.yubikey.enable [
pkgs.yubikey-personalization pkgs.yubikey-personalization
pkgs.libfido2 pkgs.libfido2

View File

@@ -16,8 +16,8 @@ in
}; };
}; };
# auto generate authorized_keys from `authorizedHosts` config = lib.mkIf config.ssh.enable {
config.users.users.${username}.openssh.authorizedKeys.keys = users.users.${username}.openssh.authorizedKeys.keys =
lib.flatten ( lib.flatten (
map ( map (
hostname: hostname:
@@ -28,4 +28,5 @@ in
) ((builtins.filter (h: h != config.host.name) adminHosts) ++ config.ssh.authorizedHosts) ) ((builtins.filter (h: h != config.host.name) adminHosts) ++ config.ssh.authorizedHosts)
) )
++ lib.splitString "\n" (builtins.readFile ./ssh_bak.pub); ++ lib.splitString "\n" (builtins.readFile ./ssh_bak.pub);
};
} }

View File

@@ -1,10 +1,17 @@
{ lib, ... }: { lib, config, ... }:
let
cfg = config.ssh;
in
{ {
imports = [ ./hardened-openssh.nix ]; imports = [ ./hardened-openssh.nix ];
config.services.openssh = { options.ssh.enable = lib.mkEnableOption "SSH server";
config = lib.mkIf cfg.enable {
services.openssh = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
harden = lib.mkDefault true; harden = lib.mkDefault true;
}; };
};
} }

View File

@@ -1,9 +1,10 @@
{ lib, config, ... }: { lib, config, ... }:
let let
inherit (config.host) username; inherit (config.host) username;
in in
{ {
# auto extract SSH keys config = lib.mkIf config.ssh.enable {
system.activationScripts.extractSshKeys = lib.stringAfter [ "etc" ] '' system.activationScripts.extractSshKeys = lib.stringAfter [ "etc" ] ''
HOST_KEY="/etc/ssh/ssh_host_ed25519_key.pub" HOST_KEY="/etc/ssh/ssh_host_ed25519_key.pub"
HOST_DIR="/home/${username}/nix/hosts/${config.networking.hostName}" HOST_DIR="/home/${username}/nix/hosts/${config.networking.hostName}"
@@ -29,4 +30,5 @@ in
chmod 644 "$HOST_DIR/ssh_user.pub" chmod 644 "$HOST_DIR/ssh_user.pub"
fi fi
''; '';
};
} }

View File

@@ -1,5 +1,7 @@
{ lib, config, ... }: { lib, config, ... }:
with lib; with lib;
let let
cfg = config.services.openssh; cfg = config.services.openssh;
in in
@@ -13,7 +15,7 @@ in
options.services.openssh.harden = mkEnableOption "harden ssh server configuration"; options.services.openssh.harden = mkEnableOption "harden ssh server configuration";
config = { config = {
networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedTCPPorts = lib.mkIf config.ssh.enable [ 22 ];
services.openssh.settings = optionalAttrs cfg.harden { services.openssh.settings = optionalAttrs cfg.harden {
PermitRootLogin = "no"; PermitRootLogin = "no";

View File

@@ -4,6 +4,7 @@
outputs, outputs,
... ...
}: }:
let let
hosts = lib.attrNames outputs.nixosConfigurations; hosts = lib.attrNames outputs.nixosConfigurations;
hostsWithKeys = lib.filter ( hostsWithKeys = lib.filter (
@@ -11,9 +12,10 @@ let
) hosts; ) hosts;
in in
{ {
# auto generate known_hosts for all hosts in flake config = lib.mkIf config.ssh.enable {
programs.ssh.knownHosts = lib.genAttrs hostsWithKeys (hostname: { programs.ssh.knownHosts = lib.genAttrs hostsWithKeys (hostname: {
publicKeyFile = ../../hosts/${hostname}/ssh_host.pub; publicKeyFile = ../../hosts/${hostname}/ssh_host.pub;
extraHostNames = lib.optional (hostname == config.networking.hostName) "localhost"; extraHostNames = lib.optional (hostname == config.networking.hostName) "localhost";
}); });
};
} }

View File

@@ -1,4 +1,10 @@
{ lib, config, ... }:
{ {
options.storage.enable = lib.mkEnableOption "storage";
config = lib.mkIf config.storage.enable {
services.udisks2.enable = true; services.udisks2.enable = true;
boot.zfs.forceImportRoot = false; boot.zfs.forceImportRoot = false;
};
} }

View File

@@ -1,16 +1,21 @@
{ {
config, config,
inputs, inputs,
lib,
pkgs, pkgs,
... ...
}: }:
let let
cfg = config.my.stylix;
theme = import ./theme.nix { inherit pkgs; }; theme = import ./theme.nix { inherit pkgs; };
in in
{ {
imports = [ inputs.stylix.nixosModules.stylix ]; imports = [ inputs.stylix.nixosModules.stylix ];
options.my.stylix.enable = lib.mkEnableOption "stylix theming";
config = lib.mkIf cfg.enable {
stylix = { stylix = {
enable = true; enable = true;
inherit (theme) inherit (theme)
@@ -33,4 +38,5 @@ in
stylix.targets = import ./targets.nix; stylix.targets = import ./targets.nix;
} }
]; ];
};
} }

View File

@@ -1,16 +1,13 @@
{ { lib, config, ... }:
lib,
config,
...
}:
with lib;
let let
cfg = config.syncthing;
inherit (config.host) username; inherit (config.host) username;
in in
{ {
config = { options.syncthing.enable = lib.mkEnableOption "syncthing";
config = lib.mkIf cfg.enable {
users.groups.${username} = { }; users.groups.${username} = { };
users.users.${username}.extraGroups = [ username ]; users.users.${username}.extraGroups = [ username ];

View File

@@ -1,10 +1,13 @@
{ config, ... }: { lib, config, ... }:
let let
cfg = config.taskwarrior;
inherit (config.secrets) owner; inherit (config.secrets) owner;
in in
{ {
config = { options.taskwarrior.enable = lib.mkEnableOption "taskwarrior";
config = lib.mkIf cfg.enable {
secrets.groups.taskwarrior = [ secrets.groups.taskwarrior = [
"sync-server-url" "sync-server-url"
"sync-server-client-id" "sync-server-client-id"

View File

@@ -1,9 +1,14 @@
{ {
lib,
config,
pkgs, pkgs,
... ...
}: }:
{ {
options."uptime-kuma".enable = lib.mkEnableOption "uptime-kuma";
config = lib.mkIf config."uptime-kuma".enable {
virtualisation.oci-containers = { virtualisation.oci-containers = {
backend = "docker"; backend = "docker";
containers.uptime-kuma = { containers.uptime-kuma = {
@@ -27,4 +32,5 @@
}; };
environment.systemPackages = with pkgs; [ docker-compose ]; environment.systemPackages = with pkgs; [ docker-compose ];
};
} }

View File

@@ -1,10 +1,18 @@
{ config, ... }: { lib, config, ... }:
{ {
options.my.users.enable = lib.mkEnableOption "user account";
config = lib.mkIf config.my.users.enable {
users.users.${config.host.username} = { users.users.${config.host.username} = {
isNormalUser = true; isNormalUser = true;
description = config.host.username; description = config.host.username;
extraGroups = [ "wheel" ]; extraGroups = [
"wheel"
"render"
"video"
];
initialPassword = "h"; initialPassword = "h";
}; };
};
} }

View File

@@ -1,4 +1,9 @@
{ lib, config, ... }:
{ {
options.desktop.x.enable = lib.mkEnableOption "xmonad desktop";
config = lib.mkIf config.desktop.x.enable {
services.xserver.windowManager.xmonad = { services.xserver.windowManager.xmonad = {
enable = true; enable = true;
enableContribAndExtras = true; enableContribAndExtras = true;
@@ -10,4 +15,5 @@
xkb.layout = "us"; xkb.layout = "us";
xkb.variant = ""; xkb.variant = "";
}; };
};
} }