diff options
Diffstat (limited to 'config/nix.org')
| -rw-r--r-- | config/nix.org | 132 |
1 files changed, 126 insertions, 6 deletions
diff --git a/config/nix.org b/config/nix.org index 83f06dc..caabe50 100644 --- a/config/nix.org +++ b/config/nix.org @@ -2454,6 +2454,105 @@ We must put Nixpkgs in another configuration because we don't want to include it }; } #+end_src +** AutoUpdater +#+begin_src nix :tangle ../nix/modules/auto-update.nix +{ config, pkgs, lib, ... }: + +{ + config = lib.mkIf config.monorepo.profiles.workstation.enable { + systemd.timers.monorepo-flake-updater = { + description = "Timer for Automated Monorepo Flake Updates"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "hourly"; + Persistent = true; + }; + }; + + systemd.services.monorepo-flake-updater = { + description = "Automated Flake Update, Check, and Patch for Monorepo"; + wants = [ "network-online.target" ]; + after = [ "network-online.target" ]; + + serviceConfig = { + Type = "oneshot"; + User = "${config.monorepo.vars.userName}"; + }; + environment = { + HOME = "/home/${config.monorepo.vars.userName}"; + }; + + path = with pkgs; [ git nix coreutils curl ]; + script = '' + # Exit immediately if any command fails + set -euo pipefail + + API_URL="https://channels.nixos.org/nixos-unstable/git-revision" + if ! curl --silent --head --location --fail "$API_URL" > /dev/null; then + echo "No internet or NixOS API is down. Aborting." + exit 0 + fi + + LATEST_REV=$(curl --silent --location "$API_URL") + STATE_FILE="$HOME/.local/state/monorepo-updater-rev" + + mkdir -p "$(dirname "$STATE_FILE")" + + if [ ! -f "$STATE_FILE" ]; then + echo "First run. Initializing baseline hash ($LATEST_REV) and exiting." + echo "$LATEST_REV" > "$STATE_FILE" + exit 0 + fi + + if [ "$(cat "$STATE_FILE")" = "$LATEST_REV" ]; then + echo "Channel has not bumped since last check ($LATEST_REV). Aborting." + exit 0 + fi + + echo "$LATEST_REV" > "$STATE_FILE" + + TEMP_DIR=$(mktemp -d) + trap 'rm -rf "$TEMP_DIR"' EXIT + cd "$TEMP_DIR" + + echo "Cloning repository..." + git clone git://git.nullring.xyz/monorepo.git --recurse-submodules + + cd monorepo/nix + + # Create and checkout [date]-bump branch INSIDE the submodule + DATE=$(date +%Y-%m-%d) + BRANCH_NAME="''${DATE}-bump" + git checkout -b "$BRANCH_NAME" + + echo "Running nix flake update..." + nix flake update --extra-experimental-features "nix-command flakes" + + # If the channel bumped, but flake update didn't change flake.lock, exit + if git diff --quiet flake.lock; then + echo "No actual updates to flake.lock. Aborting." + exit 0 + fi + + nix flake check --extra-experimental-features "nix-command flakes" + + git config user.name "NixOS Updater" + git config user.email "updater@localhost" + git add flake.lock + git commit -m "chore: automated flake update ''${DATE}" + + PATCH_DIR="$HOME/monorepo/nix" + mkdir -p "$PATCH_DIR" + PATCH_FILE="$PATCH_DIR/0000-flake-update-''${DATE}.patch" + + git format-patch -1 HEAD --stdout > "$PATCH_FILE" + echo "Successfully checked updates and created patch at $PATCH_FILE" +''; + }; + }; +} +#+end_src + ** Main Configuration This is the backbone of the all the NixOS configurations, with all these options being shared because they enhance security. @@ -3494,19 +3593,41 @@ be straightforward. *** QuteBrowser #+begin_src nix :tangle ../nix/modules/home/qutebrowser.nix -{ lib, config, catppuccin-qutebrowser, ... }: +{ pkgs, lib, config, catppuccin-qutebrowser, ... }: { programs.qutebrowser = { enable = lib.mkDefault config.monorepo.profiles.graphics.enable; + package = pkgs.qutebrowser.overrideAttrs (old: { + qtWrapperArgs = (old.qtWrapperArgs or []) ++ [ + "--set" "__EGL_VENDOR_LIBRARY_FILENAMES" "/run/opengl-driver/share/glvnd/egl_vendor.d/10_nvidia.json" + "--set" "GBM_BACKEND" "nvidia-drm" + "--set" "__GLX_VENDOR_LIBRARY_NAME" "nvidia" + "--set" "QT_QPA_PLATFORM" "wayland" + ]; + }); + enableDefaultBindings = true; searchEngines = { + DEFAULT = "https://search.marginalia.nu/search?query={}"; g = "https://www.google.com/search?hl=en&q={}"; w = "https://en.wikipedia.org/wiki/Special:Search?search={}&go=Go&ns0=1"; aw = "https://wiki.archlinux.org/?search={}"; nw = "https://wiki.nixos.org/index.php?search={}"; npk = "https://search.nixos.org/packages?channel=unstable&query={}"; }; + settings = { + # This is the magic combination for Qtile + Wayland + Qutebrowser + qt.args = [ + "enable-features=UseOzonePlatform" + "disable-gpu" + "disable-software-rasterizer" + "disable-gpu-sandbox" + ]; + + # Force Qt to draw the UI in software mode so it doesn't look for OpenGL + qt.force_software_rendering = "qt-quick"; + content.blocking.method = "both"; fonts.default_family = "Lora"; fonts.default_size = "12pt"; @@ -3523,10 +3644,8 @@ be straightforward. # Hints fonts.hints = "bold 12pt Lora"; - - # Rendering - qt.force_software_rendering = "chromium"; }; + extraConfig = (builtins.readFile "${catppuccin-qutebrowser}/setup.py") + '' config.load_autoconfig() @@ -4220,7 +4339,7 @@ for these configurations. homeDirectory = "/home/${super.monorepo.vars.userName}"; stateVersion = "24.11"; sessionVariables = { - QTWEBENGINE_FORCE_USE_GBM = 0; + QT_QPA_PLATFORM = "wayland;xcb"; NIXOS_OZONE_WL = 1; XDG_SESSION_TYPE = "wayland"; XDG_CURRENT_DESKTOP = "qtile"; @@ -4233,6 +4352,7 @@ for these configurations. unzip mupdf zathura + qt6.qtwayland fzf # passwords @@ -4246,7 +4366,7 @@ for these configurations. # Apps # octaveFull - grim swww vim element-desktop signal-desktop signal-cli imv slurp wl-clipboard + grim awww vim element-desktop signal-desktop signal-cli imv slurp wl-clipboard # Sound/media pavucontrol alsa-utils imagemagick ffmpeg pulseaudio |
