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
- redo docs
- 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

View file

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

View file

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

View file

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

View file

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

View file

@ -52,21 +52,21 @@
"ueboom.service"
];
# Allow pulseaudio to be managed by MPD
hardware.pulseaudio = {
enable = true;
services = {
# Allow pulseaudio to be managed by MPD
pulseaudio = {
enable = true;
zeroconf = {
discovery.enable = true;
publish.enable = true;
zeroconf = {
discovery.enable = true;
publish.enable = true;
};
extraConfig = ''
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
'';
};
extraConfig = ''
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
'';
};
services = {
upower.enable = true;
mpd = {

View file

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

View file

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

View file

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

View file

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

View file

@ -1,195 +1,205 @@
self: {...}: let
self: {
lib,
osConfig,
...
}: let
inherit (self.lib.hypr) mkAnimation mkBezier mkBind mkLayerRule;
inherit (lib) mkIf;
cfgDesktop = osConfig.roles.desktop;
in {
config.wayland.windowManager.hyprland = {
settings = {
general = {
gaps_in = 5;
gaps_out = 5;
border_size = 0;
};
decoration = {
rounding = 12;
blur = {
enabled = true;
size = 3;
passes = 1;
config = mkIf cfgDesktop.ags.enable {
wayland.windowManager.hyprland = {
settings = {
general = {
gaps_in = 5;
gaps_out = 5;
border_size = 0;
};
shadow.enabled = false;
};
decoration = {
rounding = 12;
animations = {
enabled = true;
blur = {
enabled = true;
size = 3;
passes = 1;
};
bezier = map mkBezier [
shadow.enabled = false;
};
animations = {
enabled = true;
bezier = map mkBezier [
{
name = "easeInQuart";
p0 = [0.895 0.030];
p1 = [0.685 0.220];
}
{
name = "easeOutQuart";
p0 = [0.165 0.840];
p1 = [0.440 1.000];
}
{
name = "easeInOutQuart";
p0 = [0.770 0.000];
p1 = [0.175 1.000];
}
# fade out
{
name = "easeInExpo";
p0 = [0.950 0.050];
p1 = [0.795 0.035];
}
];
animation = map mkAnimation [
{
name = "workspaces";
duration = 6;
bezier = "easeOutQuart";
style = "slide";
}
{
name = "windows";
duration = 4;
bezier = "easeOutQuart";
style = "slide";
}
{
name = "fadeIn";
enable = false;
}
{
name = "fadeOut";
duration = 4;
bezier = "easeInExpo";
}
{
name = "fadeLayersIn";
enable = false;
}
{
name = "fadeLayersOut";
duration = 4;
bezier = "easeInExpo";
}
{
name = "layers";
duration = 4;
bezier = "easeInOutQuart";
style = "fade";
}
];
};
layerrule = map mkLayerRule [
{
name = "easeInQuart";
p0 = [0.895 0.030];
p1 = [0.685 0.220];
rule = "animation popin";
namespace = "^(hyprpaper.*)";
}
{
name = "easeOutQuart";
p0 = [0.165 0.840];
p1 = [0.440 1.000];
rule = "animation fade";
namespace = "^(bg-layer.*)";
}
{
name = "easeInOutQuart";
p0 = [0.770 0.000];
p1 = [0.175 1.000];
rule = "noanim";
namespace = "^(noanim-.*)";
}
# fade out
{
name = "easeInExpo";
p0 = [0.950 0.050];
p1 = [0.795 0.035];
rule = "blur";
namespace = "^(blur-bg.*)";
}
{
rule = "ignorealpha 0.19";
namespace = "^(blur-bg.*)";
}
];
animation = map mkAnimation [
exec-once = [
"ags"
"sleep 3; ags request 'open win-applauncher'"
];
bind = map mkBind [
{
name = "workspaces";
duration = 6;
bezier = "easeOutQuart";
style = "slide";
modifier = "$mainMod SHIFT";
key = "E";
command = "ags toggle win-powermenu";
}
{
modifier = "$mainMod";
key = "D";
command = "ags toggle win-applauncher";
}
{
modifier = "$mainMod";
key = "V";
command = "ags toggle win-clipboard";
}
{
key = "Print";
command = "ags toggle win-screenshot";
}
{
name = "windows";
duration = 4;
bezier = "easeOutQuart";
style = "slide";
key = "XF86AudioMute";
command = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
}
{
name = "fadeIn";
enable = false;
key = "XF86AudioMicMute";
command = "pactl set-source-mute @DEFAULT_SOURCE@ toggle";
}
{
name = "fadeOut";
duration = 4;
bezier = "easeInExpo";
modifier = "$mainMod";
key = "Print";
command = "bash -c \"grim -g \\\"$(slurp)\\\" - | satty -f -\"";
}
];
binde = map mkBind [
{
key = "XF86MonBrightnessUp";
command = "ags request 'Brightness.screen +0.05'";
}
{
key = "XF86MonBrightnessDown";
command = "ags request 'Brightness.screen -0.05'";
}
{
name = "fadeLayersIn";
enable = false;
key = "XF86AudioRaiseVolume";
command = "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ & ags request 'popup speaker' &";
}
{
name = "fadeLayersOut";
duration = 4;
bezier = "easeInExpo";
key = "XF86AudioLowerVolume";
command = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- & ags request 'popup speaker' &";
}
];
bindn = map mkBind [
{
name = "layers";
duration = 4;
bezier = "easeInOutQuart";
style = "fade";
key = "Escape";
command = "ags request closeAll";
}
];
bindr = map mkBind [
{
modifier = "CAPS";
key = "Caps_Lock";
command = "ags request fetchCapsState";
}
];
};
layerrule = map mkLayerRule [
{
rule = "animation popin";
namespace = "^(hyprpaper.*)";
}
{
rule = "animation fade";
namespace = "^(bg-layer.*)";
}
{
rule = "noanim";
namespace = "^(noanim-.*)";
}
{
rule = "blur";
namespace = "^(blur-bg.*)";
}
{
rule = "ignorealpha 0.19";
namespace = "^(blur-bg.*)";
}
];
exec-once = [
"ags"
"sleep 3; ags request 'open win-applauncher'"
];
bind = map mkBind [
{
modifier = "$mainMod SHIFT";
key = "E";
command = "ags toggle win-powermenu";
}
{
modifier = "$mainMod";
key = "D";
command = "ags toggle win-applauncher";
}
{
modifier = "$mainMod";
key = "V";
command = "ags toggle win-clipboard";
}
{
key = "Print";
command = "ags toggle win-screenshot";
}
{
key = "XF86AudioMute";
command = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
}
{
key = "XF86AudioMicMute";
command = "pactl set-source-mute @DEFAULT_SOURCE@ toggle";
}
{
modifier = "$mainMod";
key = "Print";
command = "bash -c \"grim -g \\\"$(slurp)\\\" - | satty -f -\"";
}
];
binde = map mkBind [
{
key = "XF86MonBrightnessUp";
command = "ags request 'Brightness.screen +0.05'";
}
{
key = "XF86MonBrightnessDown";
command = "ags request 'Brightness.screen -0.05'";
}
{
key = "XF86AudioRaiseVolume";
command = "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ & ags request 'popup speaker' &";
}
{
key = "XF86AudioLowerVolume";
command = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- & ags request 'popup speaker' &";
}
];
bindn = map mkBind [
{
key = "Escape";
command = "ags request closeAll";
}
];
bindr = map mkBind [
{
modifier = "CAPS";
key = "Caps_Lock";
command = "ags request fetchCapsState";
}
];
};
};

View file

@ -9,7 +9,7 @@ self: {
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;
@ -29,7 +29,7 @@ self: {
'';
};
in {
config = {
config = mkIf cfgDesktop.ags.enable {
# Make these accessible outside these files
programs.ags = {
package = ags.packages.${pkgs.system}.ags.override {

View file

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

View file

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

View file

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

View file

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

View file

@ -1,32 +1,42 @@
{...}: {
{
config,
lib,
...
}: let
inherit (lib) mkIf;
cfg = config.services.borgbackup;
in {
imports = [./module.nix];
config.services.borgbackup = {
existingRepos = [
{
name = "docker";
host = "nos";
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi"
];
}
config = mkIf (cfg.configs != {}) {
services.borgbackup = {
existingRepos = [
{
name = "docker";
host = "nos";
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi"
];
}
{
name = "mc";
host = "servivi";
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi"
];
}
{
name = "mc";
host = "servivi";
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi"
];
}
{
name = "seven-days";
host = "nos";
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi"
];
}
];
{
name = "seven-days";
host = "nos";
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi"
];
}
];
};
};
# For accurate stack trace

View file

@ -92,7 +92,7 @@ self: {
}/Caddyfile";
in {
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 {

View file

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

View file

@ -1,4 +1,4 @@
{cfg}: {
cfg: {
lib,
name,
...
@ -22,7 +22,7 @@ in {
};
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 = {};
example = literalExpression ''
{

View file

@ -1,4 +1,4 @@
{cfg}: {lib, ...}: let
cfg: {lib, ...}: let
inherit (lib) literalExpression mkOption types;
in {
options = {
@ -12,7 +12,7 @@ in {
};
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 = {};
example = literalExpression ''
{
@ -30,7 +30,7 @@ in {
};
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 = {};
example = literalExpression ''
{

View file

@ -3,10 +3,10 @@ self: {
lib,
...
}: let
inherit (lib) elemAt mkOption types;
inherit (self.inputs) home-manager;
inherit (lib) elemAt mkIf mkOption types;
cfg = config.roles.desktop;
flakeDir = config.environment.variables.FLAKE;
in {
@ -18,17 +18,24 @@ in {
home-manager.nixosModules.home-manager
];
config.assertions = [
{
assertion = lib.hasPrefix "/home/${cfg.user}/" flakeDir;
message = ''
Your $FLAKE environment variable needs to point to a directory in
the main users' home to use the desktop module.
'';
}
];
config = mkIf cfg.enable {
assertions = [
{
assertion = lib.hasPrefix "/home/${cfg.user}/" flakeDir;
message = ''
Your $FLAKE environment variable needs to point to a directory in
the main users' home to use the desktop module.
'';
}
];
};
options.roles.desktop = {
enable = mkOption {
type = types.bool;
default = false;
};
user = mkOption {
type = types.str;
description = ''

View file

@ -6,6 +6,19 @@ self: {
}: let
inherit (self.inputs) hyprland;
inherit (self.lib.hypr) mkBind;
inherit (lib) concatStringsSep mkIf optionals;
cfg = config.roles.desktop;
hyprCfg =
config
.home-manager
.users
.${cfg.user}
.wayland
.windowManager
.hyprland;
in {
imports = [
(import ../../ags self)
@ -18,20 +31,7 @@ in {
(import ./modules/security.nix self)
];
config = let
inherit (lib) concatStringsSep optionals;
cfg = config.roles.desktop;
hyprCfg =
config
.home-manager
.users
.${cfg.user}
.wayland
.windowManager
.hyprland;
in {
config = mkIf cfg.enable {
services = {
dbus.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 = {
# 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";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,44 +3,45 @@ self: {
lib,
pkgs,
...
}: {
config = let
inherit (self.lib.hypr) mkBind;
inherit (lib) getExe map mkIf;
}: let
inherit (self.lib.hypr) mkBind;
cfg = config.roles.desktop;
inherit (lib) getExe map mkIf;
hmCfg = config.home-manager.users.${cfg.user};
hyprPkg = hmCfg.wayland.windowManager.hyprland.finalPackage;
cfg = config.roles.desktop;
# See modules/ags/packages.nix
lockPkg = hmCfg.programs.ags.lockPkg;
hmCfg = config.home-manager.users.${cfg.user};
hyprPkg = hmCfg.wayland.windowManager.hyprland.finalPackage;
runInDesktop = pkgs.writeShellApplication {
name = "runInDesktop";
runtimeInputs = [
pkgs.sudo
hyprPkg
];
# See modules/ags/packages.nix
lockPkg = hmCfg.programs.ags.lockPkg;
text = ''
params=( "$@" )
user="$(id -u ${cfg.user})"
readarray -t SIGS <<< "$(ls "/run/user/$user/hypr/")"
runInDesktop = pkgs.writeShellApplication {
name = "runInDesktop";
runtimeInputs = [
pkgs.sudo
hyprPkg
];
run() {
export HYPRLAND_INSTANCE_SIGNATURE="$1"
sudo -Eu ${cfg.user} hyprctl dispatch exec "''${params[@]}"
}
text = ''
params=( "$@" )
user="$(id -u ${cfg.user})"
readarray -t SIGS <<< "$(ls "/run/user/$user/hypr/")"
i=0
run() {
export HYPRLAND_INSTANCE_SIGNATURE="$1"
sudo -Eu ${cfg.user} hyprctl dispatch exec "''${params[@]}"
}
while ! run "''${SIGS[$i]}"; do
((i+=1))
done
'';
};
in {
i=0
while ! run "''${SIGS[$i]}"; do
((i+=1))
done
'';
};
in {
config = mkIf cfg.enable {
services.acpid = mkIf cfg.isLaptop {
enable = true;

View file

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

View file

@ -3,58 +3,57 @@ self: {
lib,
pkgs,
...
}: {
}: let
inherit (lib) mkIf;
cfg = config.roles.desktop;
hyprland =
config
.home-manager
.users
.${cfg.user}
.wayland
.windowManager
.hyprland
.finalPackage;
# Hide TTY on launch
cmd = toString (pkgs.writeShellScript "hyprland-wrapper" ''
trap 'systemctl --user stop hyprland-session.target; sleep 1' EXIT
exec Hyprland >/dev/null
'');
in {
imports = [
(import ./ags.nix self)
(import ./hyprland.nix self)
(import ./ags self)
(import ./hyprland self)
];
config = let
inherit (lib) mkIf;
config = mkIf (cfg.enable && cfg.displayManager.enable) {
services = {
displayManager.sessionPackages = [hyprland];
cfg = config.roles.desktop;
greetd = {
enable = true;
settings = {
default_session = {
command = cmd;
user = "greeter";
};
hyprland =
config
.home-manager
.users
.${cfg.user}
.wayland
.windowManager
.hyprland
.finalPackage;
# Hide TTY on launch
cmd = toString (pkgs.writeShellScript "hyprland-wrapper" ''
trap 'systemctl --user stop hyprland-session.target; sleep 1' EXIT
exec Hyprland >/dev/null
'');
in
mkIf cfg.displayManager.enable {
services = {
displayManager.sessionPackages = [hyprland];
greetd = {
enable = true;
settings = {
default_session = {
command = cmd;
user = "greeter";
};
initial_session = {
command = cmd;
user = cfg.user;
};
initial_session = {
command = cmd;
user = cfg.user;
};
};
};
# unlock GPG keyring on login
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
};
# unlock GPG keyring on login
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
};
# For accurate stack trace
_file = ./default.nix;
}

View file

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

View file

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

View file

@ -1,26 +1,36 @@
self: {...}: {
self: {
lib,
osConfig,
...
}: let
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
in {
imports = [
./gtk
./xresources.nix
./xresources
(import ./cursors.nix self)
(import ./qt.nix self)
(import ./hyprpaper.nix self)
(import ./cursors self)
(import ./hyprpaper self)
(import ./qt self)
];
config.wayland.windowManager.hyprland = {
settings = {
windowrule = [
"size 1231 950,title:^(Open Folder)$"
"float,title:^(Open Folder)$"
config = mkIf cfg.enable {
wayland.windowManager.hyprland = {
settings = {
windowrule = [
"size 1231 950,title:^(Open Folder)$"
"float,title:^(Open Folder)$"
"size 1231 950,title:^(Open File)$"
"float,title:^(Open File)$"
];
"size 1231 950,title:^(Open File)$"
"float,title:^(Open File)$"
];
layerrule = [
"noanim, selection"
];
layerrule = [
"noanim, selection"
];
};
};
};

View file

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

View file

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

View file

@ -3,12 +3,14 @@ self: {
osConfig,
pkgs,
...
}: {
config = let
inherit (self.scopedPackages.${pkgs.system}) dracula;
}: let
inherit (self.scopedPackages.${pkgs.system}) dracula;
cfg = osConfig.roles.desktop;
in {
inherit (lib) mkIf;
cfg = osConfig.roles.desktop;
in {
config = mkIf cfg.enable {
home.packages = [
pkgs.libsForQt5.qtstyleplugin-kvantum
pkgs.kdePackages.qtstyleplugin-kvantum
@ -44,5 +46,5 @@ self: {
};
# 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 = {
docker = {
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
systemd.services.esphome = {
environment.PLATFORMIO_CORE_DIR = mkForce "${stateDir}/.platformio";

View file

@ -7,26 +7,28 @@
cfg = config.boot.plymouth;
in {
config.boot = mkIf cfg.enable {
initrd = {
verbose = false;
systemd.enable = true;
config = mkIf cfg.enable {
boot = {
initrd = {
verbose = false;
systemd.enable = true;
};
consoleLogLevel = 0;
kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"i915.fastboot=1"
"loglevel=3"
"rd.systemd.show_status=false"
"rd.udev.log_level=3"
"udev.log_priority=3"
];
loader.timeout = 0;
};
consoleLogLevel = 0;
kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"i915.fastboot=1"
"loglevel=3"
"rd.systemd.show_status=false"
"rd.udev.log_level=3"
"udev.log_priority=3"
];
loader.timeout = 0;
};
# For accurate stack trace

View file

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

View file

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

View file

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

View file

@ -4,14 +4,14 @@
pkgs,
...
}: let
inherit (lib) attrValues elemAt hasAttr mkIf mkOption types;
inherit (lib) attrValues hasAttr head mkIf mkOption types;
cfg = config.programs.tmux;
# Support NixOnDroid
firstUser =
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;
in {
options.programs.tmux = {

View file

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