Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd-lock-handler: init at 2.4.1 #228063

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@
./services/system/saslauthd.nix
./services/system/self-deploy.nix
./services/system/systembus-notify.nix
./services/system/systemd-lock-handler
./services/system/uptimed.nix
./services/torrent/deluge.nix
./services/torrent/flexget.nix
Expand Down
33 changes: 33 additions & 0 deletions nixos/modules/services/system/systemd-lock-handler/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.services.systemd-lock-handler;
in {
options.services.systemd-lock-handler = {
enable = mkEnableOption (lib.mdDoc "systemd-lock-handler");
package = mkOption {
default = pkgs.systemd-lock-handler;
defaultText = literalExpression "pkgs.systemd-lock-handler";
type = types.package;
description = lib.mdDoc "systemd-lock-handler package to use.";
};
Comment on lines +12 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a helper, like mkEnableOption, for this:

Suggested change
package = mkOption {
default = pkgs.systemd-lock-handler;
defaultText = literalExpression "pkgs.systemd-lock-handler";
type = types.package;
description = lib.mdDoc "systemd-lock-handler package to use.";
};
package = mkPackageOption pkgs "systemd-lock-handler" { };

config = mkIf cfg.enable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nested inside options.services.systemd-lock-handler (hence the build failure), so there should be a }; before this.

systemd.user.services.systemd-lock-handler = {
description = "Logind lock event to systemd target translation";
wantedBy = [ "default.target" ];
serviceConfig = {
Documentation = "https://sr.ht/~whynothugo/systemd-lock-handler";
Slice = [ "session.slice" ];
ExecStart = "${cfg.package}/bin/systemd-lock-handler";
Copy link
Contributor

@liff liff Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ExecStart = "${cfg.package}/bin/systemd-lock-handler";
ExecStart = getExe cfg.package

Type = "notify";
Restart = "on-failure";
RestartSec = "10s";
};
};
};
};
}
25 changes: 25 additions & 0 deletions pkgs/os-specific/linux/systemd-lock-handler/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ lib
, buildGoModule
, fetchFromSourcehut
}:

buildGoModule rec {
pname = "systemd-lock-handler";
version = "2.4.1";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 2.4.2 has been released.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps also add updateScript?

  passthru.updateScript = nix-update-script { };


src = fetchFromSourcehut {
owner = "~whynothugo";
repo = "systemd-lock-handler";
rev = "v${version}";
hash = "sha256-dkOgdDGwinCvv+pO6wqykhG0J/cRtUb7uOSpIFDReoQ=";
};

vendorHash = "sha256-dWzojV3tDA5lLdpAQNC9NaADGyvV7dNOS3x8mfgNNtA=";

meta = with lib; {
description = "A systemd helper to handle lock events in systemd";
homepage = "https://git.sr.ht/~whynothugo/systemd-lock-handler";
license = licenses.isc;
maintainers = with maintainers; [ matthewcroughan ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27382,6 +27382,8 @@ with pkgs;

systemd-wait = callPackage ../os-specific/linux/systemd-wait { };

systemd-lock-handler = callPackage ../os-specific/linux/systemd-lock-handler { };

sysvinit = callPackage ../os-specific/linux/sysvinit { };

sysvtools = sysvinit.override {
Expand Down