diff --git a/hosts/bunk/default.nix b/hosts/bunk/default.nix index 318f89f4..62cff33d 100644 --- a/hosts/bunk/default.nix +++ b/hosts/bunk/default.nix @@ -33,6 +33,7 @@ in { imports = [ ./hardware-configuration.nix ./modules.nix + ./options.nix ]; networking.hostName = "bunk"; @@ -46,12 +47,6 @@ in { environment.variables.NH_FLAKE = "/home/cnst/.nix-config"; - programs.hyprland.settings = { - monitor = [ - "eDP-1,1920x1200@60,0x0,1,transform,0" - ]; - }; - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = lib.mkDefault "23.11"; } diff --git a/users/cnst/modules/bunkopt.nix b/hosts/bunk/options.nix similarity index 85% rename from users/cnst/modules/bunkopt.nix rename to hosts/bunk/options.nix index 6b67065c..ec263507 100644 --- a/users/cnst/modules/bunkopt.nix +++ b/hosts/bunk/options.nix @@ -14,17 +14,15 @@ transform = 0; bitDepth = 10; workspace = "1"; - primary = true; } { - name = "DP-4"; + name = "HDMI-A-1"; width = 1920; height = 1080; refreshRate = 60; position = "2560x0"; - transform = 3; + # transform = 3; workspace = "5"; - primary = false; } { name = "eDP-1"; @@ -32,7 +30,6 @@ height = 1200; refreshRate = 60; workspace = "1"; - primary = false; } ]; theme = { diff --git a/hosts/kima/default.nix b/hosts/kima/default.nix index f93ebf5d..639be5b4 100644 --- a/hosts/kima/default.nix +++ b/hosts/kima/default.nix @@ -33,6 +33,7 @@ in { imports = [ ./hardware-configuration.nix ./modules.nix + ./options.nix ]; time.hardwareClockInLocalTime = true; @@ -44,12 +45,12 @@ in { GEMINI_API_KEY = config.age.secrets.gcapi.path; }; - programs.hyprland.settings = { - monitor = [ - "DP-3,2560x1440@240,0x0,1,transform,0,bitdepth,10" - "DP-4,1920x1080@60,auto,1,transform,3" - ]; - }; + # programs.hyprland.settings = { + # monitor = [ + # "DP-3,2560x1440@240,0x0,1,transform,0,bitdepth,10" + # "DP-4,1920x1080@60,auto,1,transform,3" + # ]; + # }; # # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = lib.mkDefault "23.11"; diff --git a/users/cnst/modules/kimaopt.nix b/hosts/kima/options.nix similarity index 85% rename from users/cnst/modules/kimaopt.nix rename to hosts/kima/options.nix index c8183b81..82a835c7 100644 --- a/users/cnst/modules/kimaopt.nix +++ b/hosts/kima/options.nix @@ -14,17 +14,15 @@ transform = 0; bitDepth = 10; workspace = "1"; - primary = true; } { - name = "DP-4"; + name = "HDMI-A-1"; width = 1920; height = 1080; refreshRate = 60; position = "2560x0"; - transform = 3; + # transform = 3; workspace = "5"; - primary = false; } { name = "eDP-1"; @@ -32,7 +30,6 @@ height = 1200; refreshRate = 60; workspace = "1"; - primary = false; } ]; theme = { diff --git a/hosts/sobotka/default.nix b/hosts/sobotka/default.nix index 8c437881..864bcdda 100644 --- a/hosts/sobotka/default.nix +++ b/hosts/sobotka/default.nix @@ -35,6 +35,7 @@ in { imports = [ ./hardware-configuration.nix ./modules.nix + ./options.nix ./server.nix ]; diff --git a/hosts/sobotka/options.nix b/hosts/sobotka/options.nix new file mode 100644 index 00000000..8926b95c --- /dev/null +++ b/hosts/sobotka/options.nix @@ -0,0 +1,7 @@ +{ + accounts = { + username = "cnst"; + mail = "adam@cnst.dev"; + sshUser = "sobotka"; + }; +} diff --git a/hosts/toothpc/default.nix b/hosts/toothpc/default.nix index 4cf23bfb..54b6a42d 100644 --- a/hosts/toothpc/default.nix +++ b/hosts/toothpc/default.nix @@ -33,6 +33,7 @@ in { imports = [ ./hardware-configuration.nix ./modules.nix + ./options.nix ]; networking.hostName = "toothpc"; diff --git a/hosts/toothpc/options.nix b/hosts/toothpc/options.nix new file mode 100644 index 00000000..8e9ab9a1 --- /dev/null +++ b/hosts/toothpc/options.nix @@ -0,0 +1,22 @@ +{ + accounts = { + username = "toothpick"; + mail = "place@holder"; + sshUser = "toothpc"; + }; + monitors = [ + { + name = "DVI-D-1"; + width = 1920; + height = 1080; + refreshRate = 144; + workspace = "1"; + } + ]; + theme = { + background = { + lockscreen = "wallpaper_2"; + desktop = "wallpaper_1"; + }; + }; +} diff --git a/modules/home/programs/fish/default.nix b/modules/home/programs/fish/default.nix index 2a2848cf..41563194 100644 --- a/modules/home/programs/fish/default.nix +++ b/modules/home/programs/fish/default.nix @@ -39,8 +39,8 @@ in { nixconfig = "cd /home/$USER/.nix-config/"; homemodules = "$EDITOR /home/$USER/.nix-config/users/$USER/modules/{$hostname}mod.nix"; hmod = "$EDITOR /home/$USER/.nix-config/users/$USER/modules/{$hostname}mod.nix"; - homeoptions = "$EDITOR /home/$USER/.nix-config/users/$USER/modules/{$hostname}opt.nix"; - hopt = "$EDITOR /home/$USER/.nix-config/users/$USER/modules/{$hostname}opt.nix"; + nixoptions = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/options.nix"; + nopt = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/options.nix"; nixosmodules = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix"; nmod = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix"; tree = "${getExe eza} --tree --icons=always"; diff --git a/modules/home/programs/git/default.nix b/modules/home/programs/git/default.nix index 14050568..4fd5935d 100644 --- a/modules/home/programs/git/default.nix +++ b/modules/home/programs/git/default.nix @@ -2,6 +2,7 @@ config, pkgs, lib, + osConfig, ... }: let inherit (lib) mkIf mkEnableOption; @@ -14,8 +15,8 @@ in { home.packages = [pkgs.gh]; programs.git = { enable = true; - userName = config.accounts.username; - userEmail = config.accounts.mail; + userName = osConfig.accounts.username; + userEmail = osConfig.accounts.mail; delta = { enable = true; options.dark = true; @@ -53,7 +54,7 @@ in { ]; }; xdg.configFile."git/allowed_signers".text = '' - ${config.accounts.mail} namespaces="git" ${config.accounts.sshKey} + ${osConfig.accounts.mail} namespaces="git" ${osConfig.accounts.sshKey} ''; }; } diff --git a/modules/home/programs/hyprlock/default.nix b/modules/home/programs/hyprlock/default.nix index f8d7af23..b374c536 100644 --- a/modules/home/programs/hyprlock/default.nix +++ b/modules/home/programs/hyprlock/default.nix @@ -3,6 +3,7 @@ pkgs, config, lib, + osConfig, ... }: let inherit (lib) mkIf mkEnableOption; @@ -30,7 +31,7 @@ in { background = [ { monitor = ""; - path = config.theme.background.lockscreen; + path = osConfig.theme.background.lockscreen; } ]; input-field = [ diff --git a/modules/home/services/hyprpaper/default.nix b/modules/home/services/hyprpaper/default.nix index 6ed2edf0..8380e96c 100644 --- a/modules/home/services/hyprpaper/default.nix +++ b/modules/home/services/hyprpaper/default.nix @@ -3,6 +3,7 @@ lib, pkgs, inputs, + osConfig, ... }: let inherit (lib) mkIf mkEnableOption; @@ -41,13 +42,13 @@ in { ]; wallpaper = [ - # cnixtop - "DP-3,${config.theme.background.desktop}" - "DP-4,${config.theme.background.desktop}" - # cnixpad - "eDP-1,${config.theme.background.desktop}" + # kima + "DP-3,${osConfig.theme.background.desktop}" + "HDMI-A-1,${osConfig.theme.background.lockscreen}" + # bunk + "eDP-1,${osConfig.theme.background.desktop}" # toothpc - "DVI-D-1,${config.theme.background.desktop}" + "DVI-D-1,${osConfig.theme.background.desktop}" ]; }; }; diff --git a/modules/nixos/programs/hyprland/default.nix b/modules/nixos/programs/hyprland/default.nix index 00e67282..82187ff9 100644 --- a/modules/nixos/programs/hyprland/default.nix +++ b/modules/nixos/programs/hyprland/default.nix @@ -13,7 +13,7 @@ in { ./appearance.nix ./inputs.nix ./keybinds.nix - ./rules.nix + ./layout.nix ./startup.nix ]; diff --git a/modules/nixos/programs/hyprland/layout.nix b/modules/nixos/programs/hyprland/layout.nix new file mode 100644 index 00000000..a76ca259 --- /dev/null +++ b/modules/nixos/programs/hyprland/layout.nix @@ -0,0 +1,112 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkIf mkEnableOption mkMerge; + host = config.networking.hostName; + cfg = config.nixos.programs.hyprland.rules; +in { + options = { + nixos.programs.hyprland.rules.enable = mkEnableOption "Enables window rule settings in Hyprland"; + }; + + config = mkIf cfg.enable { + programs.hyprland.settings = { + monitor = + map ( + m: let + resolution = + if m.width != null && m.height != null + then "${toString m.width}x${toString m.height}@${toString m.refreshRate}" + else "preferred"; + + position = m.position or "auto"; + scale = m.scale; + + transformStr = + if m.transform != 0 + then ",transform,${toString m.transform}" + else ""; + + bitdepthStr = + if m.bitDepth != null + then ",bitdepth,${toString m.bitDepth}" + else ""; + in "${m.name},${ + if m.enabled + then "${resolution},${position},${scale}${transformStr}${bitdepthStr}" + else "disable" + }" + ) + config.monitors; + + workspace = map ( + m: "${m.workspace},monitor:${m.name}" + ) (lib.filter (m: m.enabled && m.workspace != null) config.monitors); + + windowrule = [ + "size 843 650, initialTitle:^(floatcal)$" + "move 100%-w-20 40, initialTitle:^(floatcal)$" + "float, initialTitle:^(floatcal)$" + + "size 600 300, title:^(tuirun)$" + "center, title:^(tuirun)$" + "noborder, title:^(tuirun)$" + "float, title:^(tuirun)$" + + "size 843 530, class:^(org.keepassxc.KeePassXC)$" + "move 100%-w-20 40, class:^(org.keepassxc.KeePassXC)$" + "float, class:^(org.keepassxc.KeePassXC)$" + + "size 50% 70%, class:^(net.nokyan.Resources)$" + "center, class:^(net.nokyan.Resources)$" + "float, class:^(net.nokyan.Resources)$" + + "suppressevent maximize, class:.*" + + "center, class:^(nwg-look)$" + "float, class:^(nwg-look)$" + + "center, class:^(oculante)$" + "float, class:^(oculante)$" + + "move 100%-w-20 40, class:^(pavucontrol)$" + "size 741 585, class:^(pavucontrol)$" + "float, class:^(pavucontrol)$" + + "center, class:^(xarchiver)$" + "float, class:^(xarchiver)$" + + "float, class:^(org.gnome.FileRoller)$" + "float, class:^(org.freedesktop.impl.portal.desktop.kde)$" + "float, class:^(org.corectrl.CoreCtrl)$" + "float, class:^(feh)$" + "float, class:^(polkit-gnome-authentication-agent-1)$" + "float, class:^(org.gnome.Calculator)$" + "float, class:^(com.github.hluk.copyq)$" + "float, class:^(blueman-manager)$" + + # "workspace 5 silent, class:^(discord)$" + # "workspace 5 silent, class:^(vesktop)$" + "workspace 4 silent, class:^(steam_app_0)$" + "workspace 4 silent, title:^(World of Warcraft)$" + ]; + layerrule = [ + "animation fade,hyprpicker" + "animation fade,selection" + + "animation fade,waybar" + "ignorezero,waybar" + "ignorealpha 0.0,waybar" + "blur,waybar" + + "blur,notifications" + "ignorezero,notifications" + + "noanim,wallpaper" + "noanim,launcher" + ]; + }; + }; +} diff --git a/modules/nixos/programs/hyprland/rules.nix b/modules/nixos/programs/hyprland/rules.nix deleted file mode 100644 index 758fa913..00000000 --- a/modules/nixos/programs/hyprland/rules.nix +++ /dev/null @@ -1,102 +0,0 @@ -{ - lib, - config, - ... -}: let - inherit (lib) mkIf mkEnableOption mkMerge; - host = config.networking.hostName; - cfg = config.nixos.programs.hyprland.rules; -in { - options = { - nixos.programs.hyprland.rules.enable = mkEnableOption "Enables window rule settings in Hyprland"; - }; - - config = mkIf cfg.enable (mkMerge [ - { - programs.hyprland.settings = { - windowrule = [ - "size 843 650, initialTitle:^(floatcal)$" - "move 100%-w-20 40, initialTitle:^(floatcal)$" - "float, initialTitle:^(floatcal)$" - - "size 600 300, title:^(tuirun)$" - "center, title:^(tuirun)$" - "noborder, title:^(tuirun)$" - "float, title:^(tuirun)$" - - "size 843 530, class:^(org.keepassxc.KeePassXC)$" - "move 100%-w-20 40, class:^(org.keepassxc.KeePassXC)$" - "float, class:^(org.keepassxc.KeePassXC)$" - - "size 50% 70%, class:^(net.nokyan.Resources)$" - "center, class:^(net.nokyan.Resources)$" - "float, class:^(net.nokyan.Resources)$" - - "suppressevent maximize, class:.*" - - "center, class:^(nwg-look)$" - "float, class:^(nwg-look)$" - - "center, class:^(oculante)$" - "float, class:^(oculante)$" - - "move 100%-w-20 40, class:^(pavucontrol)$" - "size 741 585, class:^(pavucontrol)$" - "float, class:^(pavucontrol)$" - - "center, class:^(xarchiver)$" - "float, class:^(xarchiver)$" - - "float, class:^(org.gnome.FileRoller)$" - "float, class:^(org.freedesktop.impl.portal.desktop.kde)$" - "float, class:^(org.corectrl.CoreCtrl)$" - "float, class:^(feh)$" - "float, class:^(polkit-gnome-authentication-agent-1)$" - "float, class:^(org.gnome.Calculator)$" - "float, class:^(com.github.hluk.copyq)$" - "float, class:^(blueman-manager)$" - - # "workspace 5 silent, class:^(discord)$" - # "workspace 5 silent, class:^(vesktop)$" - "workspace 4 silent, class:^(steam_app_0)$" - "workspace 4 silent, title:^(World of Warcraft)$" - ]; - layerrule = [ - "animation fade,hyprpicker" - "animation fade,selection" - - "animation fade,waybar" - "ignorezero,waybar" - "ignorealpha 0.0,waybar" - "blur,waybar" - - "blur,notifications" - "ignorezero,notifications" - - "noanim,wallpaper" - "noanim,launcher" - ]; - }; - } - (mkIf (host == "kima") { - programs.hyprland.settings.workspace = [ - "name:1,monitor:DP-3" - "name:2,monitor:DP-3" - "name:3,monitor:DP-3" - "name:4,monitor:DP-3" - "name:5,monitor:DP-3" - "name:6,monitor:DP-3" - "name:7,monitor:DP-3" - "name:8,monitor:DP-3" - "name:9,monitor:DP-3" - "name:10,monitor:DP-3" - ]; - }) - (mkIf (host == "bunk") { - programs.hyprland.settings.workspace = []; - }) - (mkIf (host == "toothpc") { - programs.hyprland.settings.workspace = []; - }) - ]); -} diff --git a/modules/options/monitors/default.nix b/modules/options/monitors/default.nix index 86d58f48..0a111128 100644 --- a/modules/options/monitors/default.nix +++ b/modules/options/monitors/default.nix @@ -14,10 +14,6 @@ in { type = types.str; example = "DP-1"; }; - primary = mkOption { - type = types.bool; - default = false; - }; width = mkOption { type = types.int; example = 1920; @@ -60,14 +56,4 @@ in { ); default = []; }; - config = { - assertions = [ - { - assertion = - ((lib.length config.monitors) != 0) - -> ((lib.length (lib.filter (m: m.primary) config.monitors)) == 1); - message = "Exactly one monitor must be set to primary."; - } - ]; - }; } diff --git a/users/cnst/modules/default.nix b/users/cnst/modules/default.nix index 1118e9d8..ddd2d1ee 100644 --- a/users/cnst/modules/default.nix +++ b/users/cnst/modules/default.nix @@ -3,16 +3,13 @@ if osConfig.networking.hostName == "sobotka" then [ ./sobotkamod.nix - ./sobotkaopt.nix ] else if osConfig.networking.hostName == "bunk" then [ ./bunkmod.nix - ./bunkopt.nix ] else [ ./kimamod.nix - ./kimaopt.nix ]; in { imports = hostSpecificImports; diff --git a/users/cnst/modules/sobotkaopt.nix b/users/cnst/modules/sobotkaopt.nix deleted file mode 100644 index dc8ec81e..00000000 --- a/users/cnst/modules/sobotkaopt.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ - accounts = { - username = "cnst"; - mail = "adam@cnst.dev"; - sshUser = "sobotka"; - }; - monitors = [ - { - name = "DP-3"; - width = 2560; - height = 1440; - refreshRate = 240; - position = "0x0"; - transform = 0; - bitDepth = 10; - workspace = "1"; - primary = true; - } - { - name = "DP-4"; - width = 1920; - height = 1080; - refreshRate = 60; - position = "2560x0"; - transform = 3; - workspace = "5"; - primary = false; - } - { - name = "eDP-1"; - width = 1920; - height = 1200; - refreshRate = 60; - workspace = "1"; - primary = false; - } - ]; - theme = { - background = { - lockscreen = "wallpaper_2"; - desktop = "wallpaper_1"; - }; - }; -} diff --git a/users/default.nix b/users/default.nix index 068cae5e..9b8a1bb0 100644 --- a/users/default.nix +++ b/users/default.nix @@ -9,7 +9,7 @@ "${self}/scripts" inputs.nvf.homeManagerModules.default self.nixosModules.home - self.nixosModules.options + # self.nixosModules.options ]; homeImports = {