1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-03 07:31:03 +01:00

treewide: remove with lib (#6871)

Remove from services.
This commit is contained in:
Austin Horstman 2025-04-21 09:00:59 -07:00 committed by GitHub
parent 6695b1d477
commit 82ee14ff60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
124 changed files with 1848 additions and 1891 deletions

View file

@ -4,10 +4,14 @@
pkgs,
...
}:
with lib;
let
inherit (lib)
literalExpression
maintainers
mkIf
mkOption
types
;
cfg = config.services.git-sync;
@ -28,9 +32,9 @@ let
++ repo.extraPackages
)
}"
"GIT_SYNC_DIRECTORY=${strings.escapeShellArg repo.path}"
"GIT_SYNC_DIRECTORY=${lib.strings.escapeShellArg repo.path}"
"GIT_SYNC_COMMAND=${cfg.package}/bin/git-sync"
"GIT_SYNC_REPOSITORY=${strings.escapeShellArg repo.uri}"
"GIT_SYNC_REPOSITORY=${lib.strings.escapeShellArg repo.uri}"
"GIT_SYNC_INTERVAL=${toString repo.interval}"
];
ExecStart = "${cfg.package}/bin/git-sync-on-inotify";
@ -50,7 +54,7 @@ let
};
mkService = if pkgs.stdenv.isLinux then mkUnit else mkAgent;
services = mapAttrs' (name: repo: {
services = lib.mapAttrs' (name: repo: {
name = "git-sync-${name}";
value = mkService name repo;
}) cfg.repositories;
@ -115,7 +119,7 @@ in
options = {
services.git-sync = {
enable = mkEnableOption "git-sync services";
enable = lib.mkEnableOption "git-sync services";
package = mkOption {
type = types.package;
@ -144,9 +148,11 @@ in
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf pkgs.stdenv.isLinux { systemd.user.services = services; })
(mkIf pkgs.stdenv.isDarwin { launchd.agents = services; })
]);
config = mkIf cfg.enable (
lib.mkMerge [
(mkIf pkgs.stdenv.isLinux { systemd.user.services = services; })
(mkIf pkgs.stdenv.isDarwin { launchd.agents = services; })
]
);
}