From aacfc0950b84657b32ebb4106e21eef4db8e626b Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Mon, 13 Mar 2023 23:34:09 +0200 Subject: [PATCH 1/2] regreet: 2023-02-27 -> 2023-03-19 --- pkgs/applications/display-managers/greetd/regreet.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/display-managers/greetd/regreet.nix b/pkgs/applications/display-managers/greetd/regreet.nix index e989d9782b1a..31ad614ac263 100644 --- a/pkgs/applications/display-managers/greetd/regreet.nix +++ b/pkgs/applications/display-managers/greetd/regreet.nix @@ -9,16 +9,16 @@ rustPlatform.buildRustPackage { pname = "regreet"; - version = "unstable-2023-02-27"; + version = "unstable-2023-03-19"; src = fetchFromGitHub { owner = "rharish101"; repo = "ReGreet"; - rev = "2bbabe90f112b4feeb0aea516c265daaec8ccf2a"; - hash = "sha256-71ji4x/NUE4qmBuO5PkWTPE1a0uPXqJSwW1Ai1amPJE="; + rev = "fd496fa00abc078570ac85a47ea296bfc275222a"; + hash = "sha256-pqCtDoycFKV+EFLEodoTCDSO5L+dOVtdjN6DVgJ/7to="; }; - cargoHash = "sha256-rz2eMMhoMtzBXCH6ZJOvGuYLeHSWga+Ebc4+ZO8Kk1g="; + cargoHash = "sha256-8FbA5FFJuRt5tvW1HGaaEZcr5g6OczcBeic1hCTQmUw="; buildFeatures = [ "gtk4_8" ]; From 692c28ec10f0ddbf043d6c70720a62e7293d4833 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Mon, 13 Mar 2023 23:35:06 +0200 Subject: [PATCH 2/2] nixos/regreet: init --- .../manual/release-notes/rl-2305.section.md | 2 + nixos/modules/module-list.nix | 1 + nixos/modules/programs/regreet.nix | 75 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 nixos/modules/programs/regreet.nix diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index 5bc5a8245211..85fdd07ded2b 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -75,6 +75,8 @@ In addition to numerous new and upgraded packages, this release has the followin - [woodpecker-server](https://woodpecker-ci.org/), a simple CI engine with great extensibility. Available as [services.woodpecker-server](#opt-services.woodpecker-server.enable). +- [ReGreet](https://github.com/rharish101/ReGreet), a clean and customizable greeter for greetd. Available as [programs.regreet](#opt-programs.regreet.enable). + ## Backward Incompatibilities {#sec-release-23.05-incompatibilities} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 314d67419b7f..bf0f0c7a684e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -220,6 +220,7 @@ ./programs/proxychains.nix ./programs/qdmr.nix ./programs/qt5ct.nix + ./programs/regreet.nix ./programs/rog-control-center.nix ./programs/rust-motd.nix ./programs/screen.nix diff --git a/nixos/modules/programs/regreet.nix b/nixos/modules/programs/regreet.nix new file mode 100644 index 000000000000..89b93737f4a2 --- /dev/null +++ b/nixos/modules/programs/regreet.nix @@ -0,0 +1,75 @@ +{ lib +, pkgs +, config +, ... +}: +let + cfg = config.programs.regreet; + settingsFormat = pkgs.formats.toml { }; +in +{ + options.programs.regreet = { + enable = lib.mkEnableOption null // { + description = lib.mdDoc '' + Enable ReGreet, a clean and customizable greeter for greetd. + + To use ReGreet, {option}`services.greetd` has to be enabled and + {option}`services.greetd.settings.default_session` should contain the + appropriate configuration to launch + {option}`config.programs.regreet.package`. For examples, see the + [ReGreet Readme](https://github.com/rharish101/ReGreet#set-as-default-session). + + A minimal configuration that launches ReGreet in {command}`cage` is + enabled by this module by default. + ''; + }; + + package = lib.mkPackageOptionMD pkgs [ "greetd" "regreet" ] { }; + + settings = lib.mkOption { + type = lib.types.either lib.types.path settingsFormat.type; + default = { }; + description = lib.mdDoc '' + ReGreet configuration file. Refer + + for options. + ''; + }; + + extraCss = lib.mkOption { + type = lib.types.either lib.types.path lib.types.lines; + default = ""; + description = lib.mdDoc '' + Extra CSS rules to apply on top of the GTK theme. Refer to + [GTK CSS Properties](https://docs.gtk.org/gtk4/css-properties.html) for + modifiable properties. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + services.greetd = { + enable = lib.mkDefault true; + settings.default_session.command = lib.mkDefault "${lib.getExe pkgs.cage} -s -- ${lib.getExe cfg.package}"; + }; + + environment.etc = { + "greetd/regreet.css" = + if lib.isPath cfg.extraCss + then {source = cfg.extraCss;} + else {text = cfg.extraCss;}; + + "greetd/regreet.toml".source = + if lib.isPath cfg.settings + then cfg.settings + else settingsFormat.generate "regreet.toml" cfg.settings; + }; + + systemd.tmpfiles.rules = let + user = config.services.greetd.settings.default_session.user; + in [ + "d /var/log/regreet 0755 greeter ${user} - -" + "d /var/cache/regreet 0755 greeter ${user} - -" + ]; + }; +}