1
Fork 0
mirror of https://github.com/RGBCube/GitHub2Forgejo synced 2025-07-27 13:17:44 +00:00

Add flake example in README

This commit is contained in:
RGBCube 2024-05-29 11:56:42 +03:00
parent 0d99ad2dca
commit a2f91c4bf7
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M

View file

@ -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.<system>.default` or `packages.<system>.github2forgejo` outputs.
## FAQ
### What is the difference between mirroring and cloning?