Swaylock: Difference between revisions
Add Swaylock |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 13: | Line 13: | ||
{{file|/etc/nixos/configuration.nix|nix|3= | {{file|/etc/nixos/configuration.nix|nix|3= | ||
security.pam.services.swaylock = {}; | security.pam.services.swaylock = {}; | ||
}} | |||
== Configuration == | |||
swaylock can be configured using [[Home Manager]]: | |||
{{file|~/.config/home-manager/home.nix|nix|3= | |||
programs.swaylock.settings = { color = "808080"; }; | |||
}} | |||
Alternatively, you may write configuration without using Nix language: | |||
{{file|~/.config/home-manager/home.nix|nix|3= | |||
xdg.configFile."swaylock/config".source = ./swaylock-theme; | |||
}} | |||
You may find "Swaylock theme"s shared on the web. | |||
=== Adding background === | |||
You can add background declaratively using {{Nixpkgs Manual|name=fetchurl|anchor=#sec-pkgs-fetchers-fetchurl}} similar to [[Wallpapers for Wayland]]. In this example, a wallpaper in [https://github.com/NixOS/nixos-artwork/tree/master/wallpapers nixos-artwork] is set to {{ic|image}} attribute and the remaining configuration from {{ic|./swaylock}} are merged. | |||
{{file|~/.config/home-manager/home.nix|nix|3= | |||
xdg.configFile."swaylock/config".text = | |||
let | |||
src = pkgs.fetchurl { | |||
url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/8957e93c95867faafec7f9988cedddd6837859fa/wallpapers/nix-wallpaper-binary-black.png"; | |||
sha256 = "0v3111a1ihsh4ajijbjh6y7a8p5cb5g3rdxqjbzx37pn1k9s254s"; | |||
}; | |||
in | |||
'' | |||
image=${src} | |||
'' | |||
+ builtins.readFile ./swaylock; | |||
}} | }} | ||