diff --git a/common/admins.nix b/common/admins.nix index 5aa2df9..1b55cc8 100644 --- a/common/admins.nix +++ b/common/admins.nix @@ -9,5 +9,6 @@ in { keys.users.jade ++ keys.users.janik ++ keys.users.lukegb ++ + keys.users.emilylange ++ keys.users.yuka; } diff --git a/common/ssh-keys.nix b/common/ssh-keys.nix index a151aea..eb1afb8 100644 --- a/common/ssh-keys.nix +++ b/common/ssh-keys.nix @@ -4,6 +4,7 @@ meta01 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM5t9gYorOWgpCFDJgb24pyCKIabGpeI2H/UfdvXODcT"; gerrit01 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA+eSZu+u9sCynrMlsmFzQHLIELQAuVg0Cs1pBvwb4+A"; fodwatch = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRyTNfvKl5FcSyzGzw+h+bNFNOxdhvI67WdUZ2iIJ1L"; + git = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEQJcpkCUOx8+5oukMX6lxrYcIX8FyHu8Mc/3+ieKMUn"; builder-0 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBHSNcDGctvlG6BHcJuYIzW9WsBJsts2vpwSketsbXoL"; builder-1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQOGUjERK7Mx8UPM/rbOdMqVyn1sbWqYOG6CbOzH2wm"; builder-2 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMKzXIqCoYElEKIYgjbSpqEcDeOvV+Wo3Agq3jba83cB"; @@ -40,6 +41,7 @@ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBLZxVITpJ8xbiCa/u2gjSSIupeiqOnRh+8tFIoVhCON" ]; lukegb = [ ''cert-authority,principals="lukegb" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEqNOwlR7Qa8cbGpDfSCOweDPbAGQOZIcoRgh6s/J8DR'' ]; + emilylange = [ "no-touch-required sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIL7jgq3i+N3gVJhs4shm7Kmw6dIocs2OuR0GBMG1RxfKAAAABHNzaDo=" ]; yuka = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKath4/fDnlv/4fzxkPrQN1ttmoPRNu/m9bEtdPJBDfY cardno:16_933_242" ]; }; } diff --git a/flake.nix b/flake.nix index 5d7281e..84f7cff 100644 --- a/flake.nix +++ b/flake.nix @@ -99,6 +99,7 @@ meta01.imports = commonModules ++ [ ./hosts/meta01 ]; gerrit01.imports = commonModules ++ [ ./hosts/gerrit01 ]; fodwatch.imports = commonModules ++ [ ./hosts/fodwatch ]; + git.imports = commonModules ++ [ ./hosts/git ]; wob-vpn-gw.imports = commonModules ++ [ ./hosts/wob-vpn-gw ]; } // builders; diff --git a/hosts/git/default.nix b/hosts/git/default.nix new file mode 100644 index 0000000..7d3383c --- /dev/null +++ b/hosts/git/default.nix @@ -0,0 +1,43 @@ +let + ipv6 = { + openssh ="2001:bc8:38ee:100:1000::41"; + forgejo = "2001:bc8:38ee:100:1000::40"; + }; +in +{ + networking.hostName = "git"; + networking.domain = "infra.forkos.org"; + + time.timeZone = "Europe/Paris"; + + bagel.sysadmin.enable = true; + # Forgejo will be proxied. + bagel.raito.v6-proxy-awareness.enable = true; + bagel.hardware.raito-vm = { + enable = true; + networking = { + nat-lan-mac = "BC:24:11:83:71:56"; + wan = { + address = "${ipv6.forgejo}/64"; + mac = "BC:24:11:0B:8A:81"; + }; + }; + }; + + # Add one additional IPv6, so we can have both OpenSSH and + # Forgejo's built-in server bind on port :22. + systemd.network.networks."10-wan".networkConfig.Address = [ "${ipv6.openssh}/64" ]; + services.openssh.listenAddresses = [{ + addr = "[${ipv6.openssh}]"; + }]; + + bagel.services.forgejo = { + enable = true; + sshBindAddr = ipv6.forgejo; + }; + + i18n.defaultLocale = "en_US.UTF-8"; + + system.stateVersion = "24.05"; + deployment.targetHost = "git.infra.forkos.org"; +} diff --git a/pkgs/forgejo/branch-view_remove-expensive-commit-divergence-metric.patch b/pkgs/forgejo/branch-view_remove-expensive-commit-divergence-metric.patch new file mode 100644 index 0000000..c4bb4c2 --- /dev/null +++ b/pkgs/forgejo/branch-view_remove-expensive-commit-divergence-metric.patch @@ -0,0 +1,59 @@ +diff --git a/services/repository/branch.go b/services/repository/branch.go +index e1a313749f..5a8d823eef 100644 +--- a/services/repository/branch.go ++++ b/services/repository/branch.go +@@ -26,7 +26,6 @@ import ( + "code.gitea.io/gitea/modules/timeutil" + webhook_module "code.gitea.io/gitea/modules/webhook" + notify_service "code.gitea.io/gitea/services/notify" +- files_service "code.gitea.io/gitea/services/repository/files" + + "xorm.io/builder" + ) +@@ -129,21 +128,7 @@ func loadOneBranch(ctx context.Context, repo *repo_model.Repository, dbBranch *g + p := protectedBranches.GetFirstMatched(branchName) + isProtected := p != nil + +- var divergence *git.DivergeObject +- +- // it's not default branch +- if repo.DefaultBranch != dbBranch.Name && !dbBranch.IsDeleted { +- var err error +- divergence, err = files_service.CountDivergingCommits(ctx, repo, git.BranchPrefix+branchName) +- if err != nil { +- return nil, fmt.Errorf("CountDivergingCommits: %v", err) +- } +- } +- +- if divergence == nil { +- // tolerate the error that we cannot get divergence +- divergence = &git.DivergeObject{Ahead: -1, Behind: -1} +- } ++ divergence := &git.DivergeObject{Ahead: -1, Behind: -1} + + pr, err := issues_model.GetLatestPullRequestByHeadInfo(ctx, repo.ID, branchName) + if err != nil { +diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl +index a577fed450..e102796315 100644 +--- a/templates/repo/branch/list.tmpl ++++ b/templates/repo/branch/list.tmpl +@@ -102,19 +102,6 @@ + {{end}} + +