From dce81586ac75302b0d41aebf90600bef7104b5ed Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 7 May 2026 15:48:26 -0700 Subject: [PATCH] Format NixOS flake with alejandra --- .github/workflows/cachix.yml | 9 + nixos/android.nix | 5 +- nixos/base.nix | 15 +- nixos/ben.nix | 8 +- nixos/bootstrap.nix | 3 +- nixos/bootstrap/flake.nix | 97 +++-- nixos/cache-server.nix | 12 +- nixos/cache.nix | 4 +- nixos/ci/railbird-secrets-stub/flake.nix | 9 +- nixos/configuration.nix | 5 +- nixos/cua.nix | 38 +- nixos/desktop.nix | 355 ++++++++-------- nixos/dunst.nix | 143 ++++--- nixos/electron.nix | 41 +- nixos/emacs-overlay.nix | 181 ++++----- nixos/emacs.nix | 6 +- nixos/environment.nix | 237 +++++------ nixos/extra.nix | 7 +- nixos/flake.nix | 286 ++++++------- nixos/fonts.nix | 13 +- nixos/games.nix | 7 +- nixos/gitea-runner.nix | 113 +++--- nixos/gitea.nix | 7 +- nixos/gnome.nix | 6 +- nixos/home-assistant.nix | 20 +- nixos/imalison.nix | 10 +- nixos/internet-computer.nix | 26 +- nixos/k3s.nix | 12 +- nixos/kat.nix | 7 +- nixos/keybase.nix | 4 +- nixos/keyd.nix | 15 +- nixos/kubelet.nix | 9 +- nixos/laptop.nix | 6 +- nixos/machines/adell.nix | 35 +- nixos/machines/bencbox.nix | 33 +- nixos/machines/biskcomp.nix | 15 +- nixos/machines/david-blade.nix | 17 +- nixos/machines/dean-zephyrus.nix | 7 +- nixos/machines/jay-lenovo-wsl.nix | 7 +- nixos/machines/jay-lenovo.nix | 25 +- nixos/machines/jimi-hendnix.nix | 33 +- nixos/machines/justin-bieber-creek.nix | 65 +-- nixos/machines/nixquick.nix | 38 +- nixos/machines/railbird-sf.nix | 35 +- nixos/machines/ryzen-shine-original.nix | 24 +- nixos/machines/ryzen-shine-wsl.nix | 7 +- nixos/machines/ryzen-shine.nix | 19 +- nixos/machines/strixi-minaj-wsl.nix | 7 +- nixos/machines/strixi-minaj.nix | 23 +- nixos/make-enable.nix | 25 +- nixos/nixified.ai.nix | 230 ++++++----- nixos/noctalia.nix | 74 ++-- nixos/notifications-tray-icon.nix | 42 +- nixos/nvidia-container-toolkit-overlay.nix | 4 +- nixos/nvidia.nix | 15 +- nixos/options.nix | 2 +- nixos/org-agenda-api-host.nix | 30 +- nixos/org-agenda-api.nix | 49 +-- nixos/packages/happy-coder/default.nix | 40 +- nixos/packages/kef/default.nix | 30 +- nixos/packages/playwright-cli/default.nix | 7 +- nixos/packages/pykefcontrol/default.nix | 5 +- nixos/packages/roborock-control/default.nix | 32 +- nixos/packages/t3code/default.nix | 39 +- nixos/plasma.nix | 8 +- nixos/postgres.nix | 18 +- nixos/quickshell.nix | 105 ++--- nixos/rabbitmq.nix | 8 +- nixos/raspberry-pi.nix | 13 +- nixos/remote-hyprland.nix | 310 +++++++------- nixos/sni.nix | 108 ++--- nixos/ssh.nix | 3 +- nixos/syncthing.nix | 79 ++-- nixos/taffybar.nix | 24 +- nixos/tailscale.nix | 16 +- nixos/tts.nix | 10 +- nixos/users.nix | 83 ++-- nixos/vscode.nix | 9 +- nixos/waybar.nix | 15 +- nixos/wlsunset.nix | 8 +- nixos/wsl.nix | 8 +- nixos/wyoming.nix | 7 +- nixos/xmonad.nix | 429 ++++++++++---------- 83 files changed, 2153 insertions(+), 1838 deletions(-) diff --git a/.github/workflows/cachix.yml b/.github/workflows/cachix.yml index 22286437..dfa2cbe1 100644 --- a/.github/workflows/cachix.yml +++ b/.github/workflows/cachix.yml @@ -85,6 +85,15 @@ jobs: name: ${{ vars.CACHIX_CACHE_NAME }} skipPush: true + - name: Check Nix formatting + run: | + set -euxo pipefail + nix build \ + --no-link \ + --print-build-logs \ + ./nixos#checks.x86_64-linux.formatting \ + --override-input railbird-secrets ./nixos/ci/railbird-secrets-stub + - name: Build NixOS system (strixi-minaj) run: | set -euxo pipefail diff --git a/nixos/android.nix b/nixos/android.nix index 6bb87c91..e8c5b48a 100644 --- a/nixos/android.nix +++ b/nixos/android.nix @@ -1,9 +1,8 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { options = { }; config = { nixpkgs.config.android_sdk.accept_license = true; - environment.systemPackages = [ pkgs.android-tools ]; + environment.systemPackages = [pkgs.android-tools]; }; } diff --git a/nixos/base.nix b/nixos/base.nix index b1fec458..e846fd3c 100644 --- a/nixos/base.nix +++ b/nixos/base.nix @@ -1,4 +1,10 @@ -{ config, pkgs, makeEnable, realUsers, ... }: +{ + config, + pkgs, + makeEnable, + realUsers, + ... +}: makeEnable config "myModules.base" true { nixpkgs.config.permittedInsecurePackages = [ "electron-12.2.3" @@ -30,10 +36,10 @@ makeEnable config "myModules.base" true { ''; networking.firewall.enable = false; - networking.nameservers = [ "8.8.8.8" "8.8.4.4" ]; + networking.nameservers = ["8.8.8.8" "8.8.4.4"]; networking.networkmanager = { enable = true; - plugins = [ pkgs.networkmanager-l2tp pkgs.networkmanager-openvpn ]; + plugins = [pkgs.networkmanager-l2tp pkgs.networkmanager-openvpn]; settings.main.rc-manager = "symlink"; }; networking.resolvconf.enable = false; @@ -52,7 +58,6 @@ makeEnable config "myModules.base" true { pulse.enable = true; }; - # Bluetooth hardware.bluetooth.enable = true; services.blueman.enable = true; @@ -96,7 +101,7 @@ makeEnable config "myModules.base" true { hardware.keyboard.zsa.enable = true; # For supporting gnome stuff - services.dbus.packages = [ pkgs.gcr ]; + services.dbus.packages = [pkgs.gcr]; programs.dconf.enable = true; diff --git a/nixos/ben.nix b/nixos/ben.nix index 1e6398ae..1a7344bf 100644 --- a/nixos/ben.nix +++ b/nixos/ben.nix @@ -1,4 +1,10 @@ -{ pkgs, inputs, config, makeEnable, ... }: +{ + pkgs, + inputs, + config, + makeEnable, + ... +}: makeEnable config "myModules.ben" true { home-manager.users.ben = { programs.zsh = { diff --git a/nixos/bootstrap.nix b/nixos/bootstrap.nix index e1766c85..578e56c3 100644 --- a/nixos/bootstrap.nix +++ b/nixos/bootstrap.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { imports = [ ../nix-shared/system/essential.nix ]; diff --git a/nixos/bootstrap/flake.nix b/nixos/bootstrap/flake.nix index 4d3d0d8c..36ee3fd4 100644 --- a/nixos/bootstrap/flake.nix +++ b/nixos/bootstrap/flake.nix @@ -1,8 +1,8 @@ { inputs = { - nixos-hardware = { url = github:NixOS/nixos-hardware; }; + nixos-hardware = {url = github:NixOS/nixos-hardware;}; - nixpkgs = { url = github:NixOS/nixpkgs/nixos-unstable; }; + nixpkgs = {url = github:NixOS/nixpkgs/nixos-unstable;}; home-manager = { url = github:nix-community/home-manager; @@ -18,13 +18,13 @@ inputs.systems.follows = "systems"; }; - systems = { url = github:nix-systems/default; }; + systems = {url = github:nix-systems/default;}; git-ignore-nix = { url = github:hercules-ci/gitignore.nix; inputs.nixpkgs.follows = "nixpkgs"; }; - nixos-wsl = { url = github:nix-community/NixOS-WSL; }; + nixos-wsl = {url = github:nix-community/NixOS-WSL;}; taffybar = { url = "github:taffybar/taffybar"; @@ -38,7 +38,7 @@ xmonad = { url = "github:xmonad/xmonad"; - inputs = { + inputs = { nixpkgs.follows = "nixpkgs"; flake-utils.follows = "flake-utils"; git-ignore-nix.follows = "git-ignore-nix"; @@ -56,13 +56,17 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - nixified-ai = { url = "github:nixified-ai/flake"; }; + nixified-ai = {url = "github:nixified-ai/flake";}; }; - outputs = inputs@{ - self, nixpkgs, nixos-hardware, home-manager, nix, ... - }: - let + outputs = inputs @ { + self, + nixpkgs, + nixos-hardware, + home-manager, + nix, + ... + }: let machinesPath = ../machines; machineFilenames = builtins.attrNames (builtins.readDir machinesPath); machineNameFromFilename = filename: builtins.head (builtins.split "\\." filename); @@ -70,44 +74,49 @@ mkConfigurationParams = filename: { name = machineNameFromFilename filename; value = { - modules = [ (machinesPath + ("/" + filename)) ]; + modules = [(machinesPath + ("/" + filename))]; }; }; defaultConfigurationParams = builtins.listToAttrs (map mkConfigurationParams machineFilenames); - customParams = { - biskcomp = { - system = "aarch64-linux"; - }; - air-gapped-pi = { - system = "aarch64-linux"; - }; + customParams = { + biskcomp = { + system = "aarch64-linux"; }; - mkConfig = - args@ - { system ? "x86_64-linux" - , baseModules ? [] - , modules ? [] - , specialArgs ? {} - , ... - }: - nixpkgs.lib.nixosSystem (args // { - inherit system; - modules = baseModules ++ modules; - specialArgs = rec { - inherit inputs machineNames; - makeEnable = (import ../make-enable.nix) nixpkgs.lib; - realUsers = [ "root" "imalison" "kat" "dean" "alex" "ben"]; - } // specialArgs // (import ../keys.nix); - }); - in - { - nixosConfigurations = builtins.mapAttrs (machineName: params: - let machineParams = - if builtins.hasAttr machineName customParams - then (builtins.getAttr machineName customParams) - else {}; - in mkConfig (params // machineParams) - ) defaultConfigurationParams; + air-gapped-pi = { + system = "aarch64-linux"; + }; + }; + mkConfig = args @ { + system ? "x86_64-linux", + baseModules ? [], + modules ? [], + specialArgs ? {}, + ... + }: + nixpkgs.lib.nixosSystem (args + // { + inherit system; + modules = baseModules ++ modules; + specialArgs = + rec { + inherit inputs machineNames; + makeEnable = (import ../make-enable.nix) nixpkgs.lib; + realUsers = ["root" "imalison" "kat" "dean" "alex" "ben"]; + } + // specialArgs // (import ../keys.nix); + }); + in { + nixosConfigurations = + builtins.mapAttrs ( + machineName: params: let + machineParams = + if builtins.hasAttr machineName customParams + then (builtins.getAttr machineName customParams) + else {}; + in + mkConfig (params // machineParams) + ) + defaultConfigurationParams; }; } diff --git a/nixos/cache-server.nix b/nixos/cache-server.nix index e484cef6..d661a9a1 100644 --- a/nixos/cache-server.nix +++ b/nixos/cache-server.nix @@ -1,8 +1,11 @@ -{ config, lib, ... }: -with lib; -let cfg = config.myModules.cache-server; -in { + config, + lib, + ... +}: +with lib; let + cfg = config.myModules.cache-server; +in { options = { myModules.cache-server = { enable = mkEnableOption "nix cache server"; @@ -31,4 +34,3 @@ in }; }; } - diff --git a/nixos/cache.nix b/nixos/cache.nix index 310f35ed..3e5eb734 100644 --- a/nixos/cache.nix +++ b/nixos/cache.nix @@ -1,5 +1,3 @@ -{ machineNames, ... }: -{ +{machineNames, ...}: { # nix.settings.substituters = map (machineName: "ssh-ng://imalison@${machineName}.local") machineNames; } - diff --git a/nixos/ci/railbird-secrets-stub/flake.nix b/nixos/ci/railbird-secrets-stub/flake.nix index f3c57c99..9289f7eb 100644 --- a/nixos/ci/railbird-secrets-stub/flake.nix +++ b/nixos/ci/railbird-secrets-stub/flake.nix @@ -10,11 +10,16 @@ agenix.url = "github:ryantm/agenix"; }; - outputs = { self, nixpkgs, flake-utils, agenix }: { + outputs = { + self, + nixpkgs, + flake-utils, + agenix, + }: { # Keep this minimal: NixOS flake currently doesn't use railbird-secrets, but # Nix will still try to fetch/resolve all inputs during evaluation. keys = { - kanivanKeys = [ ]; + kanivanKeys = []; }; }; } diff --git a/nixos/configuration.nix b/nixos/configuration.nix index f19567c6..472b6c0a 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -1,5 +1,8 @@ -{ config, lib, ... }: { + config, + lib, + ... +}: { imports = [ ./android.nix ./base.nix diff --git a/nixos/cua.nix b/nixos/cua.nix index 79c72843..d96242c3 100644 --- a/nixos/cua.nix +++ b/nixos/cua.nix @@ -1,6 +1,8 @@ -{ config, lib, ... }: - -let +{ + config, + lib, + ... +}: let cfg = config.myModules.cua; flavorDefaults = { xfce = { @@ -24,8 +26,7 @@ let }; selectedFlavor = flavorDefaults.${cfg.flavor}; usingQemu = cfg.flavor == "qemu-linux"; -in -{ +in { options.myModules.cua = { enable = lib.mkEnableOption "Cua Linux computer-use sandbox"; @@ -76,13 +77,13 @@ in extraOptions = lib.mkOption { type = lib.types.listOf lib.types.str; - default = [ ]; + default = []; description = "Extra options passed to the Cua Android container runtime."; }; }; flavor = lib.mkOption { - type = lib.types.enum [ "xfce" "kasm" "qemu-linux" ]; + type = lib.types.enum ["xfce" "kasm" "qemu-linux"]; default = "xfce"; description = "Cua Linux sandbox flavor to run."; }; @@ -170,7 +171,7 @@ in extraOptions = lib.mkOption { type = lib.types.listOf lib.types.str; - default = [ ]; + default = []; description = "Extra options passed to the container runtime."; }; }; @@ -186,13 +187,14 @@ in cua-sandbox = { image = cfg.image; autoStart = cfg.autoStart; - ports = [ - "${cfg.bindAddress}:${toString cfg.noVncPort}:${toString selectedFlavor.noVncContainerPort}" - "${cfg.bindAddress}:${toString cfg.apiPort}:${toString selectedFlavor.apiContainerPort}" - ] - ++ lib.optionals (cfg.flavor == "xfce" && cfg.vncPort != null) [ - "${cfg.bindAddress}:${toString cfg.vncPort}:5901" - ]; + ports = + [ + "${cfg.bindAddress}:${toString cfg.noVncPort}:${toString selectedFlavor.noVncContainerPort}" + "${cfg.bindAddress}:${toString cfg.apiPort}:${toString selectedFlavor.apiContainerPort}" + ] + ++ lib.optionals (cfg.flavor == "xfce" && cfg.vncPort != null) [ + "${cfg.bindAddress}:${toString cfg.vncPort}:5901" + ]; volumes = [ "${toString cfg.storageDir}:${selectedFlavor.storageMountPath}" ]; @@ -215,7 +217,7 @@ in VNCOPTIONS = "-disableBasicAuth"; }; extraOptions = - lib.optionals (!usingQemu) [ "--shm-size=${cfg.shmSize}" ] + lib.optionals (!usingQemu) ["--shm-size=${cfg.shmSize}"] ++ cfg.extraOptions; }; cua-android = lib.mkIf cfg.android.enable { @@ -238,9 +240,9 @@ in networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall ( - [ cfg.apiPort cfg.noVncPort ] + [cfg.apiPort cfg.noVncPort] ++ lib.optional (cfg.flavor == "xfce" && cfg.vncPort != null) cfg.vncPort ) - ++ lib.optionals cfg.android.openFirewall [ cfg.android.apiPort cfg.android.webVncPort ]; + ++ lib.optionals cfg.android.openFirewall [cfg.android.apiPort cfg.android.webVncPort]; }; } diff --git a/nixos/desktop.nix b/nixos/desktop.nix index eded50f4..c07a1780 100644 --- a/nixos/desktop.nix +++ b/nixos/desktop.nix @@ -5,8 +5,7 @@ lib, makeEnable, ... -}: -let +}: let cfg = config.myModules.desktop; desktopShellUi = pkgs.writeShellApplication { name = "desktop_shell_ui"; @@ -20,194 +19,194 @@ let ''; }; enabledModule = makeEnable config "myModules.desktop" true { - services.greenclip.enable = true; - imports = [ - ./fonts.nix - ./hyprland.nix - ./keyd.nix - ./wlsunset.nix - ]; + services.greenclip.enable = true; + imports = [ + ./fonts.nix + ./hyprland.nix + ./keyd.nix + ./wlsunset.nix + ]; - assertions = [ - { - assertion = !(config.myModules.taffybar.enable && config.myModules.waybar.enable); - message = "myModules.taffybar and myModules.waybar cannot both be enabled."; - } - ]; + assertions = [ + { + assertion = !(config.myModules.taffybar.enable && config.myModules.waybar.enable); + message = "myModules.taffybar and myModules.waybar cannot both be enabled."; + } + ]; - services.xserver = { - exportConfiguration = true; - enable = true; - displayManager = { - sessionCommands = '' - systemctl --user import-environment GDK_PIXBUF_MODULE_FILE DBUS_SESSION_BUS_ADDRESS PATH - ''; - setupCommands = '' - autorandr -c - systemctl restart autorandr.service - ''; - }; - }; - - services.autorandr = { - enable = true; - }; - - environment.sessionVariables = { - # This is for the benefit of VSCODE running natively in wayland - NIXOS_OZONE_WL = "1"; - IM_HYPRLAND_SHELL_UI = cfg.shellUi; - }; - - system.activationScripts.playwrightChromeCompat.text = lib.optionalString (pkgs.stdenv.hostPlatform.system == "x86_64-linux") '' - # Playwright's Chrome channel lookup expects the FHS path below. - mkdir -p /opt/google/chrome - ln -sfn ${pkgs.google-chrome}/bin/google-chrome-stable /opt/google/chrome/chrome - ''; - - services.gnome.at-spi2-core.enable = true; - - services.gnome.gnome-keyring.enable = true; - - home-manager.sharedModules = [ - { - imports = [./dunst.nix]; - - xdg.desktopEntries."com.mitchellh.ghostty" = { - name = "Ghostty"; - comment = "A terminal emulator"; - icon = "com.mitchellh.ghostty"; - terminal = false; - type = "Application"; - categories = ["System" "TerminalEmulator"]; - startupNotify = true; - exec = "${pkgs.ghostty}/bin/ghostty --gtk-single-instance=false"; - settings = { - StartupWMClass = "com.mitchellh.ghostty"; - X-GNOME-UsesNotifications = "true"; - X-TerminalArgExec = "-e"; - X-TerminalArgTitle = "--title="; - X-TerminalArgAppId = "--class="; - X-TerminalArgDir = "--working-directory="; - X-TerminalArgHold = "--wait-after-command"; - }; - actions = { - new-window = { - name = "New Window"; - exec = "${pkgs.ghostty}/bin/ghostty --gtk-single-instance=false"; - }; - }; - }; - - xdg.configFile."ghostty/config" = { - force = true; - text = '' - confirm-close-surface = false + services.xserver = { + exportConfiguration = true; + enable = true; + displayManager = { + sessionCommands = '' + systemctl --user import-environment GDK_PIXBUF_MODULE_FILE DBUS_SESSION_BUS_ADDRESS PATH + ''; + setupCommands = '' + autorandr -c + systemctl restart autorandr.service ''; }; - } - ]; + }; - environment.systemPackages = with pkgs; - [ - desktopShellUi + services.autorandr = { + enable = true; + }; - # Appearance - adwaita-icon-theme - hicolor-icon-theme - # libsForQt5.breeze-gtk - # materia-theme - kdePackages.qt6ct - libsForQt5.qt5ct - numix-icon-theme-circle - papirus-icon-theme + environment.sessionVariables = { + # This is for the benefit of VSCODE running natively in wayland + NIXOS_OZONE_WL = "1"; + IM_HYPRLAND_SHELL_UI = cfg.shellUi; + }; - # XOrg - autorandr - keyd - wmctrl - xclip - xdotool - xev - xwininfo - xsettingsd + system.activationScripts.playwrightChromeCompat.text = lib.optionalString (pkgs.stdenv.hostPlatform.system == "x86_64-linux") '' + # Playwright's Chrome channel lookup expects the FHS path below. + mkdir -p /opt/google/chrome + ln -sfn ${pkgs.google-chrome}/bin/google-chrome-stable /opt/google/chrome/chrome + ''; - # Desktop - alacritty - ghostty - blueman - # clipit - d-spy - kdePackages.dolphin + services.gnome.at-spi2-core.enable = true; - feh - file-roller - gthumb - firefox - cheese - kdePackages.kleopatra - libnotify - libreoffice - loupe - lxappearance - lxqt.lxqt-powermanagement - networkmanagerapplet - kdePackages.okular - pinentry-gnome3 - # mission-center - quassel - remmina - rofi - wofi - rofi-pass - rofi-systemd - simplescreenrecorder - skippy-xd - transmission_4-gtk - vlc - thunar + services.gnome.gnome-keyring.enable = true; - # Audio - picard - pavucontrol - playerctl - pulsemixer - espeak + home-manager.sharedModules = [ + { + imports = [./dunst.nix]; - # - brightnessctl + xdg.desktopEntries."com.mitchellh.ghostty" = { + name = "Ghostty"; + comment = "A terminal emulator"; + icon = "com.mitchellh.ghostty"; + terminal = false; + type = "Application"; + categories = ["System" "TerminalEmulator"]; + startupNotify = true; + exec = "${pkgs.ghostty}/bin/ghostty --gtk-single-instance=false"; + settings = { + StartupWMClass = "com.mitchellh.ghostty"; + X-GNOME-UsesNotifications = "true"; + X-TerminalArgExec = "-e"; + X-TerminalArgTitle = "--title="; + X-TerminalArgAppId = "--class="; + X-TerminalArgDir = "--working-directory="; + X-TerminalArgHold = "--wait-after-command"; + }; + actions = { + new-window = { + name = "New Window"; + exec = "${pkgs.ghostty}/bin/ghostty --gtk-single-instance=false"; + }; + }; + }; - # Visualization - graphviz - mermaid-cli - ] - ++ ( - if pkgs.stdenv.hostPlatform.system == "x86_64-linux" - then - with pkgs; [ - google-chrome - pommed_light - slack - spicetify-cli - spotify - tor-browser - vscode - zulip - ] - else [] - ); + xdg.configFile."ghostty/config" = { + force = true; + text = '' + confirm-close-surface = false + ''; + }; + } + ]; + + environment.systemPackages = with pkgs; + [ + desktopShellUi + + # Appearance + adwaita-icon-theme + hicolor-icon-theme + # libsForQt5.breeze-gtk + # materia-theme + kdePackages.qt6ct + libsForQt5.qt5ct + numix-icon-theme-circle + papirus-icon-theme + + # XOrg + autorandr + keyd + wmctrl + xclip + xdotool + xev + xwininfo + xsettingsd + + # Desktop + alacritty + ghostty + blueman + # clipit + d-spy + kdePackages.dolphin + + feh + file-roller + gthumb + firefox + cheese + kdePackages.kleopatra + libnotify + libreoffice + loupe + lxappearance + lxqt.lxqt-powermanagement + networkmanagerapplet + kdePackages.okular + pinentry-gnome3 + # mission-center + quassel + remmina + rofi + wofi + rofi-pass + rofi-systemd + simplescreenrecorder + skippy-xd + transmission_4-gtk + vlc + thunar + + # Audio + picard + pavucontrol + playerctl + pulsemixer + espeak + + # + brightnessctl + + # Visualization + graphviz + mermaid-cli + ] + ++ ( + if pkgs.stdenv.hostPlatform.system == "x86_64-linux" + then + with pkgs; [ + google-chrome + pommed_light + slack + spicetify-cli + spotify + tor-browser + vscode + zulip + ] + else [] + ); }; in -enabledModule -// { - options = lib.recursiveUpdate enabledModule.options { - myModules.desktop.shellUi = lib.mkOption { - type = lib.types.enum [ "noctalia" "taffybar" ]; - default = "taffybar"; - description = '' - Desktop shell UI used by Hyprland-oriented bindings. This controls - the active shell service and Hyprland launcher/window picker dispatch. - ''; + enabledModule + // { + options = lib.recursiveUpdate enabledModule.options { + myModules.desktop.shellUi = lib.mkOption { + type = lib.types.enum ["noctalia" "taffybar"]; + default = "taffybar"; + description = '' + Desktop shell UI used by Hyprland-oriented bindings. This controls + the active shell service and Hyprland launcher/window picker dispatch. + ''; + }; }; - }; -} + } diff --git a/nixos/dunst.nix b/nixos/dunst.nix index 6ae6518f..e141adf0 100644 --- a/nixos/dunst.nix +++ b/nixos/dunst.nix @@ -1,91 +1,90 @@ { services.dunst = { enable = true; - settings = { - global = - { - monitor = 0; - follow = "mouse"; - indicate_hidden = "yes"; - stack_duplicates = true; - hide_duplicate_count = false; + settings = { + global = { + monitor = 0; + follow = "mouse"; + indicate_hidden = "yes"; + stack_duplicates = true; + hide_duplicate_count = false; - title = "Dunst"; - class = "Dunst"; + title = "Dunst"; + class = "Dunst"; - show_age_threshold = 60; - ellipsize = "middle"; - ignore_newline = "no"; - show_indicators = "no"; - sticky_history = "no"; - history_length = 20; + show_age_threshold = 60; + ellipsize = "middle"; + ignore_newline = "no"; + show_indicators = "no"; + sticky_history = "no"; + history_length = 20; - always_run_script = true; - ignore_dbusclose = false; - force_xinerama = false; + always_run_script = true; + ignore_dbusclose = false; + force_xinerama = false; - # Notification - sort = "yes"; - scale = 0; - shrink = "no"; - word_wrap = "yes"; + # Notification + sort = "yes"; + scale = 0; + shrink = "no"; + word_wrap = "yes"; - # Geometry - width = 300; - height = 200; - origin = "top-right"; - offset = "12+48"; + # Geometry + width = 300; + height = 200; + origin = "top-right"; + offset = "12+48"; - padding = 20; - horizontal_padding = 20; - notification_limit = 0; - separator_height = 2; + padding = 20; + horizontal_padding = 20; + notification_limit = 0; + separator_height = 2; - # Progress-Bar - progress_bar = true; - progress_bar_height = 10; - progress_bar_frame_width = 1; - progress_bar_min_width = 150; - progress_bar_max_width = 300; + # Progress-Bar + progress_bar = true; + progress_bar_height = 10; + progress_bar_frame_width = 1; + progress_bar_min_width = 150; + progress_bar_max_width = 300; - # # Aesthetics - # font = let - # inherit (config.modules.themes.font.mono) family weight; - # in "${family} ${weight} 11"; - frame_width = 2; - separator_color = "frame"; - transparency = 30; + # # Aesthetics + # font = let + # inherit (config.modules.themes.font.mono) family weight; + # in "${family} ${weight} 11"; + frame_width = 2; + separator_color = "frame"; + transparency = 30; - line_height = 1; - idle_threshold = 120; - markup = "full"; - format = "%s\\n%b"; - alignment = "left"; - vertical_alignment = "center"; + line_height = 1; + idle_threshold = 120; + markup = "full"; + format = "%s\\n%b"; + alignment = "left"; + vertical_alignment = "center"; - icon_position = "left"; - min_icon_size = 0; - max_icon_size = 64; + icon_position = "left"; + min_icon_size = 0; + max_icon_size = 64; - # Keybindings - close = "ctrl+space"; - close_all = "ctrl+shift+space"; - history = "ctrl+grave"; - context = "ctrl+shift+period"; + # Keybindings + close = "ctrl+space"; + close_all = "ctrl+shift+space"; + history = "ctrl+grave"; + context = "ctrl+shift+period"; - mouse_left_click = "close_current"; - mouse_middle_click = "do_action, close_current"; - mouse_right_click = "close_all"; - }; + mouse_left_click = "close_current"; + mouse_middle_click = "do_action, close_current"; + mouse_right_click = "close_all"; + }; - experimental = {per_monitor_dpi = true;}; - fullscreen_pushback_everything = {fullscreen = "pushback";}; - global = { - highlight = "#ffffff"; - foreground = "#ffffff"; - background = "#000000"; - frame_color = "#ffffff"; - }; + experimental = {per_monitor_dpi = true;}; + fullscreen_pushback_everything = {fullscreen = "pushback";}; + global = { + highlight = "#ffffff"; + foreground = "#ffffff"; + background = "#000000"; + frame_color = "#ffffff"; + }; }; # // optionalAttrs (active != null) { # urgency_low = let diff --git a/nixos/electron.nix b/nixos/electron.nix index 70fcca04..e9c7203d 100644 --- a/nixos/electron.nix +++ b/nixos/electron.nix @@ -1,4 +1,9 @@ -{ pkgs, config, makeEnable, ... }: +{ + pkgs, + config, + makeEnable, + ... +}: makeEnable config "myModules.electron" false { environment.systemPackages = with pkgs; [ element-desktop @@ -9,22 +14,26 @@ makeEnable config "myModules.electron" false { zoom-us ]; home-manager.sharedModules = [ - (if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then { - # systemd.user.services.bitwarden = { - # Unit = { - # Description = "Bitwarden"; - # After = [ "graphical-session-pre.target" "tray.target" ]; - # PartOf = [ "graphical-session.target" ]; - # }; + ( + if pkgs.stdenv.hostPlatform.system == "x86_64-linux" + then { + # systemd.user.services.bitwarden = { + # Unit = { + # Description = "Bitwarden"; + # After = [ "graphical-session-pre.target" "tray.target" ]; + # PartOf = [ "graphical-session.target" ]; + # }; - # Install = { WantedBy = [ "graphical-session.target" ]; }; + # Install = { WantedBy = [ "graphical-session.target" ]; }; - # Service = { - # ExecStart = "${pkgs.bitwarden}/bin/bitwarden"; - # Restart = "always"; - # RestartSec = 3; - # }; - # }; - } else {}) + # Service = { + # ExecStart = "${pkgs.bitwarden}/bin/bitwarden"; + # Restart = "always"; + # RestartSec = 3; + # }; + # }; + } + else {} + ) ]; } diff --git a/nixos/emacs-overlay.nix b/nixos/emacs-overlay.nix index b1e8eeff..4d775644 100644 --- a/nixos/emacs-overlay.nix +++ b/nixos/emacs-overlay.nix @@ -1,5 +1,4 @@ -final: prev: -{ +final: prev: { # Keep pkgs.emacs as a real Emacs package (used by other derivations / emacsPackages), # but provide an "auto" wrapper for interactive use that selects the right GUI backend. emacs = prev."emacs30-pgtk".override { @@ -24,109 +23,107 @@ final: prev: pname = "emacs-auto"; version = final.emacs.version or "unknown"; dontUnpack = true; - nativeBuildInputs = [ final.makeWrapper ]; + nativeBuildInputs = [final.makeWrapper]; - installPhase = - let - emacsWayland = final.emacs-wayland; - emacsX11 = final.emacs-x11; - in - '' - mkdir -p "$out/bin" "$out/share/applications" "$out/share/icons" "$out/share/pixmaps" + installPhase = let + emacsWayland = final.emacs-wayland; + emacsX11 = final.emacs-x11; + in '' + mkdir -p "$out/bin" "$out/share/applications" "$out/share/icons" "$out/share/pixmaps" - # Ensure desktop integrations (icons) exist even though we don't install the raw emacs packages. - if [ -d "${emacsWayland}/share/icons" ]; then - ln -s "${emacsWayland}/share/icons/hicolor" "$out/share/icons/hicolor" - fi - if [ -d "${emacsWayland}/share/pixmaps" ]; then - ln -s "${emacsWayland}/share/pixmaps/"* "$out/share/pixmaps/" || true - fi + # Ensure desktop integrations (icons) exist even though we don't install the raw emacs packages. + if [ -d "${emacsWayland}/share/icons" ]; then + ln -s "${emacsWayland}/share/icons/hicolor" "$out/share/icons/hicolor" + fi + if [ -d "${emacsWayland}/share/pixmaps" ]; then + ln -s "${emacsWayland}/share/pixmaps/"* "$out/share/pixmaps/" || true + fi - # Convenience explicit launchers. - makeWrapper ${emacsWayland}/bin/emacs "$out/bin/emacs-wayland" \ - --set GDK_BACKEND wayland - makeWrapper ${emacsX11}/bin/emacs "$out/bin/emacs-x11" \ - --set GDK_BACKEND x11 + # Convenience explicit launchers. + makeWrapper ${emacsWayland}/bin/emacs "$out/bin/emacs-wayland" \ + --set GDK_BACKEND wayland + makeWrapper ${emacsX11}/bin/emacs "$out/bin/emacs-x11" \ + --set GDK_BACKEND x11 - # Main launcher. - cat > "$out/bin/emacs" <<'EOF_EMACS_WRAPPER' -#!${final.runtimeShell} -set -eu + # Main launcher. + cat > "$out/bin/emacs" <<'EOF_EMACS_WRAPPER' + #!${final.runtimeShell} + set -eu -backend="''${EMACS_AUTO_BACKEND:-}" -tty=0 -for a in "$@"; do - case "$a" in - -nw|--nw|--tty|--terminal|--no-window-system) tty=1 ;; - esac -done + backend="''${EMACS_AUTO_BACKEND:-}" + tty=0 + for a in "$@"; do + case "$a" in + -nw|--nw|--tty|--terminal|--no-window-system) tty=1 ;; + esac + done -if [ "$backend" = "wayland" ] || [ "$backend" = "pgtk" ]; then - exec "@out@/bin/emacs-wayland" "$@" -fi -if [ "$backend" = "x11" ]; then - exec "@out@/bin/emacs-x11" "$@" -fi -if [ "$backend" = "tty" ]; then - exec "@emacsX11@/bin/emacs" -nw "$@" -fi + if [ "$backend" = "wayland" ] || [ "$backend" = "pgtk" ]; then + exec "@out@/bin/emacs-wayland" "$@" + fi + if [ "$backend" = "x11" ]; then + exec "@out@/bin/emacs-x11" "$@" + fi + if [ "$backend" = "tty" ]; then + exec "@emacsX11@/bin/emacs" -nw "$@" + fi -if [ "$tty" -eq 1 ]; then - # Respect the user's explicit -nw, but still run a consistent binary. - exec "@emacsX11@/bin/emacs" "$@" -fi + if [ "$tty" -eq 1 ]; then + # Respect the user's explicit -nw, but still run a consistent binary. + exec "@emacsX11@/bin/emacs" "$@" + fi -# Prefer Wayland if it looks like a Wayland session. -if [ -n "''${WAYLAND_DISPLAY:-}" ] || [ "''${XDG_SESSION_TYPE:-}" = "wayland" ] || [ -n "''${HYPRLAND_INSTANCE_SIGNATURE:-}" ]; then - exec "@out@/bin/emacs-wayland" "$@" -fi + # Prefer Wayland if it looks like a Wayland session. + if [ -n "''${WAYLAND_DISPLAY:-}" ] || [ "''${XDG_SESSION_TYPE:-}" = "wayland" ] || [ -n "''${HYPRLAND_INSTANCE_SIGNATURE:-}" ]; then + exec "@out@/bin/emacs-wayland" "$@" + fi -# Otherwise, if X is available, use the X11 build. -if [ -n "''${DISPLAY:-}" ] || [ "''${XDG_SESSION_TYPE:-}" = "x11" ]; then - exec "@out@/bin/emacs-x11" "$@" -fi + # Otherwise, if X is available, use the X11 build. + if [ -n "''${DISPLAY:-}" ] || [ "''${XDG_SESSION_TYPE:-}" = "x11" ]; then + exec "@out@/bin/emacs-x11" "$@" + fi -# Headless fallback. -exec "@emacsX11@/bin/emacs" -nw "$@" -EOF_EMACS_WRAPPER + # Headless fallback. + exec "@emacsX11@/bin/emacs" -nw "$@" + EOF_EMACS_WRAPPER - substituteInPlace "$out/bin/emacs" \ - --subst-var out \ - --replace-fail "@emacsX11@" "${emacsX11}" - chmod +x "$out/bin/emacs" + substituteInPlace "$out/bin/emacs" \ + --subst-var out \ + --replace-fail "@emacsX11@" "${emacsX11}" + chmod +x "$out/bin/emacs" - # emacsclient is compatible across builds as long as versions match; use one. - ln -s ${emacsX11}/bin/emacsclient "$out/bin/emacsclient" + # emacsclient is compatible across builds as long as versions match; use one. + ln -s ${emacsX11}/bin/emacsclient "$out/bin/emacsclient" - cat > "$out/share/applications/emacs.desktop" <<'EOF' -[Desktop Entry] -Name=Emacs -GenericName=Text Editor -Comment=Edit text -Exec=emacs %F -TryExec=emacs -Icon=emacs -Type=Application -Terminal=false -Categories=Development;TextEditor; -MimeType=text/plain; -StartupWMClass=Emacs -EOF + cat > "$out/share/applications/emacs.desktop" <<'EOF' + [Desktop Entry] + Name=Emacs + GenericName=Text Editor + Comment=Edit text + Exec=emacs %F + TryExec=emacs + Icon=emacs + Type=Application + Terminal=false + Categories=Development;TextEditor; + MimeType=text/plain; + StartupWMClass=Emacs + EOF - cat > "$out/share/applications/emacsclient.desktop" <<'EOF' -[Desktop Entry] -Name=Emacs (Client) -GenericName=Text Editor -Comment=Edit text using a running Emacs server -Exec=emacsclient -c -a emacs %F -TryExec=emacsclient -Icon=emacs -Type=Application -Terminal=false -Categories=Development;TextEditor; -MimeType=text/plain; -StartupWMClass=Emacs -EOF - ''; + cat > "$out/share/applications/emacsclient.desktop" <<'EOF' + [Desktop Entry] + Name=Emacs (Client) + GenericName=Text Editor + Comment=Edit text using a running Emacs server + Exec=emacsclient -c -a emacs %F + TryExec=emacsclient + Icon=emacs + Type=Application + Terminal=false + Categories=Development;TextEditor; + MimeType=text/plain; + StartupWMClass=Emacs + EOF + ''; }; } diff --git a/nixos/emacs.nix b/nixos/emacs.nix index 334a2b66..40f16c74 100644 --- a/nixos/emacs.nix +++ b/nixos/emacs.nix @@ -1,5 +1,9 @@ -{ pkgs, config, specialArgs, ... }: { + pkgs, + config, + specialArgs, + ... +}: { services.emacs = { enable = false; defaultEditor = true; diff --git a/nixos/environment.nix b/nixos/environment.nix index 5c00f5c2..146f3ea3 100644 --- a/nixos/environment.nix +++ b/nixos/environment.nix @@ -1,5 +1,11 @@ -{ config, pkgs, options, lib, inputs, ... }: -let +{ + config, + pkgs, + options, + lib, + inputs, + ... +}: let libDir = "${config.dotfiles-directory}/dotfiles/lib"; machineFilenames = builtins.attrNames (builtins.readDir ./machines); machineNameFromFilename = filename: builtins.head (builtins.split "\\." filename); @@ -14,129 +20,130 @@ let managedSshHostCasePattern = lib.concatStringsSep "|" managedSshHostPatterns; multiplexerAliases = import ../shared/multiplexer-aliases.nix; in -with lib; -{ - options = { - dotfiles-directory = mkOption { - type = types.path; - default = ../.; - }; - }; - - config = { - # Shell configuration - programs.zsh = { - enable = true; - syntaxHighlighting = { - enable = true; + with lib; { + options = { + dotfiles-directory = mkOption { + type = types.path; + default = ../.; }; - ohMyZsh = { + }; + + config = { + # Shell configuration + programs.zsh = { enable = true; - plugins = [ "git" "sudo" "pip" ]; + syntaxHighlighting = { + enable = true; + }; + ohMyZsh = { + enable = true; + plugins = ["git" "sudo" "pip"]; + }; + shellInit = '' + fpath=("$HOME/.lib/completions" "${libDir}/completions" $fpath) + fpath+="${libDir}/functions" + for file in "${libDir}/functions/"* + do + autoload "''${file##*/}" + done + fpath+="${pkgs.python-with-my-packages}/lib/python3.11/site-packages/argcomplete/bash_completion.d" + ''; + interactiveShellInit = '' + eval "$(register-python-argcomplete prb)" + eval "$(register-python-argcomplete prod-prb)" + eval "$(register-python-argcomplete railbird)" + [ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh" + + # Enable bracketed paste + autoload -Uz bracketed-paste-magic + zle -N bracketed-paste bracketed-paste-magic + ''; }; - shellInit = '' - fpath=("$HOME/.lib/completions" "${libDir}/completions" $fpath) - fpath+="${libDir}/functions" - for file in "${libDir}/functions/"* - do - autoload "''${file##*/}" - done - fpath+="${pkgs.python-with-my-packages}/lib/python3.11/site-packages/argcomplete/bash_completion.d" - ''; - interactiveShellInit = '' - eval "$(register-python-argcomplete prb)" - eval "$(register-python-argcomplete prod-prb)" - eval "$(register-python-argcomplete railbird)" - [ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh" - # Enable bracketed paste - autoload -Uz bracketed-paste-magic - zle -N bracketed-paste bracketed-paste-magic - ''; - }; + programs.bash = { + interactiveShellInit = '' + eval "$(register-python-argcomplete prb)" + eval "$(register-python-argcomplete prod-prb)" + eval "$(register-python-argcomplete railbird)" + [ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash" + ''; + }; - programs.bash = { - interactiveShellInit = '' - eval "$(register-python-argcomplete prb)" - eval "$(register-python-argcomplete prod-prb)" - eval "$(register-python-argcomplete railbird)" - [ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash" - ''; - }; - - programs.starship = { - enable = true; - interactiveOnly = true; - settings = { - add_newline = false; - character = { - success_symbol = "[➜](bold green)"; - error_symbol = "[➜](bold red)"; + programs.starship = { + enable = true; + interactiveOnly = true; + settings = { + add_newline = false; + character = { + success_symbol = "[➜](bold green)"; + error_symbol = "[➜](bold red)"; + }; }; }; - }; - environment = { - homeBinInPath = true; - localBinInPath = true; - enableAllTerminfo = true; - shellAliases = { - df_ssh = "TERM=xterm-256color ssh -o StrictHostKeyChecking=no"; - fix_nix = "LD_LIBRARY_PATH='' nix"; - xo = "xdg-open"; - } // multiplexerAliases; - variables = { - ROFI_SYSTEMD_TERM = "ghostty -e"; - NIXPKGS_GIT_REV = "${inputs.nixpkgs.rev}"; - NIXPKGS_SOURCE = "${inputs.nixpkgs.outPath}"; - EDITOR = "emacsclient --alternate-editor emacs"; - QT_QPA_PLATFORMTHEME = "qt6ct"; - }; - interactiveShellInit = '' - _df_is_managed_ssh_host() { - local host="$1" - case "$host" in - ${managedSshHostCasePattern}) return 0 ;; - *) return 1 ;; - esac - } + environment = { + homeBinInPath = true; + localBinInPath = true; + enableAllTerminfo = true; + shellAliases = + { + df_ssh = "TERM=xterm-256color ssh -o StrictHostKeyChecking=no"; + fix_nix = "LD_LIBRARY_PATH='' nix"; + xo = "xdg-open"; + } + // multiplexerAliases; + variables = { + ROFI_SYSTEMD_TERM = "ghostty -e"; + NIXPKGS_GIT_REV = "${inputs.nixpkgs.rev}"; + NIXPKGS_SOURCE = "${inputs.nixpkgs.outPath}"; + EDITOR = "emacsclient --alternate-editor emacs"; + QT_QPA_PLATFORMTHEME = "qt6ct"; + }; + interactiveShellInit = '' + _df_is_managed_ssh_host() { + local host="$1" + case "$host" in + ${managedSshHostCasePattern}) return 0 ;; + *) return 1 ;; + esac + } - _df_ssh_target_host() { - command ssh -G "$@" 2>/dev/null | awk '/^hostname / { print $2; exit }' - } + _df_ssh_target_host() { + command ssh -G "$@" 2>/dev/null | awk '/^hostname / { print $2; exit }' + } - # Keep advanced TERM on managed hosts, force compatibility elsewhere. - ssh() { - local host - host="$(_df_ssh_target_host "$@")" - if [ -n "$host" ] && _df_is_managed_ssh_host "$host"; then - command ssh "$@" - else - TERM=xterm-256color command ssh "$@" - fi - } - - vterm_printf(){ - if [ -n "$TMUX" ] && ([ "''${TERM%%-*}" = "tmux" ] || [ "''${TERM%%-*}" = "screen" ] ); then - # Tell tmux to pass the escape sequences through - printf "\ePtmux;\e\e]%s\007\e\\" "$1" - elif [ "''${TERM%%-*}" = "screen" ]; then - # GNU screen (screen, screen-256color, screen-256color-bce) - printf "\eP\e]%s\007\e\\" "$1" + # Keep advanced TERM on managed hosts, force compatibility elsewhere. + ssh() { + local host + host="$(_df_ssh_target_host "$@")" + if [ -n "$host" ] && _df_is_managed_ssh_host "$host"; then + command ssh "$@" else - printf "\e]%s\e\\" "$1" + TERM=xterm-256color command ssh "$@" fi - } - if [[ "$INSIDE_EMACS" = 'vterm' ]] \ - && [[ -n ''${EMACS_VTERM_PATH} ]] \ - && [[ -f ''${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh ]]; then - source ''${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh - fi - export STARSHIP_INSIDE_EMACS="yes" - ''; - extraInit = '' - export PATH="$HOME/.cargo/bin:${libDir}/bin:${libDir}/functions:$PATH"; - ''; + } + + vterm_printf(){ + if [ -n "$TMUX" ] && ([ "''${TERM%%-*}" = "tmux" ] || [ "''${TERM%%-*}" = "screen" ] ); then + # Tell tmux to pass the escape sequences through + printf "\ePtmux;\e\e]%s\007\e\\" "$1" + elif [ "''${TERM%%-*}" = "screen" ]; then + # GNU screen (screen, screen-256color, screen-256color-bce) + printf "\eP\e]%s\007\e\\" "$1" + else + printf "\e]%s\e\\" "$1" + fi + } + if [[ "$INSIDE_EMACS" = 'vterm' ]] \ + && [[ -n ''${EMACS_VTERM_PATH} ]] \ + && [[ -f ''${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh ]]; then + source ''${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh + fi + export STARSHIP_INSIDE_EMACS="yes" + ''; + extraInit = '' + export PATH="$HOME/.cargo/bin:${libDir}/bin:${libDir}/functions:$PATH"; + ''; + }; }; - }; -} + } diff --git a/nixos/extra.nix b/nixos/extra.nix index 6f37d133..ea64fab3 100644 --- a/nixos/extra.nix +++ b/nixos/extra.nix @@ -1,4 +1,9 @@ -{ config, pkgs, makeEnable, ... }: +{ + config, + pkgs, + makeEnable, + ... +}: makeEnable config "myModules.extra" false { environment.systemPackages = with pkgs; [ android-studio diff --git a/nixos/flake.nix b/nixos/flake.nix index ccbb8829..37d15682 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -531,150 +531,160 @@ hypr-workspace-history = inputs.hypr-workspace-history.packages.${system}.hypr-workspace-history; }; - checks = lib.optionalAttrs pkgs.stdenv.isLinux { - hyprNStack = inputs.hyprNStack.packages.${system}.hyprNStack; - hyprexpo-lua = inputs.hyprland-plugins-lua.packages.${system}.hyprexpo; - hyprwinview = inputs.hyprwinview.packages.${system}.hyprwinview; - hypr-workspace-history = inputs.hypr-workspace-history.packages.${system}.hypr-workspace-history; - hyprland-config-syntax = - pkgs.runCommand "hyprland-config-syntax" { - nativeBuildInputs = [pkgs.lua5_4]; - } '' - cp ${../dotfiles/config/hypr/hyprland.lua} hyprland.lua - luac -p hyprland.lua - if grep -n 'hyprctl' hyprland.lua | grep -v 'hyprctl reload' | grep -v 'hyprctl eval' | grep -v 'hyprctl_eval' | grep -v 'hyprctl -j monitors'; then - echo "hyprland.lua should not shell out to hyprctl for window/workspace manipulation" >&2 - exit 1 - fi - lua <<'LUA' - local callbacks = {} + checks = + { + formatting = + pkgs.runCommand "alejandra-formatting-check" { + nativeBuildInputs = [pkgs.alejandra]; + } '' + alejandra --check ${./.} + touch "$out" + ''; + } + // lib.optionalAttrs pkgs.stdenv.isLinux { + hyprNStack = inputs.hyprNStack.packages.${system}.hyprNStack; + hyprexpo-lua = inputs.hyprland-plugins-lua.packages.${system}.hyprexpo; + hyprwinview = inputs.hyprwinview.packages.${system}.hyprwinview; + hypr-workspace-history = inputs.hypr-workspace-history.packages.${system}.hypr-workspace-history; + hyprland-config-syntax = + pkgs.runCommand "hyprland-config-syntax" { + nativeBuildInputs = [pkgs.lua5_4]; + } '' + cp ${../dotfiles/config/hypr/hyprland.lua} hyprland.lua + luac -p hyprland.lua + if grep -n 'hyprctl' hyprland.lua | grep -v 'hyprctl reload' | grep -v 'hyprctl eval' | grep -v 'hyprctl_eval' | grep -v 'hyprctl -j monitors'; then + echo "hyprland.lua should not shell out to hyprctl for window/workspace manipulation" >&2 + exit 1 + fi + lua <<'LUA' + local callbacks = {} - local function noop() end + local function noop() end - local function dispatcher_proxy() - local proxy = {} - return setmetatable(proxy, { - __index = function() - return dispatcher_proxy() + local function dispatcher_proxy() + local proxy = {} + return setmetatable(proxy, { + __index = function() + return dispatcher_proxy() + end, + __call = function() + return noop + end, + }) + end + + local notification = { + is_alive = function() + return true end, - __call = function() - return noop + set_text = noop, + set_timeout = noop, + pause = noop, + resume = noop, + set_paused = noop, + dismiss = noop, + } + + local monitor = { + id = 1, + name = "stub-monitor", + focused = true, + } + + local workspace = { + id = 1, + name = "1", + windows = 0, + special = false, + monitor = monitor, + } + + monitor.active_workspace = workspace + + hl = { + animation = noop, + bind = noop, + config = noop, + curve = noop, + env = noop, + exec_cmd = noop, + define_submap = function(_, reset_or_callback, callback) + local cb = type(reset_or_callback) == "function" and reset_or_callback or callback + if cb then + cb() + end end, - }) - end - - local notification = { - is_alive = function() - return true - end, - set_text = noop, - set_timeout = noop, - pause = noop, - resume = noop, - set_paused = noop, - dismiss = noop, - } - - local monitor = { - id = 1, - name = "stub-monitor", - focused = true, - } - - local workspace = { - id = 1, - name = "1", - windows = 0, - special = false, - monitor = monitor, - } - - monitor.active_workspace = workspace - - hl = { - animation = noop, - bind = noop, - config = noop, - curve = noop, - env = noop, - exec_cmd = noop, - define_submap = function(_, reset_or_callback, callback) - local cb = type(reset_or_callback) == "function" and reset_or_callback or callback - if cb then - cb() - end - end, - monitor = noop, - workspace_rule = noop, - window_rule = noop, - dsp = dispatcher_proxy(), - notification = { - create = function() - return notification - end, - }, - plugin = { - load = noop, - }, - get_active_workspace = function() - return workspace - end, - get_active_monitor = function() - return monitor - end, - get_active_window = function() - return nil - end, - get_monitor = function() - return monitor - end, - get_workspace = function(id) - if tostring(id) == "1" then + monitor = noop, + workspace_rule = noop, + window_rule = noop, + dsp = dispatcher_proxy(), + notification = { + create = function() + return notification + end, + }, + plugin = { + load = noop, + }, + get_active_workspace = function() return workspace - end - return nil - end, - get_windows = function() - return {} - end, - get_workspace_windows = function() - return {} - end, - on = function(_, callback) - callbacks[#callbacks + 1] = callback - end, - timer = function(callback) + end, + get_active_monitor = function() + return monitor + end, + get_active_window = function() + return nil + end, + get_monitor = function() + return monitor + end, + get_workspace = function(id) + if tostring(id) == "1" then + return workspace + end + return nil + end, + get_windows = function() + return {} + end, + get_workspace_windows = function() + return {} + end, + on = function(_, callback) + callbacks[#callbacks + 1] = callback + end, + timer = function(callback) + callback() + return { + set_enabled = noop, + } + end, + } + + dofile("./hyprland.lua") + + for _, callback in ipairs(callbacks) do callback() - return { - set_enabled = noop, - } - end, - } - - dofile("./hyprland.lua") - - for _, callback in ipairs(callbacks) do - callback() - end - LUA - touch "$out" - ''; - hyprland-verify-config = let - hyprlandPackage = inputs.hyprland.packages.${system}.hyprland; - hyprNStackPackage = inputs.hyprNStack.packages.${system}.hyprNStack; - in - pkgs.runCommand "hyprland-lua-verify-config" {} '' - cp ${../dotfiles/config/hypr/hyprland.lua} hyprland.lua - substituteInPlace hyprland.lua \ - --replace-fail /run/current-system/sw/lib/libhyprNStack.so \ - ${hyprNStackPackage}/lib/libhyprNStack.so - export XDG_RUNTIME_DIR="$TMPDIR/runtime" - mkdir -p "$XDG_RUNTIME_DIR" - HYPRLAND_NO_CRASHREPORTER=1 ${pkgs.coreutils}/bin/timeout 20s \ - ${hyprlandPackage}/bin/Hyprland --verify-config --config "$PWD/hyprland.lua" - touch "$out" - ''; - }; + end + LUA + touch "$out" + ''; + hyprland-verify-config = let + hyprlandPackage = inputs.hyprland.packages.${system}.hyprland; + hyprNStackPackage = inputs.hyprNStack.packages.${system}.hyprNStack; + in + pkgs.runCommand "hyprland-lua-verify-config" {} '' + cp ${../dotfiles/config/hypr/hyprland.lua} hyprland.lua + substituteInPlace hyprland.lua \ + --replace-fail /run/current-system/sw/lib/libhyprNStack.so \ + ${hyprNStackPackage}/lib/libhyprNStack.so + export XDG_RUNTIME_DIR="$TMPDIR/runtime" + mkdir -p "$XDG_RUNTIME_DIR" + HYPRLAND_NO_CRASHREPORTER=1 ${pkgs.coreutils}/bin/timeout 20s \ + ${hyprlandPackage}/bin/Hyprland --verify-config --config "$PWD/hyprland.lua" + touch "$out" + ''; + }; # Dev shell for org-agenda-api deployment devShells.org-agenda-api = pkgs.mkShell { diff --git a/nixos/fonts.nix b/nixos/fonts.nix index 9149e853..9ea652fc 100644 --- a/nixos/fonts.nix +++ b/nixos/fonts.nix @@ -1,4 +1,9 @@ -{ pkgs, makeEnable, config, ... }: +{ + pkgs, + makeEnable, + config, + ... +}: makeEnable config "myModules.fonts" true { # Enable the gtk icon cache gtk.iconCache.enable = true; @@ -32,9 +37,9 @@ makeEnable config "myModules.fonts" true { allowBitmaps = true; useEmbeddedBitmaps = true; defaultFonts = { - monospace = [ "JetBrains Mono" ]; - sansSerif = [ "Roboto" ]; - serif = [ "Source Serif Pro" ]; + monospace = ["JetBrains Mono"]; + sansSerif = ["Roboto"]; + serif = ["Source Serif Pro"]; }; }; }; diff --git a/nixos/games.nix b/nixos/games.nix index 13a6307e..64998055 100644 --- a/nixos/games.nix +++ b/nixos/games.nix @@ -1,4 +1,9 @@ -{ config, pkgs, makeEnable, ... }: +{ + config, + pkgs, + makeEnable, + ... +}: makeEnable config "myModules.games" false { environment.systemPackages = with pkgs; [ steam diff --git a/nixos/gitea-runner.nix b/nixos/gitea-runner.nix index 467cd034..4c010fb6 100644 --- a/nixos/gitea-runner.nix +++ b/nixos/gitea-runner.nix @@ -1,64 +1,71 @@ -{ pkgs, config, makeEnable, ... }: +{ + pkgs, + config, + makeEnable, + ... +}: makeEnable config "myModules.gitea-runner" false { age.secrets.gitea-runner-token = { file = ./secrets/gitea-runner-token.age; group = "docker"; }; - services.gitea-actions-runner.instances.nix = - let gitea-runner-directory = "/var/lib/gitea-runner"; - in { - settings = { - cache = { - enabled = true; - }; - container = { - workdir_parent = "${gitea-runner-directory}/workspace"; - # Increase shared memory for containers (default 64MB is too small for Metro/Gradle) - options = "--shm-size=2g"; - }; - host = { - workdir_parent = "${gitea-runner-directory}/action-cache-dir"; - }; + services.gitea-actions-runner.instances.nix = let + gitea-runner-directory = "/var/lib/gitea-runner"; + in { + settings = { + cache = { + enabled = true; + }; + container = { + workdir_parent = "${gitea-runner-directory}/workspace"; + # Increase shared memory for containers (default 64MB is too small for Metro/Gradle) + options = "--shm-size=2g"; + }; + host = { + workdir_parent = "${gitea-runner-directory}/action-cache-dir"; }; - hostPackages = with pkgs; [ - bash - coreutils - curl - direnv - docker - gawk - git-lfs - gitFull - gnused - just - nixVersions.stable - nodejs - openssh - wget - ]; - enable = true; - name = config.networking.hostName; - url = "https://dev.railbird.ai"; - tokenFile = config.age.secrets.gitea-runner-token.path; - labels = [ - "nixos-${pkgs.stdenv.hostPlatform.system}:host" - "nix:docker://localhost:5921/nix-runner" - ]; }; + hostPackages = with pkgs; [ + bash + coreutils + curl + direnv + docker + gawk + git-lfs + gitFull + gnused + just + nixVersions.stable + nodejs + openssh + wget + ]; + enable = true; + name = config.networking.hostName; + url = "https://dev.railbird.ai"; + tokenFile = config.age.secrets.gitea-runner-token.path; + labels = [ + "nixos-${pkgs.stdenv.hostPlatform.system}:host" + "nix:docker://localhost:5921/nix-runner" + ]; + }; - systemd.services.gitea-runner-nix = { - environment = let gitea-runner-directory = "/var/lib/gitea-runner"; in { - XDG_CONFIG_HOME = gitea-runner-directory; - XDG_CACHE_HOME = "${gitea-runner-directory}/.cache"; - }; - serviceConfig.PrivateTmp = false; - }; - users.groups.gitea-runner = {}; - users.users.gitea-runner = { - isSystemUser = true; - group = "gitea-runner"; - extraGroups = ["docker"]; - home = "/var/lib/gitea-runner"; + systemd.services.gitea-runner-nix = { + environment = let + gitea-runner-directory = "/var/lib/gitea-runner"; + in { + XDG_CONFIG_HOME = gitea-runner-directory; + XDG_CACHE_HOME = "${gitea-runner-directory}/.cache"; }; + serviceConfig.PrivateTmp = false; + }; + users.groups.gitea-runner = {}; + users.users.gitea-runner = { + isSystemUser = true; + group = "gitea-runner"; + extraGroups = ["docker"]; + home = "/var/lib/gitea-runner"; + }; } diff --git a/nixos/gitea.nix b/nixos/gitea.nix index bd8651e7..ea2d9a63 100644 --- a/nixos/gitea.nix +++ b/nixos/gitea.nix @@ -1,6 +1,9 @@ -{ config, makeEnable, ... }: +{ + config, + makeEnable, + ... +}: makeEnable config "myModules.gitea" false { - services.gitea = { enable = true; lfs.enable = true; diff --git a/nixos/gnome.nix b/nixos/gnome.nix index 65b7e7ad..28a73f52 100644 --- a/nixos/gnome.nix +++ b/nixos/gnome.nix @@ -1,4 +1,8 @@ -{ config, makeEnable, ... }: +{ + config, + makeEnable, + ... +}: makeEnable config "myModules.gnome" false { services.xserver = { desktopManager.gnome.enable = true; diff --git a/nixos/home-assistant.nix b/nixos/home-assistant.nix index bfa72ba0..f3bb70f5 100644 --- a/nixos/home-assistant.nix +++ b/nixos/home-assistant.nix @@ -1,4 +1,11 @@ -{ pkgs, config, lib, makeEnable, realUsers, ... }: +{ + pkgs, + config, + lib, + makeEnable, + realUsers, + ... +}: makeEnable config "myModules.home-assistant" false { boot.kernel.sysctl = { # For all interfaces (e.g. if you want to accept RA on all): @@ -97,11 +104,12 @@ makeEnable config "myModules.home-assistant" false { "yale" "zwave_js" ]; - extraPackages = python3Packages: with python3Packages; [ - numpy - python-matter-server - universal-silabs-flasher - ]; + extraPackages = python3Packages: + with python3Packages; [ + numpy + python-matter-server + universal-silabs-flasher + ]; config = { http = { use_x_forwarded_for = true; diff --git a/nixos/imalison.nix b/nixos/imalison.nix index f424bf2f..0d5544b0 100644 --- a/nixos/imalison.nix +++ b/nixos/imalison.nix @@ -1,8 +1,6 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let session = import ./session-variables.nix; -in -{ +in { home-manager.users.imalison = { imports = [ ./emacs.nix @@ -145,8 +143,8 @@ in Unit = { Description = "Hyprpaper (managed by home-manager)"; ConditionEnvironment = session.hyprland; - PartOf = [ "hyprland-session.target" ]; - After = [ "hyprland-session.target" ]; + PartOf = ["hyprland-session.target"]; + After = ["hyprland-session.target"]; }; Service = { diff --git a/nixos/internet-computer.nix b/nixos/internet-computer.nix index 20762314..c5d2ba48 100644 --- a/nixos/internet-computer.nix +++ b/nixos/internet-computer.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let quillIcSrc = pkgs.fetchFromGitHub { owner = "dfinity"; repo = "ic"; @@ -8,18 +7,19 @@ let }; quillFixed = pkgs.quill.overrideAttrs (old: { - preBuild = (old.preBuild or "") + '' - # The vendored git dependency resolves ../ledger.did from source-git-*, - # not from the vendor root where nixpkgs currently copies it. - for dir in /build/quill-*-vendor/source-git-*; do - if [ -d "$dir" ]; then - cp ${quillIcSrc}/rs/rosetta-api/icp_ledger/ledger.did "$dir/ledger.did" - fi - done - ''; + preBuild = + (old.preBuild or "") + + '' + # The vendored git dependency resolves ../ledger.did from source-git-*, + # not from the vendor root where nixpkgs currently copies it. + for dir in /build/quill-*-vendor/source-git-*; do + if [ -d "$dir" ]; then + cp ${quillIcSrc}/rs/rosetta-api/icp_ledger/ledger.did "$dir/ledger.did" + fi + done + ''; }); -in -{ +in { environment.systemPackages = with pkgs; [ ic-keysmith quillFixed diff --git a/nixos/k3s.nix b/nixos/k3s.nix index c260dbfd..cf3d1136 100644 --- a/nixos/k3s.nix +++ b/nixos/k3s.nix @@ -60,11 +60,11 @@ in { settings = { plugins."io.containerd.cri.v1.runtime" = { enable_cdi = true; - cdi_spec_dirs = [ "/var/run/cdi" ]; + cdi_spec_dirs = ["/var/run/cdi"]; }; plugins."io.containerd.grpc.v1.cri" = { enable_cdi = true; - cdi_spec_dirs = [ "/var/run/cdi" ]; + cdi_spec_dirs = ["/var/run/cdi"]; cni.bin_dir = "${plugins-path}/bin"; }; }; @@ -97,13 +97,13 @@ in { systemd.services.mount-railbird-bucket = { after = ["agenix.service"]; - wantedBy = [ "multi-user.target" ]; + wantedBy = ["multi-user.target"]; description = "Mount railbird bucket"; serviceConfig = { Type = "simple"; RemainAfterExit = true; - Restart = "on-failure"; # Restart the service on failure - RestartSec = 5; # Wait 5 seconds before restarti + Restart = "on-failure"; # Restart the service on failure + RestartSec = 5; # Wait 5 seconds before restarti TimeoutStopSec = 2; ExecStartPre = [ "-${pkgs.util-linux}/bin/umount -f ${mount-path}" @@ -114,7 +114,7 @@ in { ExecStart = let key-file = config.age.secrets.api-service-key.path; in - pkgs.writeShellScript "mount-railbird-bucket" '' + pkgs.writeShellScript "mount-railbird-bucket" '' while true; do if ${pkgs.util-linux}/bin/mount | grep -q "${mount-path}" && [ -d "${mount-path}/dev" ]; then echo "Mount path ${mount-path} is mounted and valid (contains directory 'dev')." diff --git a/nixos/kat.nix b/nixos/kat.nix index e40427cc..f78e184d 100644 --- a/nixos/kat.nix +++ b/nixos/kat.nix @@ -1,4 +1,9 @@ -{ pkgs, config, makeEnable, ... }: +{ + pkgs, + config, + makeEnable, + ... +}: makeEnable config "myModules.kat" false { environment.systemPackages = with pkgs; [ obsidian diff --git a/nixos/keybase.nix b/nixos/keybase.nix index 3cac6f59..3efc3421 100644 --- a/nixos/keybase.nix +++ b/nixos/keybase.nix @@ -1,5 +1,5 @@ -{ ... }: { +{...}: { home-manager.sharedModules = [ - { services.kbfs.enable = true; } + {services.kbfs.enable = true;} ]; } diff --git a/nixos/keyd.nix b/nixos/keyd.nix index 13beb2ac..c40705c3 100644 --- a/nixos/keyd.nix +++ b/nixos/keyd.nix @@ -1,4 +1,9 @@ -{ config, lib, makeEnable, ... }: +{ + config, + lib, + makeEnable, + ... +}: makeEnable config "myModules.keyd" true { services.keyd = { enable = true; @@ -6,7 +11,7 @@ makeEnable config "myModules.keyd" true { # Base remap applied to all keyboards. keyboards.default = { # Exclude the Glove80 (MoErgo) by vendor:product ID. - ids = [ "*" "-16c0:27db" ]; + ids = ["*" "-16c0:27db"]; settings = { main = { # Caps Lock -> Control @@ -18,19 +23,19 @@ makeEnable config "myModules.keyd" true { rightalt = "layer(hyper)"; }; # Hyper = Ctrl+Alt+Meta while held (matches $hyper = SUPER CTRL ALT) - "hyper:C-A-M" = { }; + "hyper:C-A-M" = {}; }; }; # MoErgo Glove80: only map Right Meta/Super to Hyper. keyboards.moErgo = { - ids = [ "16c0:27db" ]; + ids = ["16c0:27db"]; settings = { main = { rightmeta = "layer(hyper)"; }; # Hyper = Ctrl+Alt+Meta while held (matches $hyper = SUPER CTRL ALT) - "hyper:C-A-M" = { }; + "hyper:C-A-M" = {}; }; }; }; diff --git a/nixos/kubelet.nix b/nixos/kubelet.nix index bf20bfca..cd59ad08 100644 --- a/nixos/kubelet.nix +++ b/nixos/kubelet.nix @@ -1,4 +1,9 @@ -{ config, pkgs, makeEnable, ... }: +{ + config, + pkgs, + makeEnable, + ... +}: makeEnable config "myModules.kubelet" false { age.secrets."api_service_account_key.json.age".file = ./secrets/api_service_account_key.json.age; services.kubernetes.kubelet = { @@ -11,7 +16,7 @@ makeEnable config "myModules.kubelet" false { }; registerNode = true; cni = { - packages = [ pkgs.cni-plugins pkgs.calico-cni-plugin ]; + packages = [pkgs.cni-plugins pkgs.calico-cni-plugin]; }; extraOpts = '' --fail-swap-on=false diff --git a/nixos/laptop.nix b/nixos/laptop.nix index fd0a7c70..30194a33 100644 --- a/nixos/laptop.nix +++ b/nixos/laptop.nix @@ -1,4 +1,8 @@ -{ makeEnable, config, ... }: +{ + makeEnable, + config, + ... +}: makeEnable config "myModules.laptop" true { services.logind.settings.Login.HandleLidSwitchExternalPower = "ignore"; } diff --git a/nixos/machines/adell.nix b/nixos/machines/adell.nix index 9980c3b8..fb50336a 100644 --- a/nixos/machines/adell.nix +++ b/nixos/machines/adell.nix @@ -1,7 +1,10 @@ -{ lib, pkgs, inputs, ... }: - { - imports = [ + lib, + pkgs, + inputs, + ... +}: { + imports = [ ../configuration.nix inputs.nixos-hardware.nixosModules.dell-xps-17-9700-nvidia ]; @@ -32,11 +35,11 @@ ]; # boot.kernelPackages = pkgs.linuxPackages_latest; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; + boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; services.xserver = { - videoDrivers = [ "nvidia" ]; + videoDrivers = ["nvidia"]; }; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -55,17 +58,17 @@ }; }; - fileSystems."/" = - { device = "/dev/disk/by-uuid/18af5b4c-69c7-41a8-865e-bc3f5269d2f9"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/18af5b4c-69c7-41a8-865e-bc3f5269d2f9"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/8A9F-D7D2"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/8A9F-D7D2"; + fsType = "vfat"; + }; - swapDevices = [ ]; + swapDevices = []; networking.hostName = "adell"; diff --git a/nixos/machines/bencbox.nix b/nixos/machines/bencbox.nix index ed8a7e35..2e2a8281 100644 --- a/nixos/machines/bencbox.nix +++ b/nixos/machines/bencbox.nix @@ -1,5 +1,10 @@ -{ lib, pkgs, config, inputs, ... }: { + lib, + pkgs, + config, + inputs, + ... +}: { imports = [ ../configuration.nix ]; @@ -25,17 +30,19 @@ ]; users.users.ben = { - extraGroups = [ - "audio" - "adbusers" - "disk" - "docker" - "networkmanager" - "openrazer" - "plugdev" - "syncthing" - "systemd-journal" - "video" - ] ++ ["wheel"]; + extraGroups = + [ + "audio" + "adbusers" + "disk" + "docker" + "networkmanager" + "openrazer" + "plugdev" + "syncthing" + "systemd-journal" + "video" + ] + ++ ["wheel"]; }; } diff --git a/nixos/machines/biskcomp.nix b/nixos/machines/biskcomp.nix index 509ad954..e91aebc0 100644 --- a/nixos/machines/biskcomp.nix +++ b/nixos/machines/biskcomp.nix @@ -1,7 +1,11 @@ -{ pkgs, lib, config, ... }: -let biskcomp-nginx-hostnames = "192.168.1.44 railbird.ai 1896Folsom.duckdns.org biskcomp.local 0.0.0.0 67.162.131.71"; -in { + pkgs, + lib, + config, + ... +}: let + biskcomp-nginx-hostnames = "192.168.1.44 railbird.ai 1896Folsom.duckdns.org biskcomp.local 0.0.0.0 67.162.131.71"; +in { imports = [ ../configuration.nix ../raspberry-pi.nix @@ -151,7 +155,10 @@ in }; swapDevices = [ - { device = "/swapfile"; size = 8192; } # size is in MiB + { + device = "/swapfile"; + size = 8192; + } # size is in MiB ]; networking.hostName = "biskcomp"; diff --git a/nixos/machines/david-blade.nix b/nixos/machines/david-blade.nix index 4d091bd7..166011aa 100644 --- a/nixos/machines/david-blade.nix +++ b/nixos/machines/david-blade.nix @@ -1,6 +1,9 @@ -{ config, lib, pkgs, ... }: - { + config, + lib, + pkgs, + ... +}: { imports = [ ../configuration.nix ]; @@ -21,12 +24,12 @@ hardware.nvidiaOptimus.disable = true; # install nvidia drivers in addition to intel one - hardware.opengl.extraPackages = [ pkgs.linuxPackages.nvidia_x11.out ]; - hardware.opengl.extraPackages32 = [ pkgs.linuxPackages.nvidia_x11.lib32 ]; + hardware.opengl.extraPackages = [pkgs.linuxPackages.nvidia_x11.out]; + hardware.opengl.extraPackages32 = [pkgs.linuxPackages.nvidia_x11.lib32]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "usbhid" "sd_mod"]; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/nixos/machines/dean-zephyrus.nix b/nixos/machines/dean-zephyrus.nix index 56e152e0..4deb9a6f 100644 --- a/nixos/machines/dean-zephyrus.nix +++ b/nixos/machines/dean-zephyrus.nix @@ -1,5 +1,10 @@ -{ lib, pkgs, config, inputs, ... }: { + lib, + pkgs, + config, + inputs, + ... +}: { imports = [ ../configuration.nix ]; diff --git a/nixos/machines/jay-lenovo-wsl.nix b/nixos/machines/jay-lenovo-wsl.nix index 36d76b5d..4c23b86b 100644 --- a/nixos/machines/jay-lenovo-wsl.nix +++ b/nixos/machines/jay-lenovo-wsl.nix @@ -1,5 +1,10 @@ -{ lib, pkgs, config, inputs, ... }: { + lib, + pkgs, + config, + inputs, + ... +}: { imports = [ ../configuration.nix ]; diff --git a/nixos/machines/jay-lenovo.nix b/nixos/machines/jay-lenovo.nix index 898ef394..3bde6bab 100644 --- a/nixos/machines/jay-lenovo.nix +++ b/nixos/machines/jay-lenovo.nix @@ -1,6 +1,9 @@ -{ config, lib, pkgs, ... }: - { + config, + lib, + pkgs, + ... +}: { imports = [ ../configuration.nix ]; @@ -18,12 +21,18 @@ hardware.enableRedistributableFirmware = true; boot.kernelPackages = pkgs.linuxPackages_latest; - boot.initrd.kernelModules = [ "amdgpu" ]; + boot.initrd.kernelModules = ["amdgpu"]; boot.initrd.availableKernelModules = [ - "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" "amdgpu" + "nvme" + "xhci_pci" + "usbhid" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + "amdgpu" ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -34,8 +43,8 @@ services.libinput.enable = true; services.xserver = { - enable = true; - videoDrivers = [ "amdgpu" ]; + enable = true; + videoDrivers = ["amdgpu"]; }; fileSystems."/" = { diff --git a/nixos/machines/jimi-hendnix.nix b/nixos/machines/jimi-hendnix.nix index d4d5a9f9..9f912161 100644 --- a/nixos/machines/jimi-hendnix.nix +++ b/nixos/machines/jimi-hendnix.nix @@ -1,6 +1,9 @@ -{ config, lib, pkgs, ... }: - { + config, + lib, + pkgs, + ... +}: { imports = [ ../configuration.nix ]; @@ -84,30 +87,30 @@ hardware.enableRedistributableFirmware = true; myModules.nvidia.enable = true; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "usbhid" "sd_mod"]; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; hardware.nvidia.modesetting.enable = true; services.xserver = { - videoDrivers = [ "nvidia" ]; + videoDrivers = ["nvidia"]; }; - fileSystems."/" = - { device = "/dev/disk/by-uuid/30583504-9530-4095-a556-da1209ef9b63"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/30583504-9530-4095-a556-da1209ef9b63"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/CE95-E46C"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/CE95-E46C"; + fsType = "vfat"; + }; swapDevices = [ - { device = "/dev/disk/by-uuid/598e9aa1-4940-4410-a2fa-3dfd8b7d2c0d"; } + {device = "/dev/disk/by-uuid/598e9aa1-4940-4410-a2fa-3dfd8b7d2c0d";} ]; home-manager.sharedModules = [ diff --git a/nixos/machines/justin-bieber-creek.nix b/nixos/machines/justin-bieber-creek.nix index 9aa3c3f0..4e69c5a2 100644 --- a/nixos/machines/justin-bieber-creek.nix +++ b/nixos/machines/justin-bieber-creek.nix @@ -1,6 +1,9 @@ -{ config, lib, pkgs, ... }: - { + config, + lib, + pkgs, + ... +}: { imports = [ ../configuration.nix ]; @@ -36,15 +39,15 @@ }; systemd.services.otbr-agent = { - wants = [ "network-online.target" ]; - after = [ "network-online.target" ]; + wants = ["network-online.target"]; + after = ["network-online.target"]; }; services.openthread-border-router = { enable = true; backboneInterface = "wpan0"; logLevel = "debug"; - radio = { + radio = { device = "/dev/serial/by-id/usb-Nabu_Casa_Home_Assistant_Connect_ZBT-1_0cd053abfa38ef119c66e1d154516304-if00-port0"; baudRate = 460800; flowControl = true; @@ -60,13 +63,14 @@ services.matter-server = { enable = true; logLevel = "debug"; - extraArgs = let cert-dir = pkgs.fetchFromGitHub { - repo = "connectedhomeip"; - owner = "project-chip"; - rev = "6e8676be6142bb541fa68048c77f2fc56a21c7b1"; - hash = "sha256-QwPKn2R4mflTKMyr1k4xF04t0PJIlzNCOdXEiQwX5wk="; - }; in - [ + extraArgs = let + cert-dir = pkgs.fetchFromGitHub { + repo = "connectedhomeip"; + owner = "project-chip"; + rev = "6e8676be6142bb541fa68048c77f2fc56a21c7b1"; + hash = "sha256-QwPKn2R4mflTKMyr1k4xF04t0PJIlzNCOdXEiQwX5wk="; + }; + in [ "--bluetooth-adapter=0" "--paa-root-cert-dir=${cert-dir}/credentials/production/paa-root-certs" "--enable-test-net-dcl" @@ -109,11 +113,12 @@ "wyoming" "yale" ]; - extraPackages = python3Packages: with python3Packages; [ - numpy - python-matter-server - universal-silabs-flasher - ]; + extraPackages = python3Packages: + with python3Packages; [ + numpy + python-matter-server + universal-silabs-flasher + ]; config = { http = { use_x_forwarded_for = true; @@ -170,27 +175,27 @@ boot.kernelPackages = pkgs.linuxPackages_latest; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; boot.loader.systemd-boot.enable = true; # Add Intel Wi-Fi firmware hardware.enableRedistributableFirmware = true; hardware.enableAllFirmware = true; - fileSystems."/" = - { device = "/dev/disk/by-uuid/453d28a1-26f2-4b25-ac72-c6d301fd0bb8"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/453d28a1-26f2-4b25-ac72-c6d301fd0bb8"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/184E-E5E8"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/184E-E5E8"; + fsType = "vfat"; + }; - swapDevices = [ ]; + swapDevices = []; networking.hostName = "justin-bieber-creek"; diff --git a/nixos/machines/nixquick.nix b/nixos/machines/nixquick.nix index 2c754c84..cd8cbde6 100644 --- a/nixos/machines/nixquick.nix +++ b/nixos/machines/nixquick.nix @@ -1,5 +1,10 @@ -{ config, lib, pkgs, inputs, ... }: { + config, + lib, + pkgs, + inputs, + ... +}: { imports = [ ../configuration.nix ]; @@ -29,10 +34,10 @@ networking.hostName = "nixquick"; hardware.enableRedistributableFirmware = true; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; boot.loader.systemd-boot.enable = true; hardware.nvidia.modesetting.enable = true; @@ -40,20 +45,19 @@ # This also enables v4l2loopback programs.droidcam.enable = true; - fileSystems."/" = - { device = "/dev/disk/by-uuid/64a7c1f5-727a-413c-81a2-cb108728cff6"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/64a7c1f5-727a-413c-81a2-cb108728cff6"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/EE25-DC15"; - fsType = "vfat"; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/c0dcff59-8072-48fb-b242-a7a1797e4b48"; } - ]; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/EE25-DC15"; + fsType = "vfat"; + }; + swapDevices = [ + {device = "/dev/disk/by-uuid/c0dcff59-8072-48fb-b242-a7a1797e4b48";} + ]; networking.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/nixos/machines/railbird-sf.nix b/nixos/machines/railbird-sf.nix index ea94ae01..12a2b237 100644 --- a/nixos/machines/railbird-sf.nix +++ b/nixos/machines/railbird-sf.nix @@ -6,8 +6,7 @@ orgAgendaApiContainer ? null, orgAgendaApiImageName ? "localhost/org-agenda-api:colonelpanic-dbb1cb8-030a673", ... -}: -{ +}: { imports = [ ../configuration.nix inputs.agenix.nixosModules.default @@ -16,7 +15,7 @@ networking.hostName = "railbird-sf"; # Allow nginx to serve content synced into /var/lib/syncthing/* (owned by syncthing:syncthing, 2770 perms). - users.users.nginx.extraGroups = [ "syncthing" ]; + users.users.nginx.extraGroups = ["syncthing"]; # org-agenda-api hosting with nginx + Let's Encrypt # Separate secrets for org-agenda-api: auth password (env format) and SSH key (raw file) @@ -25,7 +24,7 @@ }; age.secrets.org-api-ssh-key = { file = ../secrets/org-api-ssh-key.age; - mode = "0400"; # Restrictive permissions for SSH key + mode = "0400"; # Restrictive permissions for SSH key }; services.org-agenda-api-host = { @@ -38,10 +37,10 @@ }; hardware.enableRedistributableFirmware = true; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; boot.loader.systemd-boot.enable = true; myModules.postgres.enable = true; features.full.enable = true; @@ -100,19 +99,19 @@ # Note: you may still need router/NAT port-forwards for inbound access from the internet. services.syncthing.openDefaultPorts = true; - fileSystems."/" = - { device = "/dev/disk/by-uuid/a317d456-6f84-41ee-a149-8e466e414aae"; + fileSystems."/" = { + device = "/dev/disk/by-uuid/a317d456-6f84-41ee-a149-8e466e414aae"; fsType = "ext4"; - }; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/B875-39D4"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/B875-39D4"; + fsType = "vfat"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/129345f3-e1e1-4d45-9db9-643160c6d564"; } - ]; + swapDevices = [ + {device = "/dev/disk/by-uuid/129345f3-e1e1-4d45-9db9-643160c6d564";} + ]; environment.systemPackages = with pkgs; [ android-studio diff --git a/nixos/machines/ryzen-shine-original.nix b/nixos/machines/ryzen-shine-original.nix index 5a281d16..ed5cf947 100644 --- a/nixos/machines/ryzen-shine-original.nix +++ b/nixos/machines/ryzen-shine-original.nix @@ -1,6 +1,8 @@ -{ lib, pkgs, ... }: - { + lib, + pkgs, + ... +}: { imports = [ ../configuration.nix ]; @@ -46,23 +48,23 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; boot.initrd.luks.devices."cryptroot".device = "/dev/nvme0n1p5"; - boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.initrd.kernelModules = ["dm-snapshot"]; # install nvidia drivers in addition to intel one - hardware.graphics.extraPackages = [ pkgs.linuxPackages.nvidia_x11.out ]; - hardware.graphics.extraPackages32 = [ pkgs.linuxPackages.nvidia_x11.lib32 ]; + hardware.graphics.extraPackages = [pkgs.linuxPackages.nvidia_x11.out]; + hardware.graphics.extraPackages32 = [pkgs.linuxPackages.nvidia_x11.lib32]; services.xserver = { - videoDrivers = [ "nvidia" ]; + videoDrivers = ["nvidia"]; }; hardware.nvidia.modesetting.enable = true; hardware.graphics.enable32Bit = true; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; fileSystems."/" = { device = "/dev/disk/by-uuid/356173ab-d076-43e0-aeb6-6a6829c4402b"; @@ -77,11 +79,11 @@ fileSystems."/shared" = { device = "/dev/disk/by-uuid/D4009CE8009CD33A"; fsType = "ntfs"; - options = [ "nofail" "uid=0" "gid=users" "umask=002" ]; + options = ["nofail" "uid=0" "gid=users" "umask=002"]; }; swapDevices = [ - { device = "/dev/disk/by-uuid/f719b44e-295a-4909-9a60-84f87acb7f77"; } + {device = "/dev/disk/by-uuid/f719b44e-295a-4909-9a60-84f87acb7f77";} ]; # nix.settings.maxJobs = lib.mkDefault 16; diff --git a/nixos/machines/ryzen-shine-wsl.nix b/nixos/machines/ryzen-shine-wsl.nix index c0b85f4a..ba7b0679 100644 --- a/nixos/machines/ryzen-shine-wsl.nix +++ b/nixos/machines/ryzen-shine-wsl.nix @@ -1,5 +1,10 @@ -{ lib, pkgs, config, inputs, ... }: { + lib, + pkgs, + config, + inputs, + ... +}: { imports = [ ../configuration.nix ]; diff --git a/nixos/machines/ryzen-shine.nix b/nixos/machines/ryzen-shine.nix index 387da413..a8b6697c 100644 --- a/nixos/machines/ryzen-shine.nix +++ b/nixos/machines/ryzen-shine.nix @@ -1,6 +1,8 @@ -{ lib, pkgs, ... }: - { + lib, + pkgs, + ... +}: { imports = [ ../configuration.nix ../nixified.ai.nix @@ -64,14 +66,14 @@ networking.interfaces.enp5s0.useDHCP = true; networking.interfaces.wlp4s0.useDHCP = true; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; hardware.nvidia.modesetting.enable = true; hardware.graphics.enable32Bit = true; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; fileSystems."/" = { device = "/dev/disk/by-uuid/9bd06145-8151-4f7b-bcfe-f1809e0db1ea"; @@ -86,11 +88,14 @@ fileSystems."/shared" = { device = "/dev/disk/by-uuid/D4009CE8009CD33A"; fsType = "ntfs"; - options = [ "nofail" "uid=0" "gid=users" "umask=002" ]; + options = ["nofail" "uid=0" "gid=users" "umask=002"]; }; swapDevices = [ - { device = "/swapfile"; size = 49152; } + { + device = "/swapfile"; + size = 49152; + } ]; # nix.settings.maxJobs = lib.mkDefault 16; diff --git a/nixos/machines/strixi-minaj-wsl.nix b/nixos/machines/strixi-minaj-wsl.nix index e039becc..897de012 100644 --- a/nixos/machines/strixi-minaj-wsl.nix +++ b/nixos/machines/strixi-minaj-wsl.nix @@ -1,5 +1,10 @@ -{ lib, pkgs, config, inputs, ... }: { + lib, + pkgs, + config, + inputs, + ... +}: { imports = [ ../configuration.nix ]; diff --git a/nixos/machines/strixi-minaj.nix b/nixos/machines/strixi-minaj.nix index 4fe435f0..2312dfaa 100644 --- a/nixos/machines/strixi-minaj.nix +++ b/nixos/machines/strixi-minaj.nix @@ -1,6 +1,10 @@ -{ config, lib, pkgs, inputs, ... }: - { + config, + lib, + pkgs, + inputs, + ... +}: { imports = [ ../configuration.nix inputs.nixos-hardware.nixosModules.asus-rog-strix-g834jzr @@ -61,10 +65,10 @@ boot.kernelPackages = pkgs.linuxPackages; # See https://github.com/NixOS/nixpkgs/issues/467814 for why this was needed hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta; - boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "thunderbolt" "nvme" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ "nvidia" "nvidia_drm" "nvidia_uvm" "nvidia_modeset" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["vmd" "xhci_pci" "thunderbolt" "nvme" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = ["nvidia" "nvidia_drm" "nvidia_uvm" "nvidia_modeset"]; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; hardware.nvidia.powerManagement.enable = true; # This laptop has a hardware MUX, so prefer dGPU-only mode instead of # PRIME sync hybrid mode to keep the compositor and displays on NVIDIA. @@ -91,8 +95,11 @@ }; swapDevices = [ - { device = "/dev/disk/by-uuid/27f277a0-b552-43a0-904d-625e48922bb9"; } - { device = "/swapfile"; size = 16384; } # size is in MiB (adds 16 GiB) + {device = "/dev/disk/by-uuid/27f277a0-b552-43a0-904d-625e48922bb9";} + { + device = "/swapfile"; + size = 16384; + } # size is in MiB (adds 16 GiB) ]; networking.hostName = "strixi-minaj"; diff --git a/nixos/make-enable.nix b/nixos/make-enable.nix index 35f99efc..07a68e19 100644 --- a/nixos/make-enable.nix +++ b/nixos/make-enable.nix @@ -1,14 +1,10 @@ -lib: config: pathStr: default: configAttrs: -let - - pathToAttrSet = str: value: - let +lib: config: pathStr: default: configAttrs: let + pathToAttrSet = str: value: let parts = lib.splitString "." str; in - if lib.length parts == 1 then - { ${lib.head parts} = value; } - else - { ${lib.head parts} = pathToAttrSet (lib.concatStringsSep "." (lib.tail parts)) value; }; + if lib.length parts == 1 + then {${lib.head parts} = value;} + else {${lib.head parts} = pathToAttrSet (lib.concatStringsSep "." (lib.tail parts)) value;}; optionsSet = pathToAttrSet pathStr { enable = lib.mkOption { @@ -17,15 +13,16 @@ let }; }; - cfg = lib.attrByPath (lib.splitString "." pathStr) { enable = false; } config; + cfg = lib.attrByPath (lib.splitString "." pathStr) {enable = false;} config; # Extract 'imports' from configAttrs, if it exists - importsAttr = if configAttrs ? imports then configAttrs.imports else []; + importsAttr = + if configAttrs ? imports + then configAttrs.imports + else []; # Remove 'imports' from configAttrs configAttrsWithoutImports = lib.attrsets.removeAttrs configAttrs ["imports"]; - -in -{ +in { options = optionsSet; config = lib.mkIf cfg.enable configAttrsWithoutImports; imports = importsAttr; diff --git a/nixos/nixified.ai.nix b/nixos/nixified.ai.nix index 0499a4f1..85aa1923 100644 --- a/nixos/nixified.ai.nix +++ b/nixos/nixified.ai.nix @@ -1,11 +1,15 @@ -{ inputs, config, pkgs, specialArgs, ... }: -let +{ + inputs, + config, + pkgs, + specialArgs, + ... +}: let system = pkgs.stdenv.hostPlatform.system; - nixifiedAiComfyuiModule = - import (inputs.nixified-ai + "/flake-modules/projects/comfyui/module.nix") { - overlays = patchedNixifiedAiOverlays; - }; + nixifiedAiComfyuiModule = import (inputs.nixified-ai + "/flake-modules/projects/comfyui/module.nix") { + overlays = patchedNixifiedAiOverlays; + }; patchedNixifiedAiOverlays = [ patchedNixifiedAiComfyuiOverlay @@ -13,14 +17,13 @@ let inputs.nixified-ai.overlays.fetchers ]; - patchedNixifiedAiComfyuiOverlay = final: prev: - let - upstream = inputs.nixified-ai.overlays.comfyui final prev; - in - (builtins.removeAttrs upstream [ "python3Packages" ]) // { + patchedNixifiedAiComfyuiOverlay = final: prev: let + upstream = inputs.nixified-ai.overlays.comfyui final prev; + in + (builtins.removeAttrs upstream ["python3Packages"]) + // { python3Packages = prev.python3Packages.overrideScope ( - python-final: python-prev: - let + python-final: python-prev: let extraPackages = final.lib.packagesFromDirectoryRecursive { inherit (python-final) callPackage; directory = inputs.nixified-ai + "/flake-modules/packages"; @@ -28,7 +31,7 @@ let packagesAlreadyInPrev = builtins.filter (name: python-prev ? ${name}) (builtins.attrNames extraPackages); in - builtins.removeAttrs extraPackages packagesAlreadyInPrev + builtins.removeAttrs extraPackages packagesAlreadyInPrev ); }; @@ -37,7 +40,7 @@ let url = "https://huggingface.co/Phr00t/Qwen-Image-Edit-Rapid-AIO/resolve/main/v23/Qwen-Rapid-AIO-NSFW-v23.safetensors"; hash = "sha256-/bkZ/IG+pj8TdZln/JLJEYFC5ccNTmeVGZIzo17vojM="; passthru = { - comfyui.installPaths = [ "checkpoints" ]; + comfyui.installPaths = ["checkpoints"]; }; }; @@ -47,54 +50,55 @@ let hash = "sha256-nfliiPRmygP31/qFh61TyAIbeE9C2qvcH1mmG3HEAjg="; }; - qwenRapidAioWorkflow = pkgs.runCommand "qwen-rapid-aio-v23-nsfw-workflow.json" { - nativeBuildInputs = [ pkgs.jq ]; - src = pkgs.fetchurl { - name = "Qwen-Rapid-AIO.json"; - url = "https://huggingface.co/Phr00t/Qwen-Image-Edit-Rapid-AIO/resolve/main/Qwen-Rapid-AIO.json"; - hash = "sha256-oLAF49cJuiQFoPfH2LW2HLHoN9py2REL9i/z/q4ijec="; - }; - } '' - jq ' - (.nodes[] | select(.type == "CheckpointLoaderSimple") | .widgets_values[0]) = "Qwen-Rapid-AIO-NSFW-v23.safetensors" - | (.nodes[] | select(.id == 7) | .title) = "Input Image 1" - | (.nodes[] | select(.id == 8) | .title) = "Optional Input Image 2" - | (.nodes[] | select(.id == 7) | .outputs[0].links) |= ((. // []) + [19]) - | (.nodes[] | select(.id == 9) | .inputs) = [ - {"name": "width", "type": "INT", "link": 20}, - {"name": "height", "type": "INT", "link": 21} - ] - | (.nodes[] | select(.id == 9) | .widgets_values) = [768, 768, 1] - | .nodes += [ - { - "id": 10, - "type": "GetImageSize", - "pos": [-565.0, 735.0], - "size": [210.0, 82.0], - "flags": {}, - "order": 8, - "mode": 0, - "inputs": [ - {"name": "image", "type": "IMAGE", "link": 19} - ], - "outputs": [ - {"name": "width", "type": "INT", "links": [20]}, - {"name": "height", "type": "INT", "links": [21]}, - {"name": "batch_size", "type": "INT", "links": null} - ], - "properties": { - "Node name for S&R": "GetImageSize" - }, - "widgets_values": [] - } - ] - | .links += [ - [19, 7, 0, 10, 0, "IMAGE"], - [20, 10, 0, 9, 0, "INT"], - [21, 10, 1, 9, 1, "INT"] - ] - ' "$src" > "$out" - ''; + qwenRapidAioWorkflow = + pkgs.runCommand "qwen-rapid-aio-v23-nsfw-workflow.json" { + nativeBuildInputs = [pkgs.jq]; + src = pkgs.fetchurl { + name = "Qwen-Rapid-AIO.json"; + url = "https://huggingface.co/Phr00t/Qwen-Image-Edit-Rapid-AIO/resolve/main/Qwen-Rapid-AIO.json"; + hash = "sha256-oLAF49cJuiQFoPfH2LW2HLHoN9py2REL9i/z/q4ijec="; + }; + } '' + jq ' + (.nodes[] | select(.type == "CheckpointLoaderSimple") | .widgets_values[0]) = "Qwen-Rapid-AIO-NSFW-v23.safetensors" + | (.nodes[] | select(.id == 7) | .title) = "Input Image 1" + | (.nodes[] | select(.id == 8) | .title) = "Optional Input Image 2" + | (.nodes[] | select(.id == 7) | .outputs[0].links) |= ((. // []) + [19]) + | (.nodes[] | select(.id == 9) | .inputs) = [ + {"name": "width", "type": "INT", "link": 20}, + {"name": "height", "type": "INT", "link": 21} + ] + | (.nodes[] | select(.id == 9) | .widgets_values) = [768, 768, 1] + | .nodes += [ + { + "id": 10, + "type": "GetImageSize", + "pos": [-565.0, 735.0], + "size": [210.0, 82.0], + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + {"name": "image", "type": "IMAGE", "link": 19} + ], + "outputs": [ + {"name": "width", "type": "INT", "links": [20]}, + {"name": "height", "type": "INT", "links": [21]}, + {"name": "batch_size", "type": "INT", "links": null} + ], + "properties": { + "Node name for S&R": "GetImageSize" + }, + "widgets_values": [] + } + ] + | .links += [ + [19, 7, 0, 10, 0, "IMAGE"], + [20, 10, 0, 9, 0, "INT"], + [21, 10, 1, 9, 1, "INT"] + ] + ' "$src" > "$out" + ''; nixifiedComfyuiPkgs = import pkgs.path { inherit system; @@ -107,60 +111,64 @@ let nixifiedComfyuiPackages = nixifiedComfyuiPkgs.comfyuiPackages; - patchedComfyuiPackages = nixifiedComfyuiPackages // { - comfyui-unwrapped = nixifiedComfyuiPackages.comfyui-unwrapped.overrideAttrs (old: { - postPatch = (old.postPatch or "") + '' - cp ${qwenImageEditPlusV2Node} comfy_extras/nodes_qwen.py - ''; - }); - }; + patchedComfyuiPackages = + nixifiedComfyuiPackages + // { + comfyui-unwrapped = nixifiedComfyuiPackages.comfyui-unwrapped.overrideAttrs (old: { + postPatch = + (old.postPatch or "") + + '' + cp ${qwenImageEditPlusV2Node} comfy_extras/nodes_qwen.py + ''; + }); + }; comfyuiPackage = nixifiedComfyuiPackages.comfyui.override { comfyuiPackages = patchedComfyuiPackages; }; in -specialArgs.makeEnable config "myModules.nixified-ai" false { - imports = [ - nixifiedAiComfyuiModule - ]; + specialArgs.makeEnable config "myModules.nixified-ai" false { + imports = [ + nixifiedAiComfyuiModule + ]; - nixpkgs.overlays = patchedNixifiedAiOverlays; + nixpkgs.overlays = patchedNixifiedAiOverlays; - services.comfyui = { - enable = true; - package = comfyuiPackage; - host = "0.0.0.0"; - acceleration = "cuda"; - environmentVariables = { - PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"; + services.comfyui = { + enable = true; + package = comfyuiPackage; + host = "0.0.0.0"; + acceleration = "cuda"; + environmentVariables = { + PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"; + }; + extraFlags = [ + "--lowvram" + "--fp8_e4m3fn-text-enc" + "--cache-none" + "--reserve-vram" + "2.0" + "--disable-smart-memory" + ]; + models = [ + qwenRapidAioNsfwV23 + (pkgs.fetchurl { + name = "lustifySDXLNSFW_v20-inpainting.safetensors"; + url = "https://huggingface.co/andro-flock/LUSTIFY-SDXL-NSFW-checkpoint-v2-0-INPAINTING/resolve/main/lustifySDXLNSFW_v20-inpainting.safetensors"; + hash = "sha256-YV8hBx9c6PkWQNIlJTGQTOuL+HNmGVIavuSdlKX434Q="; + passthru = { + comfyui.installPaths = ["checkpoints"]; + }; + }) + ]; }; - extraFlags = [ - "--lowvram" - "--fp8_e4m3fn-text-enc" - "--cache-none" - "--reserve-vram" - "2.0" - "--disable-smart-memory" - ]; - models = [ - qwenRapidAioNsfwV23 - (pkgs.fetchurl { - name = "lustifySDXLNSFW_v20-inpainting.safetensors"; - url = "https://huggingface.co/andro-flock/LUSTIFY-SDXL-NSFW-checkpoint-v2-0-INPAINTING/resolve/main/lustifySDXLNSFW_v20-inpainting.safetensors"; - hash = "sha256-YV8hBx9c6PkWQNIlJTGQTOuL+HNmGVIavuSdlKX434Q="; - passthru = { - comfyui.installPaths = [ "checkpoints" ]; - }; - }) - ]; - }; - systemd.services.comfyui.serviceConfig.ExecStartPre = [ - "+${pkgs.writeShellScript "install-qwen-rapid-aio-workflow" '' - rm -f /var/lib/comfyui/workflows/Qwen-Rapid-AIO-v23-SFW.json - rm -f /var/lib/comfyui/.local/share/comfyui/user/default/workflows/Qwen-Rapid-AIO-v23-SFW.json - install -D -m 0644 ${qwenRapidAioWorkflow} /var/lib/comfyui/workflows/Qwen-Rapid-AIO-v23-NSFW.json - install -D -m 0644 ${qwenRapidAioWorkflow} /var/lib/comfyui/.local/share/comfyui/user/default/workflows/Qwen-Rapid-AIO-v23-NSFW.json - ''}" - ]; -} + systemd.services.comfyui.serviceConfig.ExecStartPre = [ + "+${pkgs.writeShellScript "install-qwen-rapid-aio-workflow" '' + rm -f /var/lib/comfyui/workflows/Qwen-Rapid-AIO-v23-SFW.json + rm -f /var/lib/comfyui/.local/share/comfyui/user/default/workflows/Qwen-Rapid-AIO-v23-SFW.json + install -D -m 0644 ${qwenRapidAioWorkflow} /var/lib/comfyui/workflows/Qwen-Rapid-AIO-v23-NSFW.json + install -D -m 0644 ${qwenRapidAioWorkflow} /var/lib/comfyui/.local/share/comfyui/user/default/workflows/Qwen-Rapid-AIO-v23-NSFW.json + ''}" + ]; + } diff --git a/nixos/noctalia.nix b/nixos/noctalia.nix index 3dd3de53..4591ad53 100644 --- a/nixos/noctalia.nix +++ b/nixos/noctalia.nix @@ -5,8 +5,7 @@ makeEnable, pkgs, ... -}: -let +}: let system = pkgs.stdenv.hostPlatform.system; noctaliaPackage = inputs.noctalia.packages.${system}.default; waitForWayland = pkgs.writeShellScript "noctalia-wait-for-wayland" '' @@ -23,26 +22,25 @@ let exit 1 ''; in -makeEnable config "myModules.noctalia" false { - environment.systemPackages = [ - noctaliaPackage - ]; + makeEnable config "myModules.noctalia" false { + environment.systemPackages = [ + noctaliaPackage + ]; - # Noctalia's battery widget talks to UPower. Hosts that deliberately do not - # have batteries can still override this back to false. - services.upower.enable = lib.mkDefault true; + # Noctalia's battery widget talks to UPower. Hosts that deliberately do not + # have batteries can still override this back to false. + services.upower.enable = lib.mkDefault true; - home-manager.sharedModules = [ - inputs.noctalia.homeModules.default - ({ lib, ... }: { - programs.noctalia-shell = { - enable = true; - # This module provides the Hyprland-scoped service below. - systemd.enable = false; - }; + home-manager.sharedModules = [ + inputs.noctalia.homeModules.default + ({lib, ...}: { + programs.noctalia-shell = { + enable = true; + # This module provides the Hyprland-scoped service below. + systemd.enable = false; + }; - home.activation.noctaliaLauncherOverviewLayer = - lib.hm.dag.entryAfter [ "writeBoundary" ] '' + home.activation.noctaliaLauncherOverviewLayer = lib.hm.dag.entryAfter ["writeBoundary"] '' settings_file="$HOME/.config/noctalia/settings.json" settings_tmp="$(${pkgs.coreutils}/bin/mktemp)" @@ -64,24 +62,24 @@ makeEnable config "myModules.noctalia" false { fi ''; - systemd.user.services.noctalia-shell = { - Unit = { - Description = "Noctalia Shell"; - Documentation = "https://docs.noctalia.dev"; - PartOf = [ "hyprland-session.target" ]; - After = [ "hyprland-session.target" ]; - }; + systemd.user.services.noctalia-shell = { + Unit = { + Description = "Noctalia Shell"; + Documentation = "https://docs.noctalia.dev"; + PartOf = ["hyprland-session.target"]; + After = ["hyprland-session.target"]; + }; - Service = { - ExecCondition = "/run/current-system/sw/bin/desktop_shell_ui exec-condition noctalia"; - ExecStartPre = "${waitForWayland}"; - ExecStart = "${lib.getExe noctaliaPackage} --no-duplicate"; - Restart = "on-failure"; - RestartSec = 1; - }; + Service = { + ExecCondition = "/run/current-system/sw/bin/desktop_shell_ui exec-condition noctalia"; + ExecStartPre = "${waitForWayland}"; + ExecStart = "${lib.getExe noctaliaPackage} --no-duplicate"; + Restart = "on-failure"; + RestartSec = 1; + }; - Install.WantedBy = [ "hyprland-session.target" ]; - }; - }) - ]; -} + Install.WantedBy = ["hyprland-session.target"]; + }; + }) + ]; + } diff --git a/nixos/notifications-tray-icon.nix b/nixos/notifications-tray-icon.nix index 2678a435..aa6e21c3 100644 --- a/nixos/notifications-tray-icon.nix +++ b/nixos/notifications-tray-icon.nix @@ -1,24 +1,35 @@ -{ config, pkgs, inputs, lib, makeEnable, ... }: +{ + config, + pkgs, + inputs, + lib, + makeEnable, + ... +}: makeEnable config "myModules.notifications-tray-icon" true { nixpkgs.overlays = [ inputs.notifications-tray-icon.overlays.default (final: prev: { haskellPackages = prev.haskellPackages.override (old: { - overrides = final.lib.composeExtensions (old.overrides or (_: _: {})) + overrides = + final.lib.composeExtensions (old.overrides or (_: _: {})) (hself: hsuper: { - notifications-tray-icon = final.haskell.lib.overrideCabal + notifications-tray-icon = + final.haskell.lib.overrideCabal hsuper.notifications-tray-icon (oldAttrs: { - patches = (oldAttrs.patches or []) ++ [ - ./patches/notifications-tray-icon-gmail-oauth-detached-browser.patch - ]; + patches = + (oldAttrs.patches or []) + ++ [ + ./patches/notifications-tray-icon-gmail-oauth-detached-browser.patch + ]; }); }); }); }) ]; - home-manager.users.imalison = { config, ... }: let + home-manager.users.imalison = {config, ...}: let notificationsTrayIcon = pkgs.haskellPackages.notifications-tray-icon; gmailExecStart = pkgs.writeShellScript "notifications-tray-icon-gmail" '' creds_file="${config.xdg.configHome}/gws/client_secret.json" @@ -37,9 +48,9 @@ makeEnable config "myModules.notifications-tray-icon" true { mkService = description: execStart: { Unit = { Description = description; - After = [ "graphical-session.target" "tray.target" ]; - PartOf = [ "graphical-session.target" ]; - Requires = [ "tray.target" ]; + After = ["graphical-session.target" "tray.target"]; + PartOf = ["graphical-session.target"]; + Requires = ["tray.target"]; }; Service = { ExecStart = execStart; @@ -47,20 +58,23 @@ makeEnable config "myModules.notifications-tray-icon" true { RestartSec = 3; }; Install = { - WantedBy = [ "graphical-session.target" ]; + WantedBy = ["graphical-session.target"]; }; }; in { systemd.user.services = { - notifications-tray-icon-github = mkService + notifications-tray-icon-github = + mkService "GitHub notifications tray icon" "${notificationsTrayIcon}/bin/notifications-tray-icon github --token-pass github-token"; - notifications-tray-icon-gitea = mkService + notifications-tray-icon-gitea = + mkService "Gitea notifications tray icon" "${notificationsTrayIcon}/bin/notifications-tray-icon gitea --url https://dev.railbird.ai --token-pass gitea-omni-token"; - notifications-tray-icon-gmail = mkService + notifications-tray-icon-gmail = + mkService "Gmail notifications tray icon" "${gmailExecStart}"; }; diff --git a/nixos/nvidia-container-toolkit-overlay.nix b/nixos/nvidia-container-toolkit-overlay.nix index 6905315a..a25530ee 100644 --- a/nixos/nvidia-container-toolkit-overlay.nix +++ b/nixos/nvidia-container-toolkit-overlay.nix @@ -6,13 +6,13 @@ final: prev: { # This is key: multiple outputs, so you can reference them later as: # $out -> for main # $tools -> for the 'tools' output in your new derivation - outputs = [ "out" "tools" ]; + outputs = ["out" "tools"]; # No source required for a pure wrap src = null; dontUnpack = true; dontPatchShell = true; - nativeBuildInputs = [ final.installShellFiles ] ++ final.lib.optionals final.stdenv.hostPlatform.isLinux [ final.makeWrapper ]; + nativeBuildInputs = [final.installShellFiles] ++ final.lib.optionals final.stdenv.hostPlatform.isLinux [final.makeWrapper]; buildInputs = [ prev.nvidia-container-toolkit diff --git a/nixos/nvidia.nix b/nixos/nvidia.nix index 115050da..2c3cf220 100644 --- a/nixos/nvidia.nix +++ b/nixos/nvidia.nix @@ -1,5 +1,10 @@ -{ config, pkgs, makeEnable, lib, ... }: - +{ + config, + pkgs, + makeEnable, + lib, + ... +}: makeEnable config "myModules.nvidia" false { environment.systemPackages = with pkgs; [ nvidia-container-toolkit @@ -16,10 +21,10 @@ makeEnable config "myModules.nvidia" false { }; hardware.nvidia.open = true; hardware.graphics.enable32Bit = true; - hardware.graphics.extraPackages = [ config.hardware.nvidia.package.out ]; - hardware.graphics.extraPackages32 = [ config.hardware.nvidia.package.lib32 ]; + hardware.graphics.extraPackages = [config.hardware.nvidia.package.out]; + hardware.graphics.extraPackages32 = [config.hardware.nvidia.package.lib32]; services.xserver = { - videoDrivers = [ "nvidia" ]; + videoDrivers = ["nvidia"]; }; # nixpkgs.config.cudaSupport = true; } diff --git a/nixos/options.nix b/nixos/options.nix index 5d3fc5bb..0d240aee 100644 --- a/nixos/options.nix +++ b/nixos/options.nix @@ -1,4 +1,4 @@ -{ lib, ... }: { +{lib, ...}: { options = { myModules.xmonad.picom.vSync.enable = lib.mkOption { default = true; diff --git a/nixos/org-agenda-api-host.nix b/nixos/org-agenda-api-host.nix index 38029122..fae80c3d 100644 --- a/nixos/org-agenda-api-host.nix +++ b/nixos/org-agenda-api-host.nix @@ -1,14 +1,15 @@ # org-agenda-api-host.nix - Host org-agenda-api container with nginx + Let's Encrypt -{ config, lib, pkgs, ... }: - -with lib; - -let +{ + config, + lib, + pkgs, + ... +}: +with lib; let cfg = config.services.org-agenda-api-host; # Random high port to avoid conflicts containerPort = 51847; -in -{ +in { options.services.org-agenda-api-host = { enable = mkEnableOption "org-agenda-api container hosting"; @@ -22,7 +23,7 @@ in type = types.listOf types.str; default = []; description = "Additional full domain names to serve (each gets its own ACME cert)"; - example = [ "org-agenda-api.example.com" ]; + example = ["org-agenda-api.example.com"]; }; acmeEmail = mkOption { @@ -119,12 +120,13 @@ in }; }; }; - allDomains = [ "org-agenda-api.${cfg.domain}" ] ++ cfg.extraDomains; - in builtins.listToAttrs (map mkVirtualHost allDomains); + allDomains = ["org-agenda-api.${cfg.domain}"] ++ cfg.extraDomains; + in + builtins.listToAttrs (map mkVirtualHost allDomains); }; # Open firewall for HTTP/HTTPS - networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedTCPPorts = [80 443]; # Container service using podman virtualisation.oci-containers = { @@ -133,7 +135,7 @@ in image = cfg.containerImage; imageFile = cfg.containerImageFile; autoStart = true; - ports = [ "127.0.0.1:${toString containerPort}:80" ]; + ports = ["127.0.0.1:${toString containerPort}:80"]; environment = { TZ = cfg.timezone; GIT_SYNC_REPOSITORY = cfg.gitSyncRepository; @@ -141,12 +143,12 @@ in GIT_USER_NAME = cfg.gitUserName; AUTH_USER = cfg.authUser; }; - environmentFiles = [ cfg.secretsFile ]; + environmentFiles = [cfg.secretsFile]; volumes = lib.optionals (cfg.sshKeyFile != null) [ "${cfg.sshKeyFile}:/secrets/ssh_key:ro" ]; extraOptions = [ - "--pull=never" # Image is from nix store, don't try to pull + "--pull=never" # Image is from nix store, don't try to pull ]; }; }; diff --git a/nixos/org-agenda-api.nix b/nixos/org-agenda-api.nix index 6d7dcfad..540df0aa 100644 --- a/nixos/org-agenda-api.nix +++ b/nixos/org-agenda-api.nix @@ -1,34 +1,37 @@ # org-agenda-api.nix - Tangled org-config for org-agenda-api container -{ pkgs, inputs, system }: -let +{ + pkgs, + inputs, + system, +}: let # Path to org-config.org in the dotfiles orgConfigOrg = ../dotfiles/emacs.d/org-config.org; # Tangle org-config.org to produce elisp files - orgAgendaCustomConfig = pkgs.runCommand "org-agenda-custom-config" { - buildInputs = [ pkgs.emacs-nox ]; - } '' - mkdir -p $out - mkdir -p work + orgAgendaCustomConfig = + pkgs.runCommand "org-agenda-custom-config" { + buildInputs = [pkgs.emacs-nox]; + } '' + mkdir -p $out + mkdir -p work - # Copy org file to writable location (tangle writes to same directory) - cp ${orgConfigOrg} work/org-config.org + # Copy org file to writable location (tangle writes to same directory) + cp ${orgConfigOrg} work/org-config.org - # Tangle org-config.org - emacs --batch \ - --eval '(require (quote org))' \ - --eval '(org-babel-tangle-file "work/org-config.org")' - - # Copy all tangled files to output, stripping :straight keywords - # (straight.el is not available in the minimal container Emacs) - for f in work/org-config-*.el; do - if [ -f "$f" ]; then - # Remove :straight nil and :straight t from use-package declarations - sed -e 's/:straight nil//g' -e 's/:straight t//g' "$f" > "$out/$(basename "$f")" - fi - done - ''; + # Tangle org-config.org + emacs --batch \ + --eval '(require (quote org))' \ + --eval '(org-babel-tangle-file "work/org-config.org")' + # Copy all tangled files to output, stripping :straight keywords + # (straight.el is not available in the minimal container Emacs) + for f in work/org-config-*.el; do + if [ -f "$f" ]; then + # Remove :straight nil and :straight t from use-package declarations + sed -e 's/:straight nil//g' -e 's/:straight t//g' "$f" > "$out/$(basename "$f")" + fi + done + ''; in { org-agenda-custom-config = orgAgendaCustomConfig; } diff --git a/nixos/packages/happy-coder/default.nix b/nixos/packages/happy-coder/default.nix index 6f2a742c..661cbd46 100644 --- a/nixos/packages/happy-coder/default.nix +++ b/nixos/packages/happy-coder/default.nix @@ -7,29 +7,25 @@ nodejs, makeWrapper, }: - stdenv.mkDerivation ( - finalAttrs: - let + finalAttrs: let toolArchiveSuffix = - if stdenv.hostPlatform.isLinux then - if stdenv.hostPlatform.isAarch64 then - "arm64-linux" - else if stdenv.hostPlatform.isx86_64 then - "x64-linux" - else - throw "Unsupported Linux architecture for happy-coder: ${stdenv.hostPlatform.system}" - else if stdenv.hostPlatform.isDarwin then - if stdenv.hostPlatform.isAarch64 then - "arm64-darwin" - else if stdenv.hostPlatform.isx86_64 then - "x64-darwin" - else - throw "Unsupported Darwin architecture for happy-coder: ${stdenv.hostPlatform.system}" - else - throw "Unsupported platform for happy-coder: ${stdenv.hostPlatform.system}"; - in - { + if stdenv.hostPlatform.isLinux + then + if stdenv.hostPlatform.isAarch64 + then "arm64-linux" + else if stdenv.hostPlatform.isx86_64 + then "x64-linux" + else throw "Unsupported Linux architecture for happy-coder: ${stdenv.hostPlatform.system}" + else if stdenv.hostPlatform.isDarwin + then + if stdenv.hostPlatform.isAarch64 + then "arm64-darwin" + else if stdenv.hostPlatform.isx86_64 + then "x64-darwin" + else throw "Unsupported Darwin architecture for happy-coder: ${stdenv.hostPlatform.system}" + else throw "Unsupported platform for happy-coder: ${stdenv.hostPlatform.system}"; + in { pname = "happy-coder"; version = "0.11.2-unstable-2026-03-26"; @@ -112,7 +108,7 @@ stdenv.mkDerivation ( description = "Mobile and web client wrapper for Claude Code and Codex with end-to-end encryption"; homepage = "https://github.com/slopus/happy"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ onsails ]; + maintainers = with lib.maintainers; [onsails]; mainProgram = "happy"; }; } diff --git a/nixos/packages/kef/default.nix b/nixos/packages/kef/default.nix index cd41548c..bb064196 100644 --- a/nixos/packages/kef/default.nix +++ b/nixos/packages/kef/default.nix @@ -3,28 +3,26 @@ python3, python3Packages, writeShellApplication, -}: - -let +}: let pykefcontrol = python3Packages.callPackage ../pykefcontrol {}; python = python3.withPackages (ps: [ pykefcontrol ps.zeroconf ]); in -writeShellApplication { - name = "kef"; + writeShellApplication { + name = "kef"; - runtimeInputs = [ python ]; + runtimeInputs = [python]; - text = '' - exec python ${./kef.py} "$@" - ''; + text = '' + exec python ${./kef.py} "$@" + ''; - meta = { - description = "Command-line controller for KEF W2 speakers"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ imalison ]; - mainProgram = "kef"; - }; -} + meta = { + description = "Command-line controller for KEF W2 speakers"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [imalison]; + mainProgram = "kef"; + }; + } diff --git a/nixos/packages/playwright-cli/default.nix b/nixos/packages/playwright-cli/default.nix index d53fe28f..289286e3 100644 --- a/nixos/packages/playwright-cli/default.nix +++ b/nixos/packages/playwright-cli/default.nix @@ -7,7 +7,6 @@ versionCheckHook, writeShellScript, }: - buildNpmPackage (finalAttrs: { pname = "playwright-cli"; version = "0.1.1"; @@ -26,7 +25,7 @@ buildNpmPackage (finalAttrs: { # playwright-cli imports playwright/lib/cli/client/program, which current # nixpkgs playwright-test does not export, so keep the vendored Playwright # until nixpkgs Playwright is updated to a compatible version. - nativeBuildInputs = [ makeBinaryWrapper ]; + nativeBuildInputs = [makeBinaryWrapper]; postFixup = '' wrapProgram $out/bin/playwright-cli \ @@ -34,7 +33,7 @@ buildNpmPackage (finalAttrs: { ''; doInstallCheck = true; - nativeInstallCheckInputs = [ versionCheckHook ]; + nativeInstallCheckInputs = [versionCheckHook]; versionCheckProgram = writeShellScript "version-check" '' "$1" --version >/dev/null echo "${finalAttrs.version}" @@ -46,7 +45,7 @@ buildNpmPackage (finalAttrs: { homepage = "https://github.com/microsoft/playwright-cli"; changelog = "https://github.com/microsoft/playwright-cli/releases/tag/v${finalAttrs.version}"; license = lib.licenses.asl20; - maintainers = with lib.maintainers; [ imalison ]; + maintainers = with lib.maintainers; [imalison]; mainProgram = "playwright-cli"; }; }) diff --git a/nixos/packages/pykefcontrol/default.nix b/nixos/packages/pykefcontrol/default.nix index df38921c..334d8aa9 100644 --- a/nixos/packages/pykefcontrol/default.nix +++ b/nixos/packages/pykefcontrol/default.nix @@ -6,7 +6,6 @@ aiohttp, requests, }: - buildPythonPackage rec { pname = "pykefcontrol"; version = "0.9.2"; @@ -26,12 +25,12 @@ buildPythonPackage rec { requests ]; - pythonImportsCheck = [ "pykefcontrol" ]; + pythonImportsCheck = ["pykefcontrol"]; meta = { description = "Python library for controlling KEF LS50WII, LSX II, and LS60 speakers"; homepage = "https://github.com/N0ciple/pykefcontrol"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ imalison ]; + maintainers = with lib.maintainers; [imalison]; }; } diff --git a/nixos/packages/roborock-control/default.nix b/nixos/packages/roborock-control/default.nix index ee3c732e..e0c53b99 100644 --- a/nixos/packages/roborock-control/default.nix +++ b/nixos/packages/roborock-control/default.nix @@ -2,29 +2,27 @@ lib, python3, writeShellApplication, -}: - -let +}: let python = python3.withPackages (ps: [ ps.python-roborock ps.pyshark ps.pyyaml ]); in -writeShellApplication { - name = "roborock-control"; + writeShellApplication { + name = "roborock-control"; - runtimeInputs = [ python ]; + runtimeInputs = [python]; - text = '' - export ROBOROCK_CONTROL_RUNNER=direct - exec python ${../../../dotfiles/lib/bin/roborock-control} "$@" - ''; + text = '' + export ROBOROCK_CONTROL_RUNNER=direct + exec python ${../../../dotfiles/lib/bin/roborock-control} "$@" + ''; - meta = { - description = "Command-line controller for Roborock vacuums"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ imalison ]; - mainProgram = "roborock-control"; - }; -} + meta = { + description = "Command-line controller for Roborock vacuums"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [imalison]; + mainProgram = "roborock-control"; + }; + } diff --git a/nixos/packages/t3code/default.nix b/nixos/packages/t3code/default.nix index 616c62f1..7f7b15e9 100644 --- a/nixos/packages/t3code/default.nix +++ b/nixos/packages/t3code/default.nix @@ -9,10 +9,8 @@ electron_40, nodejs, }: - stdenv.mkDerivation ( - finalAttrs: - let + finalAttrs: let electron = electron_40; nodeModules = stdenvNoCC.mkDerivation { pname = "${finalAttrs.pname}-node_modules"; @@ -81,8 +79,7 @@ stdenv.mkDerivation ( outputHash = "sha256-yrzdhw+NPYZku10piHoxMy+TUJ8MYySZorMOMOztJY4="; outputHashMode = "recursive"; }; - in - { + in { pname = "t3code"; version = "0.0.15"; strictDeps = true; @@ -129,21 +126,23 @@ stdenv.mkDerivation ( --replace-fail 'host: "localhost"' 'host: "127.0.0.1"' ''; - nativeBuildInputs = [ - buildPackages.bun - buildPackages.copyDesktopItems - buildPackages.installShellFiles - buildPackages.makeBinaryWrapper - buildPackages.node-gyp - buildPackages.nodejs - buildPackages.python3 - buildPackages.writableTmpDirAsHomeHook - ] ++ lib.optionals stdenv.buildPlatform.isDarwin [ - buildPackages.cctools.libtool - buildPackages.xcbuild - ]; + nativeBuildInputs = + [ + buildPackages.bun + buildPackages.copyDesktopItems + buildPackages.installShellFiles + buildPackages.makeBinaryWrapper + buildPackages.node-gyp + buildPackages.nodejs + buildPackages.python3 + buildPackages.writableTmpDirAsHomeHook + ] + ++ lib.optionals stdenv.buildPlatform.isDarwin [ + buildPackages.cctools.libtool + buildPackages.xcbuild + ]; - nativeInstallCheckInputs = [ buildPackages.versionCheckHook ]; + nativeInstallCheckInputs = [buildPackages.versionCheckHook]; doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; configurePhase = '' @@ -221,7 +220,7 @@ stdenv.mkDerivation ( terminal = false; icon = "t3code"; startupWMClass = "T3 Code"; - categories = [ "Development" ]; + categories = ["Development"]; }) ]; diff --git a/nixos/plasma.nix b/nixos/plasma.nix index 50076e79..aa59b632 100644 --- a/nixos/plasma.nix +++ b/nixos/plasma.nix @@ -1,4 +1,10 @@ -{ pkgs, config, makeEnable, realUsers, ... }: +{ + pkgs, + config, + makeEnable, + realUsers, + ... +}: makeEnable config "myModules.plasma" true { services.accounts-daemon.enable = true; services.displayManager.sddm = { diff --git a/nixos/postgres.nix b/nixos/postgres.nix index 942efff7..1c56392d 100644 --- a/nixos/postgres.nix +++ b/nixos/postgres.nix @@ -1,23 +1,31 @@ -{ pkgs, config, makeEnable, realUsers, ... }: +{ + pkgs, + config, + makeEnable, + realUsers, + ... +}: makeEnable config "myModules.postgres" true { services.postgresql = { enable = true; package = pkgs.postgresql_15; - ensureDatabases = [ "railbird" "public" ]; + ensureDatabases = ["railbird" "public"]; authentication = pkgs.lib.mkOverride 10 '' #type database DBuser CIDR-ADDRESS auth-method local all all trust host all all 0.0.0.0/0 trust host all all ::1/128 trust ''; - ensureUsers = map (username: { + ensureUsers = + map (username: { name = username; ensureClauses = { superuser = true; createrole = true; createdb = true; }; - }) realUsers; + }) + realUsers; # initialScript = pkgs.writeText "init-sql-script" '' # CREATE DATABASE IF NOT EXISTS railbird; # \c railbird @@ -27,6 +35,6 @@ makeEnable config "myModules.postgres" true { services.pgadmin = { enable = false; initialEmail = "IvanMalison@gmail.com"; - initialPasswordFile = (builtins.toFile "password" "This is the content of the file."); + initialPasswordFile = builtins.toFile "password" "This is the content of the file."; }; } diff --git a/nixos/quickshell.nix b/nixos/quickshell.nix index 8546625c..fd687a32 100644 --- a/nixos/quickshell.nix +++ b/nixos/quickshell.nix @@ -1,53 +1,62 @@ -{ config, lib, makeEnable, inputs, ... }: +{ + config, + lib, + makeEnable, + inputs, + ... +}: makeEnable config "myModules.quickshell" false { home-manager.sharedModules = [ inputs.caelestia-shell.homeManagerModules.default - ({ lib, nixos, pkgs, ... }: - let - hyprlandEnabled = lib.attrByPath ["myModules" "hyprland" "enable"] false nixos.config; - system = pkgs.stdenv.hostPlatform.system; - quickshellBase = inputs.caelestia-shell.inputs.quickshell.packages.${system}.default.override { - # GCC 15.2 ICEs on generated NetworkManager DBus sources in - # quickshell 0.2.1. Quickshell's own dev shell uses clangStdenv. - stdenv = pkgs.clangStdenv; - withX11 = false; - withI3 = false; - }; - quickshellUnwrapped = quickshellBase.unwrapped.overrideAttrs (old: { - # Clang then needs PCH disabled because quickshell's PipeWire target - # adds compile flags that do not match the shared PCH target. - cmakeFlags = (old.cmakeFlags or []) ++ [ (lib.cmakeBool "NO_PCH" true) ]; - }); - quickshellPackage = quickshellUnwrapped.stdenv.mkDerivation { - inherit (quickshellUnwrapped) version meta buildInputs; - pname = "${quickshellUnwrapped.pname}-wrapped"; - nativeBuildInputs = quickshellUnwrapped.nativeBuildInputs ++ [ pkgs.qt6.wrapQtAppsHook ]; - dontUnpack = true; - dontConfigure = true; - dontBuild = true; - installPhase = '' - mkdir -p $out - cp -r ${quickshellUnwrapped}/* $out - ''; - passthru.unwrapped = quickshellUnwrapped; - }; - caelestiaPackage = inputs.caelestia-shell.packages.${system}.with-cli.override { - # Caelestia pins app2unit 1.0.3, which no longer builds on this nixpkgs snapshot. - app2unit = pkgs.app2unit; - quickshell = quickshellPackage; - }; - in - { - programs.caelestia = { - enable = true; - package = caelestiaPackage; - cli.enable = true; - systemd.target = lib.mkDefault ( - if hyprlandEnabled - then "wayland-session@Hyprland.target" - else "graphical-session.target" - ); - }; - }) + ({ + lib, + nixos, + pkgs, + ... + }: let + hyprlandEnabled = lib.attrByPath ["myModules" "hyprland" "enable"] false nixos.config; + system = pkgs.stdenv.hostPlatform.system; + quickshellBase = inputs.caelestia-shell.inputs.quickshell.packages.${system}.default.override { + # GCC 15.2 ICEs on generated NetworkManager DBus sources in + # quickshell 0.2.1. Quickshell's own dev shell uses clangStdenv. + stdenv = pkgs.clangStdenv; + withX11 = false; + withI3 = false; + }; + quickshellUnwrapped = quickshellBase.unwrapped.overrideAttrs (old: { + # Clang then needs PCH disabled because quickshell's PipeWire target + # adds compile flags that do not match the shared PCH target. + cmakeFlags = (old.cmakeFlags or []) ++ [(lib.cmakeBool "NO_PCH" true)]; + }); + quickshellPackage = quickshellUnwrapped.stdenv.mkDerivation { + inherit (quickshellUnwrapped) version meta buildInputs; + pname = "${quickshellUnwrapped.pname}-wrapped"; + nativeBuildInputs = quickshellUnwrapped.nativeBuildInputs ++ [pkgs.qt6.wrapQtAppsHook]; + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + installPhase = '' + mkdir -p $out + cp -r ${quickshellUnwrapped}/* $out + ''; + passthru.unwrapped = quickshellUnwrapped; + }; + caelestiaPackage = inputs.caelestia-shell.packages.${system}.with-cli.override { + # Caelestia pins app2unit 1.0.3, which no longer builds on this nixpkgs snapshot. + app2unit = pkgs.app2unit; + quickshell = quickshellPackage; + }; + in { + programs.caelestia = { + enable = true; + package = caelestiaPackage; + cli.enable = true; + systemd.target = lib.mkDefault ( + if hyprlandEnabled + then "wayland-session@Hyprland.target" + else "graphical-session.target" + ); + }; + }) ]; } diff --git a/nixos/rabbitmq.nix b/nixos/rabbitmq.nix index 6c638daf..8c99c1ea 100644 --- a/nixos/rabbitmq.nix +++ b/nixos/rabbitmq.nix @@ -1,4 +1,10 @@ -{ pkgs, config, makeEnable, realUsers, ... }: +{ + pkgs, + config, + makeEnable, + realUsers, + ... +}: makeEnable config "myModules.rabbitmq" false { services.rabbitmq = { enable = true; diff --git a/nixos/raspberry-pi.nix b/nixos/raspberry-pi.nix index ede9f461..746143f5 100644 --- a/nixos/raspberry-pi.nix +++ b/nixos/raspberry-pi.nix @@ -1,12 +1,17 @@ -{ config, pkgs, inputs, makeEnable, ... }: - +{ + config, + pkgs, + inputs, + makeEnable, + ... +}: makeEnable config "myModules.raspberry-pi" false { imports = [ inputs.nixos-hardware.nixosModules.raspberry-pi-4 ]; # These are needed to allow hardware acceleration again # https://github.com/NixOS/nixos-hardware/issues/631 - boot.kernelParams = [ "kunit.enable=0" ]; + boot.kernelParams = ["kunit.enable=0"]; hardware.deviceTree.filter = "bcm2711-rpi-4*.dtb"; hardware.raspberry-pi."4".fkms-3d.enable = true; # hardware.raspberry-pi."4".audio.enable = true; @@ -29,7 +34,7 @@ makeEnable config "myModules.raspberry-pi" false { }; }; - boot.extraModulePackages = [ ]; + boot.extraModulePackages = []; hardware.enableRedistributableFirmware = true; diff --git a/nixos/remote-hyprland.nix b/nixos/remote-hyprland.nix index 1c64c750..aac42bfb 100644 --- a/nixos/remote-hyprland.nix +++ b/nixos/remote-hyprland.nix @@ -1,67 +1,72 @@ -{ config, lib, pkgs, makeEnable, ... }: -let +{ + config, + lib, + pkgs, + makeEnable, + ... +}: let cfg = config.myModules.remote-hyprland; hyprlandPackage = config.programs.hyprland.package; geometry = "${toString cfg.width}x${toString cfg.height}@${toString cfg.refreshRate}"; monitorRule = "${cfg.output},${geometry},0x0,${toString cfg.scale}"; remoteHyprlandStartVnc = pkgs.writeShellScript "remote-hyprland-start-vnc" '' - set -euo pipefail + set -euo pipefail - export XDG_CURRENT_DESKTOP=Hyprland - export XDG_SESSION_DESKTOP=Hyprland - export XDG_SESSION_TYPE=wayland - export LIBSEAT_BACKEND=seatd + export XDG_CURRENT_DESKTOP=Hyprland + export XDG_SESSION_DESKTOP=Hyprland + export XDG_SESSION_TYPE=wayland + export LIBSEAT_BACKEND=seatd - for _ in $(${pkgs.coreutils}/bin/seq 1 50); do - instance="$( - ${hyprlandPackage}/bin/hyprctl instances \ - | ${pkgs.gawk}/bin/awk ' - /^instance / { - sig = $2 - sub(/:$/, "", sig) - } - /^[[:space:]]*time:/ { time = $2 } - /^[[:space:]]*wl socket:/ { - if (sig != "" && time != "") { - print time " " sig " " $3 - } - } - ' \ - | ${pkgs.coreutils}/bin/sort -n \ - | ${pkgs.coreutils}/bin/tail -n 1 - )" + for _ in $(${pkgs.coreutils}/bin/seq 1 50); do + instance="$( + ${hyprlandPackage}/bin/hyprctl instances \ + | ${pkgs.gawk}/bin/awk ' + /^instance / { + sig = $2 + sub(/:$/, "", sig) + } + /^[[:space:]]*time:/ { time = $2 } + /^[[:space:]]*wl socket:/ { + if (sig != "" && time != "") { + print time " " sig " " $3 + } + } + ' \ + | ${pkgs.coreutils}/bin/sort -n \ + | ${pkgs.coreutils}/bin/tail -n 1 + )" - if [ -n "$instance" ]; then - read -r _ HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY <&2 - exit 1 - fi + if [ -z "''${HYPRLAND_INSTANCE_SIGNATURE:-}" ] || [ -z "''${WAYLAND_DISPLAY:-}" ]; then + echo "Timed out waiting for a Hyprland instance" >&2 + exit 1 + fi - for _ in $(${pkgs.coreutils}/bin/seq 1 50); do - if ${hyprlandPackage}/bin/hyprctl -i "$HYPRLAND_INSTANCE_SIGNATURE" -j monitors >/dev/null 2>&1; then - break - fi - ${pkgs.coreutils}/bin/sleep 0.1 - done + for _ in $(${pkgs.coreutils}/bin/seq 1 50); do + if ${hyprlandPackage}/bin/hyprctl -i "$HYPRLAND_INSTANCE_SIGNATURE" -j monitors >/dev/null 2>&1; then + break + fi + ${pkgs.coreutils}/bin/sleep 0.1 + done - # Give wayvnc a stable output name instead of relying on Hyprland's - # fallback HEADLESS-* naming. - ${hyprlandPackage}/bin/hyprctl -i "$HYPRLAND_INSTANCE_SIGNATURE" output create headless ${cfg.output} >/dev/null 2>&1 || true - ${hyprlandPackage}/bin/hyprctl -i "$HYPRLAND_INSTANCE_SIGNATURE" keyword monitor '${monitorRule}' >/dev/null 2>&1 || true + # Give wayvnc a stable output name instead of relying on Hyprland's + # fallback HEADLESS-* naming. + ${hyprlandPackage}/bin/hyprctl -i "$HYPRLAND_INSTANCE_SIGNATURE" output create headless ${cfg.output} >/dev/null 2>&1 || true + ${hyprlandPackage}/bin/hyprctl -i "$HYPRLAND_INSTANCE_SIGNATURE" keyword monitor '${monitorRule}' >/dev/null 2>&1 || true - exec ${pkgs.wayvnc}/bin/wayvnc \ - --log-level=info \ - --output ${cfg.output} \ - ${cfg.bindAddress} ${toString cfg.port} + exec ${pkgs.wayvnc}/bin/wayvnc \ + --log-level=info \ + --output ${cfg.output} \ + ${cfg.bindAddress} ${toString cfg.port} ''; remoteHyprlandConfig = pkgs.writeText "remote-hyprland.conf" '' monitor=${monitorRule} @@ -144,7 +149,7 @@ EOF ]; autostartInstall = lib.optionalAttrs cfg.autoStart { Install = { - WantedBy = [ "default.target" ]; + WantedBy = ["default.target"]; }; }; enabledModule = makeEnable config "myModules.remote-hyprland" false { @@ -158,119 +163,124 @@ EOF users.manageLingering = true; users.users.${cfg.user}.linger = true; - environment.systemPackages = [ pkgs.wayvnc ]; + environment.systemPackages = [pkgs.wayvnc]; home-manager.users.${cfg.user} = { systemd.user.services = { - remote-hyprland = { - Unit = { - Description = "Headless Hyprland session for remote VNC access"; - After = [ "default.target" ]; - }; - Service = { - ExecStart = "${hyprlandPackage}/bin/start-hyprland --path ${hyprlandPackage}/bin/Hyprland -- --config ${remoteHyprlandConfig}"; - Restart = "on-failure"; - RestartSec = 5; - Environment = [ - "XDG_CURRENT_DESKTOP=Hyprland" - "XDG_SESSION_DESKTOP=Hyprland" - "XDG_SESSION_TYPE=wayland" - "LIBSEAT_BACKEND=seatd" - "PATH=${servicePath}" - ]; - }; - } // autostartInstall; + remote-hyprland = + { + Unit = { + Description = "Headless Hyprland session for remote VNC access"; + After = ["default.target"]; + }; + Service = { + ExecStart = "${hyprlandPackage}/bin/start-hyprland --path ${hyprlandPackage}/bin/Hyprland -- --config ${remoteHyprlandConfig}"; + Restart = "on-failure"; + RestartSec = 5; + Environment = [ + "XDG_CURRENT_DESKTOP=Hyprland" + "XDG_SESSION_DESKTOP=Hyprland" + "XDG_SESSION_TYPE=wayland" + "LIBSEAT_BACKEND=seatd" + "PATH=${servicePath}" + ]; + }; + } + // autostartInstall; - remote-hyprland-wayvnc = { - Unit = { - Description = "VNC server for the headless Hyprland session"; - After = [ "remote-hyprland.service" ]; - Requires = [ "remote-hyprland.service" ]; - PartOf = [ "remote-hyprland.service" ]; - }; - Service = { - ExecStart = "${remoteHyprlandStartVnc}"; - Restart = "on-failure"; - RestartSec = 5; - Environment = [ - "XDG_CURRENT_DESKTOP=Hyprland" - "XDG_SESSION_DESKTOP=Hyprland" - "XDG_SESSION_TYPE=wayland" - "LIBSEAT_BACKEND=seatd" - "PATH=${servicePath}" - ]; - }; - } // autostartInstall; + remote-hyprland-wayvnc = + { + Unit = { + Description = "VNC server for the headless Hyprland session"; + After = ["remote-hyprland.service"]; + Requires = ["remote-hyprland.service"]; + PartOf = ["remote-hyprland.service"]; + }; + Service = { + ExecStart = "${remoteHyprlandStartVnc}"; + Restart = "on-failure"; + RestartSec = 5; + Environment = [ + "XDG_CURRENT_DESKTOP=Hyprland" + "XDG_SESSION_DESKTOP=Hyprland" + "XDG_SESSION_TYPE=wayland" + "LIBSEAT_BACKEND=seatd" + "PATH=${servicePath}" + ]; + }; + } + // autostartInstall; }; }; }; in -enabledModule // { - options = lib.recursiveUpdate enabledModule.options { - myModules.remote-hyprland = { - user = lib.mkOption { - type = lib.types.str; - default = "imalison"; - description = "User account that owns the remote Hyprland session."; - }; + enabledModule + // { + options = lib.recursiveUpdate enabledModule.options { + myModules.remote-hyprland = { + user = lib.mkOption { + type = lib.types.str; + default = "imalison"; + description = "User account that owns the remote Hyprland session."; + }; - bindAddress = lib.mkOption { - type = lib.types.str; - default = "127.0.0.1"; - description = "Address for wayvnc to bind. Keep localhost when using SSH or Tailscale forwarding."; - }; + bindAddress = lib.mkOption { + type = lib.types.str; + default = "127.0.0.1"; + description = "Address for wayvnc to bind. Keep localhost when using SSH or Tailscale forwarding."; + }; - port = lib.mkOption { - type = lib.types.port; - default = 5900; - description = "TCP port for wayvnc."; - }; + port = lib.mkOption { + type = lib.types.port; + default = 5900; + description = "TCP port for wayvnc."; + }; - output = lib.mkOption { - type = lib.types.str; - default = "remote"; - description = "Stable Hyprland headless output name captured by wayvnc."; - }; + output = lib.mkOption { + type = lib.types.str; + default = "remote"; + description = "Stable Hyprland headless output name captured by wayvnc."; + }; - width = lib.mkOption { - type = lib.types.ints.positive; - default = 1920; - description = "Remote output width."; - }; + width = lib.mkOption { + type = lib.types.ints.positive; + default = 1920; + description = "Remote output width."; + }; - height = lib.mkOption { - type = lib.types.ints.positive; - default = 1080; - description = "Remote output height."; - }; + height = lib.mkOption { + type = lib.types.ints.positive; + default = 1080; + description = "Remote output height."; + }; - refreshRate = lib.mkOption { - type = lib.types.ints.positive; - default = 60; - description = "Remote output refresh rate."; - }; + refreshRate = lib.mkOption { + type = lib.types.ints.positive; + default = 60; + description = "Remote output refresh rate."; + }; - scale = lib.mkOption { - type = lib.types.number; - default = 1; - description = "Remote output scale."; - }; + scale = lib.mkOption { + type = lib.types.number; + default = 1; + description = "Remote output scale."; + }; - terminalCommand = lib.mkOption { - type = lib.types.str; - default = "${pkgs.ghostty}/bin/ghostty --gtk-single-instance=false"; - description = "Command launched for the default terminal binding and initial window."; - }; + terminalCommand = lib.mkOption { + type = lib.types.str; + default = "${pkgs.ghostty}/bin/ghostty --gtk-single-instance=false"; + description = "Command launched for the default terminal binding and initial window."; + }; - autoStart = lib.mkOption { - type = lib.types.bool; - default = false; - description = '' - Whether to start the remote Hyprland session automatically with the - user's systemd manager. Keep this disabled on single-GPU hosts with - an active display manager, because Hyprland needs DRM master. - ''; + autoStart = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Whether to start the remote Hyprland session automatically with the + user's systemd manager. Keep this disabled on single-GPU hosts with + an active display manager, because Hyprland needs DRM master. + ''; + }; }; }; - }; -} + } diff --git a/nixos/sni.nix b/nixos/sni.nix index 0b79b42c..09c6506a 100644 --- a/nixos/sni.nix +++ b/nixos/sni.nix @@ -1,47 +1,53 @@ -{ config, inputs, lib, pkgs, makeEnable, ... }: -let +{ + config, + inputs, + lib, + pkgs, + makeEnable, + ... +}: let system = pkgs.stdenv.hostPlatform.system; - kanshiSniPackage = - inputs.kanshi-sni.packages.${system}.default.overrideAttrs (old: { - patches = (old.patches or [ ]) ++ [ + kanshiSniPackage = inputs.kanshi-sni.packages.${system}.default.overrideAttrs (old: { + patches = + (old.patches or []) + ++ [ ./patches/kanshi-sni-refresh-and-reconnect.patch ./patches/kanshi-sni-keep-menu-root-alive.patch ]; - }); + }); in -makeEnable config "myModules.sni" true { - systemd.user.services.blueman-applet.serviceConfig.ExecStart = lib.mkForce [ - "" - "${pkgs.blueman}/bin/blueman-applet" - ]; + makeEnable config "myModules.sni" true { + systemd.user.services.blueman-applet.serviceConfig.ExecStart = lib.mkForce [ + "" + "${pkgs.blueman}/bin/blueman-applet" + ]; - home-manager.sharedModules = [ - ({ lib, ... }: { - systemd.user.services.kanshi-sni = { - Unit = { - Description = "kanshi-sni tray app"; - After = [ "graphical-session.target" "tray.target" "kanshi.service" ]; - PartOf = [ "graphical-session.target" "kanshi.service" ]; - Requires = [ "tray.target" ]; - Wants = [ "kanshi.service" ]; + home-manager.sharedModules = [ + ({lib, ...}: { + systemd.user.services.kanshi-sni = { + Unit = { + Description = "kanshi-sni tray app"; + After = ["graphical-session.target" "tray.target" "kanshi.service"]; + PartOf = ["graphical-session.target" "kanshi.service"]; + Requires = ["tray.target"]; + Wants = ["kanshi.service"]; + }; + Service = { + ExecStart = "${kanshiSniPackage}/bin/kanshi-sni"; + Restart = "always"; + RestartSec = 3; + }; + Install = { + WantedBy = ["graphical-session.target"]; + }; }; - Service = { - ExecStart = "${kanshiSniPackage}/bin/kanshi-sni"; - Restart = "always"; - RestartSec = 3; - }; - Install = { - WantedBy = [ "graphical-session.target" ]; - }; - }; - services.kdeconnect = { - enable = true; - indicator = true; - }; + services.kdeconnect = { + enable = true; + indicator = true; + }; - home.activation.disableKdeConnectBluetooth = - lib.hm.dag.entryAfter [ "writeBoundary" ] '' + home.activation.disableKdeConnectBluetooth = lib.hm.dag.entryAfter ["writeBoundary"] '' ${pkgs.kdePackages.kconfig}/bin/kwriteconfig6 \ --file kdeconnect/config \ --group General \ @@ -49,23 +55,23 @@ makeEnable config "myModules.sni" true { 'BluetoothLinkProvider,AsyncLinkProvider' ''; - services.network-manager-applet.enable = true; + services.network-manager-applet.enable = true; - # Disable the XDG autostart for nm-applet since we're managing it via systemd. - # The XDG autostart races with the systemd service and doesn't use --indicator. - xdg.configFile."autostart/nm-applet.desktop".text = '' - [Desktop Entry] - Hidden=true - ''; + # Disable the XDG autostart for nm-applet since we're managing it via systemd. + # The XDG autostart races with the systemd service and doesn't use --indicator. + xdg.configFile."autostart/nm-applet.desktop".text = '' + [Desktop Entry] + Hidden=true + ''; - services.udiskie = { - enable = true; - tray = "always"; - }; + services.udiskie = { + enable = true; + tray = "always"; + }; - services.pasystray.enable = true; + services.pasystray.enable = true; - services.flameshot.enable = true; - }) - ]; -} + services.flameshot.enable = true; + }) + ]; + } diff --git a/nixos/ssh.nix b/nixos/ssh.nix index 3add8cac..d8377677 100644 --- a/nixos/ssh.nix +++ b/nixos/ssh.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { # TODO: reenable # security.pam.sshAgentAuth.enable = true; services.avahi = { diff --git a/nixos/syncthing.nix b/nixos/syncthing.nix index eb42bfe4..f932509f 100644 --- a/nixos/syncthing.nix +++ b/nixos/syncthing.nix @@ -2,49 +2,48 @@ makeEnable, config, ... -}: -let +}: let shared = import ../nix-shared/syncthing.nix; inherit (shared) devices allDevices; in -makeEnable config "myModules.syncthing" true { - system.activationScripts.syncthingPermissions = { - text = '' - mkdir -p /var/lib/syncthing/sync - mkdir -p /var/lib/syncthing/sync/Screensaver/use - mkdir -p /var/lib/syncthing/railbird - chown -R syncthing:syncthing /var/lib/syncthing - chmod -R 2770 /var/lib/syncthing - ''; - }; - systemd.services.syncthing = { - serviceConfig = { - AmbientCapabilities = "CAP_CHOWN"; - CapabilityBoundingSet = "CAP_CHOWN"; + makeEnable config "myModules.syncthing" true { + system.activationScripts.syncthingPermissions = { + text = '' + mkdir -p /var/lib/syncthing/sync + mkdir -p /var/lib/syncthing/sync/Screensaver/use + mkdir -p /var/lib/syncthing/railbird + chown -R syncthing:syncthing /var/lib/syncthing + chmod -R 2770 /var/lib/syncthing + ''; }; - }; - services.syncthing = { - enable = true; - settings = { - inherit devices; - folders = { - sync = { - path = "~/sync"; - devices = allDevices; - ignorePerms = true; - copyOwnershipFromParent = true; - }; - railbird = { - path = "~/railbird"; - devices = allDevices; - ignorePerms = true; - copyOwnershipFromParent = true; - }; - }; - options = { - relaysEnabled = true; - localAnnounceEnabled = true; + systemd.services.syncthing = { + serviceConfig = { + AmbientCapabilities = "CAP_CHOWN"; + CapabilityBoundingSet = "CAP_CHOWN"; }; }; - }; -} + services.syncthing = { + enable = true; + settings = { + inherit devices; + folders = { + sync = { + path = "~/sync"; + devices = allDevices; + ignorePerms = true; + copyOwnershipFromParent = true; + }; + railbird = { + path = "~/railbird"; + devices = allDevices; + ignorePerms = true; + copyOwnershipFromParent = true; + }; + }; + options = { + relaysEnabled = true; + localAnnounceEnabled = true; + }; + }; + }; + } diff --git a/nixos/taffybar.nix b/nixos/taffybar.nix index 5b137cfb..543d115a 100644 --- a/nixos/taffybar.nix +++ b/nixos/taffybar.nix @@ -239,15 +239,15 @@ in rm -f "$HOME/.config/systemd/user/taffybar.service.d/override.conf" rmdir --ignore-fail-on-non-empty "$HOME/.config/systemd/user/taffybar.service.d" 2>/dev/null || true ''; - systemd.user.services.taffybar.Service = { - ExecCondition = "${taffybarExecCondition}"; - ExecStartPre = "${waitForGraphicalSocket}"; - ExecStart = lib.mkForce "${taffybarStart}"; - # Temporary startup debugging: keep a plain-text log outside journald so - # the next login/startup leaves easy-to-inspect tray traces behind. - StandardOutput = "append:/tmp/taffybar-service.log"; - StandardError = "append:/tmp/taffybar-service.log"; - }; - }) - ]; -} + systemd.user.services.taffybar.Service = { + ExecCondition = "${taffybarExecCondition}"; + ExecStartPre = "${waitForGraphicalSocket}"; + ExecStart = lib.mkForce "${taffybarStart}"; + # Temporary startup debugging: keep a plain-text log outside journald so + # the next login/startup leaves easy-to-inspect tray traces behind. + StandardOutput = "append:/tmp/taffybar-service.log"; + StandardError = "append:/tmp/taffybar-service.log"; + }; + }) + ]; + } diff --git a/nixos/tailscale.nix b/nixos/tailscale.nix index 6ec026f2..4e84516b 100644 --- a/nixos/tailscale.nix +++ b/nixos/tailscale.nix @@ -1,11 +1,17 @@ -{ config, lib, pkgs, makeEnable, ... }: +{ + config, + lib, + pkgs, + makeEnable, + ... +}: makeEnable config "myModules.tailscale" true { # Provide stable SSH connectivity between your machines without needing port # forwarding (works behind NAT/CGNAT). services.tailscale.enable = true; # Handy even if you only enable the service and run `tailscale up` manually. - environment.systemPackages = [ pkgs.tailscale ]; + environment.systemPackages = [pkgs.tailscale]; # Optional: unattended enrollment using a pre-auth key stored in agenix. # @@ -27,9 +33,9 @@ makeEnable config "myModules.tailscale" true { systemd.services.tailscale-autoconnect = { description = "Auto-connect Tailscale (optional, via agenix auth key)"; - wantedBy = [ "multi-user.target" ]; - after = [ "network-online.target" "tailscaled.service" ]; - wants = [ "network-online.target" "tailscaled.service" ]; + wantedBy = ["multi-user.target"]; + after = ["network-online.target" "tailscaled.service"]; + wants = ["network-online.target" "tailscaled.service"]; unitConfig = { ConditionPathExists = config.age.secrets.tailscale-authkey.path; diff --git a/nixos/tts.nix b/nixos/tts.nix index ead3f96e..95d6e335 100644 --- a/nixos/tts.nix +++ b/nixos/tts.nix @@ -1,12 +1,16 @@ -{ config, makeEnable, ... }: +{ + config, + makeEnable, + ... +}: makeEnable config "myModules.tts" false { services.tts.servers.coqui = { enable = true; useCuda = false; port = 11115; model = "tts_models/en/vctk/vits"; - extraArgs = [ "--speaker_idx" "p376" ]; + extraArgs = ["--speaker_idx" "p376"]; }; - systemd.services.tts-coqui.wants = [ "network-online.target" ]; + systemd.services.tts-coqui.wants = ["network-online.target"]; } diff --git a/nixos/users.nix b/nixos/users.nix index 26597d58..cb07e566 100644 --- a/nixos/users.nix +++ b/nixos/users.nix @@ -1,5 +1,9 @@ -{ pkgs, keys, inputs, ... }: -let +{ + pkgs, + keys, + inputs, + ... +}: let extraGroups = [ "adbusers" "audio" @@ -24,40 +28,51 @@ let createHome = true; shell = pkgs.zsh; }; -in -{ +in { security.sudo.wheelNeedsPassword = false; users.users = with keys; { - imalison = userDefaults // { - extraGroups = extraGroupsWithWheel; - name = "imalison"; - openssh.authorizedKeys.keys = kanivanKeys; - }; - kat = userDefaults // { - extraGroups = extraGroupsWithWheel; - name = "kat"; - openssh.authorizedKeys.keys = kanivanKeys; - }; - dean = userDefaults // { - extraGroups = extraGroupsWithWheel; - name = "dean"; - openssh.authorizedKeys.keys = kanivanKeys ++ deanKeys; - }; - alex = userDefaults // { - extraGroups = extraGroupsWithWheel; - name = "alex"; - openssh.authorizedKeys.keys = kanivanKeys ++ alexKeys; - }; - loewy = userDefaults // { - inherit extraGroups; - name = "loewy"; - openssh.authorizedKeys.keys = kanivanKeys ++ loewyKeys; - }; - ben = userDefaults // { - inherit extraGroups; - name = "ben"; - openssh.authorizedKeys.keys = benKeys ++ kanivanKeys; - }; + imalison = + userDefaults + // { + extraGroups = extraGroupsWithWheel; + name = "imalison"; + openssh.authorizedKeys.keys = kanivanKeys; + }; + kat = + userDefaults + // { + extraGroups = extraGroupsWithWheel; + name = "kat"; + openssh.authorizedKeys.keys = kanivanKeys; + }; + dean = + userDefaults + // { + extraGroups = extraGroupsWithWheel; + name = "dean"; + openssh.authorizedKeys.keys = kanivanKeys ++ deanKeys; + }; + alex = + userDefaults + // { + extraGroups = extraGroupsWithWheel; + name = "alex"; + openssh.authorizedKeys.keys = kanivanKeys ++ alexKeys; + }; + loewy = + userDefaults + // { + inherit extraGroups; + name = "loewy"; + openssh.authorizedKeys.keys = kanivanKeys ++ loewyKeys; + }; + ben = + userDefaults + // { + inherit extraGroups; + name = "ben"; + openssh.authorizedKeys.keys = benKeys ++ kanivanKeys; + }; }; nix.sshServe = { diff --git a/nixos/vscode.nix b/nixos/vscode.nix index 5f009b94..dbc54da4 100644 --- a/nixos/vscode.nix +++ b/nixos/vscode.nix @@ -1,7 +1,12 @@ -{ inputs, config, makeEnable, ... }: +{ + inputs, + config, + makeEnable, + ... +}: makeEnable config "myModules.vscode" true { home-manager.sharedModules = [ inputs.vscode-server.homeModules.default - { services.vscode-server.enable = true; } + {services.vscode-server.enable = true;} ]; } diff --git a/nixos/waybar.nix b/nixos/waybar.nix index a00ca1cf..7b017eca 100644 --- a/nixos/waybar.nix +++ b/nixos/waybar.nix @@ -1,4 +1,9 @@ -{ config, pkgs, makeEnable, ... }: +{ + config, + pkgs, + makeEnable, + ... +}: makeEnable config "myModules.waybar" false { home-manager.sharedModules = [ { @@ -7,9 +12,9 @@ makeEnable config "myModules.waybar" false { systemd.user.services.waybar = { Unit = { Description = "Waybar"; - PartOf = [ "wayland-session@Hyprland.target" "tray.target" ]; - After = [ "wayland-session@Hyprland.target" "tray.target" ]; - Wants = [ "tray.target" ]; + PartOf = ["wayland-session@Hyprland.target" "tray.target"]; + After = ["wayland-session@Hyprland.target" "tray.target"]; + Wants = ["tray.target"]; }; Service = { ExecStartPre = "${pkgs.bash}/bin/bash -lc 'uid=$(id -u); runtime_dir=\"$XDG_RUNTIME_DIR\"; if [ -z \"$runtime_dir\" ]; then runtime_dir=\"/run/user/$uid\"; fi; for i in $(seq 1 50); do if [ -n \"$WAYLAND_DISPLAY\" ] && [ -S \"$runtime_dir/$WAYLAND_DISPLAY\" ]; then found=1; break; fi; sleep 0.1; done; if [ -z \"$found\" ]; then exit 1; fi; \"$HOME/.config/waybar/scripts/render-config\"'"; @@ -18,7 +23,7 @@ makeEnable config "myModules.waybar" false { RestartSec = 1; }; Install = { - WantedBy = [ "wayland-session@Hyprland.target" ]; + WantedBy = ["wayland-session@Hyprland.target"]; }; }; } diff --git a/nixos/wlsunset.nix b/nixos/wlsunset.nix index f4e247f4..c3dee299 100644 --- a/nixos/wlsunset.nix +++ b/nixos/wlsunset.nix @@ -1,4 +1,10 @@ -{ config, pkgs, lib, makeEnable, ... }: +{ + config, + pkgs, + lib, + makeEnable, + ... +}: makeEnable config "myModules.wlsunset" true { home-manager.sharedModules = [ { diff --git a/nixos/wsl.nix b/nixos/wsl.nix index 0f2b2b33..d2364d36 100644 --- a/nixos/wsl.nix +++ b/nixos/wsl.nix @@ -1,4 +1,10 @@ -{ config, inputs, pkgs, makeEnable, ... }: +{ + config, + inputs, + pkgs, + makeEnable, + ... +}: makeEnable config "myModules.wsl" false { imports = [ inputs.nixos-wsl.nixosModules.wsl diff --git a/nixos/wyoming.nix b/nixos/wyoming.nix index 103eea71..bcc20022 100644 --- a/nixos/wyoming.nix +++ b/nixos/wyoming.nix @@ -1,4 +1,9 @@ -{ pkgs, config, makeEnable, ... }: +{ + pkgs, + config, + makeEnable, + ... +}: makeEnable config "myModules.wyoming" false { environment.systemPackages = with pkgs; [ alsa-utils diff --git a/nixos/xmonad.nix b/nixos/xmonad.nix index 71416291..406993d6 100644 --- a/nixos/xmonad.nix +++ b/nixos/xmonad.nix @@ -1,217 +1,226 @@ -{ config, pkgs, inputs, lib, makeEnable, ... }: -let +{ + config, + pkgs, + inputs, + lib, + makeEnable, + ... +}: let session = import ./session-variables.nix; in -makeEnable config "myModules.xmonad" true { - myModules.taffybar.enable = lib.mkDefault (config.myModules.desktop.shellUi == "taffybar"); + makeEnable config "myModules.xmonad" true { + myModules.taffybar.enable = lib.mkDefault (config.myModules.desktop.shellUi == "taffybar"); - nixpkgs.overlays = with inputs; [ - xmonad.overlay - xmonad-contrib.overlay - (import ../dotfiles/config/xmonad/overlay.nix) - ]; + nixpkgs.overlays = with inputs; [ + xmonad.overlay + xmonad-contrib.overlay + (import ../dotfiles/config/xmonad/overlay.nix) + ]; - services.rumno.enable = true; + services.rumno.enable = true; - services.xserver = { - windowManager = { - session = [ - { - name = "xmonad"; - start = '' - /usr/bin/env imalison-xmonad & - waitPID=$! + services.xserver = { + windowManager = { + session = [ + { + name = "xmonad"; + start = '' + /usr/bin/env imalison-xmonad & + waitPID=$! + ''; + } + ]; + }; + }; + + environment.systemPackages = with pkgs; [ + # Haskell Desktop + haskellPackages.xmonad + haskellPackages.imalison-xmonad + # haskellPackages.notifications-tray-icon + # haskellPackages.gtk-sni-tray + haskellPackages.dbus-hslogger + ]; + + home-manager.sharedModules = [ + { + services.autorandr.enable = true; + systemd.user.services.autorandr.Unit.ConditionEnvironment = session.x11; + + services.random-background = { + enable = true; + display = "fill"; + interval = "1h"; + imageDirectory = "/var/lib/syncthing/sync/Wallpaper/use"; + }; + # This service uses feh (X11), so don't run it in Wayland sessions. + systemd.user.services.random-background.Unit.ConditionEnvironment = session.x11; + + services.xsettingsd.enable = true; + systemd.user.services.xsettingsd.Unit.ConditionEnvironment = session.x11; + + # services.parcellite = { + # enable = true; + # package = pkgs.clipit; + # }; + + # Completely disable home-manager's picom - we manage everything ourselves + # to work around the libconfig list vs array syntax issue for animations + services.picom.enable = false; + + # Our own picom systemd service + systemd.user.services.picom = { + Unit = { + Description = "Picom X11 compositor"; + ConditionEnvironment = session.x11; + After = ["graphical-session.target"]; + PartOf = ["graphical-session.target"]; + }; + Service = { + # Debug logging to file for monitoring + ExecStart = "${pkgs.picom}/bin/picom --config %h/.config/picom/picom.conf --log-level=debug --log-file=%h/.local/share/picom/debug.log"; + Restart = "always"; + RestartSec = 3; + }; + Install = { + WantedBy = ["graphical-session.target"]; + }; + }; + + # Ensure log directory exists + xdg.dataFile."picom/.keep".text = ""; + + # Write complete picom config directly to avoid home-manager's libconfig generator + # which incorrectly uses [] instead of () for the animations list + xdg.configFile."picom/picom.conf" = { + force = true; # Override home-manager's generated config + text = '' + # Backend and basic settings + backend = "glx"; + vsync = ${ + if config.myModules.xmonad.picom.vSync.enable + then "true" + else "false" + }; + + # Spring physics animations (mainline picom with spring-physics branch) + # Syntax: spring(stiffness, dampening, mass) or spring(stiffness, dampening, mass, clamping) + # Set clamping to false for bounce/overshoot effects + animations = ( + # Window move/resize animation with spring physics + # "geometry" is alias for "size" + "position" triggers + # Suppress opacity changes so they don't interrupt geometry animations + { + triggers = ["geometry"]; + suppressions = ["decrease-opacity", "increase-opacity"]; + offset-x = { + curve = "spring(150, 18, 1.5, false)"; + start = "window-x-before - window-x"; + end = 0; + }; + offset-y = { + curve = "spring(150, 18, 1.5, false)"; + start = "window-y-before - window-y"; + end = 0; + }; + scale-x = { + curve = "spring(150, 18, 1.5, false)"; + start = "window-width-before / window-width"; + end = 1; + }; + scale-y = { + curve = "spring(150, 18, 1.5, false)"; + start = "window-height-before / window-height"; + end = 1; + }; + }, + # Window open/show animation with spring physics + { + triggers = ["open", "show"]; + # Opacity uses spring with clamping to prevent going above 1 + opacity = { + curve = "spring(150, 18, 1.5, true)"; + start = 0; + end = "window-raw-opacity"; + }; + # Scale uses spring with bounce for a nice "pop" effect + scale-x = { + curve = "spring(150, 18, 1.5, false)"; + start = 0.85; + end = 1; + }; + scale-y = { + curve = "spring(150, 18, 1.5, false)"; + start = 0.85; + end = 1; + }; + # Center the scaling effect + offset-x = "(1 - scale-x) / 2 * window-width"; + offset-y = "(1 - scale-y) / 2 * window-height"; + }, + # Window close/hide animation with spring physics + { + triggers = ["close", "hide"]; + opacity = { + curve = "spring(150, 18, 1.5, true)"; + start = "window-raw-opacity"; + end = 0; + }; + scale-x = { + curve = "spring(150, 18, 1.5, true)"; + start = 1; + end = 0.9; + }; + scale-y = { + curve = "spring(150, 18, 1.5, true)"; + start = 1; + end = 0.9; + }; + # Center the scaling effect + offset-x = "(1 - scale-x) / 2 * window-width"; + offset-y = "(1 - scale-y) / 2 * window-height"; + } + ); + + # Fading + fading = true; + fade-in-step = 0.028; + fade-out-step = 0.028; + + # Corners + corner-radius = 10; + round-borders = 0; + rounded-corners-exclude = [ + "! name~='''", + "window_type = 'dock'", + "window_type = 'desktop'", + "class_g ?= 'Dunst'" + ]; + round-borders-exclude = [ + "! name~='''" + ]; + + # Focus and opacity + focus-exclude = ["class_g ?= 'rofi'", "class_g ?= 'Steam'"]; + invert-color-include = []; + + # Detection + detect-rounded-corners = true; + detect-client-opacity = true; + detect-transient = true; + detect-client-leader = true; + mark-wmwin-focused = false; + mark-ovredir-focused = false; + + # Other settings + daemon = false; + dbus = false; + unredir-if-possible = false; + unredir-if-possible-exclude = []; + use-damage = false; + transparent-clipping = false; ''; - } - ]; - }; - }; - - environment.systemPackages = with pkgs; [ - # Haskell Desktop - haskellPackages.xmonad - haskellPackages.imalison-xmonad - # haskellPackages.notifications-tray-icon - # haskellPackages.gtk-sni-tray - haskellPackages.dbus-hslogger - ]; - - home-manager.sharedModules = [ - { - services.autorandr.enable = true; - systemd.user.services.autorandr.Unit.ConditionEnvironment = session.x11; - - services.random-background = { - enable = true; - display = "fill"; - interval = "1h"; - imageDirectory = "/var/lib/syncthing/sync/Wallpaper/use"; - }; - # This service uses feh (X11), so don't run it in Wayland sessions. - systemd.user.services.random-background.Unit.ConditionEnvironment = session.x11; - - services.xsettingsd.enable = true; - systemd.user.services.xsettingsd.Unit.ConditionEnvironment = session.x11; - - # services.parcellite = { - # enable = true; - # package = pkgs.clipit; - # }; - - # Completely disable home-manager's picom - we manage everything ourselves - # to work around the libconfig list vs array syntax issue for animations - services.picom.enable = false; - - # Our own picom systemd service - systemd.user.services.picom = { - Unit = { - Description = "Picom X11 compositor"; - ConditionEnvironment = session.x11; - After = [ "graphical-session.target" ]; - PartOf = [ "graphical-session.target" ]; }; - Service = { - # Debug logging to file for monitoring - ExecStart = "${pkgs.picom}/bin/picom --config %h/.config/picom/picom.conf --log-level=debug --log-file=%h/.local/share/picom/debug.log"; - Restart = "always"; - RestartSec = 3; - }; - Install = { - WantedBy = [ "graphical-session.target" ]; - }; - }; - - # Ensure log directory exists - xdg.dataFile."picom/.keep".text = ""; - - # Write complete picom config directly to avoid home-manager's libconfig generator - # which incorrectly uses [] instead of () for the animations list - xdg.configFile."picom/picom.conf" = { - force = true; # Override home-manager's generated config - text = '' - # Backend and basic settings - backend = "glx"; - vsync = ${if config.myModules.xmonad.picom.vSync.enable then "true" else "false"}; - - # Spring physics animations (mainline picom with spring-physics branch) - # Syntax: spring(stiffness, dampening, mass) or spring(stiffness, dampening, mass, clamping) - # Set clamping to false for bounce/overshoot effects - animations = ( - # Window move/resize animation with spring physics - # "geometry" is alias for "size" + "position" triggers - # Suppress opacity changes so they don't interrupt geometry animations - { - triggers = ["geometry"]; - suppressions = ["decrease-opacity", "increase-opacity"]; - offset-x = { - curve = "spring(150, 18, 1.5, false)"; - start = "window-x-before - window-x"; - end = 0; - }; - offset-y = { - curve = "spring(150, 18, 1.5, false)"; - start = "window-y-before - window-y"; - end = 0; - }; - scale-x = { - curve = "spring(150, 18, 1.5, false)"; - start = "window-width-before / window-width"; - end = 1; - }; - scale-y = { - curve = "spring(150, 18, 1.5, false)"; - start = "window-height-before / window-height"; - end = 1; - }; - }, - # Window open/show animation with spring physics - { - triggers = ["open", "show"]; - # Opacity uses spring with clamping to prevent going above 1 - opacity = { - curve = "spring(150, 18, 1.5, true)"; - start = 0; - end = "window-raw-opacity"; - }; - # Scale uses spring with bounce for a nice "pop" effect - scale-x = { - curve = "spring(150, 18, 1.5, false)"; - start = 0.85; - end = 1; - }; - scale-y = { - curve = "spring(150, 18, 1.5, false)"; - start = 0.85; - end = 1; - }; - # Center the scaling effect - offset-x = "(1 - scale-x) / 2 * window-width"; - offset-y = "(1 - scale-y) / 2 * window-height"; - }, - # Window close/hide animation with spring physics - { - triggers = ["close", "hide"]; - opacity = { - curve = "spring(150, 18, 1.5, true)"; - start = "window-raw-opacity"; - end = 0; - }; - scale-x = { - curve = "spring(150, 18, 1.5, true)"; - start = 1; - end = 0.9; - }; - scale-y = { - curve = "spring(150, 18, 1.5, true)"; - start = 1; - end = 0.9; - }; - # Center the scaling effect - offset-x = "(1 - scale-x) / 2 * window-width"; - offset-y = "(1 - scale-y) / 2 * window-height"; - } - ); - - # Fading - fading = true; - fade-in-step = 0.028; - fade-out-step = 0.028; - - # Corners - corner-radius = 10; - round-borders = 0; - rounded-corners-exclude = [ - "! name~='''", - "window_type = 'dock'", - "window_type = 'desktop'", - "class_g ?= 'Dunst'" - ]; - round-borders-exclude = [ - "! name~='''" - ]; - - # Focus and opacity - focus-exclude = ["class_g ?= 'rofi'", "class_g ?= 'Steam'"]; - invert-color-include = []; - - # Detection - detect-rounded-corners = true; - detect-client-opacity = true; - detect-transient = true; - detect-client-leader = true; - mark-wmwin-focused = false; - mark-ovredir-focused = false; - - # Other settings - daemon = false; - dbus = false; - unredir-if-possible = false; - unredir-if-possible-exclude = []; - use-damage = false; - transparent-clipping = false; - ''; - }; - - } - ]; -} + } + ]; + }