From b78f3a54f0887a9eb0d95875ae91476aeed0a1cc Mon Sep 17 00:00:00 2001 From: pagedmov Date: Mon, 11 Nov 2024 17:52:20 -0500 Subject: [PATCH] made waybar and hyprland configs more compatible with the single-monitor layout --- flake.nix | 4 +- hosts/desktop/config.nix | 1 - hosts/laptop/config.nix | 64 ++++++++++++++++++++++----- hosts/laptop/home.nix | 52 ++++++++++++---------- modules/home/environment/hyprland.nix | 12 ++--- modules/home/environment/waybar.nix | 20 ++++----- 6 files changed, 94 insertions(+), 59 deletions(-) diff --git a/flake.nix b/flake.nix index d45fe60..681e324 100755 --- a/flake.nix +++ b/flake.nix @@ -60,7 +60,7 @@ mercuryHome = home-manager.lib.homeManagerConfiguration { inherit pkgs; extraSpecialArgs = { - host = "oganesson"; + host = "mercury"; inherit self username inputs; }; @@ -76,7 +76,7 @@ xenonHome = home-manager.lib.homeManagerConfiguration { inherit pkgs; extraSpecialArgs = { - host = "oganesson"; + host = "xenon"; inherit self username inputs; }; diff --git a/hosts/desktop/config.nix b/hosts/desktop/config.nix index 1cc88a9..47ae677 100755 --- a/hosts/desktop/config.nix +++ b/hosts/desktop/config.nix @@ -59,5 +59,4 @@ nix.settings.allowed-users = [ "${username}" ]; time.timeZone = "America/New_York"; - i18n.defaultLocale = "en_US.UTF-8"; } diff --git a/hosts/laptop/config.nix b/hosts/laptop/config.nix index c47a57b..bc2d61e 100755 --- a/hosts/laptop/config.nix +++ b/hosts/laptop/config.nix @@ -1,22 +1,30 @@ -{ pkgs, config, ... }: { - imports = [ ./hardware.nix ./home.nix ]; +{ username, pkgs, config, ... }: { + imports = [ ./hardware.nix ]; - powerProfiles.enable = true; boot = { kernelModules = [ "acpi_call" ]; extraModulePackages = with config.boot.kernelPackages; [ acpi_call cpupower ] ++ [ pkgs.cpupower-gui ]; }; - networkModule.enable = true; - nixSettings.enable = true; - bootLoader.enable = true; - issue.enable = true; - sddmConfig.enable = true; - stylixConfig.enable = true; - sysPkgs.enable = true; - sysProgs.enable = true; - sysServices.enable = true; + movOpts = { + sysEnv = { + issue.enable = true; + sddmConfig.enable = true; + stylixConfig.enable = true; + nixSettings.enable = true; + }; + hardwareCfg = { + networkModule.enable = true; + bootLoader.enable = true; + powerProfiles.enable = true; + }; + softwareCfg = { + sysPkgs.enable = true; + sysProgs.enable = true; + sysServices.enable = true; + }; + }; environment = { variables = { PATH = "${pkgs.clang-tools}/bin:$PATH"; }; @@ -24,4 +32,36 @@ systemPackages = with pkgs; [ acpi brightnessctl cpupower-gui powertop ]; }; + nix = { + settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + substituters = [ "https://nix-gaming.cachix.org" ]; + }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + users = { + groups.persist = { }; + users = { + root.initialPassword = "1234"; + ${username} = { + isNormalUser = true; + initialPassword = "1234"; + shell = pkgs.zsh; + extraGroups = [ "wheel" "persist" "libvirtd" ]; + }; + }; + }; + security.sudo.extraConfig = '' + ${username} ALL=(ALL) NOPASSWD: /etc/profiles/per-user/${username}/bin/rebuild + ''; + nix.settings.allowed-users = [ "${username}" ]; + + time.timeZone = "America/New_York"; + } diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 05bc6c5..9364c00 100755 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -12,33 +12,37 @@ homeFiles.enable = true; # modules/home/environment - hyprlandConfig = { - enable = true; - workspaceLayout = "singlemonitor"; - monitorNames = [ "eDP-1" ]; + envConfig = { + hyprlandConfig = { + enable = true; + workspaceLayout = "singlemonitor"; + monitorNames = [ "eDP-1" ]; + }; + userPkgs.enable = true; + stylixHomeConfig.enable = true; + waybarConfig.enable = true; + gtkConfig.enable = true; + spicetifyConfig.enable = true; + starshipConfig.enable = true; + swayncConfig.enable = true; + zshConfig.enable = true; }; - autojumpConfig.enable = true; - stylixHomeConfig.enable = true; - waybarConfig.enable = true; - gtkConfig.enable = true; - spicetifyConfig.enable = true; - starshipConfig.enable = true; # modules/home/programs - btopConfig.enable = true; - swayncConfig.enable = true; - userPkgs.enable = true; - cavaConfig.enable = true; - ezaConfig.enable = true; - firefoxConfig.enable = true; - fuzzelConfig.enable = true; - fzfConfig.enable = true; - gitConfig.enable = true; - kittyConfig.enable = true; - yaziConfig.enable = true; - zshConfig.enable = true; - passConfig.enable = true; - batConfig.enable = true; + programConfigs = { + autojumpConfig.enable = true; + btopConfig.enable = true; + cavaConfig.enable = true; + ezaConfig.enable = true; + firefoxConfig.enable = true; + fuzzelConfig.enable = true; + fzfConfig.enable = true; + gitConfig.enable = true; + kittyConfig.enable = true; + yaziConfig.enable = true; + passConfig.enable = true; + batConfig.enable = true; + }; # modules/home/scripts movScripts = { diff --git a/modules/home/environment/hyprland.nix b/modules/home/environment/hyprland.nix index ea8235c..acea048 100755 --- a/modules/home/environment/hyprland.nix +++ b/modules/home/environment/hyprland.nix @@ -67,30 +67,26 @@ in { "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &" ]; - workspace = if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout - == "dualmonitor") then [ + workspace = if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout == "dualmonitor") then [ "1,persistent=true,monitor:${builtins.elemAt mons 0}" "2,persistent=true,monitor:${builtins.elemAt mons 0}" "3,persistent=true,monitor:${builtins.elemAt mons 0}" "4,persistent=true,monitor:${builtins.elemAt mons 1}" "5,persistent=true,monitor:${builtins.elemAt mons 1}" "6,persistent=true,monitor:${builtins.elemAt mons 1}" - ] else if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout - == "singlemonitor") then [ + ] else if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout == "singlemonitor") then [ "1,persistent=true,monitor:${builtins.elemAt mons 0} " "2,persistent=true,monitor:${builtins.elemAt mons 0}" "3,persistent=true,monitor:${builtins.elemAt mons 0}" "4,persistent=true,monitor:${builtins.elemAt mons 0}" - ] else if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout - == "trimonitor") then [ + ] else if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout == "trimonitor") then [ "1,persistent=true,monitor:${builtins.elemAt mons 2}" "2,persistent=true,monitor:${builtins.elemAt mons 2}" "3,persistent=true,monitor:${builtins.elemAt mons 1}" "4,persistent=true,monitor:${builtins.elemAt mons 1}" "5,persistent=true,monitor:${builtins.elemAt mons 0}" "6,persistent=true,monitor:${builtins.elemAt mons 0}" - ] else - [ ]; + ] else [ ]; env = [ "XDG_CONFIG_HOME,$HOME/.config" diff --git a/modules/home/environment/waybar.nix b/modules/home/environment/waybar.nix index 7cdbd17..a905e5e 100755 --- a/modules/home/environment/waybar.nix +++ b/modules/home/environment/waybar.nix @@ -1,7 +1,8 @@ { pkgs, host, lib, config, ... }: let - desktop = host == "oganesson"; + desktop = (host == "oganesson"); + layout = config.movOpts.envConfig.hyprlandConfig.workspaceLayout; workspaces = { format = "{icon}"; format-icons = { @@ -13,15 +14,12 @@ let "6" = "六"; }; persistent-workspaces = - if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout - == "singlemonitor") then { + if (layout == "singlemonitor") then { "${builtins.elemAt monitors 0}" = [ 1 2 3 4 ]; - } else if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout - == "dualmonitor") then { + } else if (layout == "dualmonitor") then { "${builtins.elemAt monitors 0}" = [ 1 2 3 ]; "${builtins.elemAt monitors 1}" = [ 4 5 6 ]; - } else if (config.movOpts.envConfig.hyprlandConfig.workspaceLayout - == "trimonitor") then { + } else if (layout == "trimonitor") then { "${builtins.elemAt monitors 2}" = [ 1 2 ]; "${builtins.elemAt monitors 1}" = [ 3 4 ]; "${builtins.elemAt monitors 0}" = [ 5 6 ]; @@ -71,7 +69,8 @@ in { settings = { mainBar = { layer = "bottom"; - output = builtins.elemAt monitors 1; + output = if layout == "singlemonitor" then builtins.elemAt monitors 0 + else builtins.elemAt monitors 1; position = "top"; name = "mainBar"; margin-left = 8; @@ -193,10 +192,7 @@ in { }; sideBar = { layer = "bottom"; - output = if desktop then - builtins.elemAt monitors 0 - else - builtins.elemAt monitors 1; + output = builtins.elemAt monitors 0; position = "right"; margin-top = 8; margin-right = 5;