From 9d1b3f23a64506988608143f4bca8ab4c5141d3e Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Wed, 2 Oct 2024 22:37:06 -0500 Subject: update moreee --- modules/root/default.nix | 17 ++++- modules/root/resources/x11/xinit-startx-xdg.patch | 14 ++++ modules/root/software.nix | 90 +++++++++++++++++++++++ modules/root/software/default.nix | 23 ------ modules/root/software/desktop-extra.nix | 16 ---- modules/root/software/desktop.nix | 22 ------ modules/root/software/dev-extra.nix | 16 ---- modules/root/software/dev.nix | 23 ------ modules/root/software/utils.nix | 30 -------- modules/root/x11.nix | 30 ++++++++ modules/root/x11/default.nix | 30 -------- modules/root/x11/xinit-startx-xdg.patch | 14 ---- 12 files changed, 149 insertions(+), 176 deletions(-) create mode 100644 modules/root/resources/x11/xinit-startx-xdg.patch create mode 100644 modules/root/software.nix delete mode 100644 modules/root/software/default.nix delete mode 100644 modules/root/software/desktop-extra.nix delete mode 100644 modules/root/software/desktop.nix delete mode 100644 modules/root/software/dev-extra.nix delete mode 100644 modules/root/software/dev.nix delete mode 100644 modules/root/software/utils.nix create mode 100644 modules/root/x11.nix delete mode 100644 modules/root/x11/default.nix delete mode 100644 modules/root/x11/xinit-startx-xdg.patch (limited to 'modules') diff --git a/modules/root/default.nix b/modules/root/default.nix index dd518d2..05453b4 100644 --- a/modules/root/default.nix +++ b/modules/root/default.nix @@ -10,10 +10,10 @@ ./localization.nix ./nix.nix ./pipewire.nix - ./software + ./software.nix ./virtualisation.nix ./wifi.nix - ./x11 + ./x11.nix ]; cups.enable = lib.mkDefault true; @@ -29,6 +29,19 @@ }; home-manager.enable = lib.mkDefault true; pipewire.enable = lib.mkDefault true; + software = { + desktop = { + enable = lib.mkDefault true; + extra.enable = lib.mkDefault false; + }; + dev = { + enable = lib.mkDefault true; + extra.enable = lib.mkDefault false; + }; + utils = { + enable = lib.mkDefault true; + }; + }; virtualisation.enable = lib.mkDefault false; wifi.enable = lib.mkDefault true; xserver.awesome.enable = lib.mkDefault true; diff --git a/modules/root/resources/x11/xinit-startx-xdg.patch b/modules/root/resources/x11/xinit-startx-xdg.patch new file mode 100644 index 0000000..c1bca97 --- /dev/null +++ b/modules/root/resources/x11/xinit-startx-xdg.patch @@ -0,0 +1,14 @@ +diff --git a/startx.cpp b/startx.cpp +index dfbebe1..472a1b0 100644 +--- a/startx.cpp ++++ b/startx.cpp +@@ -272,7 +272,7 @@ if [ x"$enable_xauth" = x1 ] ; then + dummy=0 + + XCOMM create a file with auth information for the server. ':0' is a dummy. +- xserverauthfile=$HOME/.serverauth.$$ ++ xserverauthfile="${XAUTHORITY:-$HOME/.Xauthority}" + trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM + xauth -q -f "$xserverauthfile" << EOF + add :$dummy . $mcookie + diff --git a/modules/root/software.nix b/modules/root/software.nix new file mode 100644 index 0000000..c991456 --- /dev/null +++ b/modules/root/software.nix @@ -0,0 +1,90 @@ +{ pkgs, lib, config, ... }: { + options = { + software = { + desktop = { + enable = lib.mkEnableOption "enables desktop apps"; + extra.enable = lib.mkEnableOption "enables extra desktop apps"; + }; + dev = { + enable = lib.mkEnableOption "enables development utilities"; + extra.enable = lib.mkEnableOption "enables extra development utilities"; + }; + utils = { + enable = lib.mkEnableOption "enables general utilities"; + }; + }; + }; + + config = { + environment.systemPackages = with pkgs; pkgs.lib.optionals config.software.desktop.enable [ + # Desktop + alacritty + arandr + dmenu + firefox + mpv + pavucontrol + pcmanfm + redshift + sxiv + zathura + ] ++ pkgs.lib.optionals config.software.desktop.extra.enable [ + # Desktop Extra + geeqie + gimp + inkscape + qbittorrent + qdirstat + ungoogled-chromium + ] ++ pkgs.lib.optionals config.software.dev.enable [ + # Development + dash # TODO should be default /bin/sh + entr + gcc + git + gnumake + jq + lm_sensors + nmap + openssl + python3 + sassc + sslscan + wget + ] ++ pkgs.lib.optionals config.software.dev.extra.enable [ + # Development Extra + android-tools + cargo + hugo + #python-pip # TODO figure this one out + uhubctl + wireguard-tools + ] ++ pkgs.lib.optionals config.software.utils.enable [ + # Utilities + ddcutil # TODO + fastfetch + htop + light + neovim + p7zip + powertop + pv + rsync + screen + scrot + smartmontools + stress + testdisk + tmux + xxHash + ]; + + # More desktop + programs.dconf.enable = lib.mkIf config.software.desktop.enable true; # For home-manager to configure gtk TODO this should be there instead + + # More utilities + programs.zsh.enable = lib.mkIf config.software.utils.enable true; + users.defaultUserShell = lib.mkIf config.software.utils.enable pkgs.zsh; + services.openssh.enable = lib.mkIf config.software.utils.enable true; + }; +} diff --git a/modules/root/software/default.nix b/modules/root/software/default.nix deleted file mode 100644 index 0ceef7f..0000000 --- a/modules/root/software/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ lib, ... }: { - imports = [ - ./desktop.nix - ./desktop-extra.nix - ./dev.nix - ./dev-extra.nix - ./utils.nix - ]; - - software = { - desktop = { - enable = lib.mkDefault true; - extra.enable = lib.mkDefault false; - }; - dev = { - enable = lib.mkDefault true; - extra.enable = lib.mkDefault false; - }; - utils = { - enable = lib.mkDefault true; - }; - }; -} diff --git a/modules/root/software/desktop-extra.nix b/modules/root/software/desktop-extra.nix deleted file mode 100644 index a3bf8fb..0000000 --- a/modules/root/software/desktop-extra.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.desktop.extra.enable = lib.mkEnableOption "enables extra desktop apps"; - }; - - config = lib.mkIf config.software.desktop.extra.enable { - environment.systemPackages = with pkgs; [ - geeqie - gimp - inkscape - qbittorrent - qdirstat - ungoogled-chromium - ]; - }; -} diff --git a/modules/root/software/desktop.nix b/modules/root/software/desktop.nix deleted file mode 100644 index 195d742..0000000 --- a/modules/root/software/desktop.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.desktop.enable = lib.mkEnableOption "enables desktop apps"; - }; - - config = lib.mkIf config.software.desktop.enable { - programs.dconf.enable = true; # For home-manager to configure gtk - - environment.systemPackages = with pkgs; [ - alacritty - arandr - dmenu - firefox - mpv - pavucontrol - pcmanfm - redshift - sxiv - zathura - ]; - }; -} diff --git a/modules/root/software/dev-extra.nix b/modules/root/software/dev-extra.nix deleted file mode 100644 index b027b37..0000000 --- a/modules/root/software/dev-extra.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.dev.extra.enable = lib.mkEnableOption "enables extra dev apps"; - }; - - config = lib.mkIf config.software.dev.extra.enable { - environment.systemPackages = with pkgs; [ - android-tools - cargo - hugo - #python-pip - uhubctl - wireguard-tools - ]; - }; -} diff --git a/modules/root/software/dev.nix b/modules/root/software/dev.nix deleted file mode 100644 index b0dabcc..0000000 --- a/modules/root/software/dev.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.dev.enable = lib.mkEnableOption "enables dev apps"; - }; - - config = lib.mkIf config.software.dev.enable { - environment.systemPackages = with pkgs; [ - dash # TODO should be default /bin/sh - entr - gcc - git - gnumake - jq - lm_sensors - nmap - openssl - python3 - sassc - sslscan - wget - ]; - }; -} diff --git a/modules/root/software/utils.nix b/modules/root/software/utils.nix deleted file mode 100644 index 1efdb18..0000000 --- a/modules/root/software/utils.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - software.utils.enable = lib.mkEnableOption "enables dev apps"; - }; - - config = lib.mkIf config.software.utils.enable { - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; - services.openssh.enable = true; - - environment.systemPackages = with pkgs; [ - ddcutil # TODO - fastfetch - htop - light - neovim - p7zip - powertop - pv - rsync - screen - scrot - smartmontools - stress - testdisk - tmux - xxHash - ]; - }; -} diff --git a/modules/root/x11.nix b/modules/root/x11.nix new file mode 100644 index 0000000..fd15c52 --- /dev/null +++ b/modules/root/x11.nix @@ -0,0 +1,30 @@ +{ pkgs, lib, config, ... }: { + options = { + xserver.enable = lib.mkEnableOption "enables xserver"; + }; + + config = lib.mkIf config.xserver.enable { + services.xserver.enable = true; + services.xserver.displayManager.startx.enable = true; + services.libinput.enable = true; # Enable touchpad support + + environment.systemPackages = with pkgs; [ + unclutter + xcape + xclip + xdotool + xorg.setxkbmap + xorg.xinput + xorg.xkill + xorg.xrandr + xorg.xset + xwallpaper + # Patch startx to be compliant with xdg base dir spec + (xorg.xinit.overrideAttrs (old: rec { + patches = [ + ./resources/x11/xinit-startx-xdg.patch + ]; + })) + ]; + }; +} diff --git a/modules/root/x11/default.nix b/modules/root/x11/default.nix deleted file mode 100644 index 8fa1d27..0000000 --- a/modules/root/x11/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs, lib, config, ... }: { - options = { - xserver.enable = lib.mkEnableOption "enables xserver"; - }; - - config = lib.mkIf config.xserver.enable { - services.xserver.enable = true; - services.xserver.displayManager.startx.enable = true; - services.libinput.enable = true; # Enable touchpad support - - environment.systemPackages = with pkgs; [ - unclutter - xcape - xclip - xdotool - xorg.setxkbmap - xorg.xinput - xorg.xkill - xorg.xrandr - xorg.xset - xwallpaper - # Patch startx to be compliant with xdg base dir spec - (xorg.xinit.overrideAttrs (old: rec { - patches = [ - ./xinit-startx-xdg.patch - ]; - })) - ]; - }; -} diff --git a/modules/root/x11/xinit-startx-xdg.patch b/modules/root/x11/xinit-startx-xdg.patch deleted file mode 100644 index c1bca97..0000000 --- a/modules/root/x11/xinit-startx-xdg.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/startx.cpp b/startx.cpp -index dfbebe1..472a1b0 100644 ---- a/startx.cpp -+++ b/startx.cpp -@@ -272,7 +272,7 @@ if [ x"$enable_xauth" = x1 ] ; then - dummy=0 - - XCOMM create a file with auth information for the server. ':0' is a dummy. -- xserverauthfile=$HOME/.serverauth.$$ -+ xserverauthfile="${XAUTHORITY:-$HOME/.Xauthority}" - trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM - xauth -q -f "$xserverauthfile" << EOF - add :$dummy . $mcookie - -- cgit v1.2.3