diff --git a/flake.lock b/flake.lock index be689de..1ba535e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,126 +1,12 @@ { "nodes": { - "base16": { - "inputs": { - "fromYaml": "fromYaml" - }, - "locked": { - "lastModified": 1708890466, - "narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=", - "owner": "SenchoPens", - "repo": "base16.nix", - "rev": "665b3c6748534eb766c777298721cece9453fdae", - "type": "github" - }, - "original": { - "owner": "SenchoPens", - "repo": "base16.nix", - "type": "github" - } - }, - "base16-fish": { - "flake": false, - "locked": { - "lastModified": 1622559957, - "narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=", - "owner": "tomyun", - "repo": "base16-fish", - "rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe", - "type": "github" - }, - "original": { - "owner": "tomyun", - "repo": "base16-fish", - "type": "github" - } - }, - "base16-foot": { - "flake": false, - "locked": { - "lastModified": 1696725948, - "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", - "owner": "tinted-theming", - "repo": "base16-foot", - "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-foot", - "type": "github" - } - }, - "base16-helix": { - "flake": false, - "locked": { - "lastModified": 1720809814, - "narHash": "sha256-numb3xigRGnr/deF7wdjBwVg7fpbTH7reFDkJ75AJkY=", - "owner": "tinted-theming", - "repo": "base16-helix", - "rev": "34f41987bec14c0f3f6b2155c19787b1f6489625", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-helix", - "type": "github" - } - }, - "base16-kitty": { - "flake": false, - "locked": { - "lastModified": 1665001328, - "narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=", - "owner": "kdrag0n", - "repo": "base16-kitty", - "rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805", - "type": "github" - }, - "original": { - "owner": "kdrag0n", - "repo": "base16-kitty", - "type": "github" - } - }, - "base16-tmux": { - "flake": false, - "locked": { - "lastModified": 1696725902, - "narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=", - "owner": "tinted-theming", - "repo": "base16-tmux", - "rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-tmux", - "type": "github" - } - }, - "base16-vim": { - "flake": false, - "locked": { - "lastModified": 1716150083, - "narHash": "sha256-ZMhnNmw34ogE5rJZrjRv5MtG3WaqKd60ds2VXvT6hEc=", - "owner": "tinted-theming", - "repo": "base16-vim", - "rev": "6e955d704d046b0dc3e5c2d68a2a6eeffd2b5d3d", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-vim", - "type": "github" - } - }, "catppuccin": { "locked": { - "lastModified": 1730458408, - "narHash": "sha256-JQ+SphQn13bdibKUrBBBznYehXX4xJrxD1ifBp6vSWw=", + "lastModified": 1731232837, + "narHash": "sha256-0aIwr/RC/oe7rYkfJb47xjdEQDSNcqpFGsEa+EPlDEs=", "owner": "catppuccin", "repo": "nix", - "rev": "191fbf2d81a63fad8f62f1233c0051f09b75d0ad", + "rev": "32359bf226fe874d3b7a0a5753d291a4da9616fe", "type": "github" }, "original": { @@ -135,6 +21,7 @@ "flake-utils": [ "flake-utils" ], + "nix-github-actions": "nix-github-actions", "nixpkgs": [ "nixpkgs" ], @@ -143,11 +30,11 @@ ] }, "locked": { - "lastModified": 1728263678, - "narHash": "sha256-gyUVsPAWY9AgVKjrNPoowrIr5BvK4gI0UkDXvv8iSxA=", + "lastModified": 1731527002, + "narHash": "sha256-dI9I6suECoIAmbS4xcrqF8r2pbmed8WWm5LIF1yWPw8=", "owner": "zhaofengli", "repo": "colmena", - "rev": "b0a62f234fae02a006123e661ff70e62af16106b", + "rev": "e3ad42138015fcdf2524518dd564a13145c72ea1", "type": "github" }, "original": { @@ -224,22 +111,6 @@ "type": "github" } }, - "flake-compat_4": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -285,11 +156,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -316,43 +187,6 @@ "type": "github" } }, - "flake-utils_3": { - "inputs": { - "systems": [ - "stylix", - "systems" - ] - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "fromYaml": { - "flake": false, - "locked": { - "lastModified": 1689549921, - "narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=", - "owner": "SenchoPens", - "repo": "fromYaml", - "rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84", - "type": "github" - }, - "original": { - "owner": "SenchoPens", - "repo": "fromYaml", - "type": "github" - } - }, "git-hooks": { "inputs": { "flake-compat": [ @@ -409,23 +243,6 @@ "type": "github" } }, - "gnome-shell": { - "flake": false, - "locked": { - "lastModified": 1713702291, - "narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=", - "owner": "GNOME", - "repo": "gnome-shell", - "rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934", - "type": "github" - }, - "original": { - "owner": "GNOME", - "ref": "46.1", - "repo": "gnome-shell", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -433,11 +250,11 @@ ] }, "locked": { - "lastModified": 1730837930, - "narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=", + "lastModified": 1731535640, + "narHash": "sha256-2EckCJn4wxran/TsRiCOFcmVpep2m9EBKl99NBh2GnM=", "owner": "nix-community", "repo": "home-manager", - "rev": "2f607e07f3ac7e53541120536708e824acccfaa8", + "rev": "35b055009afd0107b69c286fca34d2ad98940d57", "type": "github" }, "original": { @@ -468,27 +285,6 @@ "type": "github" } }, - "home-manager_3": { - "inputs": { - "nixpkgs": [ - "stylix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1724435763, - "narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, "ixx": { "inputs": { "flake-utils": [ @@ -563,6 +359,27 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "colmena", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729742964, + "narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "e04df33f62cdcf93d73e9a04142464753a16db67", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -570,11 +387,11 @@ ] }, "locked": { - "lastModified": 1730604744, - "narHash": "sha256-/MK6QU4iOozJ4oHTfZipGtOgaT/uy/Jm4foCqHQeYR4=", + "lastModified": 1731209121, + "narHash": "sha256-BF7FBh1hIYPDihdUlImHGsQzaJZVLLfYqfDx41wjuF0=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "cc2ddbf2df8ef7cc933543b1b42b845ee4772318", + "rev": "896019f04b22ce5db4c0ee4f89978694f44345c3", "type": "github" }, "original": { @@ -594,11 +411,11 @@ ] }, "locked": { - "lastModified": 1730944043, - "narHash": "sha256-DIYTHa57pQQc9ARiMpJWYkaoiTaQPLH7Y4qK0J10Khk=", + "lastModified": 1731548914, + "narHash": "sha256-UtYkHq8OdZcz2Q/r7gh+3HFGVgX9AFfYDrMjAVO6sj4=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "0a959b25ff573f079ed032f88d8c988561b96a96", + "rev": "00e11784c89ecd236ff045acd7a447e0fe5b80df", "type": "github" }, "original": { @@ -609,11 +426,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1730919458, - "narHash": "sha256-yMO0T0QJlmT/x4HEyvrCyigGrdYfIXX3e5gWqB64wLg=", + "lastModified": 1731403644, + "narHash": "sha256-T9V7CTucjRZ4Qc6pUEV/kpgNGzQbHWfGcfK6JJLfUeI=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "e1cc1f6483393634aee94514186d21a4871e78d7", + "rev": "f6581f1c3b137086e42a08a906bdada63045f991", "type": "github" }, "original": { @@ -653,11 +470,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1730741070, - "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", + "lastModified": 1731386116, + "narHash": "sha256-lKA770aUmjPHdTaJWnP3yQ9OI1TigenUqVC3wweqZuI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", + "rev": "689fed12a013f56d4c4d3f612489634267d86529", "type": "github" }, "original": { @@ -685,11 +502,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1731119255, - "narHash": "sha256-rDHKmBBUu7XSK+68yXEI9TJVc2TaQH7SVieP9pH3h7k=", + "lastModified": 1731570228, + "narHash": "sha256-mLuo8lZViwYdQQkA+hs6kTCPzAw1VR6O0jtXS1eC+Yc=", "owner": "xinyangli", "repo": "nixpkgs", - "rev": "ca12ccda69b37abe3ea78dab388b0bfe638eb743", + "rev": "8cb7e7a9ead084be01f290e26602f40815ea36fe", "type": "github" }, "original": { @@ -699,22 +516,6 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1725194671, - "narHash": "sha256-tLGCFEFTB5TaOKkpfw3iYT9dnk4awTP/q4w+ROpMfuw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b833ff01a0d694b910daca6e2ff4a3f26dee478c", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixvim": { "inputs": { "devshell": "devshell", @@ -743,11 +544,11 @@ }, "nur": { "locked": { - "lastModified": 1730959878, - "narHash": "sha256-UZ6oSptjE04ooORHvvR+kiGnr/nhzWgYwGryxUkKAv0=", + "lastModified": 1731569820, + "narHash": "sha256-5i2hiBMnhqLVXpnmPwvLJKB5Tn816Z+9UmC5EcL2av4=", "owner": "nix-community", "repo": "NUR", - "rev": "bc4d2a3b71c75d81cc247b1bf991b63f75358004", + "rev": "6e804f7059440328e36f002f6eead1fd9b8eef43", "type": "github" }, "original": { @@ -793,8 +594,7 @@ "nixpkgs": "nixpkgs_2", "nixpkgs-stable": "nixpkgs-stable", "nur": "nur", - "sops-nix": "sops-nix", - "stylix": "stylix" + "sops-nix": "sops-nix" } }, "sops-nix": { @@ -805,11 +605,11 @@ "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1730883027, - "narHash": "sha256-pvXMOJIqRW0trsW+FzRMl6d5PbsM4rWfD5lcKCOrrwI=", + "lastModified": 1731364708, + "narHash": "sha256-HC0anOL+KmUQ2hdRl0AtunbAckasxrkn4VLmxbW/WaA=", "owner": "Mic92", "repo": "sops-nix", - "rev": "c5ae1e214ff935f2d3593187a131becb289ea639", + "rev": "4c91d52db103e757fc25b58998b0576ae702d659", "type": "github" }, "original": { @@ -818,36 +618,6 @@ "type": "github" } }, - "stylix": { - "inputs": { - "base16": "base16", - "base16-fish": "base16-fish", - "base16-foot": "base16-foot", - "base16-helix": "base16-helix", - "base16-kitty": "base16-kitty", - "base16-tmux": "base16-tmux", - "base16-vim": "base16-vim", - "flake-compat": "flake-compat_4", - "flake-utils": "flake-utils_3", - "gnome-shell": "gnome-shell", - "home-manager": "home-manager_3", - "nixpkgs": "nixpkgs_3", - "systems": "systems_3" - }, - "locked": { - "lastModified": 1725416430, - "narHash": "sha256-DkF49DlcaZHV9v3m5ctQnC9qNqsEdfNhwjQArx5Q+Zw=", - "owner": "xinyangli", - "repo": "stylix", - "rev": "7aad490478518af03367dabfb5811b3f87ea93a1", - "type": "github" - }, - "original": { - "owner": "xinyangli", - "repo": "stylix", - "type": "github" - } - }, "systems": { "locked": { "lastModified": 1681028828, @@ -878,21 +648,6 @@ "type": "github" } }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 959d920..42f1e30 100644 --- a/flake.nix +++ b/flake.nix @@ -52,12 +52,6 @@ catppuccin = { url = "github:catppuccin/nix"; }; - - stylix = { - url = "github:xinyangli/stylix"; - # inputs.nixpkgs.follows = "nixpkgs"; - # inputs.home-manager.follows = "home-manager"; - }; }; outputs = @@ -141,6 +135,7 @@ modules = [ self.nixosModules.default nur.nixosModules.nur + catppuccin.nixosModules.catppuccin ] ++ modules; }; in diff --git a/home/xin/calcite.nix b/home/xin/calcite.nix index 654aedc..e0b4693 100644 --- a/home/xin/calcite.nix +++ b/home/xin/calcite.nix @@ -36,13 +36,21 @@ in home.packages = with pkgs; [ thunderbird remmina + qq + wechat-uos ]; # Theme catppuccin = { enable = true; + accent = "peach"; flavor = "mocha"; }; + # Missing from catppuccin module + services.swaync.style = pkgs.fetchurl { + url = "https://github.com/catppuccin/swaync/releases/download/v0.2.3/mocha.css"; + hash = "sha256-Hie/vDt15nGCy4XWERGy1tUIecROw17GOoasT97kIfc="; + }; xdg.enable = true; @@ -84,6 +92,7 @@ in zellij = { enable = true; }; + gui = { niri.enable = true; waybar.enable = true; diff --git a/machines/calcite/configuration.nix b/machines/calcite/configuration.nix index 7235179..aaa71d0 100644 --- a/machines/calcite/configuration.nix +++ b/machines/calcite/configuration.nix @@ -4,7 +4,9 @@ lib, ... }: - +let + inherit (lib) mkForce getExe; +in { imports = [ # Include the results of the hardware scan. @@ -14,7 +16,6 @@ ]; commonSettings = { - auth.enable = true; nix = { enableMirrors = true; signing.enable = true; @@ -43,7 +44,7 @@ # TPM2TOOLS_TCTI and TPM2_PKCS11_TCTI env variables tctiEnvironment.enable = true; }; - services.gnome.gnome-keyring.enable = lib.mkForce false; + # services.gnome.gnome-keyring.enable = lib.mkForce false; security.pam.services.login.enableGnomeKeyring = lib.mkForce false; services.ssh-tpm-agent.enable = true; @@ -98,14 +99,49 @@ LC_TIME = "en_US.utf8"; }; - services.displayManager = { - enable = true; - defaultSession = "niri"; - }; + # ====== GUI ====== programs.niri.enable = true; + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + security.pam.services.gtklock = { }; # Required by gtklock - services.xserver.displayManager.gdm.enable = true; + catppuccin = { + enable = true; + accent = "rosewater"; + flavor = "mocha"; + }; + + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-gnome + ]; + configPackages = [ pkgs.niri ]; + }; + + systemd.user.services.xdg-desktop-portal-gtk.after = [ "graphical-session.target" ]; + + services.greetd = + let + niri-login-config = pkgs.writeText "niri-login-config.kdl" '' + animations { + off + } + hotkey-overlay { + skip-at-startup + } + ''; + in + { + enable = true; + vt = 1; + settings = { + default_session = { + command = "${pkgs.dbus}/bin/dbus-run-session -- ${getExe pkgs.niri} -c ${niri-login-config} -- ${getExe pkgs.greetd.gtkgreet} -l -c niri-session -s ${pkgs.magnetic-catppuccin-gtk}/share/themes/Catppuccin-GTK-Dark/gtk-3.0/gtk.css"; + }; + }; + }; # Keyboard mapping on internal keyboard services.keyd = { @@ -229,7 +265,6 @@ # IM element-desktop tdesktop - qq # Password manager bitwarden @@ -300,8 +335,6 @@ exporters.blackbox.enable = true; }; - custom.stylix.enable = false; - services.ollama = { enable = true; acceleration = "cuda"; @@ -311,7 +344,6 @@ services.gvfs.enable = true; services.flatpak.enable = true; - xdg.portal.enable = true; # Fonts fonts = { diff --git a/machines/calcite/network.nix b/machines/calcite/network.nix index 89e9255..31203ad 100644 --- a/machines/calcite/network.nix +++ b/machines/calcite/network.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { imports = [ ]; @@ -10,7 +10,6 @@ dns = "systemd-resolved"; }; }; - systemd.services.NetworkManager-wait-online.enable = false; services.resolved = { enable = true; @@ -25,6 +24,7 @@ services.dae.enable = true; services.dae.configFile = "/var/lib/dae/config.dae"; + systemd.services.dae.after = lib.mkIf (config.networking.networkmanager.enable) [ "NetworkManager-wait-online.service" ]; custom.sing-box = { enable = false; @@ -46,14 +46,13 @@ # Use nftables to manager firewall networking.nftables.enable = true; - # Add gsconnect, open firewall - programs.kdeconnect = { - enable = true; - package = pkgs.gnomeExtensions.gsconnect; - }; - programs.wireshark = { enable = true; package = pkgs.wireshark-qt; }; + + programs.kdeconnect = { + enable = true; + package = pkgs.valent; + }; } diff --git a/modules/home-manager/gui/bwmountains.jpg b/modules/home-manager/gui/bwmountains.jpg new file mode 100755 index 0000000..41ca976 Binary files /dev/null and b/modules/home-manager/gui/bwmountains.jpg differ diff --git a/modules/home-manager/gui/default.nix b/modules/home-manager/gui/default.nix index dae49a8..5528027 100644 --- a/modules/home-manager/gui/default.nix +++ b/modules/home-manager/gui/default.nix @@ -1,7 +1,20 @@ +{ config, lib, ... }: +let + inherit (lib) mkOption types; + cfg = config.custom-hm.gui; +in { imports = [ ./niri.nix ./fuzzel.nix + ./gtklock.nix ./waybar.nix ]; + + options.custom-hm.gui = { + wallpaper = mkOption { + type = types.path; + default = ./bwmountains.jpg; + }; + }; } diff --git a/modules/home-manager/gui/fuzzel.nix b/modules/home-manager/gui/fuzzel.nix index 8b27240..3b4e880 100644 --- a/modules/home-manager/gui/fuzzel.nix +++ b/modules/home-manager/gui/fuzzel.nix @@ -1,4 +1,9 @@ -{ config, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let inherit (lib) mkIf mkEnableOption; cfg = config.custom-hm.gui.fuzzel; @@ -9,6 +14,28 @@ in }; config = mkIf cfg.enable { - programs.fuzzel.enable = true; + programs.fuzzel = { + enable = true; + settings = { + main = { + fields = "filename,name,exec,generic"; + y-margin = 30; + width = 40; + font = "Ubuntu"; + use-bold = true; + line-height = 30; + }; + }; + }; + home.packages = with pkgs; [ + networkmanager_dmenu + networkmanagerapplet + ]; + xdg.configFile."networkmanager-dmenu/config.ini".text = '' + [dmenu] + dmenu_command = fuzzel --dmenu + wifi_chars = ▂▄▆█ + wifi_icons = 󰤯󰤟󰤢󰤥󰤨 + ''; }; } diff --git a/modules/home-manager/gui/gtklock.nix b/modules/home-manager/gui/gtklock.nix new file mode 100644 index 0000000..69b3ce9 --- /dev/null +++ b/modules/home-manager/gui/gtklock.nix @@ -0,0 +1,128 @@ +# modified from https://github.com/isabelroses/dotfiles/blob/2fd4d2d0cb8254cad5ce4b089d81114e1b88ad02/modules/extra/home-manager/gtklock.nix +{ + lib, + pkgs, + config, + ... +}: +let + cfg = config.custom-hm.gui.gtklock; + + inherit (lib.modules) mkIf; + inherit (lib.options) + mkOption + mkEnableOption + mkPackageOption + literalExpression + ; + inherit (lib.strings) optionalString concatStringsSep; + inherit (lib.lists) optionals; + inherit (lib.types) + oneOf + str + path + listOf + either + package + nullOr + attrs + ; + inherit (lib.generators) toINI; + + # the main config includes two very niche options: style (which takes a path) and modules, which takes a list of module paths + # concatted by ";" + # for type checking purposes, I prefer templating the main section of the config and let the user safely choose options + # extraConfig takes an attrset, and converts it to the correct INI format - it's mostly just strings and integers, so that's fine + baseConfig = '' + [main] + ${optionalString (cfg.config.gtk-theme != "") "gtk-theme=${cfg.config.gtk-theme}"} + ${optionalString (cfg.config.style != "") "style=${cfg.config.style}"} + ${optionalString (cfg.config.modules != [ ]) "modules=${concatStringsSep ";" cfg.config.modules}"} + ''; + + finalConfig = baseConfig + optionals (cfg.extraConfig != null) (toINI { } cfg.extraConfig); +in +{ + options.custom-hm.gui.gtklock = { + enable = mkEnableOption "GTK-based lockscreen for Wayland"; + package = mkPackageOption pkgs "gtklock" { }; + + config = { + gtk-theme = mkOption { + type = str; + default = ""; + description = '' + GTK theme to use for gtklock. + ''; + example = "Adwaita-dark"; + }; + + style = mkOption { + type = oneOf [ + str + path + ]; + default = pkgs.writeText "gtklock-style.css" '' + window { + background-image: url("${config.custom-hm.gui.wallpaper}"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + ''; + description = '' + The css file to be used for gtklock. + ''; + example = literalExpression '' + pkgs.writeText "gtklock-style.css" ''' + window { + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + ''' + ''; + }; + + modules = mkOption { + type = listOf (either package str); + default = [ + # "${pkgs.gtklock-playerctl-module.outPath}/lib/gtklock/playerctl-module.so" + ]; + description = '' + A list of gtklock modulesto use. Can either be packages, absolute paths, or strings. + ''; + example = literalExpression '' + [ + "${pkgs.gtklock-powerbar-module.outPath}/lib/gtklock/powerbar-module.so" + "${pkgs.gtklock-playerctl-module.outPath}/lib/gtklock/playerctl-module.so" + ]; + ''; + }; + }; + + extraConfig = mkOption { + type = nullOr attrs; + default = + { + }; + description = '' + Extra configuration to append to gtklock configuration file. + Mostly used for appending module configurations. + ''; + example = literalExpression '' + countdown = { + countdown-position = "top-right"; + justify = "right"; + countdown = 20; + } + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."gtklock/config.ini".source = pkgs.writeText "gtklock-config.ini" finalConfig; + }; +} diff --git a/modules/home-manager/gui/niri.nix b/modules/home-manager/gui/niri.nix index a80e692..8eb07b6 100644 --- a/modules/home-manager/gui/niri.nix +++ b/modules/home-manager/gui/niri.nix @@ -5,38 +5,52 @@ ... }: let - inherit (lib) mkIf mkEnableOption; + inherit (lib) mkIf mkEnableOption getExe; cfg = config.custom-hm.gui.niri; - wallpaper = pkgs.fetchurl { - url = "https://github.com/NixOS/nixos-artwork/blob/master/wallpapers/nixos-wallpaper-catppuccin-mocha.png?raw=true"; - hash = "sha256-fmKFYw2gYAYFjOv4lr8IkXPtZfE1+88yKQ4vjEcax1s="; - }; + wallpaper = config.custom-hm.gui.wallpaper; + xwayland-satellite = pkgs.xwayland-satellite.overrideAttrs (drv: rec { + src = pkgs.fetchFromGitHub { + owner = "Supreeeme"; + repo = "xwayland-satellite"; + rev = "3e6f892d20d918479e67d1e6c90c4be824a9d4ab"; + hash = "sha256-W1UUok7DPi4IXCYtc273FbVH1ifuCIcl+oO6CDqt8Dk="; + }; + cargoDeps = drv.cargoDeps.overrideAttrs ( + lib.const { + name = "xwayland-satellite-vendor.tar.gz"; + inherit src; + outputHash = "sha256-/nK4cVgelaMtpym18RYNafPUFnMOG4uHRpVO8bOS3ow="; + } + ); + }); in { + imports = [ + ./themes.nix + ]; + options.custom-hm.gui.niri = { enable = mkEnableOption "niri"; }; config = mkIf cfg.enable { home.packages = with pkgs; [ - xwayland-satellite cosmic-files ]; - home.pointerCursor = { - name = "Bibata-Modern-Ice"; - size = 24; - package = pkgs.bibata-cursors; - gtk.enable = true; - }; - gtk = { - enable = true; - theme = { - name = "Catppuccin-GTK-Dark"; - package = pkgs.magnetic-catppuccin-gtk; + + systemd.user.services.xwayland-satellite = { + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + Unit = { + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${xwayland-satellite}/bin/xwayland-satellite"; + Restart = "on-failure"; }; - gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; }; - services.network-manager-applet.enable = true; systemd.user.services.swaybg = { Install = { @@ -52,12 +66,14 @@ in }; }; - programs.swaylock = { + services.swaync = { enable = true; - settings = { - show-failed-attempts = true; - daemonize = true; - scaling = "fill"; + }; + + custom-hm.gui.gtklock = { + enable = true; + config = { + gtk-theme = "Catppuccin-GTK-Dark"; }; }; @@ -75,7 +91,7 @@ in events = [ { event = "lock"; - command = "${pkgs.swaylock}/bin/swaylock"; + command = "${getExe pkgs.gtklock}"; } { event = "before-sleep"; diff --git a/modules/home-manager/gui/themes.nix b/modules/home-manager/gui/themes.nix new file mode 100644 index 0000000..ad0de1c --- /dev/null +++ b/modules/home-manager/gui/themes.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: +{ + config = { + home.pointerCursor = { + name = "Bibata-Modern-Ice"; + size = 24; + package = pkgs.bibata-cursors; + gtk.enable = true; + }; + gtk = { + enable = true; + theme = { + name = "Catppuccin-GTK-Dark"; + package = pkgs.magnetic-catppuccin-gtk; + }; + gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + }; + }; +} diff --git a/modules/home-manager/gui/waybar.css b/modules/home-manager/gui/waybar.css index 6a5da1d..eaed007 100644 --- a/modules/home-manager/gui/waybar.css +++ b/modules/home-manager/gui/waybar.css @@ -49,7 +49,8 @@ window#waybar { #network, #backlight, #battery, -#tray { +#tray, +#custom-notification { margin-right: 15px; } #clock { diff --git a/modules/home-manager/gui/waybar.nix b/modules/home-manager/gui/waybar.nix index 001e7ce..3890a00 100644 --- a/modules/home-manager/gui/waybar.nix +++ b/modules/home-manager/gui/waybar.nix @@ -57,6 +57,8 @@ in "battery" "custom/separator" "tray" + "custom/separator" + "custom/notification" ]; "niri/workspaces" = { all-outputs = true; @@ -158,16 +160,30 @@ in icon-size = 18; spacing = 14; }; + + "custom/notification" = { + escape = true; + exec = "swaync-client -swb"; + exec-if = "which swaync-client"; + format = "{icon}"; + format-icons = { + dnd-inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-none = ""; + dnd-notification = ""; + inhibited-none = ""; + inhibited-notification = ""; + none = ""; + notification = ""; + }; + on-click = "swaync-client -t -sw"; + on-click-right = "swaync-client -d -sw"; + return-type = "json"; + tooltip = false; + }; }; }; systemd.enable = true; }; - - systemd.user.targets.tray = { - Unit = { - Description = "Home Manager System Tray"; - Requires = [ "graphical-session-pre.target" ]; - }; - }; }; } diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index bfc36ce..2851a12 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -8,7 +8,6 @@ ./prometheus ./hedgedoc.nix ./sing-box.nix - ./stylix.nix ./kanidm-client.nix ./ssh-tpm-agent.nix # FIXME: Waiting for upstream merge ./forgejo-actions-runner.nix diff --git a/modules/nixos/stylix.nix b/modules/nixos/stylix.nix deleted file mode 100644 index c5e546b..0000000 --- a/modules/nixos/stylix.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - inputs, - config, - pkgs, - lib, - ... -}: -let - inherit (lib) mkEnableOption mkIf; - cfg = config.custom.stylix; -in -{ - imports = [ inputs.stylix.nixosModules.stylix ]; - - options = { - custom.stylix = { - enable = mkEnableOption "style management with stylix"; - }; - }; - - config = mkIf cfg.enable { - stylix.enable = true; - stylix.image = pkgs.fetchurl { - url = "https://github.com/NixOS/nixos-artwork/blob/master/wallpapers/nixos-wallpaper-catppuccin-mocha.png?raw=true"; - hash = "sha256-fmKFYw2gYAYFjOv4lr8IkXPtZfE1+88yKQ4vjEcax1s="; - }; - - stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; - stylix.polarity = "dark"; - stylix.autoEnable = false; - stylix.homeManagerIntegration.autoImport = true; - stylix.homeManagerIntegration.followSystem = true; - - stylix.targets = { - console.enable = true; - # gnome.enable = if config.services.xserver.desktopManager.gnome.enable then true else false; - gnome.enable = false; - gtk.enable = true; - }; - }; -}