Skip to content

Commit

Permalink
nixos/forgejo: add robots.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed Feb 9, 2025
1 parent 44ff26b commit f802591
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
15 changes: 15 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
};
};

# Use their robots.txt
codeberg-infra = {
url = "https://codeberg.org/Codeberg-Infrastructure/build-deploy-forgejo/archive/codeberg-10.tar.gz";
flake = false;
};

determinate = {
url = "https://flakehub.com/f/DeterminateSystems/determinate/0.1";
inputs = {
Expand Down
19 changes: 18 additions & 1 deletion modules/nixos/mixins/forgejo.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{ config, lib, ... }:
{
config,
lib,
inputs,
...
}:

let
forgejoCfg = config.services.forgejo;

robotsTxtPath = forgejoCfg.stateDir + "/custom/public/robots.txt";
in

{
Expand Down Expand Up @@ -46,6 +53,16 @@ in
proxyPass = "http://unix:${forgejoCfg.settings.server.HTTP_ADDR}";
};
};

systemd.tmpfiles.settings."forgejo-settings" = {
${robotsTxtPath}."L+" = {
argument = inputs.codeberg-infra + "/etc/gitea/public/robots.txt";
};

${dirOf robotsTxtPath}.d = {
inherit (forgejoCfg) user group;
};
};
})
];
}

0 comments on commit f802591

Please sign in to comment.