modularize config

This commit is contained in:
willifan 2024-12-15 13:01:45 +01:00
parent 48f0c3b3ec
commit 65ff3fcd11
25 changed files with 88 additions and 14 deletions

View file

@ -0,0 +1,11 @@
{ ... }:
{
system.autoUpgrade = {
enable = true;
dates = "04:00";
flake = "git+ssh://gitea@git.huwe.mooo.com/willifan/nix-config";
persistent = true;
randomizedDelaySec = "5min";
fixedRandomDelay = true;
};
}

View file

@ -0,0 +1,20 @@
{ hostname, ... }:
{
imports = [
./autoupdate.nix
./garbage-collect.nix
./keyd.nix
./mimetype.nix
./optimise.nix
./sops.nix
];
networking = {
networkmanager.enable = true;
hostName = "${hostname}";
};
console.keyMap = "de";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nixpkgs.config.allowUnfree = true;
system.stateVersion = "23.11";
}

View file

@ -0,0 +1,9 @@
{ ... }:
{
nix.gc = {
automatic = true;
dates = "04:30";
persistent = true;
options = "--delete-older-than 30d";
};
}

23
modules/common/keyd.nix Normal file
View file

@ -0,0 +1,23 @@
{ ... }:
{
services.keyd = {
enable = true;
keyboards.default = {
ids = [ "*" ];
settings = {
main = {
rightalt = "overload(altgr, rightalt)";
capslock = "overload(control, esc)";
};
altgr = {
a = ''macro(compose a ")'';
o = ''macro(compose o ")'';
u = ''macro(compose u ")'';
s = ''macro(compose s s)'';
};
};
};
};
}

View file

@ -0,0 +1,15 @@
{ ... }:
{
xdg.mime.defaultApplications = {
"application/pdf" = "zen.desktop";
"text/html" = "zen.desktop";
"x-scheme-handler/http" = "zen.desktop";
"x-scheme-handler/https" = "zen.desktop";
"x-scheme-handler/about" = "zen.desktop";
"x-scheme-handler/unknown" = "zen.desktop";
};
environment.sessionVariables.DEFAULT_BROWSER = "zen";
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
nix.optimise = {
automatic = true;
dates = [ "05:00" ];
};
}

18
modules/common/sops.nix Normal file
View file

@ -0,0 +1,18 @@
{ attrs, ... }:
{
imports = [
attrs.sops-nix.nixosModules.sops
];
sops.defaultSopsFile = ../../secrets/secrets.yaml;
sops.defaultSopsFormat = "yaml";
sops.age.keyFile = "/home/willifan/.config/sops/age/keys.txt";
sops.secrets."ssh/root/private" = {
owner = "root";
};
sops.secrets."syncthing/password" = {
};
}

View file

@ -0,0 +1,70 @@
{ lib, config, ... }:
{
options = {
syncthing.devices = lib.mkOption {
default = { };
type = lib.types.attrsOf (lib.types.submodule {
options = {
id = lib.mkOption {
type = lib.types.str;
default = null;
};
};
});
};
};
services.syncthing = {
enable = true;
user = "willifan";
dataDir = "/mnt/data";
configDir = "/mnt/data/.config/syncthing";
overrideDevices = true;
overrideFolders = true;
settings = {
gui = {
user = "willifan";
password = "temppassword";
};
devices = {
Anton = { id = "WCDBADD-UPKCACI-X2YJOIO-5QC44PL-DBCR6TS-ADVQV33-HSMF32O-FOKMKAU"; };
};
folders = {
"Documents" = {
id = "jtl6g-qjmwo";
path = "/mnt/data/Documents";
devices = [ "Anton" ];
};
"Enpass" = {
id = "ciksm-xsw4m";
path = "/mnt/data/Enpass";
devices = [ "Anton" ];
};
"Pictures" = {
id = "po4qj-q9t0t";
path = "/mnt/data/Pictures";
devices = [ "Anton" ];
};
"Videos" = {
id = "4wqf5-xasng";
path = "/mnt/data/Videos";
devices = [ "Anton" ];
};
"Notes" = {
id = "oc61n-iewgj";
path = "/mnt/data/Notes";
devices = [ "Anton" ];
};
"Music" = {
id = "xxh8a-3y2tq";
path = "/mnt/data/Music";
devices = [ "Anton" ];
};
};
};
};
}