Wrap hyprlock

This commit is contained in:
SebastianStork 2024-05-10 15:42:28 +02:00
parent 08dae72f8d
commit e7fbcb4a49
5 changed files with 28 additions and 105 deletions

77
flake.lock generated
View file

@ -38,7 +38,7 @@
},
"flake-utils": {
"inputs": {
"systems": "systems_3"
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
@ -74,50 +74,6 @@
"type": "github"
}
},
"hyprlang": {
"inputs": {
"nixpkgs": [
"hyprlock",
"nixpkgs"
],
"systems": "systems"
},
"locked": {
"lastModified": 1713121246,
"narHash": "sha256-502X0Q0fhN6tJK7iEUA8CghONKSatW/Mqj4Wappd++0=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "78fcaa27ae9e1d782faa3ff06c8ea55ddce63706",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"hyprlock": {
"inputs": {
"hyprlang": "hyprlang",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_2"
},
"locked": {
"lastModified": 1714843107,
"narHash": "sha256-89WxndRGO3CGuWE5XCaHKnsV3IKBRdOWqScp6o8enT4=",
"owner": "hyprwm",
"repo": "Hyprlock",
"rev": "c87af3aa1f6e6bd06cffaabcc400bd45e26d565a",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprlock",
"type": "github"
}
},
"nix-index-database": {
"inputs": {
"nixpkgs": [
@ -196,7 +152,6 @@
"inputs": {
"disko": "disko",
"home-manager": "home-manager",
"hyprlock": "hyprlock",
"nix-index-database": "nix-index-database",
"nix-vscode-extensions": "nix-vscode-extensions",
"nixpkgs": "nixpkgs",
@ -226,36 +181,6 @@
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",

View file

@ -31,11 +31,6 @@
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprlock = {
url = "github:hyprwm/Hyprlock";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {

View file

@ -1,33 +1,19 @@
{
inputs,
config,
lib,
wrappers,
...
}: {
imports = [inputs.hyprlock.homeManagerModules.hyprlock];
options.myConfig.de.hypridlelock.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.de.hypridlelock.enable {
programs.hyprlock = {
enable = true;
backgrounds = [
{
path = "screenshot";
blur_passes = 1;
blur_size = 4;
}
];
};
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = let
hyprlockExe = "${lib.getExe config.programs.hyprlock.package}";
hyprlockExe = "${lib.getExe wrappers.hyprlock}";
in "pidof ${hyprlockExe} || ${hyprlockExe}";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";

View file

@ -1,5 +1,4 @@
{
inputs,
pkgs,
lib,
...
@ -17,13 +16,6 @@
wayland.windowManager.hyprland.settings.monitor = "DP-2,2560x1440@144,0x0,1";
programs.hyprlock.package = inputs.hyprlock.packages.${pkgs.system}.default.overrideAttrs {
postPatch = ''
substituteInPlace src/core/hyprlock.cpp \
--replace "5000" "16"
'';
};
services.hypridle.settings.general.before_sleep_cmd = lib.mkForce "";
};
}

25
wrappers/hyprlock.nix Normal file
View file

@ -0,0 +1,25 @@
{
assembleWrapper,
pkgs,
...
}:
assembleWrapper {
basePackage = pkgs.hyprlock;
flags = let
hyprlock-config = pkgs.writeText "hyprlock-config" ''
background {
monitor =
path = screenshot
blur_size = 4
blur_passes = 1
}
input-field {
monitor =
}
'';
in [
"--config"
hyprlock-config
];
}