From af5411f3302491d5fdebc92fd24a4ea8d8401b8c Mon Sep 17 00:00:00 2001 From: agryphus Date: Wed, 13 Dec 2023 08:57:32 -0500 Subject: [PATCH] Factored nix wm configs --- .config/nixos/core.nix | 7 ++ .config/nixos/profiles/desktop_wayland.nix | 78 ----------------- .../profiles/{desktop_x.nix => wm/dwm.nix} | 24 ------ .config/nixos/profiles/wm/hyprland.nix | 84 +++++++++++++++++++ 4 files changed, 91 insertions(+), 102 deletions(-) delete mode 100644 .config/nixos/profiles/desktop_wayland.nix rename .config/nixos/profiles/{desktop_x.nix => wm/dwm.nix} (73%) create mode 100644 .config/nixos/profiles/wm/hyprland.nix diff --git a/.config/nixos/core.nix b/.config/nixos/core.nix index 09ae173..8adba03 100644 --- a/.config/nixos/core.nix +++ b/.config/nixos/core.nix @@ -19,6 +19,12 @@ "/share" ]; + i18n.defaultLocale = "en_US.UTF-8"; + + fonts.packages = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + ]; + networking.networkmanager.enable = true; # Bluetooth daemon @@ -91,6 +97,7 @@ pass-nodmenu # CLI password store (without dmenu dependency) pinentry-curses # Terminal-based pinentry program python311 # Python + socat # Interact with sockets syncthing # Syncing files between machines tldr # Brief info about a command tmux # Terminal multiplexor diff --git a/.config/nixos/profiles/desktop_wayland.nix b/.config/nixos/profiles/desktop_wayland.nix deleted file mode 100644 index 2448b9e..0000000 --- a/.config/nixos/profiles/desktop_wayland.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ config, pkgs, ... }: - -{ - environment.sessionVariables = { - TERMINAL = "footclient"; - }; - - # Or else swaylock will not accept correct password - security.pam.services.swaylock = {}; - - i18n = { - defaultLocale = "en_US.UTF-8"; - inputMethod = { - # Have to install fcitx5 through here so that the binary is patched to be able to see the addons. - # If also installed through system packages, the binary without addonds will take precedence. - enabled = "fcitx5"; - fcitx5.addons = with pkgs; [ - fcitx5-configtool - fcitx5-rime - fcitx5-chinese-addons - ]; - }; - }; - - fonts.packages = with pkgs; [ - source-han-sans - source-han-serif - (nerdfonts.override { fonts = [ "FiraCode" ]; }) - ]; - - programs = { - hyprland = { - enable = true; - enableNvidiaPatches = true; - xwayland.enable = true; - }; - }; - - environment.systemPackages = with pkgs; [ - blueman # Bluetooth manager - dunst # Notification daemon - eww-wayland - firefox # My browser of choice - foot # Wayland native terminal - hyprland-autoname-workspaces - hyprpaper - kanshi # Autorandr substitute - libnotify # Send messages to notification daemon - libreoffice # MSOffice btfo - pinentry-rofi # Rofi frontend for pinentry program - pyprland # Plugin manager for Hyprland - rofi # Menu prompt program - rofi-pass # Rofi frontend for password store - swaylock # Wayland session locker - swww # Sets background images - texlive.combined.scheme-full # LaTeX to create documents - typst # Cool, minimal LaTeX alternative - ungoogled-chromium # If I need a special chrome feature - waybar # Status bar - wdisplays # Arnadr substitute - wlr-randr # Xrandr substitute - - # GTK Themes - lxappearance-gtk2 # Theme switcher - gruvbox-dark-gtk - ]; - - nixpkgs.overlays = [ - (self: super: { - wlroots-hyprland-nvidia = super.wlroots-hyprland-nvidia.overrideAttrs (oa: { - patches = (oa.patches or [ ]) ++ [ - /home/vince/misc/DisplayLink_v2.patch - ]; - }); - }) - ]; -} - diff --git a/.config/nixos/profiles/desktop_x.nix b/.config/nixos/profiles/wm/dwm.nix similarity index 73% rename from .config/nixos/profiles/desktop_x.nix rename to .config/nixos/profiles/wm/dwm.nix index a2b2627..80a8086 100644 --- a/.config/nixos/profiles/desktop_x.nix +++ b/.config/nixos/profiles/wm/dwm.nix @@ -1,34 +1,10 @@ { config, pkgs, ... }: { - environment.sessionVariables = { - TERMINAL = "st"; - }; - security.sudo.extraConfig = '' %wheel ALL=(ALL:ALL) NOPASSWD: ${pkgs.systemd}/bin/systemctl restart autorandr ''; - i18n = { - defaultLocale = "en_US.UTF-8"; - inputMethod = { - # Have to install fcitx5 through here so that the binary is patched to be able to see the addons. - # If also installed through system packages, the binary without addonds will take precedence. - enabled = "fcitx5"; - fcitx5.addons = with pkgs; [ - fcitx5-configtool - fcitx5-rime - fcitx5-chinese-addons - ]; - }; - }; - - fonts.packages = with pkgs; [ - source-han-sans - source-han-serif - (nerdfonts.override { fonts = [ "FiraCode" ]; }) - ]; - # X Server services.xserver = { enable = true; diff --git a/.config/nixos/profiles/wm/hyprland.nix b/.config/nixos/profiles/wm/hyprland.nix new file mode 100644 index 0000000..fc2e3b4 --- /dev/null +++ b/.config/nixos/profiles/wm/hyprland.nix @@ -0,0 +1,84 @@ +{ config, pkgs, ... }: + +{ + # Or else swaylock will not accept correct password + security.pam.services.swaylock = {}; + + programs = { + hyprland = { # Dynamic tiling window manager + enable = true; + enableNvidiaPatches = true; + xwayland.enable = true; + }; + waybar.enable = true; # Status bar + }; + + systemd.user.services = { + hyprland-autoname-workspaces = { + description = "Hyprland-autoname-workspaces as systemd service"; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + script = "${pkgs.hyprland-autoname-workspaces}/bin/hyprland-autoname-workspaces"; + }; + network-manager-applet = { + description = "Start the network manager applet"; + wantedBy = [ "default.target" ]; + serviceConfig.Type = "forking"; + serviceConfig.Restart = "always"; + serviceConfig.RestartSec = 2; + serviceConfig.ExecStart = "${pkgs.networkmanagerapplet}/bin/nm-applet"; + }; + }; + + environment.systemPackages = with pkgs; [ + blueman # Bluetooth manager + dunst # Notification daemon + eww-wayland + firefox # My browser of choice + foot # Wayland native terminal + gobble # Wayland alternative to devour + grim # Screenshot tool + grimblast # Allows freezing screen + hicolor-icon-theme # Icons + hyprland-autoname-workspaces + hyprpaper + kanshi # Autorandr substitute + libnotify # Send messages to notification daemon + libreoffice # MSOffice btfo + networkmanagerapplet # Wifi dropdown menu + pinentry-rofi # Rofi frontend for pinentry program + pyprland # Plugin manager for Hyprland + rofi # Menu prompt program + rofi-pass # Rofi frontend for password store + slurp # Screen selection utility + swaylock # Wayland session locker + swww # Sets background images + texlive.combined.scheme-full # LaTeX to create documents + typst # Cool, minimal LaTeX alternative + ungoogled-chromium # If I need a special chrome feature + wayland-utils + wdisplays # Arnadr substitute + wl-clipboard # Copy/paste utility + wlr-randr # Xrandr substitute + + # GTK Themes + lxappearance-gtk2 # Theme switcher + gruvbox-dark-gtk + + # Specific versions of packages + (import (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/9957cd48326fe8dbd52fdc50dd2502307f188b0d.tar.gz"; + }) {}).hyprpicker # v0.1.1. Current verison causes segfault. + ]; + + nixpkgs.overlays = [ + (self: super: { + grimblast = super.grimblast.override (oa: { + hyprpicker = (import (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/9957cd48326fe8dbd52fdc50dd2502307f188b0d.tar.gz"; + }) {}).hyprpicker; # v0.1.1. Current verison causes segfault. + }); + }) + ]; +} +