@@ -10,52 +10,62 @@ LDAP and SSO integration as well as one local runner.
10
10
11
11
## Features {#services-forgejo-features}
12
12
13
- - Declarative [ LDAP] ( #services-forgejo-options-shb.forgejo.ldap ) Configuration. [ Manual] ( #services-forgejo-usage-ldap ) .
13
+ - Declarative creation of users, admin or not.
14
+ - Also declarative [ LDAP] ( #services-forgejo-options-shb.forgejo.ldap ) Configuration. [ Manual] ( #services-forgejo-usage-ldap ) .
14
15
- Declarative [ SSO] ( #services-forgejo-options-shb.forgejo.sso ) Configuration. [ Manual] ( #services-forgejo-usage-sso ) .
15
16
- Declarative [ local runner] ( #services-forgejo-options-shb.forgejo.localActionRunner ) Configuration.
16
- - Access through [ subdomain] ( #services-forgejo-options-shb.forgejo.subdomain ) using reverse proxy. [ Manual] ( #services-forgejo-usage-basic ) .
17
- - Access through [ HTTPS] ( #services-forgejo-options-shb.forgejo.ssl ) using reverse proxy. [ Manual] ( #services-forgejo-usage-basic ) .
17
+ - Access through [ subdomain] ( #services-forgejo-options-shb.forgejo.subdomain ) using reverse proxy. [ Manual] ( #services-forgejo-usage-configuration ) .
18
+ - Access through [ HTTPS] ( #services-forgejo-options-shb.forgejo.ssl ) using reverse proxy. [ Manual] ( #services-forgejo-usage-configuration ) .
18
19
- [ Backup] ( #services-forgejo-options-shb.forgejo.sso ) through the [ backup block] ( ./blocks-backup.html ) . [ Manual] ( #services-forgejo-usage-backup ) .
19
20
20
21
## Usage {#services-forgejo-usage}
21
22
22
- ### Secrets {#services-forgejo-secrets }
23
+ ### Initial Configuration {#services-forgejo-usage-configuration }
23
24
24
- All the secrets should be readable by the forgejo user.
25
-
26
- Secrets should not be stored in the nix store.
27
- If you're using [ sops-nix] ( https://github.com/Mic92/sops-nix )
28
- and assuming your secrets file is located at ` ./secrets.yaml ` ,
29
- you can define a secret with:
25
+ The following snippet enables Forgejo and makes it available under the ` forgejo.example.com ` endpoint.
30
26
31
27
``` nix
32
- sops.secrets."forgejo/adminPasswordFile" = {
33
- sopsFile = ./secrets.yaml;
34
- mode = "0400";
35
- owner = "forgejo";
36
- group = "forgejo";
37
- restartUnits = [ "forgejo.service" ];
28
+ shb.forgejo = {
29
+ enable = true;
30
+ subdomain = "forgejo";
31
+ enable = "example.com";
32
+
33
+ users = {
34
+ "theadmin" = {
35
+ isAdmin = true;
36
+
37
+ password.result = config.shb.hardcodedsecret.forgejoAdminPassword.result;
38
+ };
39
+ "theuser" = {
40
+
41
+ password.result = config.shb.hardcodedsecret.forgejoUserPassword.result;
42
+ };
43
+ };
38
44
};
39
- ```
40
45
41
- Then you can use that secret:
46
+ shb.hardcodedsecret."forgejo/admin/password" = {
47
+ request = config.shb.forgejo.users."theadmin".password.request;
48
+ };
42
49
43
- ``` nix
44
- shb.forgejo.adminPasswordFile = config.sops.secrets."forgejo/adminPasswordFile".path;
50
+ shb.hardcodedsecret."forgejo/user/password" = {
51
+ request = config.shb.forgejo.users."theuser".password.request;
52
+ };
45
53
```
46
54
47
- ### Forgejo through HTTPS {#services-forgejo-usage-basic}
55
+ Two users are created, ` theadmin ` and ` theuser ` ,
56
+ respectively with the passwords ` foregejo/admin/password `
57
+ and ` foregejo/user/password ` from a SOPS file.
48
58
49
- This will set up a Forgejo service that runs on the NixOS target machine,
50
- reachable at ` http://forgejo.example.com ` .
59
+ This assumes secrets are setup with SOPS
60
+ as mentioned in [ the secrets setup section] ( usage.html#usage-secrets ) of the manual.
61
+ Secrets can be randomly generated with ` nix run nixpkgs#openssl -- rand -hex 64 ` .
51
62
52
- ``` nix
53
- shb.forgejo = {
54
- enable = true;
55
- domain = "example.com";
56
- subdomain = "forgejo";
57
- };
58
- ```
63
+ ### Forgejo through HTTPS {#services-forgejo-usage-https}
64
+
65
+ :::: {.note}
66
+ We will build upon the [ Initial Configuration] ( #services-forgejo-usage-configuration ) section,
67
+ so please follow that first.
68
+ ::::
59
69
60
70
If the ` shb.ssl ` block is used (see [ manual] ( blocks-ssl.html#usage ) on how to set it up),
61
71
the instance will be reachable at ` https://fogejo.example.com ` .
@@ -77,14 +87,14 @@ Then you can tell Forgejo to use those certificates.
77
87
shb.certs.certs.letsencrypt."example.com".extraDomains = [ "forgejo.example.com" ];
78
88
79
89
shb.forgejo = {
80
- ssl = config.shb.certs.certs.selfsigned.forgejo ;
90
+ ssl = config.shb.certs.certs.letsencrypt."example.com" ;
81
91
};
82
92
```
83
93
84
94
### With LDAP Support {#services-forgejo-usage-ldap}
85
95
86
96
:::: {.note}
87
- We will build upon the [ HTTPS] ( #services-forgejo-usage-basic ) section,
97
+ We will build upon the [ HTTPS] ( #services-forgejo-usage-https ) section,
88
98
so please follow that first.
89
99
::::
90
100
0 commit comments