diff --git a/README.md b/README.md index 1a17f27..3fe670b 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,69 @@ And get a nice interactive experience. This works on any Forgejo instance. +You can also set up a systemd service and timer to run every once in a while. + +Use the flake, like so: + +```nix +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + github2forgejo = { + url = "github:RGBCube/GitHub2Forgejo"; + + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, github2forgejo, ... }: let inherit (nixpkgs) lib; in { + nixosConfigurations.myserver = lib.nixosSystem { + modules = [ + github2forgejo.nixosModules.default + + { + nixpkgs.overlays = [ github2forgejo.overlays.default ]; + + services.github2forgejo = { + enable = true; + + # Something along the lines of: + # + # GITHUB_USER="RGBCube" + # GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + # FORGEJO_URL="https://git.rgbcu.be/" + # FORGEJO_USER="RGBCube" + # FORGEJO_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + # STRATEGY="mirrored" + # FORCE_SYNC="true" + # + # Do `GITHUB_TOKEN=""` if you want to only mirror public repositories of a person. + # You HAVE TO set each one of these. Leaving one unset will make the systemd unit fail! + environmentFile = "/secrets/github2forgejo.env"; + + # The default runs every day at midnight. But you can override it like so: + # + # timerConfig = { + # OnCalendar = "00:05"; + # RandomizedDelaySec = "5h"; + # Persistent = true; + # }; + # + # Or you can disable the timer by setting `timerConfig` to null: + # + # timerConfig = null; + } + } + ]; + } + }; +} +``` + +The script is also available as a package, you just need to use the +`packages..default` or `packages..github2forgejo` outputs. + ## FAQ ### What is the difference between mirroring and cloning?