From a67a34261750851fdc522b0c0d98a366fb0b2fb9 Mon Sep 17 00:00:00 2001 From: cnst Date: Wed, 31 Jul 2024 16:15:08 +0200 Subject: [PATCH] hm --- flake.lock | 75 ++---------------- flake.nix | 18 ++--- home/core/default.nix | 2 +- home/core/gui/gtk/default.nix | 29 ------- home/core/gui/hypr/cnst.nix | 2 + home/core/gui/hypr/land/cnst/inputs.nix | 12 +-- home/core/gui/style/dconf.nix | 9 +++ home/core/gui/style/default.nix | 8 ++ home/core/gui/style/gtk.nix | 87 +++++++++++++++++++++ home/core/gui/xdg/default.nix | 7 -- nixos/hardware/cnix.nix | 10 +++ nixos/pkgs/bibata-hyprcursor/configure.py | 54 +++++++++++++ nixos/pkgs/bibata-hyprcursor/default.nix | 94 +++++++++++++++++++++++ nixos/pkgs/default.nix | 1 + 14 files changed, 287 insertions(+), 121 deletions(-) delete mode 100644 home/core/gui/gtk/default.nix create mode 100644 home/core/gui/style/dconf.nix create mode 100644 home/core/gui/style/default.nix create mode 100644 home/core/gui/style/gtk.nix create mode 100644 nixos/pkgs/bibata-hyprcursor/configure.py create mode 100644 nixos/pkgs/bibata-hyprcursor/default.nix diff --git a/flake.lock b/flake.lock index 8e4304a5..0ef2fd03 100644 --- a/flake.lock +++ b/flake.lock @@ -159,11 +159,11 @@ ] }, "locked": { - "lastModified": 1722381373, - "narHash": "sha256-BKx7uzHo3WyCmjjEWic3UuYDfq5i41ToCiHRlA7xZzU=", + "lastModified": 1722424503, + "narHash": "sha256-LnOw7mj4z+LuIM0JOqYT6wzEfXkv9mmTCp6MC72oQgM=", "owner": "nix-community", "repo": "flake-firefox-nightly", - "rev": "480f9615514981d2e1c6d634e878d6384ae73bc2", + "rev": "e9557b516eb848b88f0bed9675e4b6c9e51df640", "type": "github" }, "original": { @@ -494,27 +494,6 @@ "type": "github" } }, - "gitignore_3": { - "inputs": { - "nixpkgs": [ - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "hardware": { "locked": { "lastModified": 1722332872, @@ -983,22 +962,6 @@ "type": "github" } }, - "nixpkgs-stable_2": { - "locked": { - "lastModified": 1720386169, - "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_2": { "locked": { "lastModified": 1722062969, @@ -1094,11 +1057,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1722248209, - "narHash": "sha256-yYoxx5hVrI7JaiPy44sgnr5YIRXWY7ttNoN/l5fJOgI=", + "lastModified": 1722425500, + "narHash": "sha256-nAVezKR8I1ny1dE7qbSdC1Z5uhFVmn6HnOC7eGBiutY=", "owner": "nix-community", "repo": "nixvim", - "rev": "2089eb407d8c5dbd6ca6e93d4988a439ca6446fd", + "rev": "9314cd46f0f1ff756bae1ae1718c116be894930d", "type": "github" }, "original": { @@ -1129,31 +1092,6 @@ "type": "github" } }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": [ - "flake-compat" - ], - "gitignore": "gitignore_3", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable_2" - }, - "locked": { - "lastModified": 1721042469, - "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": [ @@ -1196,7 +1134,6 @@ "nix-gaming": "nix-gaming", "nixpkgs": "nixpkgs_5", "nixvim": "nixvim", - "pre-commit-hooks": "pre-commit-hooks", "systems": "systems_6", "wezterm": "wezterm" } diff --git a/flake.nix b/flake.nix index 5022d651..0206480c 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ ./home/users ./nixos/hosts ./nixos/pkgs - ./pre-commit-hooks.nix + # ./pre-commit-hooks.nix ]; perSystem = { @@ -25,9 +25,9 @@ ]; name = "dots"; DIRENV_LOG_FORMAT = ""; - shellHook = '' - ${config.pre-commit.installationScript} - ''; + # shellHook = '' + # ${config.pre-commit.installationScript} + # ''; }; formatter = pkgs.alejandra; @@ -73,10 +73,10 @@ url = "github:wez/wezterm?dir=nix"; }; anyrun.url = "github:anyrun-org/anyrun"; - pre-commit-hooks = { - url = "github:cachix/pre-commit-hooks.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.flake-compat.follows = "flake-compat"; - }; + # pre-commit-hooks = { + # url = "github:cachix/pre-commit-hooks.nix"; + # inputs.nixpkgs.follows = "nixpkgs"; + # inputs.flake-compat.follows = "flake-compat"; + # }; }; } diff --git a/home/core/default.nix b/home/core/default.nix index ddbd2c5f..9bf3a3f8 100644 --- a/home/core/default.nix +++ b/home/core/default.nix @@ -3,10 +3,10 @@ # ./gui/anyrun ./gui/browsers ./gui/discord - ./gui/gtk ./gui/utility ./gui/waybar ./gui/xdg + ./gui/style ./tui/alacritty ./tui/foot diff --git a/home/core/gui/gtk/default.nix b/home/core/gui/gtk/default.nix deleted file mode 100644 index 0a3a74e8..00000000 --- a/home/core/gui/gtk/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{pkgs, ...}: { - home.pointerCursor = { - gtk.enable = true; - x11.enable = true; - name = "Adwaita"; - package = pkgs.adwaita-icon-theme; - size = 28; - }; - gtk = { - enable = true; - theme = { - package = pkgs.orchis-theme; - name = "Orchis-Grey-Dark-Compact"; - }; - iconTheme = { - package = pkgs.gruvbox-plus-icons; - name = "Gruvbox-Plus-Dark"; - }; - font = { - name = "Input Sans Narrow Light"; - size = 10; - }; - cursorTheme = { - name = "Adwaita"; - package = pkgs.adwaita-icon-theme; - size = 28; - }; - }; -} diff --git a/home/core/gui/hypr/cnst.nix b/home/core/gui/hypr/cnst.nix index 269a740c..9f13f926 100644 --- a/home/core/gui/hypr/cnst.nix +++ b/home/core/gui/hypr/cnst.nix @@ -3,8 +3,10 @@ inputs.hyprland.homeManagerModules.default ./land/cnst ]; + wayland.windowManager.hyprland = { enable = true; + xwayland.enable = true; systemd = { variables = ["--all"]; diff --git a/home/core/gui/hypr/land/cnst/inputs.nix b/home/core/gui/hypr/land/cnst/inputs.nix index 31f210ad..06bf476b 100644 --- a/home/core/gui/hypr/land/cnst/inputs.nix +++ b/home/core/gui/hypr/land/cnst/inputs.nix @@ -50,7 +50,7 @@ workspace_swipe_create_new = true; }; misc = { - vrr = 1; + vrr = 2; no_direct_scanout = false; mouse_move_enables_dpms = 1; key_press_enables_dpms = 0; @@ -62,10 +62,10 @@ xwayland = { force_zero_scaling = true; }; - cursor = { - no_hardware_cursors = true; - no_break_fs_vrr = true; - min_refresh_rate = 24; - }; + # cursor = { + # no_hardware_cursors = true; + # no_break_fs_vrr = true; + # min_refresh_rate = 24; + # }; }; } diff --git a/home/core/gui/style/dconf.nix b/home/core/gui/style/dconf.nix new file mode 100644 index 00000000..984c9159 --- /dev/null +++ b/home/core/gui/style/dconf.nix @@ -0,0 +1,9 @@ +{ + dconf = { + settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; + }; + }; +} diff --git a/home/core/gui/style/default.nix b/home/core/gui/style/default.nix new file mode 100644 index 00000000..6957f705 --- /dev/null +++ b/home/core/gui/style/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ + ./gtk.nix + ./dconf.nix + # ./qt.nix + # ./global.nix + ]; +} diff --git a/home/core/gui/style/gtk.nix b/home/core/gui/style/gtk.nix new file mode 100644 index 00000000..0541f83e --- /dev/null +++ b/home/core/gui/style/gtk.nix @@ -0,0 +1,87 @@ +{ + pkgs, + config, + ... +}: { + home = { + packages = [pkgs.glib]; # gsettings + pointerCursor = { + package = pkgs.catppuccin-cursors.latteDark; + name = "catppuccin-latte-dark-cursors"; + size = 28; + gtk.enable = true; + x11.enable = true; + }; + }; + gtk = { + enable = true; + theme = { + package = pkgs.orchis-theme; + name = "Orchis-Grey-Dark-Compact"; + }; + iconTheme = { + package = pkgs.gruvbox-plus-icons; + name = "Gruvbox-Plus-Dark"; + }; + font = { + name = "Input Sans Narrow Light"; + size = 10; + }; + cursorTheme = { + package = pkgs.catppuccin-cursors.latteDark; + name = "catppuccin-latte-dark-cursors"; + size = 28; + }; + + gtk2 = { + configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + extraConfig = '' + gtk-xft-antialias=1 + gtk-xft-hinting=1 + gtk-xft-hintstyle="hintslight" + gtk-xft-rgba="rgb" + ''; + }; + + gtk3.extraConfig = { + # Lets be easy on the eyes. This should be easy to make dependent on + # the "variant" of the theme, but I never use a light theme anyway. + gtk-application-prefer-dark-theme = true; + + # Decorations + gtk-decoration-layout = "appmenu:none"; + gtk-toolbar-style = "GTK_TOOLBAR_BOTH"; + gtk-toolbar-icon-size = "GTK_ICON_SIZE_LARGE_TOOLBAR"; + gtk-button-images = 1; + gtk-menu-images = 1; + + # Silence bells and whistles, quite literally. + gtk-error-bell = 0; + gtk-enable-event-sounds = 0; + gtk-enable-input-feedback-sounds = 0; + + # Fonts + gtk-xft-antialias = 1; + gtk-xft-hinting = 1; + gtk-xft-hintstyle = "hintslight"; + }; + + gtk4.extraConfig = { + # Prefer dark theme. + gtk-application-prefer-dark-theme = true; + + # Decorations. + gtk-decoration-layout = "appmenu:none"; + + # Sounds, again. + gtk-error-bell = 0; + gtk-enable-event-sounds = 0; + gtk-enable-input-feedback-sounds = 0; + + # Fonts, you know the drill. + gtk-xft-antialias = 1; + gtk-xft-hinting = 1; + gtk-xft-hintstyle = "hintslight"; + }; + }; +} diff --git a/home/core/gui/xdg/default.nix b/home/core/gui/xdg/default.nix index bba3feb2..61c5f7c9 100644 --- a/home/core/gui/xdg/default.nix +++ b/home/core/gui/xdg/default.nix @@ -13,11 +13,4 @@ videos = "${config.home.homeDirectory}/media/videos"; }; }; - dconf = { - settings = { - "org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; - }; - }; - }; } diff --git a/nixos/hardware/cnix.nix b/nixos/hardware/cnix.nix index fbba64eb..e6464648 100644 --- a/nixos/hardware/cnix.nix +++ b/nixos/hardware/cnix.nix @@ -17,6 +17,16 @@ libva vaapiVdpau libvdpau-va-gl + amdvlk + + # mesa + mesa + + # vulkan + vulkan-tools + vulkan-loader + vulkan-validation-layers + vulkan-extension-layer ]; extraPackages32 = with pkgs.pkgsi686Linux; [ vaapiVdpau diff --git a/nixos/pkgs/bibata-hyprcursor/configure.py b/nixos/pkgs/bibata-hyprcursor/configure.py new file mode 100644 index 00000000..30adfda9 --- /dev/null +++ b/nixos/pkgs/bibata-hyprcursor/configure.py @@ -0,0 +1,54 @@ +# stolen from https://github.com/diniamo/niqspkgs/blob/544c3b2c69fd1b5ab3407e7b35c76060801a8bcf/pkgs/bibata-hyprcursor/default.nix + +from sys import argv +import os +from os import path +from pathlib import Path +import tomli +import tomli_w + + +def fallback_value(config, cursor, field): + return (config.get(cursor, None) or {}).get(field, None) or ( + config["fallback_settings"].get(field, None) + ) + + +def filter_none_dict(**kwargs): + return {k: v for k, v in kwargs.items() if v is not None} + + +def construct_meta(config, name, sizes): + meta = filter_none_dict( + define_size=";".join(sizes), + define_override=( + None + if (overrides := fallback_value(config, name, "x11_symlinks")) is None + else ";".join(overrides) + ), + hotspot_x=fallback_value(config, name, "x_hotspot") / 256, + hotspot_y=fallback_value(config, name, "y_hotspot") / 256, + ) + + with open(f"{name}/meta.toml", "wb") as file: + tomli_w.dump({"General": meta}, file) + + +with open(argv[1], "rb") as file: + config = tomli.load(file)["cursors"] + +os.chdir(argv[2]) + +for cursor in os.listdir("."): + if path.isfile(cursor): + name = Path(cursor).stem + + os.mkdir(name) + os.rename(cursor, f"{name}/{cursor}") + + construct_meta(config, name, [f"0,{cursor}"]) + else: + delay = fallback_value(config, cursor, "x11_delay") + construct_meta( + config, cursor, map(lambda c: f"0,{c},{delay}", os.listdir(cursor)) + ) diff --git a/nixos/pkgs/bibata-hyprcursor/default.nix b/nixos/pkgs/bibata-hyprcursor/default.nix new file mode 100644 index 00000000..a1c9e21a --- /dev/null +++ b/nixos/pkgs/bibata-hyprcursor/default.nix @@ -0,0 +1,94 @@ +# stolen from https://github.com/diniamo/niqspkgs/blob/544c3b2c69fd1b5ab3407e7b35c76060801a8bcf/pkgs/bibata-hyprcursor/default.nix +{ + lib, + stdenvNoCC, + fetchFromGitHub, + python3, + python3Packages, + hyprcursor, + variant ? "modern", + baseColor ? "#000000", + outlineColor ? "#FFFFFF", + watchBackgroundColor ? "#000000", + colorName ? "classic", +}: let + capitalize = str: let + capital_letter = builtins.substring 0 1 str; + non_capital = lib.removePrefix capital_letter str; + in + lib.toUpper capital_letter + non_capital; + + themeName = "Bibata-${capitalize variant}-${capitalize colorName}"; +in + assert builtins.elem variant ["modern" "modern-right" "original" "original-right"]; + stdenvNoCC.mkDerivation (final: { + pname = "bibata-hyprcursor"; + version = "v2.0.7"; + + src = fetchFromGitHub { + owner = "ful1e5"; + repo = "Bibata_Cursor"; + rev = final.version; + hash = "sha256-kIKidw1vditpuxO1gVuZeUPdWBzkiksO/q2R/+DUdEc="; + }; + + nativeBuildInputs = [ + python3 + python3Packages.tomli + python3Packages.tomli-w + hyprcursor + ]; + + phases = ["unpackPhase" "configurePhase" "buildPhase" "installPhase"]; + + unpackPhase = '' + runHook preUnpack + + cp $src/configs/${ + if lib.hasSuffix "right" variant + then "right" + else "normal" + }/x.build.toml config.toml + + mkdir cursors + for cursor in $src/svg/${variant}/*; do + cp -r $src/svg/${variant}/$(readlink $cursor) cursors + done + + chmod -R u+w . + + runHook postUnpack + ''; + + configurePhase = '' + runHook preConfigure + + cat << EOF > manifest.hl + name = ${themeName} + description = The Bibata Cursor theme packaged for hyprcursor. + version = ${final.version} + cursors_directory = cursors + EOF + + find cursors -type f -name '*.svg' | xargs sed -i -e 's/#00FF00/${baseColor}/g' -e 's/#0000FF/${outlineColor}/g' -e 's/#FF0000/${watchBackgroundColor}/g' + + python ${./configure.py} config.toml cursors + + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + hyprcursor-util --create . --output . + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/icons + cp -r theme_${themeName} $out/share/icons/${themeName} + + runHook postInstall + ''; + }) diff --git a/nixos/pkgs/default.nix b/nixos/pkgs/default.nix index d942dcb3..77fe7948 100644 --- a/nixos/pkgs/default.nix +++ b/nixos/pkgs/default.nix @@ -7,6 +7,7 @@ ... }: { packages = { + bibata-hyprcursor = pkgs.callPackage ./bibata-hyprcursor {}; wl-ocr = pkgs.callPackage ./wl-ocr {}; }; };