1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

swaylock: Add module (#3003)

This commit is contained in:
rcerc 2022-06-07 15:01:14 -04:00 committed by GitHub
parent 64ab7d6e8d
commit 70824bb5c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 79 additions and 0 deletions

3
.github/CODEOWNERS vendored
View file

@ -247,6 +247,9 @@
/modules/programs/starship.nix @marsam
/modules/programs/swaylock.nix @rcerc
/tests/modules/programs/swaylock @rcerc
/modules/programs/tealdeer.nix @marsam
/modules/programs/terminator.nix @chisui

View file

@ -271,4 +271,14 @@
github = "rszamszur";
githubId = 10353018;
};
rcerc = {
name = "rcerc";
email = "88944439+rcerc@users.noreply.github.com";
github = "rcerc";
githubId = 88944439;
keys = [{
longkeyid = "ed25519/0x3F98EC7EC2B87ED1";
fingerprint = "D5D6 FD1F 0D9A 3284 FB9B C26D 3F98 EC7E C2B8 7ED1";
}];
};
}

View file

@ -150,6 +150,7 @@ let
./programs/sqls.nix
./programs/ssh.nix
./programs/starship.nix
./programs/swaylock.nix
./programs/taskwarrior.nix
./programs/tealdeer.nix
./programs/terminator.nix

View file

@ -0,0 +1,32 @@
{ config, lib, ... }:
let cfg = config.programs.swaylock;
in {
meta.maintainers = [ lib.hm.maintainers.rcerc ];
options.programs.swaylock.settings = lib.mkOption {
type = with lib.types; attrsOf (oneOf [ bool float int str ]);
default = { };
description = ''
Default arguments to <command>swaylock</command>. An empty set
disables configuration generation.
'';
example = {
color = "808080";
font-size = 24;
indicator-idle-visible = false;
indicator-radius = 100;
line-color = "ffffff";
show-failed-attempts = true;
};
};
config.xdg.configFile."swaylock/config" = lib.mkIf (cfg.settings != { }) {
text = lib.concatStrings (lib.mapAttrsToList (n: v:
if v == false then
""
else
(if v == true then n else n + "=" + builtins.toString v) + "\n")
cfg.settings);
};
}

View file

@ -130,6 +130,7 @@ import nmt {
./modules/programs/rbw
./modules/programs/rofi
./modules/programs/rofi-pass
./modules/programs/swaylock
./modules/programs/terminator
./modules/programs/waybar
./modules/programs/xmobar

View file

@ -0,0 +1,5 @@
color=808080
font-size=24
indicator-radius=100
line-color=ffffff
show-failed-attempts

View file

@ -0,0 +1,4 @@
{
swaylock-disabled = import ./disabled.nix;
swaylock-settings = import ./settings.nix;
}

View file

@ -0,0 +1,7 @@
{ ... }: {
programs.swaylock.settings = { };
nmt.script = ''
assertPathNotExists home-files/.config/swaylock/config
'';
}

View file

@ -0,0 +1,16 @@
{ ... }: {
programs.swaylock.settings = {
color = "808080";
font-size = 24;
indicator-idle-visible = false; # Test that this does nothing
indicator-radius = 100;
line-color = "ffffff";
show-failed-attempts = true;
};
nmt.script = let homeConfig = "home-files/.config/swaylock/config";
in ''
assertFileExists ${homeConfig}
assertFileContent ${homeConfig} ${./config}
'';
}