mirror of
https://github.com/nix-community/home-manager
synced 2025-02-25 09:35:10 +01:00
pass-secret-service: Add dbus file, assert
Add the dbus service file in the package folder to XDG_DATA_HOME, as well as adding an assertion to ensure both it and `gnome-keyring` aren't enabled at the same time.
This commit is contained in:
parent
38271ead8e
commit
9d79f9676d
2 changed files with 36 additions and 18 deletions
|
@ -28,6 +28,10 @@ in {
|
||||||
assertions = [
|
assertions = [
|
||||||
(lib.hm.assertions.assertPlatform "services.gnome-keyring" pkgs
|
(lib.hm.assertions.assertPlatform "services.gnome-keyring" pkgs
|
||||||
lib.platforms.linux)
|
lib.platforms.linux)
|
||||||
|
{
|
||||||
|
assertion = !config.services.pass-secret-store.enable;
|
||||||
|
message = "Only one libsecret service can be enabled at a time.";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.user.services.gnome-keyring = {
|
systemd.user.services.gnome-keyring = {
|
||||||
|
|
|
@ -5,8 +5,7 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.pass-secret-service;
|
cfg = config.services.pass-secret-service;
|
||||||
|
|
||||||
serviceArgs =
|
busName = "org.freedesktop.secrets";
|
||||||
optionalString (cfg.storePath != null) "--path ${cfg.storePath}";
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with maintainers; [ cab404 cyntheticfox ];
|
meta.maintainers = with maintainers; [ cab404 cyntheticfox ];
|
||||||
|
|
||||||
|
@ -16,11 +15,13 @@ in {
|
||||||
package = mkPackageOption pkgs "pass-secret-service" { };
|
package = mkPackageOption pkgs "pass-secret-service" { };
|
||||||
|
|
||||||
storePath = mkOption {
|
storePath = mkOption {
|
||||||
type = with types; nullOr str;
|
type = types.str;
|
||||||
default = null;
|
default = "";
|
||||||
defaultText = "~/.password-store";
|
defaultText = "$HOME/.password-store";
|
||||||
example = "/home/user/.local/share/password-store";
|
example = "/home/user/.local/share/password-store";
|
||||||
description = "Absolute path to password store.";
|
description = ''
|
||||||
|
Absolute path to password store.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,21 +29,34 @@ in {
|
||||||
assertions = [
|
assertions = [
|
||||||
(hm.assertions.assertPlatform "services.pass-secret-service" pkgs
|
(hm.assertions.assertPlatform "services.pass-secret-service" pkgs
|
||||||
platforms.linux)
|
platforms.linux)
|
||||||
|
{
|
||||||
|
assertion = !config.services.gnome-keyring.enable;
|
||||||
|
message = "Only one secrets service per user can be enabled at a time";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.user.services.pass-secret-service = {
|
systemd.user.services.pass-secret-service =
|
||||||
|
let binPath = "${cfg.package}/bin/pass_secret_service";
|
||||||
|
in {
|
||||||
Unit = {
|
Unit = {
|
||||||
AssertFileIsExecutable = "${cfg.package}/bin/pass_secret_service";
|
AssertFileIsExecutable = "${binPath}";
|
||||||
Description = "Pass libsecret service";
|
Description = "Pass libsecret service";
|
||||||
Documentation = "https://github.com/mdellweg/pass_secret_service";
|
Documentation = "https://github.com/mdellweg/pass_secret_service";
|
||||||
PartOf = [ "default.target" ];
|
PartOf = [ "default.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart = "${cfg.package}/bin/pass_secret_service ${serviceArgs}";
|
Type = "dbus";
|
||||||
|
ExecStart = "${binPath} ${
|
||||||
|
optionalString (cfg.storePath != "") "--path ${cfg.storePath}"
|
||||||
|
}";
|
||||||
|
BusName = busName;
|
||||||
};
|
};
|
||||||
|
|
||||||
Install = { WantedBy = [ "default.target" ]; };
|
Install.WantedBy = [ "default.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xdg.dataFile."dbus-1/services/${busName}.service".source =
|
||||||
|
"${cfg.package}/share/dbus-1/services/${busName}.service";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue