fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ pkgs , config , lib , ...} : 2 3with lib ; 4 5let 6cfg = config . services . pass-secret-service ; 7 8busName = "org.freedesktop.secrets" ; 9in { 10meta . maintainers = with maintainers ; [ cab404 cyntheticfox ]; 11 12options . services . pass-secret-service = { 13enable = mkEnableOption "Pass libsecret service" ; 14 15package = mkPackageOption pkgs "pass-secret-service" { }; 16 17storePath = mkOption { 18type = with types ; nullOr str ; 19default = null ; 20defaultText = "$HOME/.password-store" ; 21example = "/home/user/.local/share/password-store" ; 22description = '' 23Absolute path to password store. Defaults to 24{file}`$HOME/.password-store` if the 25{option}`programs.password-store` module is not enabled, and 26{option}`programs.password-store.settings.PASSWORD_STORE_DIR` if it is. 27'' ; 28}; 29}; 30 31config = mkIf cfg . enable { 32assertions = [ 33( hm . assertions . assertPlatform "services.pass-secret-service" pkgs 34platforms . linux ) 35{ 36assertion = ! config . services . gnome-keyring . enable ; 37message = '' 38Only one secrets service per user can be enabled at a time. 39Other services enabled: 40- gnome-keyring 41'' ; 42} 43]; 44 45systemd . user . services . pass-secret-service = 46let binPath = " ${ cfg . package } /bin/pass_secret_service" ; 47in { 48Unit = { 49AssertFileIsExecutable = " ${ binPath } " ; 50Description = "Pass libsecret service" ; 51Documentation = "https://github.com/mdellweg/pass_secret_service" ; 52PartOf = [ "default.target" ]; 53}; 54 55Service = { 56Type = "dbus" ; 57ExecStart = " ${ binPath } ${ 58optionalString ( cfg . storePath != null ) "--path ${ cfg . storePath } " 59} " ; 60BusName = busName ; 61}; 62 63Install . WantedBy = [ "default.target" ]; 64}; 65 66xdg . dataFile . "dbus-1/services/ ${ busName } .service" . source = 67" ${ cfg . package } /share/dbus-1/services/ ${ busName } .service" ; 68}; 69}