refactor(modules): make sure nothing is added without setting enable
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2025-01-04 19:02:30 -05:00
parent 4a2ad39114
commit 49dc072b81
56 changed files with 684 additions and 506 deletions

View file

@ -8,6 +8,8 @@ TODO: add directory structure info and enforce it
- if there is non nix code, it will be in a `config` folder - if there is non nix code, it will be in a `config` folder
- redo docs - redo docs
- every module should not do anything if imported - every module should not do anything if imported
- all nix files that represent a module should be `default.nix` (a nix file
which is imported directly can be called anything alongside `default.nix`)
## AGS ## AGS

View file

@ -47,6 +47,7 @@
}; };
roles.server = { roles.server = {
enable = true;
user = mainUser; user = mainUser;
sshd.enable = true; sshd.enable = true;
}; };

View file

@ -55,6 +55,7 @@
}; };
roles.desktop = { roles.desktop = {
enable = true;
user = mainUser; user = mainUser;
ags.enable = true; ags.enable = true;
@ -65,6 +66,7 @@
}; };
roles.server = { roles.server = {
enable = true;
user = mainUser; user = mainUser;
tailscale.enable = true; tailscale.enable = true;
sshd.enable = true; sshd.enable = true;

View file

@ -58,6 +58,7 @@ in {
}; };
roles.server = { roles.server = {
enable = true;
user = mainUser; user = mainUser;
tailscale.enable = true; tailscale.enable = true;
sshd.enable = true; sshd.enable = true;

View file

@ -48,6 +48,7 @@
}; };
roles.server = { roles.server = {
enable = true;
user = mainUser; user = mainUser;
tailscale.enable = true; tailscale.enable = true;
sshd.enable = true; sshd.enable = true;

View file

@ -52,8 +52,9 @@
"ueboom.service" "ueboom.service"
]; ];
services = {
# Allow pulseaudio to be managed by MPD # Allow pulseaudio to be managed by MPD
hardware.pulseaudio = { pulseaudio = {
enable = true; enable = true;
zeroconf = { zeroconf = {
@ -66,7 +67,6 @@
''; '';
}; };
services = {
upower.enable = true; upower.enable = true;
mpd = { mpd = {

View file

@ -23,6 +23,7 @@
}; };
roles.server = { roles.server = {
enable = true;
user = mainUser; user = mainUser;
sshd.enable = true; sshd.enable = true;
}; };

View file

@ -49,6 +49,7 @@
}; };
roles.server = { roles.server = {
enable = true;
user = mainUser; user = mainUser;
tailscale.enable = true; tailscale.enable = true;
sshd.enable = true; sshd.enable = true;

View file

@ -62,6 +62,7 @@
}; };
roles.server = { roles.server = {
enable = true;
user = mainUser; user = mainUser;
tailscale.enable = true; tailscale.enable = true;
sshd.enable = true; sshd.enable = true;

View file

@ -65,6 +65,7 @@
}; };
roles.desktop = { roles.desktop = {
enable = true;
user = mainUser; user = mainUser;
ags.enable = true; ags.enable = true;
@ -76,6 +77,7 @@
}; };
roles.server = { roles.server = {
enable = true;
user = mainUser; user = mainUser;
tailscale.enable = true; tailscale.enable = true;
}; };

View file

@ -1,7 +1,16 @@
self: {...}: let self: {
lib,
osConfig,
...
}: let
inherit (self.lib.hypr) mkAnimation mkBezier mkBind mkLayerRule; inherit (self.lib.hypr) mkAnimation mkBezier mkBind mkLayerRule;
inherit (lib) mkIf;
cfgDesktop = osConfig.roles.desktop;
in { in {
config.wayland.windowManager.hyprland = { config = mkIf cfgDesktop.ags.enable {
wayland.windowManager.hyprland = {
settings = { settings = {
general = { general = {
gaps_in = 5; gaps_in = 5;
@ -192,6 +201,7 @@ in {
]; ];
}; };
}; };
};
# For accurate stack trace # For accurate stack trace
_file = ./default.nix; _file = ./default.nix;

View file

@ -9,7 +9,7 @@ self: {
gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default; gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default;
inherit (lib) attrValues boolToString filter getExe optionalAttrs optionals; inherit (lib) attrValues boolToString filter getExe mkIf optionalAttrs optionals;
inherit (osConfig.networking) hostName; inherit (osConfig.networking) hostName;
@ -29,7 +29,7 @@ self: {
''; '';
}; };
in { in {
config = { config = mkIf cfgDesktop.ags.enable {
# Make these accessible outside these files # Make these accessible outside these files
programs.ags = { programs.ags = {
package = ags.packages.${pkgs.system}.ags.override { package = ags.packages.${pkgs.system}.ags.override {

View file

@ -7,8 +7,8 @@
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = config.roles.base; cfg = config.roles.base;
in in {
mkIf cfg.enable { config = mkIf cfg.enable {
fonts = { fonts = {
fontconfig = { fontconfig = {
enable = true; enable = true;
@ -45,4 +45,8 @@ in
# Select internationalisation properties. # Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8"; i18n.defaultLocale = "en_CA.UTF-8";
console.useXkbConfig = true; console.useXkbConfig = true;
};
# For accurate stack trace
_file = ./default.nix;
} }

View file

@ -23,8 +23,8 @@
${updatedb} -o ${database} --prunefs "${pruneFS}" \ ${updatedb} -o ${database} --prunefs "${pruneFS}" \
--prunepaths "${prunePaths}" --prunenames "${pruneNames}" --prunepaths "${prunePaths}" --prunenames "${pruneNames}"
''; '';
in in {
mkIf (baseCfg.enable) { config = mkIf baseCfg.enable {
users.users.${baseCfg.user}.extraGroups = [ users.users.${baseCfg.user}.extraGroups = [
locateGroup locateGroup
]; ];
@ -79,4 +79,8 @@ in
".svn" ".svn"
]; ];
}; };
};
# For accurate stack trace
_file = ./default.nix;
} }

View file

@ -8,7 +8,7 @@ self: {
cfg = config.roles.base; cfg = config.roles.base;
in { in {
config = mkIf (cfg.enable) { config = mkIf cfg.enable {
nixpkgs.overlays = nixpkgs.overlays =
(map (i: self.inputs.${i}.overlays.default) [ (map (i: self.inputs.${i}.overlays.default) [
"discord-overlay" "discord-overlay"

View file

@ -14,8 +14,8 @@
then unique (a ++ b) then unique (a ++ b)
else b)) {} else b)) {}
list; list;
in in {
mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = [
(pkgs.writeShellApplication { (pkgs.writeShellApplication {
name = "rebuild-no-cache"; name = "rebuild-no-cache";
@ -50,4 +50,8 @@ in
(mkSubstituterConf 10 "https://cache-apt.nelim.org" "cache-apt.nelim.org:NLAsWxa2Qbm4b+hHimjCpZfm48a4oN4O/GPZY9qpjNw=") (mkSubstituterConf 10 "https://cache-apt.nelim.org" "cache-apt.nelim.org:NLAsWxa2Qbm4b+hHimjCpZfm48a4oN4O/GPZY9qpjNw=")
]); ]);
}; };
};
# For accurate stack trace
_file = ./default.nix;
} }

View file

@ -1,7 +1,16 @@
{...}: { {
config,
lib,
...
}: let
inherit (lib) mkIf;
cfg = config.services.borgbackup;
in {
imports = [./module.nix]; imports = [./module.nix];
config.services.borgbackup = { config = mkIf (cfg.configs != {}) {
services.borgbackup = {
existingRepos = [ existingRepos = [
{ {
name = "docker"; name = "docker";
@ -28,6 +37,7 @@
} }
]; ];
}; };
};
# For accurate stack trace # For accurate stack trace
_file = ./default.nix; _file = ./default.nix;

View file

@ -92,7 +92,7 @@ self: {
}/Caddyfile"; }/Caddyfile";
in { in {
options.services.caddy.virtualHosts = mkOption { options.services.caddy.virtualHosts = mkOption {
type = types.attrsOf (types.submodule (import ./vhost-options.nix {inherit cfg;})); type = types.attrsOf (types.submodule (import ./vhost-options.nix cfg));
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,4 +1,4 @@
{cfg}: { cfg: {
lib, lib,
name, name,
... ...

View file

@ -1,4 +1,4 @@
{cfg}: { cfg: {
lib, lib,
name, name,
... ...
@ -22,7 +22,7 @@ in {
}; };
subDirectories = mkOption { subDirectories = mkOption {
type = types.attrsOf (types.submodule (import ./sub-dir-options.nix {inherit cfg;})); type = types.attrsOf (types.submodule (import ./sub-dir-options.nix cfg));
default = {}; default = {};
example = literalExpression '' example = literalExpression ''
{ {

View file

@ -1,4 +1,4 @@
{cfg}: {lib, ...}: let cfg: {lib, ...}: let
inherit (lib) literalExpression mkOption types; inherit (lib) literalExpression mkOption types;
in { in {
options = { options = {
@ -12,7 +12,7 @@ in {
}; };
subDomains = mkOption { subDomains = mkOption {
type = types.attrsOf (types.submodule (import ./sub-domain-options.nix {inherit cfg;})); type = types.attrsOf (types.submodule (import ./sub-domain-options.nix cfg));
default = {}; default = {};
example = literalExpression '' example = literalExpression ''
{ {
@ -30,7 +30,7 @@ in {
}; };
subDirectories = mkOption { subDirectories = mkOption {
type = types.attrsOf (types.submodule (import ./sub-dir-options.nix {inherit cfg;})); type = types.attrsOf (types.submodule (import ./sub-dir-options.nix cfg));
default = {}; default = {};
example = literalExpression '' example = literalExpression ''
{ {

View file

@ -3,10 +3,10 @@ self: {
lib, lib,
... ...
}: let }: let
inherit (lib) elemAt mkOption types;
inherit (self.inputs) home-manager; inherit (self.inputs) home-manager;
inherit (lib) elemAt mkIf mkOption types;
cfg = config.roles.desktop; cfg = config.roles.desktop;
flakeDir = config.environment.variables.FLAKE; flakeDir = config.environment.variables.FLAKE;
in { in {
@ -18,7 +18,8 @@ in {
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
]; ];
config.assertions = [ config = mkIf cfg.enable {
assertions = [
{ {
assertion = lib.hasPrefix "/home/${cfg.user}/" flakeDir; assertion = lib.hasPrefix "/home/${cfg.user}/" flakeDir;
message = '' message = ''
@ -27,8 +28,14 @@ in {
''; '';
} }
]; ];
};
options.roles.desktop = { options.roles.desktop = {
enable = mkOption {
type = types.bool;
default = false;
};
user = mkOption { user = mkOption {
type = types.str; type = types.str;
description = '' description = ''

View file

@ -6,20 +6,8 @@ self: {
}: let }: let
inherit (self.inputs) hyprland; inherit (self.inputs) hyprland;
inherit (self.lib.hypr) mkBind; inherit (self.lib.hypr) mkBind;
in {
imports = [
(import ../../ags self)
./modules/dconf.nix inherit (lib) concatStringsSep mkIf optionals;
./modules/printer.nix
(import ./modules/audio.nix self)
(import ./modules/packages.nix self)
(import ./modules/ratbag-mice.nix self)
(import ./modules/security.nix self)
];
config = let
inherit (lib) concatStringsSep optionals;
cfg = config.roles.desktop; cfg = config.roles.desktop;
@ -32,6 +20,18 @@ in {
.windowManager .windowManager
.hyprland; .hyprland;
in { in {
imports = [
(import ../../ags self)
./modules/dconf.nix
./modules/printer.nix
(import ./modules/audio.nix self)
(import ./modules/packages.nix self)
(import ./modules/ratbag-mice.nix self)
(import ./modules/security.nix self)
];
config = mkIf cfg.enable {
services = { services = {
dbus.enable = true; dbus.enable = true;
gvfs.enable = true; gvfs.enable = true;

View file

@ -1,5 +1,14 @@
{pkgs, ...}: { {
config = { lib,
osConfig,
pkgs,
...
}: let
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
in {
config = mkIf cfg.enable {
programs.bash.shellAliases = { programs.bash.shellAliases = {
# https://wiki.hyprland.org/Contributing-and-Debugging/#lsp-and-formatting # https://wiki.hyprland.org/Contributing-and-Debugging/#lsp-and-formatting
"mkCMakeFiles" = "${pkgs.cmake}/bin/cmake -S . -B build/ -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"; "mkCMakeFiles" = "${pkgs.cmake}/bin/cmake -S . -B build/ -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON";

View file

@ -2,10 +2,12 @@
lib, lib,
osConfig, osConfig,
... ...
}: { }: let
config = let inherit (lib) mkIf;
cfg = osConfig.roles.desktop; cfg = osConfig.roles.desktop;
in { in {
config = mkIf cfg.enable {
programs = { programs = {
# https://codeberg.org/dnkl/foot/wiki#spawning-new-terminal-instances-in-the-current-working-directory # https://codeberg.org/dnkl/foot/wiki#spawning-new-terminal-instances-in-the-current-working-directory
bash.bashrcExtra = bash.bashrcExtra =

View file

@ -1,7 +1,16 @@
self: {pkgs, ...}: let self: {
lib,
osConfig,
pkgs,
...
}: let
inherit (self.lib.hypr) mkBind; inherit (self.lib.hypr) mkBind;
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
in { in {
config = { config = mkIf cfg.enable {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
plugins = [self.inputs.hyprland-plugins.packages.${pkgs.system}.hyprexpo]; plugins = [self.inputs.hyprland-plugins.packages.${pkgs.system}.hyprexpo];

View file

@ -4,12 +4,13 @@ self: {
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) map mkIf;
inherit (self.lib.hypr) mkBind; inherit (self.lib.hypr) mkBind;
inherit (lib) map mkIf;
cfg = osConfig.roles.desktop; cfg = osConfig.roles.desktop;
in { in {
config = mkIf cfg.isTouchscreen { config = mkIf (cfg.enable && cfg.isTouchscreen) {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
plugins = [self.inputs.hyprgrass.packages.${pkgs.system}.default]; plugins = [self.inputs.hyprgrass.packages.${pkgs.system}.default];

View file

@ -2,13 +2,14 @@ self: {
osConfig, osConfig,
lib, lib,
... ...
}: { }: let
config = let
inherit (lib) map;
inherit (self.lib.hypr) mkBind; inherit (self.lib.hypr) mkBind;
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
inherit (osConfig.services.xserver) xkb; inherit (osConfig.services.xserver) xkb;
inherit (osConfig.roles.desktop) mainMonitor;
miceNames = [ miceNames = [
"logitech-g502-x" "logitech-g502-x"
@ -21,6 +22,7 @@ self: {
accel_profile = "flat"; accel_profile = "flat";
}; };
in { in {
config = mkIf cfg.enable {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
settings = { settings = {
device = map mkConf miceNames; device = map mkConf miceNames;
@ -31,8 +33,8 @@ self: {
}; };
exec-once = exec-once =
if mainMonitor != null if cfg.mainMonitor != null
then ["hyprctl dispatch focusmonitor ${mainMonitor}"] then ["hyprctl dispatch focusmonitor ${cfg.mainMonitor}"]
else []; else [];
input = { input = {

View file

@ -1,7 +1,16 @@
self: {pkgs, ...}: { self: {
config = let lib,
osConfig,
pkgs,
...
}: let
inherit (self.scopedPackages.${pkgs.system}) mpvScripts; inherit (self.scopedPackages.${pkgs.system}) mpvScripts;
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
in { in {
config = mkIf cfg.enable {
# For kdialog-open-files # For kdialog-open-files
home.packages = [ home.packages = [
pkgs.kdialog pkgs.kdialog

View file

@ -1,9 +1,18 @@
self: {pkgs, ...}: let self: {
lib,
osConfig,
pkgs,
...
}: let
inherit (self.inputs) nixpkgs-wayland; inherit (self.inputs) nixpkgs-wayland;
in {
config = let
waypkgs = nixpkgs-wayland.packages.${pkgs.system}; waypkgs = nixpkgs-wayland.packages.${pkgs.system};
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
in { in {
config = mkIf cfg.enable {
programs = { programs = {
obs-studio = { obs-studio = {
enable = true; enable = true;

View file

@ -1,9 +1,17 @@
self: {...}: let self: {
config,
lib,
...
}: let
inherit (self.inputs) nix-gaming; inherit (self.inputs) nix-gaming;
inherit (lib) mkIf;
cfg = config.roles.desktop;
in { in {
imports = [nix-gaming.nixosModules.pipewireLowLatency]; imports = [nix-gaming.nixosModules.pipewireLowLatency];
config = { config = mkIf cfg.enable {
services = { services = {
pulseaudio.enable = false; pulseaudio.enable = false;

View file

@ -1,7 +1,13 @@
{config, ...}: { {
config = let config,
lib,
...
}: let
inherit (lib) mkIf;
cfg = config.roles.desktop; cfg = config.roles.desktop;
in { in {
config = mkIf cfg.enable {
programs.dconf.enable = true; programs.dconf.enable = true;
home-manager.users.${cfg.user} = { home-manager.users.${cfg.user} = {

View file

@ -1,11 +1,14 @@
{ {
config, config,
lib,
pkgs, pkgs,
... ...
}: { }: let
config = let inherit (lib) mkIf;
cfg = config.roles.desktop; cfg = config.roles.desktop;
in { in {
config = mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = [
pkgs.plasma5Packages.kio-admin pkgs.plasma5Packages.kio-admin
]; ];

View file

@ -6,21 +6,22 @@ self: {
}: let }: let
inherit (self.lib.hypr) mkBind; inherit (self.lib.hypr) mkBind;
inherit (self.inputs) jellyfin-flake; inherit (self.inputs) jellyfin-flake;
in {
imports = [./dolphin.nix];
config = let inherit (lib) getExe mkIf optionals;
inherit (lib) getExe map optionals;
inherit (pkgs.writers) writeTOML; inherit (pkgs.writers) writeTOML;
flakeDir = config.environment.variables.FLAKE;
cfg = config.roles.desktop; cfg = config.roles.desktop;
flakeDir = config.environment.variables.FLAKE;
isNvidia = config.nvidia.enable; isNvidia = config.nvidia.enable;
restartTailscale = pkgs.writeShellScriptBin "restartTailscale" '' restartTailscale = pkgs.writeShellScriptBin "restartTailscale" ''
sudo ${pkgs.systemd}/bin/systemctl restart tailscaled.service sudo ${pkgs.systemd}/bin/systemctl restart tailscaled.service
''; '';
in { in {
imports = [./dolphin.nix];
config = mkIf cfg.enable {
programs.kdeconnect.enable = true; programs.kdeconnect.enable = true;
security.sudo.extraRules = [ security.sudo.extraRules = [

View file

@ -1,5 +1,14 @@
{pkgs, ...}: { {
config = { config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
cfg = config.roles.desktop;
in {
config = mkIf cfg.enable {
services = { services = {
# Enable CUPS to print documents. # Enable CUPS to print documents.
printing = { printing = {

View file

@ -1,7 +1,15 @@
self: {pkgs, ...}: let self: {
config,
lib,
pkgs,
...
}: let
inherit (self.packages.${pkgs.system}) libratbag piper; inherit (self.packages.${pkgs.system}) libratbag piper;
inherit (lib) mkIf;
cfg = config.roles.desktop;
in { in {
config = { config = mkIf cfg.enable {
services.ratbagd = { services.ratbagd = {
enable = true; enable = true;

View file

@ -3,9 +3,9 @@ self: {
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = let
inherit (self.lib.hypr) mkBind; inherit (self.lib.hypr) mkBind;
inherit (lib) getExe map mkIf; inherit (lib) getExe map mkIf;
cfg = config.roles.desktop; cfg = config.roles.desktop;
@ -41,6 +41,7 @@ self: {
''; '';
}; };
in { in {
config = mkIf cfg.enable {
services.acpid = mkIf cfg.isLaptop { services.acpid = mkIf cfg.isLaptop {
enable = true; enable = true;

View file

@ -1,9 +1,11 @@
self: { self: {
config, config,
lib,
pkgs, pkgs,
... ...
}: { }: let
config = let inherit (lib) mkIf;
cfg = config.roles.desktop; cfg = config.roles.desktop;
agsCfg = hmCfg.programs.ags; agsCfg = hmCfg.programs.ags;
hmCfg = config.home-manager.users.${cfg.user}; hmCfg = config.home-manager.users.${cfg.user};
@ -17,13 +19,14 @@ self: {
varsTs = homeFiles."${agsCfg.configDir}/widgets/lockscreen/vars.ts".source; varsTs = homeFiles."${agsCfg.configDir}/widgets/lockscreen/vars.ts".source;
in in
pkgs.runCommandLocal "agsConfig" {} '' pkgs.runCommandLocal "agsConfig" {} ''
cp -ar ${../../ags/config}/* ./. cp -ar ${self}/modules/ags/config/* ./.
chmod +w -R ./. chmod +w -R ./.
cp -ar ${varsTs} ./widgets/lockscreen/vars.ts cp -ar ${varsTs} ./widgets/lockscreen/vars.ts
cp -ar ${nodeModules} ./node_modules cp -ar ${nodeModules} ./node_modules
${agsCfg.package}/bin/ags bundle ./app.ts $out ${agsCfg.package}/bin/ags bundle ./app.ts $out
''; '';
in { in {
config = mkIf cfg.enable {
assertions = [ assertions = [
{ {
assertion = cfg.ags.enable; assertion = cfg.ags.enable;

View file

@ -3,13 +3,7 @@ self: {
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
imports = [
(import ./ags.nix self)
(import ./hyprland.nix self)
];
config = let
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = config.roles.desktop; cfg = config.roles.desktop;
@ -29,8 +23,13 @@ self: {
trap 'systemctl --user stop hyprland-session.target; sleep 1' EXIT trap 'systemctl --user stop hyprland-session.target; sleep 1' EXIT
exec Hyprland >/dev/null exec Hyprland >/dev/null
''); '');
in in {
mkIf cfg.displayManager.enable { imports = [
(import ./ags self)
(import ./hyprland self)
];
config = mkIf (cfg.enable && cfg.displayManager.enable) {
services = { services = {
displayManager.sessionPackages = [hyprland]; displayManager.sessionPackages = [hyprland];

View file

@ -3,16 +3,15 @@ self: {
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = let
inherit (lib) optionals;
inherit (self.lib.hypr) mkAnimation; inherit (self.lib.hypr) mkAnimation;
inherit (lib) mkIf optionals;
inherit (import ./setupMonitors.nix {inherit config pkgs;}) setupMonitors; inherit (import ./setupMonitors.nix {inherit config pkgs;}) setupMonitors;
cfg = config.roles.desktop; cfg = config.roles.desktop;
# Nix stuff
cfgHypr = cfgHypr =
config config
.home-manager .home-manager
@ -22,9 +21,10 @@ self: {
.windowManager .windowManager
.hyprland; .hyprland;
in { in {
config = mkIf cfg.enable {
home-manager.users.greeter = { home-manager.users.greeter = {
imports = [ imports = [
(import ../theme self) (import ../../theme self)
]; ];
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
@ -73,5 +73,5 @@ self: {
}; };
# For accurate stack trace # For accurate stack trace
_file = ./hyprland.nix; _file = ./default.nix;
} }

View file

@ -1,12 +1,21 @@
self: {pkgs, ...}: { self: {
config = let lib,
osConfig,
pkgs,
...
}: let
inherit (self.scopedPackages.${pkgs.system}) dracula; inherit (self.scopedPackages.${pkgs.system}) dracula;
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
cursorTheme = dracula.hyprcursor; cursorTheme = dracula.hyprcursor;
cursorThemeName = "Dracula-cursors"; cursorThemeName = "Dracula-cursors";
hyprcursorThemeName = "Dracula-hyprcursor"; hyprcursorThemeName = "Dracula-hyprcursor";
cursorSize = 24; cursorSize = 24;
in { in {
config = mkIf cfg.enable {
home.pointerCursor = { home.pointerCursor = {
name = cursorThemeName; name = cursorThemeName;
package = dracula.gtk; package = dracula.gtk;
@ -35,5 +44,5 @@ self: {pkgs, ...}: {
}; };
# For accurate stack trace # For accurate stack trace
_file = ./cursors.nix; _file = ./default.nix;
} }

View file

@ -1,14 +1,23 @@
self: {...}: { self: {
lib,
osConfig,
...
}: let
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
in {
imports = [ imports = [
./gtk ./gtk
./xresources.nix ./xresources
(import ./cursors.nix self) (import ./cursors self)
(import ./qt.nix self) (import ./hyprpaper self)
(import ./hyprpaper.nix self) (import ./qt self)
]; ];
config.wayland.windowManager.hyprland = { config = mkIf cfg.enable {
wayland.windowManager.hyprland = {
settings = { settings = {
windowrule = [ windowrule = [
"size 1231 950,title:^(Open Folder)$" "size 1231 950,title:^(Open Folder)$"
@ -23,6 +32,7 @@ self: {...}: {
]; ];
}; };
}; };
};
# For accurate stack trace # For accurate stack trace
_file = ./default.nix; _file = ./default.nix;

View file

@ -3,12 +3,14 @@
lib, lib,
osConfig, osConfig,
... ...
}: { }: let
config = let inherit (lib) mkIf;
inherit (import ./gradience.nix {inherit pkgs lib;}) gradience; inherit (import ./gradience.nix {inherit pkgs lib;}) gradience;
cfg = osConfig.roles.desktop; cfg = osConfig.roles.desktop;
in { in {
config = mkIf cfg.enable {
home.packages = [ home.packages = [
pkgs.gnomeExtensions.user-themes pkgs.gnomeExtensions.user-themes
]; ];

View file

@ -1,12 +1,17 @@
self: { self: {
lib, lib,
osConfig,
pkgs, pkgs,
... ...
}: { }: let
config = let inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
hyprpaper = self.inputs.hyprpaper.packages.${pkgs.system}.default; hyprpaper = self.inputs.hyprpaper.packages.${pkgs.system}.default;
wallpaper = toString self.scopedPackages.${pkgs.system}.dracula.wallpaper; wallpaper = toString self.scopedPackages.${pkgs.system}.dracula.wallpaper;
in { in {
config = mkIf cfg.enable {
home.packages = [hyprpaper]; home.packages = [hyprpaper];
xdg.configFile."hypr/hyprpaper.conf" = { xdg.configFile."hypr/hyprpaper.conf" = {
@ -26,5 +31,5 @@ self: {
}; };
# For accurate stack trace # For accurate stack trace
_file = ./hyprpaper.nix; _file = ./default.nix;
} }

View file

@ -3,12 +3,14 @@ self: {
osConfig, osConfig,
pkgs, pkgs,
... ...
}: { }: let
config = let
inherit (self.scopedPackages.${pkgs.system}) dracula; inherit (self.scopedPackages.${pkgs.system}) dracula;
inherit (lib) mkIf;
cfg = osConfig.roles.desktop; cfg = osConfig.roles.desktop;
in { in {
config = mkIf cfg.enable {
home.packages = [ home.packages = [
pkgs.libsForQt5.qtstyleplugin-kvantum pkgs.libsForQt5.qtstyleplugin-kvantum
pkgs.kdePackages.qtstyleplugin-kvantum pkgs.kdePackages.qtstyleplugin-kvantum
@ -44,5 +46,5 @@ self: {
}; };
# For accurate stack trace # For accurate stack trace
_file = ./qt.nix; _file = ./default.nix;
} }

View file

@ -1,23 +0,0 @@
{...}: {
xresources.extraConfig = ''
! Dracula Xresources palette
*.foreground: #F8F8F2
*.background: #282A36
*.color0: #000000
*.color8: #4D4D4D
*.color1: #FF5555
*.color9: #FF6E67
*.color2: #50FA7B
*.color10: #5AF78E
*.color3: #F1FA8C
*.color11: #F4F99D
*.color4: #BD93F9
*.color12: #CAA9FA
*.color5: #FF79C6
*.color13: #FF92D0
*.color6: #8BE9FD
*.color14: #9AEDFE
*.color7: #BFBFBF
*.color15: #E6E6E6
'';
}

View file

@ -0,0 +1,36 @@
{
lib,
osConfig,
...
}: let
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
in {
config = mkIf cfg.enable {
xresources.extraConfig = ''
! Dracula Xresources palette
*.foreground: #F8F8F2
*.background: #282A36
*.color0: #000000
*.color8: #4D4D4D
*.color1: #FF5555
*.color9: #FF6E67
*.color2: #50FA7B
*.color10: #5AF78E
*.color3: #F1FA8C
*.color11: #F4F99D
*.color4: #BD93F9
*.color12: #CAA9FA
*.color5: #FF79C6
*.color13: #FF92D0
*.color6: #8BE9FD
*.color14: #9AEDFE
*.color7: #BFBFBF
*.color15: #E6E6E6
'';
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -33,7 +33,7 @@ in {
}; };
}; };
config = mkIf (cfg.enable) { config = mkIf cfg.enable {
virtualisation = { virtualisation = {
docker = { docker = {
enable = true; enable = true;

View file

@ -51,7 +51,7 @@ in {
}; };
}; };
config = mkIf (cfg.enable) { config = mkIf cfg.enable {
# FIXME: https://github.com/NixOS/nixpkgs/issues/339557 # FIXME: https://github.com/NixOS/nixpkgs/issues/339557
systemd.services.esphome = { systemd.services.esphome = {
environment.PLATFORMIO_CORE_DIR = mkForce "${stateDir}/.platformio"; environment.PLATFORMIO_CORE_DIR = mkForce "${stateDir}/.platformio";

View file

@ -7,7 +7,8 @@
cfg = config.boot.plymouth; cfg = config.boot.plymouth;
in { in {
config.boot = mkIf cfg.enable { config = mkIf cfg.enable {
boot = {
initrd = { initrd = {
verbose = false; verbose = false;
systemd.enable = true; systemd.enable = true;
@ -28,6 +29,7 @@ in {
loader.timeout = 0; loader.timeout = 0;
}; };
};
# For accurate stack trace # For accurate stack trace
_file = ./default.nix; _file = ./default.nix;

View file

@ -2,11 +2,16 @@
inherit (lib) mkOption types; inherit (lib) mkOption types;
in { in {
imports = [ imports = [
./sshd.nix ./sshd
./tailscale.nix ./tailscale
]; ];
options.roles.server = { options.roles.server = {
enable = mkOption {
type = types.bool;
default = false;
};
user = mkOption { user = mkOption {
type = types.str; type = types.str;
description = '' description = ''

View file

@ -7,7 +7,7 @@
cfg = config.roles.server; cfg = config.roles.server;
in { in {
config = mkIf cfg.sshd.enable { config = mkIf (cfg.enable && cfg.sshd.enable) {
services = { services = {
openssh = { openssh = {
enable = true; enable = true;
@ -29,5 +29,5 @@ in {
}; };
# For accurate stack trace # For accurate stack trace
_file = ./sshd.nix; _file = ./default.nix;
} }

View file

@ -8,7 +8,7 @@
cfg = config.roles.server; cfg = config.roles.server;
in { in {
config = mkIf cfg.tailscale.enable { config = mkIf (cfg.enable && cfg.tailscale.enable) {
services = { services = {
tailscale = { tailscale = {
enable = true; enable = true;
@ -48,5 +48,5 @@ in {
}; };
# For accurate stack trace # For accurate stack trace
_file = ./tailscale.nix; _file = ./default.nix;
} }

View file

@ -4,14 +4,14 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) attrValues elemAt hasAttr mkIf mkOption types; inherit (lib) attrValues hasAttr head mkIf mkOption types;
cfg = config.programs.tmux; cfg = config.programs.tmux;
# Support NixOnDroid # Support NixOnDroid
firstUser = firstUser =
if hasAttr "users" config.home-manager if hasAttr "users" config.home-manager
then elemAt (attrValues config.home-manager.users) 0 then head (attrValues config.home-manager.users)
else config.home-manager.config; else config.home-manager.config;
in { in {
options.programs.tmux = { options.programs.tmux = {

View file

@ -9,6 +9,8 @@
inherit (lib.strings) concatMapStringsSep concatStringsSep; inherit (lib.strings) concatMapStringsSep concatStringsSep;
cfg = config.services.wyoming; cfg = config.services.wyoming;
forkedPkg = pkgs.callPackage ./pkgs {};
in { in {
options.services.wyoming.openwakeword.vadThreshold = mkOption { options.services.wyoming.openwakeword.vadThreshold = mkOption {
type = types.float; type = types.float;
@ -16,9 +18,7 @@ in {
apply = toString; apply = toString;
}; };
config = let config = {
forkedPkg = pkgs.callPackage ./pkgs {};
in {
systemd.services = mkIf (cfg.openwakeword.enable) { systemd.services = mkIf (cfg.openwakeword.enable) {
wyoming-openwakeword.serviceConfig = { wyoming-openwakeword.serviceConfig = {
MemoryDenyWriteExecute = mkForce (cfg.openwakeword.package != forkedPkg); MemoryDenyWriteExecute = mkForce (cfg.openwakeword.package != forkedPkg);