2021-04-27 21:36:29 +02:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2022-05-07 20:05:10 +02:00
|
|
|
let
|
|
|
|
cfg = config.services.pass-secret-service;
|
|
|
|
|
|
|
|
serviceArgs =
|
|
|
|
optionalString (cfg.storePath != null) "--path ${cfg.storePath}";
|
2021-04-27 21:36:29 +02:00
|
|
|
in {
|
2023-04-03 20:28:29 +02:00
|
|
|
meta.maintainers = with maintainers; [ cab404 cyntheticfox ];
|
2022-05-07 20:05:10 +02:00
|
|
|
|
2021-04-27 21:36:29 +02:00
|
|
|
options.services.pass-secret-service = {
|
|
|
|
enable = mkEnableOption "Pass libsecret service";
|
2022-05-07 20:05:10 +02:00
|
|
|
|
|
|
|
package = mkPackageOption pkgs "pass-secret-service" { };
|
|
|
|
|
|
|
|
storePath = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
|
|
|
defaultText = "~/.password-store";
|
|
|
|
example = "/home/user/.local/share/password-store";
|
|
|
|
description = "Absolute path to password store.";
|
|
|
|
};
|
2021-04-27 21:36:29 +02:00
|
|
|
};
|
2022-05-07 20:05:10 +02:00
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2021-07-07 23:24:27 +02:00
|
|
|
assertions = [
|
|
|
|
(hm.assertions.assertPlatform "services.pass-secret-service" pkgs
|
|
|
|
platforms.linux)
|
|
|
|
];
|
2021-04-27 21:36:29 +02:00
|
|
|
|
|
|
|
systemd.user.services.pass-secret-service = {
|
2022-05-07 20:05:10 +02:00
|
|
|
Unit = {
|
|
|
|
AssertFileIsExecutable = "${cfg.package}/bin/pass_secret_service";
|
|
|
|
Description = "Pass libsecret service";
|
|
|
|
Documentation = "https://github.com/mdellweg/pass_secret_service";
|
|
|
|
PartOf = [ "default.target" ];
|
|
|
|
};
|
|
|
|
|
2021-04-27 21:36:29 +02:00
|
|
|
Service = {
|
2022-05-07 20:05:10 +02:00
|
|
|
ExecStart = "${cfg.package}/bin/pass_secret_service ${serviceArgs}";
|
2021-04-27 21:36:29 +02:00
|
|
|
};
|
2022-05-07 20:05:10 +02:00
|
|
|
|
2021-04-27 22:17:36 +02:00
|
|
|
Install = { WantedBy = [ "default.target" ]; };
|
2021-04-27 21:36:29 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|