mirror of
https://github.com/nix-community/home-manager
synced 2024-11-22 12:43:14 +00:00
swaylock: Add module (#3003)
This commit is contained in:
parent
64ab7d6e8d
commit
70824bb5c7
9 changed files with 79 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
32
modules/programs/swaylock.nix
Normal file
32
modules/programs/swaylock.nix
Normal 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);
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
5
tests/modules/programs/swaylock/config
Normal file
5
tests/modules/programs/swaylock/config
Normal file
|
@ -0,0 +1,5 @@
|
|||
color=808080
|
||||
font-size=24
|
||||
indicator-radius=100
|
||||
line-color=ffffff
|
||||
show-failed-attempts
|
4
tests/modules/programs/swaylock/default.nix
Normal file
4
tests/modules/programs/swaylock/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
swaylock-disabled = import ./disabled.nix;
|
||||
swaylock-settings = import ./settings.nix;
|
||||
}
|
7
tests/modules/programs/swaylock/disabled.nix
Normal file
7
tests/modules/programs/swaylock/disabled.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ ... }: {
|
||||
programs.swaylock.settings = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/swaylock/config
|
||||
'';
|
||||
}
|
16
tests/modules/programs/swaylock/settings.nix
Normal file
16
tests/modules/programs/swaylock/settings.nix
Normal 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}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue