diff --git a/flake.lock b/flake.lock index 441adec..23ee43f 100644 --- a/flake.lock +++ b/flake.lock @@ -232,7 +232,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_3" + "systems": "systems_4" }, "locked": { "lastModified": 1710146030, @@ -250,7 +250,7 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_4" + "systems": "systems_5" }, "locked": { "lastModified": 1726560853, @@ -283,7 +283,7 @@ }, "flake-utils_5": { "inputs": { - "systems": "systems_5" + "systems": "systems_6" }, "locked": { "lastModified": 1694529238, @@ -302,7 +302,7 @@ "gen-luarc": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1718922730, @@ -562,6 +562,56 @@ "type": "github" } }, + "hyprlang_2": { + "inputs": { + "hyprutils": [ + "hyprlock", + "hyprutils" + ], + "nixpkgs": [ + "hyprlock", + "nixpkgs" + ], + "systems": [ + "hyprlock", + "systems" + ] + }, + "locked": { + "lastModified": 1721324361, + "narHash": "sha256-BiJKO0IIdnSwHQBSrEJlKlFr753urkLE48wtt0UhNG4=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "adbefbf49664a6c2c8bf36b6487fd31e3eb68086", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprlock": { + "inputs": { + "hyprlang": "hyprlang_2", + "hyprutils": "hyprutils_2", + "nixpkgs": "nixpkgs_2", + "systems": "systems_3" + }, + "locked": { + "lastModified": 1728661487, + "narHash": "sha256-4PiVL3GGz5kSWrt5QX+/7LTymyJ49VQ3JvSdKnZuZto=", + "owner": "hyprwm", + "repo": "hyprlock", + "rev": "7362ce3435afd1fffd2c81d5d7f58996f496b533", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlock", + "type": "github" + } + }, "hyprutils": { "inputs": { "nixpkgs": [ @@ -587,6 +637,31 @@ "type": "github" } }, + "hyprutils_2": { + "inputs": { + "nixpkgs": [ + "hyprlock", + "nixpkgs" + ], + "systems": [ + "hyprlock", + "systems" + ] + }, + "locked": { + "lastModified": 1721324102, + "narHash": "sha256-WAZ0X6yJW1hFG6otkHBfyJDKRpNP5stsRqdEuHrFRpk=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "962582a090bc233c4de9d9897f46794280288989", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, "hyprwayland-scanner": { "inputs": { "nixpkgs": [ @@ -752,6 +827,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1721138476, + "narHash": "sha256-+W5eZOhhemLQxelojLxETfbFbc19NWawsXBlapYpqIA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ad0b5eed1b6031efaed382844806550c3dcb4206", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1718714799, "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", @@ -767,7 +858,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1728492678, "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", @@ -783,7 +874,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1728093190, "narHash": "sha256-CAZF2NRuHmqTtRTNAruWpHA43Gg2UvuCNEIzabP0l6M=", @@ -799,7 +890,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_6": { "locked": { "lastModified": 1727634051, "narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=", @@ -848,11 +939,12 @@ "hy3": "hy3", "hyprland": "hyprland", "hyprland-plugins": "hyprland-plugins", + "hyprlock": "hyprlock", "kickstartnvim": "kickstartnvim", "nix-ld": "nix-ld", "nixos-hardware": "nixos-hardware", "nixos-wsl": "nixos-wsl", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "snowfall-flake": "snowfall-flake", "snowfall-lib": "snowfall-lib_2", "sops-nix": "sops-nix", @@ -972,7 +1064,7 @@ }, "sops-nix": { "inputs": { - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_5", "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { @@ -1021,16 +1113,16 @@ }, "systems_3": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", "type": "github" } }, @@ -1064,6 +1156,21 @@ "type": "github" } }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "unstable": { "locked": { "lastModified": 1728492678, @@ -1123,7 +1230,7 @@ }, "zen-browser": { "inputs": { - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_6" }, "locked": { "lastModified": 1727727601, diff --git a/flake.nix b/flake.nix index 9fcaf3d..67190b7 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,7 @@ ### # hyprland stuff hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; + hyprlock.url = "github:hyprwm/hyprlock"; hyprland-plugins = { url = "github:hyprwm/hyprland-plugins"; inputs.hyprland.follows = "hyprland"; diff --git a/modules/nixos/desktop/addons/hyprlock/default.nix b/modules/nixos/desktop/addons/hyprlock/default.nix new file mode 100644 index 0000000..72c2c20 --- /dev/null +++ b/modules/nixos/desktop/addons/hyprlock/default.nix @@ -0,0 +1,125 @@ +{ + config, + inputs, + lib, + namespace, + pkgs, + system, + ... +}: +let + inherit (lib) mkIf mkEnableOption; + inherit (lib.${namespace}) enabled; + + hyprlock-package = inputs.hyprlock.packages.${system}.hyprlock; + + hyprlock-blur = pkgs.writeShellScriptBin "hyprlock-blur" '' + ${pkgs.grim}/bin/grim -o DP-2 -l 0 /tmp/screenshot1.png & + ${pkgs.grim}/bin/grim -o HDMI-A-1 -l 0 /tmp/screenshot2.png & + wait && + hyprlock + ''; + + cfg = config.${namespace}.desktop.addons.hyprlock; +in +{ + options.${namespace}.desktop.addons.hyprlock = { + enable = mkEnableOption "Enable Hyprlock"; + }; + + config = mkIf cfg.enable { + security.pam.services.hyprlock = { }; + + ${namespace}.desktop.hyprland.settings = { + bind = [ + "$mod CTRL, l, exec, ${hyprlock-blur}/bin/hyprlock-blur" + ]; + }; + + snowfallorg.users.${config.${namespace}.user.name}.home.config = { + + programs.hyprlock = { + enable = true; + package = hyprlock-package; + settings = { + background = [ + { + monitor = "DP-2"; + path = "/tmp/screenshot1.png"; + + # all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations + blur_passes = 1; # 0 disables blurring + blur_size = 7; + noise = 1.17e-2; + } + { + monitor = "HDMI-A-1"; + path = "/tmp/screenshot2.png"; + + # all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations + blur_passes = 2; # 0 disables blurring + blur_size = 7; + noise = 1.17e-2; + } + ]; + + input-field = { + monitor = "DP-2"; + size = "200,50"; + outline_thickness = 2; + dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.35; # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = true; + outer_color = "rgba(0, 0, 0, 0)"; + inner_color = "rgba(0, 0, 0, 0.2)"; + font_color = "rgb(255,129,0)"; + fade_on_empty = false; + rounding = -1; + check_color = "rgb(204, 136, 34)"; + placeholder_text = ''Input Password...''; + hide_input = false; + position = "0, -100"; + halign = "center"; + valign = "center"; + }; + + label = [ + { + monitor = "DP-2"; + text = "$TIME"; + color = "rgba(242, 243, 244, 0.75)"; + font_size = 95; + font_family = "JetBrains Mono"; + position = "0, 300"; + halign = "center"; + valign = "center"; + } + { + + monitor = "DP-2"; + text = ''cmd[update:1000] echo $(date +"%A, %B %d")''; + color = "rgba(242, 243, 244, 0.75)"; + font_size = 22; + font_family = "JetBrains Mono"; + position = "0, 200"; + halign = "center"; + valign = "center"; + + } + ]; + }; + }; + }; + + # ${namespace}.home.extraOptions = { + # programs.hello = enabled; + + # programs.hyprlock = { + # enable = true; + # settings = { + # monitor = "DP-2"; + # }; + # }; + # }; + }; +} diff --git a/modules/nixos/desktop/hyprland/default.nix b/modules/nixos/desktop/hyprland/default.nix index 81c9b47..bc34484 100644 --- a/modules/nixos/desktop/hyprland/default.nix +++ b/modules/nixos/desktop/hyprland/default.nix @@ -21,7 +21,7 @@ let cachix-url = "https://hyprland.cachix.org"; cachix-key = "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="; - hyprland-package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; + hyprland-package = inputs.hyprland.packages.${system}.hyprland; focus-1password = pkgs.writeShellScriptBin "focus-or-open-1pass" '' running=$(hyprctl -j clients | jq -r '.[] | select(.class == "1password") | .workspace.id') @@ -66,8 +66,7 @@ in hyprland = { enable = true; package = hyprland-package; - portalPackage = - inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; + portalPackage = inputs.hyprland.packages.${system}.xdg-desktop-portal-hyprland; }; }; @@ -86,6 +85,7 @@ in enable = true; package = pkgs.rofi-wayland-unwrapped; }; + hyprlock = enabled; }; nix.extra-substituters.${cachix-url} = {