1
0
mirror of https://github.com/nix-community/home-manager synced 2024-07-08 14:23:28 +02:00
home-manager/modules/services/pass-secret-service.nix
Emily 36a53d9f26 treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]. All
conversions were automatically checked to produce the same DocBook
result when converted back, modulo minor typographical/formatting
differences on the acceptable-to-desirable spectrum.

To reproduce this commit, run:

  $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
    nix shell nixpkgs#coreutils \
    -c find . -name '*.nix' \
    -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
    {} +
  $ ./format

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
2023-07-17 18:40:56 +01:00

70 lines
2.0 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.services.pass-secret-service;
busName = "org.freedesktop.secrets";
in {
meta.maintainers = with maintainers; [ cab404 cyntheticfox ];
options.services.pass-secret-service = {
enable = mkEnableOption (lib.mdDoc "Pass libsecret service");
package = mkPackageOptionMD pkgs "pass-secret-service" { };
storePath = mkOption {
type = with types; nullOr str;
default = null;
defaultText = "$HOME/.password-store";
example = "/home/user/.local/share/password-store";
description = lib.mdDoc ''
Absolute path to password store. Defaults to
{file}`$HOME/.password-store` if the
{option}`programs.password-store` module is not enabled, and
{option}`programs.password-store.settings.PASSWORD_STORE_DIR` if it is.
'';
};
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "services.pass-secret-service" pkgs
platforms.linux)
{
assertion = !config.services.gnome-keyring.enable;
message = ''
Only one secrets service per user can be enabled at a time.
Other services enabled:
- gnome-keyring
'';
}
];
systemd.user.services.pass-secret-service =
let binPath = "${cfg.package}/bin/pass_secret_service";
in {
Unit = {
AssertFileIsExecutable = "${binPath}";
Description = "Pass libsecret service";
Documentation = "https://github.com/mdellweg/pass_secret_service";
PartOf = [ "default.target" ];
};
Service = {
Type = "dbus";
ExecStart = "${binPath} ${
optionalString (cfg.storePath != null) "--path ${cfg.storePath}"
}";
BusName = busName;
};
Install.WantedBy = [ "default.target" ];
};
xdg.dataFile."dbus-1/services/${busName}.service".source =
"${cfg.package}/share/dbus-1/services/${busName}.service";
};
}