1
0
Fork 0

module(hyprlock): create module & replace swaylock

This commit is contained in:
Antoine Langlois 2024-03-23 20:02:56 +01:00
parent 8173c6fefa
commit 64846a8f8e
Signed by: DataHearth
GPG Key ID: 946E2D0C410C7B3D
9 changed files with 187 additions and 97 deletions

View File

@ -93,7 +93,7 @@
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
"systems": "systems_3"
},
"locked": {
"lastModified": 1701680307,
@ -111,7 +111,7 @@
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
"systems": "systems_4"
},
"locked": {
"lastModified": 1701680307,
@ -190,6 +190,49 @@
"type": "github"
}
},
"hyprlang": {
"inputs": {
"nixpkgs": [
"hyprlock",
"nixpkgs"
]
},
"locked": {
"lastModified": 1708212860,
"narHash": "sha256-nW3Zrhh9RJcMTvOcXAaKADnJM/g6tDf3121lJtTHnYo=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "11d5ccda071c153dfdc18ef65338956a51cef96a",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"hyprlock": {
"inputs": {
"hyprlang": "hyprlang",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_2"
},
"locked": {
"lastModified": 1711206123,
"narHash": "sha256-fVlcA90xQ1//eLhspcISExagsVnR9WYG7ltP2D9OjQQ=",
"owner": "hyprwm",
"repo": "hyprlock",
"rev": "230f8aadb5123dd7388143aa4f2a5a881a9c0a41",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlock",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
@ -305,6 +348,7 @@
"inputs": {
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"hyprlock": "hyprlock",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim"
@ -326,6 +370,21 @@
}
},
"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=",
@ -340,7 +399,7 @@
"type": "github"
}
},
"systems_3": {
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",

View File

@ -16,6 +16,10 @@
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprlock = {
url = "github:hyprwm/hyprlock";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{
@ -25,12 +29,14 @@
home-manager,
flake-utils,
nixvim,
hyprlock,
...
}:
{
nixosConfigurations = {
antoine-nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit hyprlock; };
modules = [
./hosts/antoine-nixos/configuration.nix
home-manager.nixosModules.home-manager

View File

@ -1,4 +1,4 @@
{ pkgs, lib, ... }:
{ pkgs, lib, hyprlock, ... }:
{
imports = [
# Modules
@ -8,7 +8,6 @@
# Host specific
./hardware-configuration.nix
./systemd.nix
./services.nix
];
nixpkgs.config.allowUnfree = true;
@ -70,8 +69,12 @@
security = {
rtkit.enable = true;
pam.services.swaylock = {};
polkit.enable = true;
pam.services = {
swaylock = {};
hyprlock = {};
};
};
xdg = {
@ -119,6 +122,7 @@
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit hyprlock; };
users = {
"datahearth" = import ./home-manager/home.nix;
};

View File

@ -1,4 +1,4 @@
{ pkgs, lib, ... }:
{ pkgs, lib, hyprlock, ... }:
{
imports = let
modules_base_path = ../../../modules;
@ -11,6 +11,7 @@
../../shared/hm.nix
./services.nix
hyprlock.homeManagerModules.default
] ++ (import ../../../modules/home-manager);
# Almost static information
@ -66,6 +67,12 @@
dunst.enable = true;
waybar.enable = true;
ssh.enable = true;
hyprlock = {
enable = true;
lockBackgroundImage = "~/Pictures/wallpapers/lock2.png";
defaultDisplay = "DP-2";
};
git = {
enable = true;
@ -74,7 +81,6 @@
hyprland = {
enable = true;
hyprlock.enable = false;
workspaceSettings = [
"DP-2,1"
"DP-2,3"

View File

@ -5,4 +5,5 @@
./dunst
./waybar
./ssh
./hyprlock.nix
]

View File

@ -27,24 +27,13 @@ let
default = [ "XCURSOR_SIZER,24" ];
};
nvidia = mkEnableOption "nvidia";
hyprlock = {
enable = mkEnableOption "hyprlock";
};
in
{
options.hm.hyprland = {
inherit enable hyprlock enableXWayland workspaceSettings monitorSettings nvidia envVariables;
inherit enable enableXWayland workspaceSettings monitorSettings nvidia envVariables;
};
config = mkIf cfg.enable {
home.packages = with pkgs; [] ++
(if cfg.hyprlock.enable then [ hyprlock ] else [ ]);
home.file.".config/hypr/hyprlock.conf" = mkIf cfg.hyprlock.enable {
source = ./hyprlock.conf;
};
wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = cfg.enableXWayland;

View File

@ -1,75 +0,0 @@
# BACKGROUND
background {
monitor =
path = /home/datahearth/Pictures/wallpapers/lock.png
blur_passes = 3
contrast = 0.8916
brightness = 0.8172
vibrancy = 0.1696
vibrancy_darkness = 0.0
}
# GENERAL
general {
no_fade_in = false
grace = 0
disable_loading_bar = true
}
# INPUT FIELD
input-field {
monitor = DP-1
size = 250, 60
outline_thickness = 2
dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2 # 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.5)
font_color = rgb(200, 200, 200)
fade_on_empty = false
placeholder_text = <i><span foreground="##cdd6f4">Input Password...</span></i>
hide_input = false
position = 0, -120
halign = center
valign = center
}
# TIME
label {
monitor = DP-1
text = cmd[update:1000] echo "$(date +"%-I:%M%p")"
color = rgba(205, 214, 242, 0)
#color = rgba(255, 255, 255, 0.6)
font_size = 120
font_family = FiraCode Nerd Font, Retina
position = 0, -300
halign = center
valign = top
}
# USER
label {
monitor = DP-1
text = Hi there, $USER
color = rgba(205, 214, 242, 0)
#color = rgba(255, 255, 255, 0.6)
font_size = 25
font_family = FiraCode Nerd Font, Retina
position = 0, -40
halign = center
valign = center
}
# CURRENT SONG
label {
monitor = DP-1
text = cmd[update:1000] echo "$(playerctl metadata --format '{{title}}  {{artist}}')"
color = rgba(205, 214, 242, 0)
#color = rgba(255, 255, 255, 0.6)
font_size = 18
font_family = FiraCode Nerd Font, Retina
position = 0, -50
halign = center
valign = bottom
}

View File

@ -0,0 +1,100 @@
{ config, options, lib, ... }:
with lib;
let
cfg = config.hm.hyprlock;
enable = mkEnableOption "hyprlock";
lockBackgroundImage = mkOption {
type = types.str;
description = "Path to background image for lock screen";
default = "";
};
defaultDisplay = mkOption {
type = types.str;
description = "Default display will have all labels and input-labels written on.";
default = "";
};
in
{
options.hm.hyprlock = {
inherit enable lockBackgroundImage defaultDisplay;
};
config = mkIf cfg.enable {
programs.hyprlock = {
enable = true;
general.disable_loading_bar = true;
backgrounds = [
{
# path = mkIf (cfg.lockBackgroundImage != "") cfg.lockBackgroundImage;
path = "";
blur_passes = 3;
contrast = 0.8916;
brightness = 0.8172;
vibrancy = 0.1696;
vibrancy_darkness = 0.0;
}
];
input-fields = [
{
monitor = mkIf (cfg.defaultDisplay != "") cfg.defaultDisplay;
size = {
width = 250;
height = 60;
};
outline_thickness = 2;
dots_size = 0.2;
dots_spacing = 0.2;
outer_color = "rgba(0, 0, 0, 0)";
inner_color = "rgba(0, 0, 0, 0.5)";
font_color = "rgb(200, 200, 200)";
placeholder_text = "<i><span foreground=\"##cdd6f4\">Input Password...</span></i>";
position = {
x = 0;
y = -120;
};
}
];
labels = [
{
monitor = mkIf (cfg.defaultDisplay != "") cfg.defaultDisplay;
text = "cmd[update:1000] echo \"$TIME\"";
font_family = "Mononoki Nerd Font";
color = "rgba(255, 255, 255, 0.6)";
font_size = 120;
position = {
x = 0;
y = -300;
};
valign = "top";
}
{
monitor = mkIf (cfg.defaultDisplay != "") cfg.defaultDisplay;
text = "Hello there, $USER";
font_family = "Mononoki Nerd Font";
color = "rgba(255, 255, 255, 0.6)";
font_size = 25;
position = {
x = 0;
y = -40;
};
}
{
monitor = mkIf (cfg.defaultDisplay != "") cfg.defaultDisplay;
text = "cmd[update:1000] playerctl metadata --format \"{{ artist }} - {{ album }} - {{ title }}\"";
color = "rgba(255, 255, 255, 0.6)";
font_size = 18;
font_family = "Mononoki Nerd Font";
position = {
x = 0;
y = -50;
};
valign = "bottom";
}
];
};
};
}

View File

@ -13,7 +13,7 @@ function confirm {
}
function lock {
sleep 0.5s; swaylock & disown
sleep 0.5s; hyprlock & disown
}
function powermenu {
@ -23,7 +23,7 @@ function powermenu {
suspend=" Suspend"
logout=" Logout"
action=$(echo -e "$poweroff\n$reboot\n$lock\n$suspend\n$logout" |\
action=$(echo -e "$suspend\n$lock\n$poweroff\n$reboot\n$logout" |\
tofi -c $config_dir/powermenu.conf)
case $action in