From c1d38216679737be7f5e529b900daae723ba1c63 Mon Sep 17 00:00:00 2001 From: Javier Feliz Date: Fri, 15 Aug 2025 17:45:00 -0400 Subject: [PATCH] Logitech management --- README.md | 6 +- hosts/desktop/default.nix | 10 +- modules/home/common/shell.nix | 4 + modules/home/home.nix | 4 + modules/home/hyprland/binds.nix | 2 +- modules/system/device-management/logitech.nix | 30 ++++ modules/system/nix-valet.nix | 152 ++++++++++++++++++ 7 files changed, 203 insertions(+), 5 deletions(-) create mode 100644 modules/system/device-management/logitech.nix create mode 100644 modules/system/nix-valet.nix diff --git a/README.md b/README.md index b4582b4..83c2ea6 100644 --- a/README.md +++ b/README.md @@ -63,4 +63,8 @@ tools since they played a lot nicer with stylix for theming as well as just resp ## Theming -- Consistent **Gruvbox** color scheme across all applications thanks to stylix \ No newline at end of file +- Consistent **Gruvbox** color scheme across all applications thanks to stylix + +## Extra Features + +- [Solaar](https://pwr-solaar.github.io/Solaar/) to manage my logitech mouse. \ No newline at end of file diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix index 0f61dfc..141fe8d 100755 --- a/hosts/desktop/default.nix +++ b/hosts/desktop/default.nix @@ -9,13 +9,17 @@ { imports = [ ../common-config.nix + ../../modules/system/nix-valet.nix + ../../modules/system/device-management/logitech.nix ./hardware-configuration.nix ]; # Mount second hard drive - boot.supportedFilesystems = [ - "ntfs" - ]; + boot = { + supportedFilesystems = [ + "ntfs" + ]; + }; fileSystems."/mnt/working-files" = { device = "/dev/disk/by-uuid/BE8EBBDA8EBB8A03"; diff --git a/modules/home/common/shell.nix b/modules/home/common/shell.nix index ec8bc1a..b16309a 100755 --- a/modules/home/common/shell.nix +++ b/modules/home/common/shell.nix @@ -131,4 +131,8 @@ } ''; }; + + home.sessionPath = [ + "$HOME/.config/composer/vendor/bin" + ]; } diff --git a/modules/home/home.nix b/modules/home/home.nix index 93eb23a..2b5f898 100755 --- a/modules/home/home.nix +++ b/modules/home/home.nix @@ -47,11 +47,15 @@ nixfmt # Nix formatting pkgs.libsForQt5.full # QML formatting (for working on quickshell) claude-code + xsel + nss.tools # System tools btop fastfetch gnumake + dig + lsof # Langs php diff --git a/modules/home/hyprland/binds.nix b/modules/home/hyprland/binds.nix index d92805d..a079051 100644 --- a/modules/home/hyprland/binds.nix +++ b/modules/home/hyprland/binds.nix @@ -28,7 +28,7 @@ "$mod SHIFT, o, exec, $browser" "$mod SHIFT, p, exec, $browser --incognito" "$mod, e, exec, $file_browser" - "$mod SHIFT, n, exec, $terminal --start-as=normal -- bash -ic 'code ~/nix && exit'" + "$mod SHIFT, n, exec, code ~/nix" "$mod SHIFT, ESC, exec, $terminal --start-as=normal -- bash -ic 'btop'" # "$mod ALT, p, exec, $terminal --start-as=normal -- bash -ic 'proj'" diff --git a/modules/system/device-management/logitech.nix b/modules/system/device-management/logitech.nix new file mode 100644 index 0000000..8f91ff9 --- /dev/null +++ b/modules/system/device-management/logitech.nix @@ -0,0 +1,30 @@ +{ + config, + pkgs, + inputs, + ... +}: + +{ + boot = { + kernelModules = [ "uinput" ]; + }; + + environment = { + systemPackages = with pkgs; [ + solaar # Manage logitech mouse + ]; + }; + + hardware = { + logitech = { + wireless.enable = true; + wireless.enableGraphical = true; + }; + }; + + users.users.javi.extraGroups = [ + "input" + "plugdev" + ]; +} diff --git a/modules/system/nix-valet.nix b/modules/system/nix-valet.nix new file mode 100644 index 0000000..e71620a --- /dev/null +++ b/modules/system/nix-valet.nix @@ -0,0 +1,152 @@ +/* + This module gives the same functionality as laravel valet or valet linux. + + Set up DNSMasq to point all *.test domains to caddy. + + Caddy will look for a folder with the same name in ~/projects and serve it. +*/ +{ + config, + pkgs, + lib, + ... +}: + +{ + services = { + # Enable dnsmasq + dnsmasq = { + enable = true; + settings = { + # Point all .test domains to localhost + address = "/.test/127.0.0.1"; + # Don't forward .test queries to upstream DNS + # server = "/test/"; + # Listen on localhost only + listen-address = "127.0.0.1"; + # Bind to interface + bind-interfaces = true; + # Cache size + cache-size = 1000; + # Don't read /etc/hosts + no-hosts = true; + # Don't poll /etc/resolv.conf + no-poll = true; + }; + }; + + # Enable PHP-FPM + phpfpm = { + pools.www = { + user = "javi"; + group = "users"; + settings = { + "listen.owner" = "javi"; + "listen.group" = "users"; + "listen.mode" = "0660"; + "pm" = "dynamic"; + "pm.max_children" = 32; + "pm.start_servers" = 2; + "pm.min_spare_servers" = 2; + "pm.max_spare_servers" = 4; + "pm.max_requests" = 500; + }; + phpEnv."PATH" = lib.makeBinPath [ pkgs.php ]; + }; + }; + + # Enable Caddy + caddy = { + enable = true; + globalConfig = '' + auto_https off + admin off + ''; + extraConfig = '' + *.test:80 { + root * /home/javi/projects/{labels.1} + + # Try /public directory first (for Laravel) + @laravel file /home/javi/projects/{labels.1}/public/index.php + root @laravel /home/javi/projects/{labels.1}/public + + # PHP FastCGI + php_fastcgi unix//run/phpfpm/www.sock + + # File server for static assets + file_server + + # Laravel specific - handle missing files + try_files {path} {path}/ /index.php?{query} + } + ''; + }; + + # Configure system to use local dnsmasq for .test domains + resolved = { + enable = true; + domains = [ "~test" ]; + fallbackDns = [ + "10.89.0.1" + # "8.8.8.8" + # "1.1.1.1" + ]; + extraConfig = '' + DNS=127.0.0.1#53 + Domains=~test + DNSSEC=false + ''; + }; + }; + + # Install PHP and related packages + environment.systemPackages = with pkgs; [ + # Add common PHP extensions you might need + php84Extensions.mbstring + php84Extensions.xml + php84Extensions.curl + php84Extensions.zip + php84Extensions.gd + php84Extensions.intl + php84Extensions.bcmath + php84Extensions.soap + php84Extensions.mysqli + php84Extensions.pdo_mysql + php84Extensions.pgsql + php84Extensions.pdo_sqlite + ]; + + # Create a dedicated caddy config directory + systemd.tmpfiles.rules = [ + "d /var/lib/caddy 0755 javi users -" + ]; + + systemd.services.caddy = { + serviceConfig = { + User = lib.mkForce "javi"; + Group = lib.mkForce "users"; + # More comprehensive capabilities + AmbientCapabilities = [ + "CAP_NET_BIND_SERVICE" + "CAP_SETUID" + "CAP_SETGID" + ]; + CapabilityBoundingSet = [ + "CAP_NET_BIND_SERVICE" + "CAP_SETUID" + "CAP_SETGID" + ]; + # Keep it simple - just set the config directory + Environment = [ "XDG_CONFIG_HOME=/var/lib/caddy" ]; + # Ensure the working directory is accessible + WorkingDirectory = "/var/lib/caddy"; + }; + }; + + # And make sure your user is in the caddy group + users.users.javi = { + extraGroups = [ + "users" + ]; + }; +}