From bdb36cc8add5e55b7c2de544bbb0ffe91abb7f1c Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sun, 3 Sep 2023 13:55:56 -0600 Subject: [PATCH] [NixOS] Add bitwarden service --- nixos/desktop.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/nixos/desktop.nix b/nixos/desktop.nix index 9702eb68..f2febd53 100644 --- a/nixos/desktop.nix +++ b/nixos/desktop.nix @@ -1,4 +1,4 @@ -{ config, pkgs, options, inputs, makeEnable, ... }: +{ config, pkgs, options, inputs, makeEnable, forEachUser, ... }: makeEnable config "modules.desktop" true { imports = [ ./fonts.nix @@ -117,4 +117,22 @@ makeEnable config "modules.desktop" true { vscode zoom-us ] else []); + + home-manager.users = forEachUser (if pkgs.system == "x86_64-linux" then { + systemd.user.services.bitwarden = { + Unit = { + Description = "Bitwarden"; + After = [ "graphical-session-pre.target" "tray.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + + Service = { + ExecStart = "${pkgs.bitwarden}/bin/bitwarden"; + Restart = "always"; + RestartSec = 3; + }; + }; + } else {}); }