1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-02 13:03:33 +02:00
home-manager/modules/services/pass-secret-service.nix
Robert Helgesson 5f433eb164
Move platform check into modules
Before, loading a module would be guarded by an optional platform
condition. This made it possible to avoid loading and evaluating a
module if it did not support the host platform.

Unfortunately, this made it impossible to share a single configuration
between GNU/Linux and Darwin hosts, which some wish to do.

This removes the conditional load and instead inserts host platform
assertions in the modules that are platform specific.

Fixes #1906
2021-07-18 20:43:22 +02:00

34 lines
1.0 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
let serviceCfg = config.services.pass-secret-service;
in {
meta.maintainers = [ maintainers.cab404 ];
options.services.pass-secret-service = {
enable = mkEnableOption "Pass libsecret service";
};
config = mkIf serviceCfg.enable {
assertions = [
(hm.assertions.assertPlatform "services.pass-secret-service" pkgs
platforms.linux)
{
assertion = config.programs.password-store.enable;
message = "The 'services.pass-secret-service' module requires"
+ " 'programs.password-store.enable = true'.";
}
];
systemd.user.services.pass-secret-service = {
Unit = { Description = "Pass libsecret service"; };
Service = {
# pass-secret-service doesn't use environment variables for some reason.
ExecStart =
"${pkgs.pass-secret-service}/bin/pass_secret_service --path ${config.programs.password-store.settings.PASSWORD_STORE_DIR}";
};
Install = { WantedBy = [ "default.target" ]; };
};
};
}