From 6bba64781e4b7c1f91a733583defbd3e46b49408 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 8 Oct 2023 20:02:03 +0200 Subject: [PATCH] password-store-sync: remove module The module `services.git-sync` (introduced two years after) provides the same functionality, but in a more general and reliable way. --- docs/release-notes/rl-2311.adoc | 3 + modules/modules.nix | 5 +- modules/services/password-store-sync.nix | 73 ------------------------ 3 files changed, 7 insertions(+), 74 deletions(-) delete mode 100644 modules/services/password-store-sync.nix diff --git a/docs/release-notes/rl-2311.adoc b/docs/release-notes/rl-2311.adoc index 4947b809..172cfd60 100644 --- a/docs/release-notes/rl-2311.adoc +++ b/docs/release-notes/rl-2311.adoc @@ -32,6 +32,9 @@ If you have any external Home Manager modules, their option descriptions and literal examples should be translated to {nixpkgs-markdown}[Nixpkgs-flavoured Markdown]. +* The `services.password-store-sync` module has been removed. +Use `services.git-sync` instead. + [[sec-release-23.11-state-version-changes]] === State Version Changes diff --git a/modules/modules.nix b/modules/modules.nix index c5e952bc..35bf06ff 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -301,7 +301,6 @@ let ./services/pantalaimon.nix ./services/parcellite.nix ./services/pass-secret-service.nix - ./services/password-store-sync.nix ./services/pasystray.nix ./services/pbgopy.nix ./services/picom.nix @@ -364,6 +363,10 @@ let ./misc/nix.nix (pkgs.path + "/nixos/modules/misc/assertions.nix") (pkgs.path + "/nixos/modules/misc/meta.nix") + + (mkRemovedOptionModule [ "services" "password-store-sync" ] '' + Use services.git-sync instead. + '') ] ++ optional useNixpkgsModule ./misc/nixpkgs.nix ++ optional (!useNixpkgsModule) ./misc/nixpkgs-disabled.nix; diff --git a/modules/services/password-store-sync.nix b/modules/services/password-store-sync.nix deleted file mode 100644 index dfff410f..00000000 --- a/modules/services/password-store-sync.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - serviceCfg = config.services.password-store-sync; - programCfg = config.programs.password-store; - -in { - meta.maintainers = with maintainers; [ pacien ]; - - options.services.password-store-sync = { - enable = mkEnableOption "Password store periodic sync"; - - frequency = mkOption { - type = types.str; - default = "*:0/5"; - description = '' - How often to synchronise the password store git repository with its - default upstream. - - This value is passed to the systemd timer configuration as the - `onCalendar` option. - See - {manpage}`systemd.time(7)` - for more information about the format. - ''; - }; - }; - - config = mkIf serviceCfg.enable { - assertions = [ - (hm.assertions.assertPlatform "services.password-store-sync" pkgs - platforms.linux) - - { - assertion = programCfg.enable; - message = "The 'services.password-store-sync' module requires" - + " 'programs.password-store.enable = true'."; - } - ]; - - systemd.user.services.password-store-sync = { - Unit = { Description = "Password store sync"; }; - - Service = { - CPUSchedulingPolicy = "idle"; - IOSchedulingClass = "idle"; - Environment = let - makeEnvironmentPairs = - mapAttrsToList (key: value: "${key}=${builtins.toJSON value}"); - in makeEnvironmentPairs programCfg.settings; - ExecStart = toString (pkgs.writeShellScript "password-store-sync" '' - ${pkgs.pass}/bin/pass git pull --rebase && \ - ${pkgs.pass}/bin/pass git push - ''); - }; - }; - - systemd.user.timers.password-store-sync = { - Unit = { Description = "Password store periodic sync"; }; - - Timer = { - Unit = "password-store-sync.service"; - OnCalendar = serviceCfg.frequency; - Persistent = true; - }; - - Install = { WantedBy = [ "timers.target" ]; }; - }; - }; -}