From d51dee11adc6d5f9f0ba737ef4727f41a9cb34c3 Mon Sep 17 00:00:00 2001 From: Patrick Widmer Date: Sun, 12 Nov 2023 20:36:52 +0100 Subject: [PATCH] himitsu: add service module --- modules/services/himitsu.nix | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/services/himitsu.nix diff --git a/modules/services/himitsu.nix b/modules/services/himitsu.nix new file mode 100644 index 00000000..bed06ca4 --- /dev/null +++ b/modules/services/himitsu.nix @@ -0,0 +1,45 @@ +{ lib, pkgs, config, ... }: + +let cfg = config.services.himitsu; +in { + options = { + services.himitsu = { + enable = mkEnableOption '' + Himitsu, secret storage system for Unix systems + ''; + + package = mkPackageOption pkgs "himitsu" { }; + + prompter = mkPackageOption pkgs "himitsu-prompter" { + default = [ "hiprompt-gtk-py" ]; + }; + }; + }; + + config = mkIf (cfg.enable) { + home.packages = [ cfg.package cfg.prompter ]; + + systemd.user.services.himitsu = { + Unit = { + Description = "Himitsu daemon"; + PartOf = "graphical-session.target"; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${cfg.package}/bin/himitsud"; + }; + }; + + xdg.configFile."himitsu/config.ini" = { + text = lib.generators.toINI { } { + himitsud = { + prompter = lib.getExe' cfg.prompter "hiprompt-gtk"; + }; + }; + }; + }; + + meta.maintainers = [ maintainers.patwid ]; +}