From 3f2fedfb794a1fccf4581a9cef5eaf4fd1c837a7 Mon Sep 17 00:00:00 2001 From: Soispha Date: Mon, 3 Jul 2023 08:49:41 +0200 Subject: Feat(system/services/nix-sync): Remodel git-sync to make it useful --- system/services/git-sync/default.nix | 99 ------------------------------------ 1 file changed, 99 deletions(-) delete mode 100644 system/services/git-sync/default.nix (limited to 'system/services/git-sync/default.nix') diff --git a/system/services/git-sync/default.nix b/system/services/git-sync/default.nix deleted file mode 100644 index 4295870..0000000 --- a/system/services/git-sync/default.nix +++ /dev/null @@ -1,99 +0,0 @@ -/* -Taken from: -https://github.com/nix-community/home-manager/blob/9ba7b3990eb1f4782ea3f5fe7ac4f3c88dd7a32c/modules/services/git-sync.nix -*/ -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.services.git-sync; - - mkUnit = name: repo: { - unitConfig.Description = "Git Sync ${name}"; - - wantedBy = ["default.target"]; - - serviceConfig = { - Environment = [ - "PATH=${lib.makeBinPath (with pkgs; [openssh git])}" - "GIT_SYNC_DIRECTORY=${repo.path}" - "GIT_SYNC_COMMAND=${cfg.package}/bin/git-sync" - "GIT_SYNC_REPOSITORY=${repo.uri}" - "GIT_SYNC_INTERVAL=${toString repo.interval}" - ]; - ExecStart = "${cfg.package}/bin/git-sync-on-inotify"; - Restart = "on-abort"; - }; - }; - - services = - lib.mapAttrs' (name: repo: { - name = "git-sync-${name}"; - value = mkUnit name repo; - }) - cfg.repositories; - - repositoryType = lib.types.submodule ({name, ...}: { - options = { - name = lib.mkOption { - internal = true; - default = name; - type = lib.types.str; - description = "The name that should be given to this unit."; - }; - - path = lib.mkOption { - type = lib.types.str; - description = "The path at which to sync the repository"; - }; - - uri = lib.mkOption { - type = lib.types.str; - example = "git+ssh://user@example.com:/~[user]/path/to/repo.git"; - description = '' - The URI of the remote to be synchronized. This is only used in the - event that the directory does not already exist. See - - for the supported URIs. - ''; - }; - - interval = lib.mkOption { - type = lib.types.int; - default = 500; - description = '' - The interval, specified in seconds, at which the synchronization will - be triggered even without filesystem changes. - ''; - }; - }; - }); -in { - options = { - services.git-sync = { - enable = lib.mkEnableOption "git-sync services"; - - package = lib.mkOption { - type = lib.types.package; - default = pkgs.git-sync; - defaultText = lib.literalExpression "pkgs.git-sync"; - description = '' - Package containing the git-sync program. - ''; - }; - - repositories = lib.mkOption { - type = with lib.types; attrsOf repositoryType; - description = '' - The repositories that should be synchronized. - ''; - }; - }; - }; - - config = lib.mkIf cfg.enable { - systemd.services = services; - }; -} -- cgit 1.4.1