refactor: finish initial move to modules-only [WIP]

This commit is contained in:
Leon Schwarzäugl 2025-04-05 02:16:21 +02:00
parent e7e59715d8
commit 27679d38fd
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
34 changed files with 1934 additions and 1617 deletions

View file

@ -807,7 +807,10 @@ My work machine. Built for more security, this is the gold standard of my config
isBtrfs = true;
isLinux = true;
sharescreen = "eDP-2";
profiles.personal = true;
profiles = {
personal = true;
work = true;
};
};
in
{
@ -826,11 +829,13 @@ My work machine. Built for more security, this is the gold standard of my config
"${modulesPath}/nixos/optional/gaming.nix"
"${modulesPath}/nixos/optional/work.nix"
"${self}/profiles/nixos"
"${modulesPath}/nixos/server"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users."${primaryUser}".imports = [
"${self}/profiles/home"
"${modulesPath}/home/server"
"${modulesPath}/home/optional/gaming.nix"
"${modulesPath}/home/optional/work.nix"
];
@ -3865,6 +3870,32 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
lid = lib.mkDefault true;
lowBattery = lib.mkDefault true;
lanzaboote = lib.mkDefault true;
optional = {
gaming = lib.mkDefault true;
virtualbox = lib.mkDefault true;
autologin = lib.mkDefault true;
nswitch-rcm = lib.mkDefault true;
};
};
};
}
#+end_src
***** Work
#+begin_src nix :tangle profiles/nixos/work/default.nix :mkdirp yes
{ lib, config, ... }:
{
options.swarselsystems.profiles.work = lib.mkEnableOption "is this a work host";
config = lib.mkIf config.swarselsystems.profiles.work {
swarselsystems.modules = {
optional = {
work = lib.mkDefault true;
};
};
};
@ -3881,7 +3912,6 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
options.swarselsystems.profiles.server.local = lib.mkEnableOption "is this a local server";
config = lib.mkIf config.swarselsystems.profiles.server.local {
swarselsystems = {
# common modules
modules = {
nix-ld = lib.mkDefault true;
home-manager = lib.mkDefault true;
@ -3892,23 +3922,29 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
time = lib.mkDefault true;
users = lib.mkDefault true;
};
# server modules
# server = {
# kavita = lib.mkDefault true;
# jellyfin = lib.mkDefault true;
# navidrome = lib.mkDefault true;
# spotifyd = lib.mkDefault true;
# mpd = lib.mkDefault true;
# matrix = lib.mkDefault true;
# nextcloud = lib.mkDefault true;
# immich = lib.mkDefault true;
# paperless = lib.mkDefault true;
# transmission = lib.mkDefault true;
# syncthing = lib.mkDefault true;
# monitoring = lib.mkDefault true;
# emacs = lib.mkDefault true;
# freshrss = lib.mkDefault true;
# };
server = {
general = lib.mkDefault true;
packages = lib.mkDefault true;
sops = lib.mkDefault true;
nfs = lib.mkDefault true;
nginx = lib.mkDefault true;
ssh = lib.mkDefault true;
kavita = lib.mkDefault true;
jellyfin = lib.mkDefault true;
navidrome = lib.mkDefault true;
spotifyd = lib.mkDefault true;
mpd = lib.mkDefault true;
matrix = lib.mkDefault true;
nextcloud = lib.mkDefault true;
immich = lib.mkDefault true;
paperless = lib.mkDefault true;
transmission = lib.mkDefault true;
syncthing = lib.mkDefault true;
monitoring = lib.mkDefault true;
emacs = lib.mkDefault true;
freshrss = lib.mkDefault true;
};
};
};
@ -3923,7 +3959,6 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
options.swarselsystems.profiles.server.sync = lib.mkEnableOption "is this a oci sync server";
config = lib.mkIf config.swarselsystems.profiles.server.sync {
swarselsystems = {
# common modules
modules = {
nix-ld = lib.mkDefault true;
home-manager = lib.mkDefault true;
@ -3934,11 +3969,16 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
time = lib.mkDefault true;
users = lib.mkDefault true;
};
# server modules
# server = {
# forgejo = lib.mkDefault true;
# ankisync = lib.mkDefault true;
# };
server = {
general = lib.mkDefault true;
packages = lib.mkDefault true;
sops = lib.mkDefault true;
nfs = lib.mkDefault true;
nginx = lib.mkDefault true;
ssh = lib.mkDefault true;
forgejo = lib.mkDefault true;
ankisync = lib.mkDefault true;
};
};
};
@ -3997,6 +4037,71 @@ This holds modules that are to be used on most hosts. These are also the most im
waybar = lib.mkDefault true;
firefox = lib.mkDefault true;
gnome-keyring = lib.mkDefault true;
kdeconnect = lib.mkDefault true;
mako = lib.mkDefault true;
swayosd = lib.mkDefault true;
yubikeytouch = lib.mkDefault true;
sway = lib.mkDefault true;
kanshi = lib.mkDefault true;
gpgagent = lib.mkDefault true;
gammastep = lib.mkDefault true;
optional = {
gaming = lib.mkDefault true;
};
};
};
}
#+end_src
***** Work
#+begin_src nix :tangle profiles/home/work/default.nix :mkdirp yes
{ lib, config, ... }:
{
options.swarselsystems.profiles.work = lib.mkEnableOption "is this a work host";
config = lib.mkIf config.swarselsystems.profiles.work {
swarselsystems.modules = {
optional = {
work = lib.mkDefault true;
};
};
};
}
#+end_src
***** Darwin
#+begin_src nix :tangle profiles/home/darwin/default.nix :mkdirp yes
{ lib, config, ... }:
{
options.swarselsystems.profiles.darwin = lib.mkEnableOption "is this a darwin host";
config = lib.mkIf config.swarselsystems.profiles.darwin {
swarselsystems.modules = {
general = lib.mkDefault true;
};
};
}
#+end_src
***** Local Server
#+begin_src nix :tangle profiles/home/localserver/default.nix :mkdirp yes
{ lib, config, ... }:
{
options.swarselsystems.profiles.server.local = lib.mkEnableOption "is this a local server";
config = lib.mkIf config.swarselsystems.profiles.server.local {
swarselsystems.modules = {
general = lib.mkDefault true;
server = {
dotfiles = lib.mkDefault true;
};
};
};
@ -6077,12 +6182,13 @@ Here we just define some aliases for rebuilding the system, and we allow some in
in
{
options.swarselsystems = {
server.general = lib.mkEnableOption "general setting on server";
shellAliases = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
};
};
config = {
config = lib.mkIf config.swarselsystems.server.general {
environment.shellAliases = lib.recursiveUpdate
{
npswitch = "cd ${flakePath}; git pull; sudo nixos-rebuild --flake .#$(hostname) switch; cd -;";
@ -6114,8 +6220,10 @@ Here we just define some aliases for rebuilding the system, and we allow some in
:END:
#+begin_src nix :tangle modules/nixos/server/packages.nix
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.server.packages = lib.mkEnableOption "enable packages on server";
config = lib.mkIf config.swarselsystems.server.packages {
environment.systemPackages = with pkgs; [
gnupg
nix-index
@ -6124,6 +6232,7 @@ Here we just define some aliases for rebuilding the system, and we allow some in
emacs
vim
];
};
}
#+end_src
@ -6135,12 +6244,14 @@ Here we just define some aliases for rebuilding the system, and we allow some in
#+begin_src nix :tangle modules/nixos/server/sops.nix
{ config, lib, ... }:
{
options.swarselsystems.server.sops = lib.mkEnableOption "enable sops on server";
config = lib.mkIf config.swarselsystems.server.sops {
sops = {
age.sshKeyPaths = lib.mkDefault [ "/etc/ssh/sops" ];
defaultSopsFile = lib.mkDefault "${config.swarselsystems.flakePath}/secrets/winters/secrets.yaml";
validateSopsFiles = false;
};
};
}
#+end_src
@ -6150,8 +6261,10 @@ Here we just define some aliases for rebuilding the system, and we allow some in
:END:
#+begin_src nix :tangle modules/nixos/server/nfs.nix
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.server.nfs = lib.mkEnableOption "enable nfs on server";
config = lib.mkIf config.swarselsystems.server.nfs {
services = {
# add a user with sudo smbpasswd -a <user>
samba = {
@ -6198,6 +6311,7 @@ Here we just define some aliases for rebuilding the system, and we allow some in
openFirewall = true;
};
};
};
}
#+end_src
@ -6207,8 +6321,10 @@ Here we just define some aliases for rebuilding the system, and we allow some in
:END:
#+begin_src nix :tangle modules/nixos/server/nginx.nix
{ pkgs, config, ... }:
{ pkgs, lib, config, ... }:
{
options.swarselsystems.server.nginx = lib.mkEnableOption "enable nginx on server";
config = lib.mkIf config.swarselsystems.server.nginx {
environment.systemPackages = with pkgs; [
lego
];
@ -6242,7 +6358,7 @@ Here we just define some aliases for rebuilding the system, and we allow some in
recommendedGzipSettings = true;
# virtualHosts are defined in the respective sections
};
};
}
#+end_src
@ -6252,8 +6368,10 @@ Here we just define some aliases for rebuilding the system, and we allow some in
:END:
#+begin_src nix :tangle modules/nixos/server/ssh.nix
{ self, config, ... }:
{ self, lib, config, ... }:
{
options.swarselsystems.server.ssh = lib.mkEnableOption "enable ssh on server";
config = lib.mkIf config.swarselsystems.server.ssh {
services.openssh = {
enable = true;
};
@ -6268,7 +6386,7 @@ Here we just define some aliases for rebuilding the system, and we allow some in
security.sudo.extraConfig = ''
Defaults env_keep+=SSH_AUTH_SOCK
'';
};
}
#+end_src
@ -7853,8 +7971,10 @@ These sets of configuration do not need to be deployed on every host, for a mult
This opens a few gaming ports and installs the steam configuration suite for gaming. There are more options in [[#h:84fd7029-ecb6-4131-9333-289982f24ffa][Gaming]] (home-manager side).
#+begin_src nix :tangle modules/nixos/optional/gaming.nix
{ pkgs, lib, ... }:
{ pkgs, lib, config, ... }:
{
options.swarselsystems.modules.optional.gaming = lib.mkEnableOption "optional gaming settings";
config = lib.mkIf config.swarselsystems.modules.optional.gaming {
specialisation = {
gaming.configuration = {
networking = {
@ -7888,6 +8008,7 @@ This opens a few gaming ports and installs the steam configuration suite for gam
];
};
};
};
}
@ -7902,9 +8023,10 @@ This opens a few gaming ports and installs the steam configuration suite for gam
This sets the VirtualBox configuration. Guest should not be enabled if not direly needed, it will make rebuilds unbearably slow. I only use this privately to run an old editor that does not run well under wine, so I put it into it's own specialisation.
#+begin_src nix :tangle modules/nixos/optional/virtualbox.nix
{ lib, pkgs, ... }:
{
{ lib, config, pkgs, ... }:
{
options.swarselsystems.modules.optional.virtualbox = lib.mkEnableOption "optional VBox settings";
config = lib.mkIf config.swarselsystems.modules.optional.virtualbox {
specialisation = {
VBox.configuration = {
virtualisation.virtualbox = {
@ -7921,8 +8043,9 @@ This sets the VirtualBox configuration. Guest should not be enabled if not direl
boot.kernelPackages = lib.mkForce pkgs.linuxPackages;
};
};
};
}
}
#+end_src
**** VmWare
@ -7934,11 +8057,14 @@ This sets the VirtualBox configuration. Guest should not be enabled if not direl
This sets the VirtualBox configuration. Guest should not be enabled if not direly needed, it will make rebuilds unbearably slow.
#+begin_src nix :tangle modules/nixos/optional/vmware.nix
_:
{ lib, config, ... }:
{
options.swarselsystems.modules.optional.vmware = lib.mkEnableOption "optional vmware settings";
config = lib.mkIf config.swarselsystems.modules.optional.vmware {
virtualisation.vmware.host.enable = true;
virtualisation.vmware.guest.enable = true;
};
}
#+end_src
@ -7950,15 +8076,18 @@ This sets the VirtualBox configuration. Guest should not be enabled if not direl
Auto login for the initial session.
#+begin_src nix :tangle modules/nixos/optional/autologin.nix
{ config, ... }:
{ lib, config, ... }:
let
inherit (config.swarselsystems) mainUser;
in
{
options.swarselsystems.modules.optional.autologin = lib.mkEnableOption "optional autologin settings";
config = lib.mkIf config.swarselsystems.modules.optional.autologin {
services = {
getty.autologinUser = mainUser;
greetd.settings.initial_session.user = mainUser;
};
};
}
#+end_src
@ -7970,8 +8099,10 @@ Auto login for the initial session.
This smashes Atmosphere 1.3.2 on the switch, which is what I am currenty using.
#+begin_src nix :tangle modules/nixos/optional/nswitch-rcm.nix
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.modules.optional.nswitch-rcm = lib.mkEnableOption "optional nswitch-rcm settings";
config = lib.mkIf config.swarselsystems.modules.optional.nswitch-rcm {
services.nswitch-rcm = {
enable = true;
package = pkgs.fetchurl {
@ -7979,6 +8110,7 @@ This smashes Atmosphere 1.3.2 on the switch, which is what I am currenty using.
hash = "sha256-5AXzNsny45SPLIrvWJA9/JlOCal5l6Y++Cm+RtlJppI=";
};
};
};
}
#+end_src
@ -8016,6 +8148,8 @@ Options that I need specifically at work. There are more options at [[#h:f0b2ea9
};
in
{
options.swarselsystems.modules.optional.work = lib.mkEnableOption "optional work settings";
config = lib.mkIf config.swarselsystems.modules.optional.work {
sops =
let
secretNames = [
@ -8179,6 +8313,7 @@ Options that I need specifically at work. There are more options at [[#h:f0b2ea9
];
};
};
};
}
#+end_src
@ -10655,12 +10790,15 @@ Used for storing sessions in e.g. Nextcloud
This enables phone/computer communication, including sending clipboard, files etc. Sadly on Wayland many of the features are broken (like remote control).
#+begin_src nix :tangle modules/home/common/kdeconnect.nix
_:
{ lib, config, ... }:
{
options.swarselsystems.modules.kdeconnect = lib.mkEnableOption "kdeconnect settings";
config = lib.mkIf config.swarselsystems.modules.kdeconnect {
services.kdeconnect = {
enable = true;
indicator = true;
};
};
}
#+end_src
@ -10675,8 +10813,10 @@ Desktop notifications!
The `extraConfig` section here CANNOT be reindented. This has something to do with how nix handles multiline strings, when indented Mako will fail to start. This might be a mako bug as well.
#+begin_src nix :tangle modules/home/common/mako.nix
_:
{ lib, config, ... }:
{
options.swarselsystems.modules.mako = lib.mkEnableOption "mako settings";
config = lib.mkIf config.swarselsystems.modules.mako {
services.mako = {
enable = true;
# backgroundColor = "#2e3440";
@ -10705,12 +10845,23 @@ The `extraConfig` section here CANNOT be reindented. This has something to do wi
group-by=category
'';
};
};
}
#+end_src
***** SwayOSD
#+begin_src nix :tangle modules/home/common/swayosd.nix
{ lib, config, ... }:
{
options.swarselsystems.modules.swayosd = lib.mkEnableOption "swayosd settings";
config = lib.mkIf config.swarselsystems.modules.swayosd {
services.swayosd = {
enable = true;
topMargin = 0.5;
};
};
}
#+end_src
@ -10720,8 +10871,10 @@ The `extraConfig` section here CANNOT be reindented. This has something to do wi
:END:
#+begin_src nix :tangle modules/home/common/yubikey-touch-detector.nix
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.modules.yubikeytouch = lib.mkEnableOption "yubikey touch detector service settings";
config = lib.mkIf config.swarselsystems.modules.yubikeytouch {
systemd.user.services.yubikey-touch-detector = {
Unit = {
Description = "Detects when your YubiKey is waiting for a touch";
@ -10748,6 +10901,7 @@ The `extraConfig` section here CANNOT be reindented. This has something to do wi
WantedBy = [ "sockets.target" ];
};
};
};
}
#+end_src
@ -10764,6 +10918,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se
{ self, config, lib, ... }:
{
options.swarselsystems = {
modules.sway = lib.mkEnableOption "sway settings";
inputs = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { };
@ -10827,7 +10982,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se
internal = true;
};
};
config = {
config = lib.mkIf config.swarselsystems.modules.sway {
swarselsystems = {
touchpad = lib.mkIf config.swarselsystems.isLaptop {
"type:touchpad" = {
@ -11175,8 +11330,10 @@ Currently, I am too lazy to explain every option here, but most of it is very se
#+begin_src nix :tangle modules/home/common/kanshi.nix
{ config, ... }:
{ lib, config, ... }:
{
options.swarselsystems.modules.kanshi = lib.mkEnableOption "kanshi settings";
config = lib.mkIf config.swarselsystems.modules.kanshi {
services.kanshi = {
enable = true;
settings = [
@ -11247,6 +11404,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se
}
];
};
};
}
#+end_src
@ -11258,11 +11416,13 @@ Currently, I am too lazy to explain every option here, but most of it is very se
Settinfs that are needed for the gpg-agent. Also we are enabling emacs support for unlocking my Yubikey here.
#+begin_src nix :tangle modules/home/common/gpg-agent.nix
{ self, config, pkgs, ... }:
{ self, lib, config, pkgs, ... }:
let
inherit (config.swarselsystems) mainUser homeDir;
in
{
options.swarselsystems.modules.gpgagent = lib.mkEnableOption "gpg agent settings";
config = lib.mkIf config.swarselsystems.modules.gpgagent {
services.gpg-agent = {
enable = true;
enableZshIntegration = true;
@ -11295,6 +11455,7 @@ Settinfs that are needed for the gpg-agent. Also we are enabling emacs support f
systemd.user.tmpfiles.rules = [
"d ${homeDir}/.gnupg 700 ${mainUser} users"
];
};
}
#+end_src
@ -11307,17 +11468,20 @@ Settinfs that are needed for the gpg-agent. Also we are enabling emacs support f
This service changes the screen hue at night. I am not sure if that really does something, but I like the color anyways.
#+begin_src nix :tangle modules/home/common/gammastep.nix
{ lib, nix-secrets, ... }:
{ lib, config, nix-secrets, ... }:
let
secretsDirectory = builtins.toString nix-secrets;
in
{
options.swarselsystems.modules.gammastep = lib.mkEnableOption "gammastep settings";
config = lib.mkIf config.swarselsystems.modules.gammastep {
services.gammastep = {
enable = true;
provider = "manual";
latitude = lib.swarselsystems.getSecret "${secretsDirectory}/home/gammastep-latitude";
longitude = lib.swarselsystems.getSecret "${secretsDirectory}/home/gammastep-longitude";
};
};
}
#+end_src
@ -11357,14 +11521,17 @@ This section should be used in order to symlink already existing configuration f
As for the `home.sessionVariables`, it should be noted that environment variables that are needed at system start should NOT be loaded here, but instead in `programs.zsh.config.extraSessionCommands` (in the home-manager programs section). This is also where all the wayland related variables are stored.
#+begin_src nix :tangle modules/home/server/symlink.nix
{ self, lib, ... }:
{ self, lib, config, ... }:
{
options.swarselsystems.modules.server.dotfiles = lib.mkEnableOption "server dotfiles settings";
config = lib.mkIf config.swarselsystems.modules.server.dotfiles {
home.file = {
"init.el" = lib.mkForce {
source = self + /programs/emacs/server.el;
target = ".emacs.d/init.el";
};
};
};
}
#+end_src
@ -11408,8 +11575,10 @@ Akin to the optional NixOS modules.
The rest of the settings is at [[#h:fb3f3e01-7df4-4b06-9e91-aa9cac61a431][gaming]].
#+begin_src nix :tangle modules/home/optional/gaming.nix
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.modules.optional.gaming = lib.mkEnableOption "optional gaming settings";
config = lib.mkIf config.swarselsystems.modules.optional.gaming {
# specialisation = {
# gaming.configuration = {
home.packages = with pkgs; [
@ -11442,6 +11611,7 @@ The rest of the settings is at [[#h:fb3f3e01-7df4-4b06-9e91-aa9cac61a431][gaming
];
# };
# };
};
}
#+end_src
@ -11463,6 +11633,8 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]]
wsUser = lib.swarselsystems.getSecret "${secretsDirectory}/work/ws-user";
in
{
options.swarselsystems.modules.optional.work = lib.mkEnableOption "optional work settings";
config = lib.mkIf config.swarselsystems.modules.optional.work {
home.packages = with pkgs; [
stable.teams-for-linux
shellcheck
@ -11765,6 +11937,7 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]]
};
};
};
}

View file

@ -6,7 +6,10 @@ let
isBtrfs = true;
isLinux = true;
sharescreen = "eDP-2";
profiles.personal = true;
profiles = {
personal = true;
work = true;
};
};
in
{
@ -25,11 +28,13 @@ in
"${modulesPath}/nixos/optional/gaming.nix"
"${modulesPath}/nixos/optional/work.nix"
"${self}/profiles/nixos"
"${modulesPath}/nixos/server"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users."${primaryUser}".imports = [
"${self}/profiles/home"
"${modulesPath}/home/server"
"${modulesPath}/home/optional/gaming.nix"
"${modulesPath}/home/optional/work.nix"
];

View file

@ -1,12 +1,15 @@
{ lib, nix-secrets, ... }:
{ lib, config, nix-secrets, ... }:
let
secretsDirectory = builtins.toString nix-secrets;
in
{
options.swarselsystems.modules.gammastep = lib.mkEnableOption "gammastep settings";
config = lib.mkIf config.swarselsystems.modules.gammastep {
services.gammastep = {
enable = true;
provider = "manual";
latitude = lib.swarselsystems.getSecret "${secretsDirectory}/home/gammastep-latitude";
longitude = lib.swarselsystems.getSecret "${secretsDirectory}/home/gammastep-longitude";
};
};
}

View file

@ -1,8 +1,10 @@
{ self, config, pkgs, ... }:
{ self, lib, config, pkgs, ... }:
let
inherit (config.swarselsystems) mainUser homeDir;
in
{
options.swarselsystems.modules.gpgagent = lib.mkEnableOption "gpg agent settings";
config = lib.mkIf config.swarselsystems.modules.gpgagent {
services.gpg-agent = {
enable = true;
enableZshIntegration = true;
@ -35,5 +37,6 @@ in
systemd.user.tmpfiles.rules = [
"d ${homeDir}/.gnupg 700 ${mainUser} users"
];
};
}

View file

@ -1,5 +1,7 @@
{ config, ... }:
{ lib, config, ... }:
{
options.swarselsystems.modules.kanshi = lib.mkEnableOption "kanshi settings";
config = lib.mkIf config.swarselsystems.modules.kanshi {
services.kanshi = {
enable = true;
settings = [
@ -70,4 +72,5 @@
}
];
};
};
}

View file

@ -1,8 +1,11 @@
_:
{ lib, config, ... }:
{
options.swarselsystems.modules.kdeconnect = lib.mkEnableOption "kdeconnect settings";
config = lib.mkIf config.swarselsystems.modules.kdeconnect {
services.kdeconnect = {
enable = true;
indicator = true;
};
};
}

View file

@ -1,5 +1,7 @@
_:
{ lib, config, ... }:
{
options.swarselsystems.modules.mako = lib.mkEnableOption "mako settings";
config = lib.mkIf config.swarselsystems.modules.mako {
services.mako = {
enable = true;
# backgroundColor = "#2e3440";
@ -28,10 +30,6 @@ _:
group-by=category
'';
};
services.swayosd = {
enable = true;
topMargin = 0.5;
};
}

View file

@ -1,6 +1,7 @@
{ self, config, lib, ... }:
{
options.swarselsystems = {
modules.sway = lib.mkEnableOption "sway settings";
inputs = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { };
@ -64,7 +65,7 @@
internal = true;
};
};
config = {
config = lib.mkIf config.swarselsystems.modules.sway {
swarselsystems = {
touchpad = lib.mkIf config.swarselsystems.isLaptop {
"type:touchpad" = {

View file

@ -0,0 +1,10 @@
{ lib, config, ... }:
{
options.swarselsystems.modules.swayosd = lib.mkEnableOption "swayosd settings";
config = lib.mkIf config.swarselsystems.modules.swayosd {
services.swayosd = {
enable = true;
topMargin = 0.5;
};
};
}

View file

@ -1,5 +1,7 @@
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.modules.yubikeytouch = lib.mkEnableOption "yubikey touch detector service settings";
config = lib.mkIf config.swarselsystems.modules.yubikeytouch {
systemd.user.services.yubikey-touch-detector = {
Unit = {
Description = "Detects when your YubiKey is waiting for a touch";
@ -26,4 +28,5 @@
WantedBy = [ "sockets.target" ];
};
};
};
}

View file

@ -1,5 +1,7 @@
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.modules.optional.gaming = lib.mkEnableOption "optional gaming settings";
config = lib.mkIf config.swarselsystems.modules.optional.gaming {
# specialisation = {
# gaming.configuration = {
home.packages = with pkgs; [
@ -32,4 +34,5 @@
];
# };
# };
};
}

View file

@ -7,6 +7,8 @@ let
wsUser = lib.swarselsystems.getSecret "${secretsDirectory}/work/ws-user";
in
{
options.swarselsystems.modules.optional.work = lib.mkEnableOption "optional work settings";
config = lib.mkIf config.swarselsystems.modules.optional.work {
home.packages = with pkgs; [
stable.teams-for-linux
shellcheck
@ -309,5 +311,6 @@ in
};
};
};
}

View file

@ -1,9 +1,12 @@
{ self, lib, ... }:
{ self, lib, config, ... }:
{
options.swarselsystems.modules.server.dotfiles = lib.mkEnableOption "server dotfiles settings";
config = lib.mkIf config.swarselsystems.modules.server.dotfiles {
home.file = {
"init.el" = lib.mkForce {
source = self + /programs/emacs/server.el;
target = ".emacs.d/init.el";
};
};
};
}

View file

@ -1,10 +1,13 @@
{ config, ... }:
{ lib, config, ... }:
let
inherit (config.swarselsystems) mainUser;
in
{
options.swarselsystems.modules.optional.autologin = lib.mkEnableOption "optional autologin settings";
config = lib.mkIf config.swarselsystems.modules.optional.autologin {
services = {
getty.autologinUser = mainUser;
greetd.settings.initial_session.user = mainUser;
};
};
}

View file

@ -1,5 +1,7 @@
{ pkgs, lib, ... }:
{ pkgs, lib, config, ... }:
{
options.swarselsystems.modules.optional.gaming = lib.mkEnableOption "optional gaming settings";
config = lib.mkIf config.swarselsystems.modules.optional.gaming {
specialisation = {
gaming.configuration = {
networking = {
@ -33,5 +35,6 @@
];
};
};
};
}

View file

@ -1,5 +1,7 @@
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.modules.optional.nswitch-rcm = lib.mkEnableOption "optional nswitch-rcm settings";
config = lib.mkIf config.swarselsystems.modules.optional.nswitch-rcm {
services.nswitch-rcm = {
enable = true;
package = pkgs.fetchurl {
@ -7,4 +9,5 @@
hash = "sha256-5AXzNsny45SPLIrvWJA9/JlOCal5l6Y++Cm+RtlJppI=";
};
};
};
}

View file

@ -1,6 +1,7 @@
{ lib, pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.modules.optional.virtualbox = lib.mkEnableOption "optional VBox settings";
config = lib.mkIf config.swarselsystems.modules.optional.virtualbox {
specialisation = {
VBox.configuration = {
virtualisation.virtualbox = {
@ -17,5 +18,6 @@
boot.kernelPackages = lib.mkForce pkgs.linuxPackages;
};
};
};
}

View file

@ -1,6 +1,9 @@
_:
{ lib, config, ... }:
{
options.swarselsystems.modules.optional.vmware = lib.mkEnableOption "optional vmware settings";
config = lib.mkIf config.swarselsystems.modules.optional.vmware {
virtualisation.vmware.host.enable = true;
virtualisation.vmware.guest.enable = true;
};
}

View file

@ -24,6 +24,8 @@ let
};
in
{
options.swarselsystems.modules.optional.work = lib.mkEnableOption "optional work settings";
config = lib.mkIf config.swarselsystems.modules.optional.work {
sops =
let
secretNames = [
@ -187,5 +189,6 @@ in
];
};
};
};
}

View file

@ -1,5 +1,7 @@
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.server.nfs = lib.mkEnableOption "enable nfs on server";
config = lib.mkIf config.swarselsystems.server.nfs {
services = {
# add a user with sudo smbpasswd -a <user>
samba = {
@ -46,4 +48,5 @@
openFirewall = true;
};
};
};
}

View file

@ -1,5 +1,7 @@
{ pkgs, config, ... }:
{ pkgs, lib, config, ... }:
{
options.swarselsystems.server.nginx = lib.mkEnableOption "enable nginx on server";
config = lib.mkIf config.swarselsystems.server.nginx {
environment.systemPackages = with pkgs; [
lego
];
@ -33,5 +35,5 @@
recommendedGzipSettings = true;
# virtualHosts are defined in the respective sections
};
};
}

View file

@ -1,5 +1,7 @@
{ pkgs, ... }:
{ lib, config, pkgs, ... }:
{
options.swarselsystems.server.packages = lib.mkEnableOption "enable packages on server";
config = lib.mkIf config.swarselsystems.server.packages {
environment.systemPackages = with pkgs; [
gnupg
nix-index
@ -8,4 +10,5 @@
emacs
vim
];
};
}

View file

@ -4,12 +4,13 @@ let
in
{
options.swarselsystems = {
server.general = lib.mkEnableOption "general setting on server";
shellAliases = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
};
};
config = {
config = lib.mkIf config.swarselsystems.server.general {
environment.shellAliases = lib.recursiveUpdate
{
npswitch = "cd ${flakePath}; git pull; sudo nixos-rebuild --flake .#$(hostname) switch; cd -;";

View file

@ -1,9 +1,11 @@
{ config, lib, ... }:
{
options.swarselsystems.server.sops = lib.mkEnableOption "enable sops on server";
config = lib.mkIf config.swarselsystems.server.sops {
sops = {
age.sshKeyPaths = lib.mkDefault [ "/etc/ssh/sops" ];
defaultSopsFile = lib.mkDefault "${config.swarselsystems.flakePath}/secrets/winters/secrets.yaml";
validateSopsFiles = false;
};
};
}

View file

@ -1,5 +1,7 @@
{ self, config, ... }:
{ self, lib, config, ... }:
{
options.swarselsystems.server.ssh = lib.mkEnableOption "enable ssh on server";
config = lib.mkIf config.swarselsystems.server.ssh {
services.openssh = {
enable = true;
};
@ -14,5 +16,5 @@
security.sudo.extraConfig = ''
Defaults env_keep+=SSH_AUTH_SOCK
'';
};
}

View file

@ -0,0 +1,10 @@
{ lib, config, ... }:
{
options.swarselsystems.profiles.darwin = lib.mkEnableOption "is this a darwin host";
config = lib.mkIf config.swarselsystems.profiles.darwin {
swarselsystems.modules = {
general = lib.mkDefault true;
};
};
}

View file

@ -0,0 +1,13 @@
{ lib, config, ... }:
{
options.swarselsystems.profiles.server.local = lib.mkEnableOption "is this a local server";
config = lib.mkIf config.swarselsystems.profiles.server.local {
swarselsystems.modules = {
general = lib.mkDefault true;
server = {
dotfiles = lib.mkDefault true;
};
};
};
}

View file

@ -30,6 +30,18 @@
waybar = lib.mkDefault true;
firefox = lib.mkDefault true;
gnome-keyring = lib.mkDefault true;
kdeconnect = lib.mkDefault true;
mako = lib.mkDefault true;
swayosd = lib.mkDefault true;
yubikeytouch = lib.mkDefault true;
sway = lib.mkDefault true;
kanshi = lib.mkDefault true;
gpgagent = lib.mkDefault true;
gammastep = lib.mkDefault true;
optional = {
gaming = lib.mkDefault true;
};
};
};

View file

@ -0,0 +1,12 @@
{ lib, config, ... }:
{
options.swarselsystems.profiles.work = lib.mkEnableOption "is this a work host";
config = lib.mkIf config.swarselsystems.profiles.work {
swarselsystems.modules = {
optional = {
work = lib.mkDefault true;
};
};
};
}

View file

@ -3,7 +3,6 @@
options.swarselsystems.profiles.server.local = lib.mkEnableOption "is this a local server";
config = lib.mkIf config.swarselsystems.profiles.server.local {
swarselsystems = {
# common modules
modules = {
nix-ld = lib.mkDefault true;
home-manager = lib.mkDefault true;
@ -14,23 +13,29 @@
time = lib.mkDefault true;
users = lib.mkDefault true;
};
# server modules
# server = {
# kavita = lib.mkDefault true;
# jellyfin = lib.mkDefault true;
# navidrome = lib.mkDefault true;
# spotifyd = lib.mkDefault true;
# mpd = lib.mkDefault true;
# matrix = lib.mkDefault true;
# nextcloud = lib.mkDefault true;
# immich = lib.mkDefault true;
# paperless = lib.mkDefault true;
# transmission = lib.mkDefault true;
# syncthing = lib.mkDefault true;
# monitoring = lib.mkDefault true;
# emacs = lib.mkDefault true;
# freshrss = lib.mkDefault true;
# };
server = {
general = lib.mkDefault true;
packages = lib.mkDefault true;
sops = lib.mkDefault true;
nfs = lib.mkDefault true;
nginx = lib.mkDefault true;
ssh = lib.mkDefault true;
kavita = lib.mkDefault true;
jellyfin = lib.mkDefault true;
navidrome = lib.mkDefault true;
spotifyd = lib.mkDefault true;
mpd = lib.mkDefault true;
matrix = lib.mkDefault true;
nextcloud = lib.mkDefault true;
immich = lib.mkDefault true;
paperless = lib.mkDefault true;
transmission = lib.mkDefault true;
syncthing = lib.mkDefault true;
monitoring = lib.mkDefault true;
emacs = lib.mkDefault true;
freshrss = lib.mkDefault true;
};
};
};

View file

@ -44,6 +44,13 @@
lid = lib.mkDefault true;
lowBattery = lib.mkDefault true;
lanzaboote = lib.mkDefault true;
optional = {
gaming = lib.mkDefault true;
virtualbox = lib.mkDefault true;
autologin = lib.mkDefault true;
nswitch-rcm = lib.mkDefault true;
};
};
};

View file

@ -3,7 +3,6 @@
options.swarselsystems.profiles.server.sync = lib.mkEnableOption "is this a oci sync server";
config = lib.mkIf config.swarselsystems.profiles.server.sync {
swarselsystems = {
# common modules
modules = {
nix-ld = lib.mkDefault true;
home-manager = lib.mkDefault true;
@ -14,11 +13,16 @@
time = lib.mkDefault true;
users = lib.mkDefault true;
};
# server modules
# server = {
# forgejo = lib.mkDefault true;
# ankisync = lib.mkDefault true;
# };
server = {
general = lib.mkDefault true;
packages = lib.mkDefault true;
sops = lib.mkDefault true;
nfs = lib.mkDefault true;
nginx = lib.mkDefault true;
ssh = lib.mkDefault true;
forgejo = lib.mkDefault true;
ankisync = lib.mkDefault true;
};
};
};

View file

@ -0,0 +1,13 @@
{ lib, config, ... }:
{
options.swarselsystems.profiles.work = lib.mkEnableOption "is this a work host";
config = lib.mkIf config.swarselsystems.profiles.work {
swarselsystems.modules = {
optional = {
work = lib.mkDefault true;
};
};
};
}

View file

@ -103,8 +103,8 @@ in
format_center ""
format_right "#[bg=#${colors.base00},fg=#${colors.base02}]#[bg=#${colors.base02},fg=#${colors.base01},bold] #[bg=#${colors.base02},fg=#${colors.base01},bold] {session} #[bg=#${colors.base02},fg=#${colors.base01},bold]"
format_space ""
format_hide_on_overlength "true"
format_precedence "crl"
format_hide_on_overlength "false"
format_precedence "lcr"
border_enabled "false"
border_char ""