style: avoid repeated keys in modules

This commit is contained in:
Leon Schwarzäugl 2025-03-21 20:00:14 +01:00
parent 34b7222665
commit 658d2bb7ba
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
16 changed files with 840 additions and 760 deletions

View file

@ -3760,13 +3760,17 @@ This lets me set some basic flags about the hardware of the configured systems.
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.hasBluetooth = lib.mkEnableOption "bluetooth availability"; options.swarselsystems = {
options.swarselsystems.hasFingerprint = lib.mkEnableOption "fingerprint sensor availability"; hasBluetooth = lib.mkEnableOption "bluetooth availability";
options.swarselsystems.trackpoint.isAvailable = lib.mkEnableOption "trackpoint availability"; hasFingerprint = lib.mkEnableOption "fingerprint sensor availability";
options.swarselsystems.trackpoint.device = lib.mkOption { trackpoint = {
isAvailable = lib.mkEnableOption "trackpoint availability";
trackpoint.device = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
};
};
} }
#+end_src #+end_src
@ -3780,31 +3784,33 @@ I usually use =mutableUsers = false= in my NixOS configuration. However, on a ne
#+begin_src nix :tangle modules/nixos/setup.nix #+begin_src nix :tangle modules/nixos/setup.nix
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.user = lib.mkOption { options.swarselsystems = {
user = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "swarsel"; default = "swarsel";
}; };
options.swarselsystems.withHomeManager = lib.mkOption { withHomeManager = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
}; };
options.swarselsystems.isSwap = lib.mkOption { isSwap = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
}; };
options.swarselsystems.swapSize = lib.mkOption { swapSize = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "8G"; default = "8G";
}; };
options.swarselsystems.rootDisk = lib.mkOption { rootDisk = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.isCrypted = lib.mkEnableOption "uses full disk encryption"; isCrypted = lib.mkEnableOption "uses full disk encryption";
options.swarselsystems.initialSetup = lib.mkEnableOption "initial setup (no sops keys available)"; initialSetup = lib.mkEnableOption "initial setup (no sops keys available)";
options.swarselsystems.isImpermanence = lib.mkEnableOption "use impermanence on this system"; isImpermanence = lib.mkEnableOption "use impermanence on this system";
options.swarselsystems.isSecureBoot = lib.mkEnableOption "use secure boot on this system"; isSecureBoot = lib.mkEnableOption "use secure boot on this system";
};
} }
#+end_src #+end_src
@ -3816,25 +3822,29 @@ I usually use =mutableUsers = false= in my NixOS configuration. However, on a ne
#+begin_src nix :tangle modules/nixos/server.nix #+begin_src nix :tangle modules/nixos/server.nix
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.server.enable = lib.mkEnableOption "is a server machine"; options.swarselsystems = {
options.swarselsystems.server.kavita = lib.mkEnableOption "enable kavita on server"; server = {
options.swarselsystems.server.jellyfin = lib.mkEnableOption "enable jellyfin on server"; enable = lib.mkEnableOption "is a server machine";
options.swarselsystems.server.navidrome = lib.mkEnableOption "enable navidrome on server"; kavita = lib.mkEnableOption "enable kavita on server";
options.swarselsystems.server.spotifyd = lib.mkEnableOption "enable spotifyd on server"; jellyfin = lib.mkEnableOption "enable jellyfin on server";
options.swarselsystems.server.mpd = lib.mkEnableOption "enable mpd on server"; navidrome = lib.mkEnableOption "enable navidrome on server";
options.swarselsystems.server.matrix = lib.mkEnableOption "enable matrix on server"; spotifyd = lib.mkEnableOption "enable spotifyd on server";
options.swarselsystems.server.nextcloud = lib.mkEnableOption "enable nextcloud on server"; mpd = lib.mkEnableOption "enable mpd on server";
options.swarselsystems.server.immich = lib.mkEnableOption "enable immich on server"; matrix = lib.mkEnableOption "enable matrix on server";
options.swarselsystems.server.paperless = lib.mkEnableOption "enable paperless on server"; nextcloud = lib.mkEnableOption "enable nextcloud on server";
options.swarselsystems.server.transmission = lib.mkEnableOption "enable transmission and friends on server"; immich = lib.mkEnableOption "enable immich on server";
options.swarselsystems.server.syncthing = lib.mkEnableOption "enable syncthing on server"; paperless = lib.mkEnableOption "enable paperless on server";
options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server"; transmission = lib.mkEnableOption "enable transmission and friends on server";
options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server"; syncthing = lib.mkEnableOption "enable syncthing on server";
options.swarselsystems.server.jenkins = lib.mkEnableOption "enable jenkins on server"; restic = lib.mkEnableOption "enable restic backups on server";
options.swarselsystems.server.emacs = lib.mkEnableOption "enable emacs server on server"; monitoring = lib.mkEnableOption "enable monitoring on server";
options.swarselsystems.server.forgejo = lib.mkEnableOption "enable forgejo on server"; jenkins = lib.mkEnableOption "enable jenkins on server";
options.swarselsystems.server.ankisync = lib.mkEnableOption "enable ankisync on server"; emacs = lib.mkEnableOption "enable emacs server on server";
options.swarselsystems.server.freshrss = lib.mkEnableOption "enable freshrss on server"; forgejo = lib.mkEnableOption "enable forgejo on server";
ankisync = lib.mkEnableOption "enable ankisync on server";
freshrss = lib.mkEnableOption "enable freshrss on server";
};
};
} }
#+end_src #+end_src
@ -3868,8 +3878,12 @@ Laptops are not always plugged in, so they should show a battery icon in Waybar.
#+begin_src nix :tangle modules/home/laptop.nix #+begin_src nix :tangle modules/home/laptop.nix
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.isLaptop = lib.mkEnableOption "laptop host"; options.swarselsystems = {
config.swarselsystems.touchpad = lib.mkIf config.swarselsystems.isLaptop { isLaptop = lib.mkEnableOption "laptop host";
};
config.swarselsystems = {
touchpad = lib.mkIf config.swarselsystems.isLaptop {
"type:touchpad" = { "type:touchpad" = {
dwt = "enabled"; dwt = "enabled";
tap = "enabled"; tap = "enabled";
@ -3878,7 +3892,7 @@ Laptops are not always plugged in, so they should show a battery icon in Waybar.
drag_lock = "disabled"; drag_lock = "disabled";
}; };
}; };
config.swarselsystems.waybarModules = lib.mkIf config.swarselsystems.isLaptop [ waybarModules = lib.mkIf config.swarselsystems.isLaptop [
"custom/outer-left-arrow-dark" "custom/outer-left-arrow-dark"
"mpris" "mpris"
"custom/left-arrow-light" "custom/left-arrow-light"
@ -3895,6 +3909,7 @@ Laptops are not always plugged in, so they should show a battery icon in Waybar.
"custom/left-arrow-dark" "custom/left-arrow-dark"
"clock#1" "clock#1"
]; ];
};
} }
#+end_src #+end_src
@ -3908,19 +3923,23 @@ This section is mostly used to deliver the correct information to Waybar. AMD sy
#+begin_src nix :tangle modules/home/hardware.nix #+begin_src nix :tangle modules/home/hardware.nix
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.cpuCount = lib.mkOption { options.swarselsystems = {
cpuCount = lib.mkOption {
type = lib.types.int; type = lib.types.int;
default = 8; default = 8;
}; };
options.swarselsystems.temperatureHwmon.isAbsolutePath = lib.mkEnableOption "absolute temperature path"; temperatureHwmon = {
options.swarselsystems.temperatureHwmon.path = lib.mkOption { isAbsolutePath = lib.mkEnableOption "absolute temperature path";
path = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.temperatureHwmon.input-filename = lib.mkOption { input-filename = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
};
};
} }
#+end_src #+end_src
@ -3939,13 +3958,14 @@ The most part of this configuration is done here: [[#h:0bf51f63-01c0-4053-a591-7
generateIcons = n: lib.concatStringsSep " " (builtins.map (x: "{icon" + toString x + "}") (lib.range 0 (n - 1))); generateIcons = n: lib.concatStringsSep " " (builtins.map (x: "{icon" + toString x + "}") (lib.range 0 (n - 1)));
in in
{ {
options.swarselsystems.cpuString = lib.mkOption { options.swarselsystems = {
cpuString = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = generateIcons config.swarselsystems.cpuCount; default = generateIcons config.swarselsystems.cpuCount;
description = "The generated icons string for use by Waybar."; description = "The generated icons string for use by Waybar.";
internal = true; internal = true;
}; };
options.swarselsystems.waybarModules = lib.mkOption { waybarModules = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = [ default = [
"custom/outer-left-arrow-dark" "custom/outer-left-arrow-dark"
@ -3966,6 +3986,7 @@ The most part of this configuration is done here: [[#h:0bf51f63-01c0-4053-a591-7
"clock#1" "clock#1"
]; ];
}; };
};
} }
#+end_src #+end_src
@ -3979,22 +4000,24 @@ This allows me to define my monitors in the machine's =default.nix=.
#+begin_src nix :tangle modules/home/monitors.nix #+begin_src nix :tangle modules/home/monitors.nix
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.monitors = lib.mkOption { options.swarselsystems = {
monitors = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { }; default = { };
}; };
options.swarselsystems.sharescreen = lib.mkOption { sharescreen = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.lowResolution = lib.mkOption { lowResolution = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.highResolution = lib.mkOption { highResolution = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
};
} }
#+end_src #+end_src
@ -4008,11 +4031,12 @@ This allows me to configure input options. Here, I am globally defining my split
#+begin_src nix :tangle modules/home/input.nix #+begin_src nix :tangle modules/home/input.nix
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.inputs = lib.mkOption { options.swarselsystems = {
inputs = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { }; default = { };
}; };
options.swarselsystems.kyria = lib.mkOption { kyria = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { default = {
"36125:53060:splitkb.com_splitkb.com_Kyria_rev3" = { "36125:53060:splitkb.com_splitkb.com_Kyria_rev3" = {
@ -4025,23 +4049,24 @@ This allows me to configure input options. Here, I am globally defining my split
}; };
}; };
}; };
options.swarselsystems.touchpad = lib.mkOption { touchpad = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { }; default = { };
}; };
options.swarselsystems.standardinputs = lib.mkOption { standardinputs = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = lib.recursiveUpdate (lib.recursiveUpdate config.swarselsystems.touchpad config.swarselsystems.kyria) config.swarselsystems.inputs; default = lib.recursiveUpdate (lib.recursiveUpdate config.swarselsystems.touchpad config.swarselsystems.kyria) config.swarselsystems.inputs;
internal = true; internal = true;
}; };
options.swarselsystems.keybindings = lib.mkOption { keybindings = lib.mkOption {
type = lib.types.attrsOf lib.types.str; type = lib.types.attrsOf lib.types.str;
default = { }; default = { };
}; };
options.swarselsystems.shellAliases = lib.mkOption { shellAliases = lib.mkOption {
type = lib.types.attrsOf lib.types.str; type = lib.types.attrsOf lib.types.str;
default = { }; default = { };
}; };
};
} }
#+end_src #+end_src
@ -4055,23 +4080,14 @@ These are some extra options that will be used if the machine also runs NixOS. F
#+begin_src nix :noweb yes :tangle modules/home/nixos.nix #+begin_src nix :noweb yes :tangle modules/home/nixos.nix
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.flakePath = lib.mkOption { options.swarselsystems = {
flakePath = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.isNixos = lib.mkEnableOption "nixos host"; isNixos = lib.mkEnableOption "nixos host";
options.swarselsystems.isPublic = lib.mkEnableOption "is a public machine (no secrets)"; isPublic = lib.mkEnableOption "is a public machine (no secrets)";
config.swarselsystems.startup = lib.mkIf (!config.swarselsystems.isNixos) [ swayfxConfig = lib.mkOption {
{ command = "sleep 60 && nixGL nextcloud --background"; }
{ command = "sleep 60 && nixGL vesktop --start-minimized -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && nixGL syncthingtray --wait"; }
{ command = "sleep 60 && ANKI_WAYLAND=1 nixGL anki"; }
{ command = "nm-applet --indicator"; }
{ command = "sleep 60 && OBSIDIAN_USE_WAYLAND=1 nixGL obsidian -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
];
options.swarselsystems.swayfxConfig = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = " default = "
blur enable blur enable
@ -4085,7 +4101,20 @@ These are some extra options that will be used if the machine also runs NixOS. F
"; ";
internal = true; internal = true;
}; };
config.swarselsystems.swayfxConfig = lib.mkIf (!config.swarselsystems.isNixos) " "; };
config.swarselsystems = {
startup = lib.mkIf (!config.swarselsystems.isNixos) [
{ command = "sleep 60 && nixGL nextcloud --background"; }
{ command = "sleep 60 && nixGL vesktop --start-minimized -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && nixGL syncthingtray --wait"; }
{ command = "sleep 60 && ANKI_WAYLAND=1 nixGL anki"; }
{ command = "nm-applet --indicator"; }
{ command = "sleep 60 && OBSIDIAN_USE_WAYLAND=1 nixGL obsidian -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
];
swayfxConfig = lib.mkIf (!config.swarselsystems.isNixos) " ";
};
} }
#+end_src #+end_src
@ -4099,8 +4128,10 @@ Provides settings related to nix-darwin systems. At the moment, I am only making
#+begin_src nix :noweb yes :tangle modules/home/setup.nix #+begin_src nix :noweb yes :tangle modules/home/setup.nix
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host"; options.swarselsystems = {
options.swarselsystems.isLinux = lib.mkEnableOption "whether this is a linux machine"; isDarwin = lib.mkEnableOption "darwin host";
isLinux = lib.mkEnableOption "whether this is a linux machine";
};
} }
#+end_src #+end_src
@ -4122,7 +4153,8 @@ Do not that =syncthingtray= is also not mentioned here. It is installed as a hom
#+begin_src nix :tangle modules/home/startup.nix #+begin_src nix :tangle modules/home/startup.nix
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.startup = lib.mkOption { options.swarselsystems = {
startup = lib.mkOption {
type = lib.types.listOf (lib.types.attrsOf lib.types.str); type = lib.types.listOf (lib.types.attrsOf lib.types.str);
default = [ default = [
{ command = "nextcloud --background"; } { command = "nextcloud --background"; }
@ -4134,6 +4166,7 @@ Do not that =syncthingtray= is also not mentioned here. It is installed as a hom
{ command = "feishin"; } { command = "feishin"; }
]; ];
}; };
};
} }
#+end_src #+end_src
@ -4147,10 +4180,12 @@ Again, I set the wallpaper here for =stylix=.
#+begin_src nix :tangle modules/home/wallpaper.nix #+begin_src nix :tangle modules/home/wallpaper.nix
{ self, lib, ... }: { self, lib, ... }:
{ {
options.swarselsystems.wallpaper = lib.mkOption { options.swarselsystems = {
wallpaper = lib.mkOption {
type = lib.types.path; type = lib.types.path;
default = self + /wallpaper/lenovowp.png; default = self + /wallpaper/lenovowp.png;
}; };
};
} }
#+end_src #+end_src
@ -4165,7 +4200,9 @@ Another duplicated option for the filesystem.
#+begin_src nix :tangle modules/home/filesystem.nix #+begin_src nix :tangle modules/home/filesystem.nix
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.isBtrfs = lib.mkEnableOption "use btrfs filesystem"; options.swarselsystems = {
isBtrfs = lib.mkEnableOption "use btrfs filesystem";
};
} }
#+end_src #+end_src
@ -4191,7 +4228,8 @@ Set in firefox =about:config > toolkit.legacyUserProfileCustomizations.styleshee
}; };
in in
{ {
options.swarselsystems.firefox = lib.mkOption { options.swarselsystems = {
firefox = lib.mkOption {
type = lib.types.attrs; type = lib.types.attrs;
default = { default = {
isDefault = false; isDefault = false;
@ -4331,7 +4369,7 @@ Set in firefox =about:config > toolkit.legacyUserProfileCustomizations.styleshee
}; };
}; };
}; };
};
} }
#+end_src #+end_src
@ -4341,7 +4379,8 @@ Set in firefox =about:config > toolkit.legacyUserProfileCustomizations.styleshee
#+begin_src nix :noweb yes :tangle modules/home/stylix.nix #+begin_src nix :noweb yes :tangle modules/home/stylix.nix
{ self, lib, pkgs, ... }: { self, lib, pkgs, ... }:
{ {
options.swarselsystems.stylix = lib.mkOption { options.swarselsystems = {
stylix = lib.mkOption {
type = lib.types.attrs; type = lib.types.attrs;
default = { default = {
enable = true; enable = true;
@ -4387,6 +4426,7 @@ Set in firefox =about:config > toolkit.legacyUserProfileCustomizations.styleshee
}; };
}; };
}; };
};
} }
#+end_src #+end_src

View file

@ -1,4 +1,6 @@
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.isBtrfs = lib.mkEnableOption "use btrfs filesystem"; options.swarselsystems = {
isBtrfs = lib.mkEnableOption "use btrfs filesystem";
};
} }

View file

@ -10,7 +10,8 @@ let
}; };
in in
{ {
options.swarselsystems.firefox = lib.mkOption { options.swarselsystems = {
firefox = lib.mkOption {
type = lib.types.attrs; type = lib.types.attrs;
default = { default = {
isDefault = false; isDefault = false;
@ -150,6 +151,6 @@ in
}; };
}; };
}; };
};
} }

View file

@ -1,16 +1,20 @@
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.cpuCount = lib.mkOption { options.swarselsystems = {
cpuCount = lib.mkOption {
type = lib.types.int; type = lib.types.int;
default = 8; default = 8;
}; };
options.swarselsystems.temperatureHwmon.isAbsolutePath = lib.mkEnableOption "absolute temperature path"; temperatureHwmon = {
options.swarselsystems.temperatureHwmon.path = lib.mkOption { isAbsolutePath = lib.mkEnableOption "absolute temperature path";
path = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.temperatureHwmon.input-filename = lib.mkOption { input-filename = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
};
};
} }

View file

@ -1,10 +1,11 @@
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.inputs = lib.mkOption { options.swarselsystems = {
inputs = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { }; default = { };
}; };
options.swarselsystems.kyria = lib.mkOption { kyria = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { default = {
"36125:53060:splitkb.com_splitkb.com_Kyria_rev3" = { "36125:53060:splitkb.com_splitkb.com_Kyria_rev3" = {
@ -17,21 +18,22 @@
}; };
}; };
}; };
options.swarselsystems.touchpad = lib.mkOption { touchpad = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { }; default = { };
}; };
options.swarselsystems.standardinputs = lib.mkOption { standardinputs = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = lib.recursiveUpdate (lib.recursiveUpdate config.swarselsystems.touchpad config.swarselsystems.kyria) config.swarselsystems.inputs; default = lib.recursiveUpdate (lib.recursiveUpdate config.swarselsystems.touchpad config.swarselsystems.kyria) config.swarselsystems.inputs;
internal = true; internal = true;
}; };
options.swarselsystems.keybindings = lib.mkOption { keybindings = lib.mkOption {
type = lib.types.attrsOf lib.types.str; type = lib.types.attrsOf lib.types.str;
default = { }; default = { };
}; };
options.swarselsystems.shellAliases = lib.mkOption { shellAliases = lib.mkOption {
type = lib.types.attrsOf lib.types.str; type = lib.types.attrsOf lib.types.str;
default = { }; default = { };
}; };
};
} }

View file

@ -1,7 +1,11 @@
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.isLaptop = lib.mkEnableOption "laptop host"; options.swarselsystems = {
config.swarselsystems.touchpad = lib.mkIf config.swarselsystems.isLaptop { isLaptop = lib.mkEnableOption "laptop host";
};
config.swarselsystems = {
touchpad = lib.mkIf config.swarselsystems.isLaptop {
"type:touchpad" = { "type:touchpad" = {
dwt = "enabled"; dwt = "enabled";
tap = "enabled"; tap = "enabled";
@ -10,7 +14,7 @@
drag_lock = "disabled"; drag_lock = "disabled";
}; };
}; };
config.swarselsystems.waybarModules = lib.mkIf config.swarselsystems.isLaptop [ waybarModules = lib.mkIf config.swarselsystems.isLaptop [
"custom/outer-left-arrow-dark" "custom/outer-left-arrow-dark"
"mpris" "mpris"
"custom/left-arrow-light" "custom/left-arrow-light"
@ -27,4 +31,5 @@
"custom/left-arrow-dark" "custom/left-arrow-dark"
"clock#1" "clock#1"
]; ];
};
} }

View file

@ -1,19 +1,21 @@
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.monitors = lib.mkOption { options.swarselsystems = {
monitors = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); type = lib.types.attrsOf (lib.types.attrsOf lib.types.str);
default = { }; default = { };
}; };
options.swarselsystems.sharescreen = lib.mkOption { sharescreen = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.lowResolution = lib.mkOption { lowResolution = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.highResolution = lib.mkOption { highResolution = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
};
} }

View file

@ -1,22 +1,13 @@
{ lib, config, ... }: { lib, config, ... }:
{ {
options.swarselsystems.flakePath = lib.mkOption { options.swarselsystems = {
flakePath = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.isNixos = lib.mkEnableOption "nixos host"; isNixos = lib.mkEnableOption "nixos host";
options.swarselsystems.isPublic = lib.mkEnableOption "is a public machine (no secrets)"; isPublic = lib.mkEnableOption "is a public machine (no secrets)";
config.swarselsystems.startup = lib.mkIf (!config.swarselsystems.isNixos) [ swayfxConfig = lib.mkOption {
{ command = "sleep 60 && nixGL nextcloud --background"; }
{ command = "sleep 60 && nixGL vesktop --start-minimized -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && nixGL syncthingtray --wait"; }
{ command = "sleep 60 && ANKI_WAYLAND=1 nixGL anki"; }
{ command = "nm-applet --indicator"; }
{ command = "sleep 60 && OBSIDIAN_USE_WAYLAND=1 nixGL obsidian -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
];
options.swarselsystems.swayfxConfig = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = " default = "
blur enable blur enable
@ -30,5 +21,18 @@
"; ";
internal = true; internal = true;
}; };
config.swarselsystems.swayfxConfig = lib.mkIf (!config.swarselsystems.isNixos) " "; };
config.swarselsystems = {
startup = lib.mkIf (!config.swarselsystems.isNixos) [
{ command = "sleep 60 && nixGL nextcloud --background"; }
{ command = "sleep 60 && nixGL vesktop --start-minimized -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && nixGL syncthingtray --wait"; }
{ command = "sleep 60 && ANKI_WAYLAND=1 nixGL anki"; }
{ command = "nm-applet --indicator"; }
{ command = "sleep 60 && OBSIDIAN_USE_WAYLAND=1 nixGL obsidian -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
{ command = "sleep 60 && element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
];
swayfxConfig = lib.mkIf (!config.swarselsystems.isNixos) " ";
};
} }

View file

@ -1,5 +1,7 @@
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host"; options.swarselsystems = {
options.swarselsystems.isLinux = lib.mkEnableOption "whether this is a linux machine"; isDarwin = lib.mkEnableOption "darwin host";
isLinux = lib.mkEnableOption "whether this is a linux machine";
};
} }

View file

@ -1,6 +1,7 @@
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.startup = lib.mkOption { options.swarselsystems = {
startup = lib.mkOption {
type = lib.types.listOf (lib.types.attrsOf lib.types.str); type = lib.types.listOf (lib.types.attrsOf lib.types.str);
default = [ default = [
{ command = "nextcloud --background"; } { command = "nextcloud --background"; }
@ -12,4 +13,5 @@
{ command = "feishin"; } { command = "feishin"; }
]; ];
}; };
};
} }

View file

@ -1,6 +1,7 @@
{ self, lib, pkgs, ... }: { self, lib, pkgs, ... }:
{ {
options.swarselsystems.stylix = lib.mkOption { options.swarselsystems = {
stylix = lib.mkOption {
type = lib.types.attrs; type = lib.types.attrs;
default = { default = {
enable = true; enable = true;
@ -46,5 +47,6 @@
}; };
}; };
}; };
};
} }

View file

@ -1,7 +1,9 @@
{ self, lib, ... }: { self, lib, ... }:
{ {
options.swarselsystems.wallpaper = lib.mkOption { options.swarselsystems = {
wallpaper = lib.mkOption {
type = lib.types.path; type = lib.types.path;
default = self + /wallpaper/lenovowp.png; default = self + /wallpaper/lenovowp.png;
}; };
};
} }

View file

@ -3,13 +3,14 @@ let
generateIcons = n: lib.concatStringsSep " " (builtins.map (x: "{icon" + toString x + "}") (lib.range 0 (n - 1))); generateIcons = n: lib.concatStringsSep " " (builtins.map (x: "{icon" + toString x + "}") (lib.range 0 (n - 1)));
in in
{ {
options.swarselsystems.cpuString = lib.mkOption { options.swarselsystems = {
cpuString = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = generateIcons config.swarselsystems.cpuCount; default = generateIcons config.swarselsystems.cpuCount;
description = "The generated icons string for use by Waybar."; description = "The generated icons string for use by Waybar.";
internal = true; internal = true;
}; };
options.swarselsystems.waybarModules = lib.mkOption { waybarModules = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = [ default = [
"custom/outer-left-arrow-dark" "custom/outer-left-arrow-dark"
@ -30,4 +31,5 @@ in
"clock#1" "clock#1"
]; ];
}; };
};
} }

View file

@ -1,11 +1,15 @@
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.hasBluetooth = lib.mkEnableOption "bluetooth availability"; options.swarselsystems = {
options.swarselsystems.hasFingerprint = lib.mkEnableOption "fingerprint sensor availability"; hasBluetooth = lib.mkEnableOption "bluetooth availability";
options.swarselsystems.trackpoint.isAvailable = lib.mkEnableOption "trackpoint availability"; hasFingerprint = lib.mkEnableOption "fingerprint sensor availability";
options.swarselsystems.trackpoint.device = lib.mkOption { trackpoint = {
isAvailable = lib.mkEnableOption "trackpoint availability";
trackpoint.device = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
};
};
} }

View file

@ -1,22 +1,26 @@
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.server.enable = lib.mkEnableOption "is a server machine"; options.swarselsystems = {
options.swarselsystems.server.kavita = lib.mkEnableOption "enable kavita on server"; server = {
options.swarselsystems.server.jellyfin = lib.mkEnableOption "enable jellyfin on server"; enable = lib.mkEnableOption "is a server machine";
options.swarselsystems.server.navidrome = lib.mkEnableOption "enable navidrome on server"; kavita = lib.mkEnableOption "enable kavita on server";
options.swarselsystems.server.spotifyd = lib.mkEnableOption "enable spotifyd on server"; jellyfin = lib.mkEnableOption "enable jellyfin on server";
options.swarselsystems.server.mpd = lib.mkEnableOption "enable mpd on server"; navidrome = lib.mkEnableOption "enable navidrome on server";
options.swarselsystems.server.matrix = lib.mkEnableOption "enable matrix on server"; spotifyd = lib.mkEnableOption "enable spotifyd on server";
options.swarselsystems.server.nextcloud = lib.mkEnableOption "enable nextcloud on server"; mpd = lib.mkEnableOption "enable mpd on server";
options.swarselsystems.server.immich = lib.mkEnableOption "enable immich on server"; matrix = lib.mkEnableOption "enable matrix on server";
options.swarselsystems.server.paperless = lib.mkEnableOption "enable paperless on server"; nextcloud = lib.mkEnableOption "enable nextcloud on server";
options.swarselsystems.server.transmission = lib.mkEnableOption "enable transmission and friends on server"; immich = lib.mkEnableOption "enable immich on server";
options.swarselsystems.server.syncthing = lib.mkEnableOption "enable syncthing on server"; paperless = lib.mkEnableOption "enable paperless on server";
options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server"; transmission = lib.mkEnableOption "enable transmission and friends on server";
options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server"; syncthing = lib.mkEnableOption "enable syncthing on server";
options.swarselsystems.server.jenkins = lib.mkEnableOption "enable jenkins on server"; restic = lib.mkEnableOption "enable restic backups on server";
options.swarselsystems.server.emacs = lib.mkEnableOption "enable emacs server on server"; monitoring = lib.mkEnableOption "enable monitoring on server";
options.swarselsystems.server.forgejo = lib.mkEnableOption "enable forgejo on server"; jenkins = lib.mkEnableOption "enable jenkins on server";
options.swarselsystems.server.ankisync = lib.mkEnableOption "enable ankisync on server"; emacs = lib.mkEnableOption "enable emacs server on server";
options.swarselsystems.server.freshrss = lib.mkEnableOption "enable freshrss on server"; forgejo = lib.mkEnableOption "enable forgejo on server";
ankisync = lib.mkEnableOption "enable ankisync on server";
freshrss = lib.mkEnableOption "enable freshrss on server";
};
};
} }

View file

@ -1,28 +1,30 @@
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.user = lib.mkOption { options.swarselsystems = {
user = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "swarsel"; default = "swarsel";
}; };
options.swarselsystems.withHomeManager = lib.mkOption { withHomeManager = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
}; };
options.swarselsystems.isSwap = lib.mkOption { isSwap = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
}; };
options.swarselsystems.swapSize = lib.mkOption { swapSize = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "8G"; default = "8G";
}; };
options.swarselsystems.rootDisk = lib.mkOption { rootDisk = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
}; };
options.swarselsystems.isCrypted = lib.mkEnableOption "uses full disk encryption"; isCrypted = lib.mkEnableOption "uses full disk encryption";
options.swarselsystems.initialSetup = lib.mkEnableOption "initial setup (no sops keys available)"; initialSetup = lib.mkEnableOption "initial setup (no sops keys available)";
options.swarselsystems.isImpermanence = lib.mkEnableOption "use impermanence on this system"; isImpermanence = lib.mkEnableOption "use impermanence on this system";
options.swarselsystems.isSecureBoot = lib.mkEnableOption "use secure boot on this system"; isSecureBoot = lib.mkEnableOption "use secure boot on this system";
};
} }