|
46 | 46 | GUIX_LOCPATH = "${cfg.stateDir}/guix/profiles/per-user/root/guix-profile/lib/locale"; |
47 | 47 | LC_ALL = "C.UTF-8"; |
48 | 48 | }; |
| 49 | + |
| 50 | + # Currently, this is just done the lazy way with the official Guix script. A |
| 51 | + # more "formal" way would be creating our own Guix script to handle and |
| 52 | + # generate the ACL file ourselves. |
| 53 | + aclFile = pkgs.runCommandLocal "guix-acl" { } '' |
| 54 | + export GUIX_CONFIGURATION_DIRECTORY=./ |
| 55 | + for official_server_keys in ${lib.concatStringsSep " " cfg.substituters.authorizedKeys}; do |
| 56 | + ${lib.getExe' cfg.package "guix"} archive --authorize < "$official_server_keys" |
| 57 | + done |
| 58 | + install -Dm0600 ./acl "$out" |
| 59 | + ''; |
49 | 60 | in |
50 | 61 | { |
51 | 62 | meta.maintainers = with lib.maintainers; [ foo-dogsquared ]; |
|
118 | 129 | example = "/gnu/var"; |
119 | 130 | }; |
120 | 131 |
|
| 132 | + substituters = { |
| 133 | + urls = lib.mkOption { |
| 134 | + type = with lib.types; listOf str; |
| 135 | + default = [ |
| 136 | + "https://ci.guix.gnu.org" |
| 137 | + "https://bordeaux.guix.gnu.org" |
| 138 | + "https://berlin.guix.gnu.org" |
| 139 | + ]; |
| 140 | + example = lib.literalExpression '' |
| 141 | + options.services.guix.substituters.urls.default ++ [ |
| 142 | + "https://guix.example.com" |
| 143 | + "https://guix.example.org" |
| 144 | + ] |
| 145 | + ''; |
| 146 | + description = '' |
| 147 | + A list of substitute servers' URLs for the Guix daemon to download |
| 148 | + substitutes from. |
| 149 | + ''; |
| 150 | + }; |
| 151 | + |
| 152 | + authorizedKeys = lib.mkOption { |
| 153 | + type = with lib.types; listOf path; |
| 154 | + default = [ |
| 155 | + "${cfg.package}/share/guix/ci.guix.gnu.org.pub" |
| 156 | + "${cfg.package}/share/guix/bordeaux.guix.gnu.org.pub" |
| 157 | + "${cfg.package}/share/guix/berlin.guix.gnu.org.pub" |
| 158 | + ]; |
| 159 | + defaultText = '' |
| 160 | + The packaged signing keys from {option}`services.guix.package`. |
| 161 | + ''; |
| 162 | + example = lib.literalExpression '' |
| 163 | + options.services.guix.substituters.authorizedKeys.default ++ [ |
| 164 | + (builtins.fetchurl { |
| 165 | + url = "https://guix.example.com/signing-key.pub"; |
| 166 | + }) |
| 167 | +
|
| 168 | + (builtins.fetchurl { |
| 169 | + url = "https://guix.example.org/static/signing-key.pub"; |
| 170 | + }) |
| 171 | + ] |
| 172 | + ''; |
| 173 | + description = '' |
| 174 | + A list of signing keys for each substitute server to be authorized as |
| 175 | + a source of substitutes. Without this, the listed substitute servers |
| 176 | + from {option}`services.guix.substituters.urls` would be ignored [with |
| 177 | + some |
| 178 | + exceptions](https://guix.gnu.org/manual/en/html_node/Substitute-Authentication.html). |
| 179 | + ''; |
| 180 | + }; |
| 181 | + }; |
| 182 | + |
121 | 183 | publish = { |
122 | 184 | enable = mkEnableOption "substitute server for your Guix store directory"; |
123 | 185 |
|
|
215 | 277 | script = '' |
216 | 278 | ${lib.getExe' package "guix-daemon"} \ |
217 | 279 | --build-users-group=${cfg.group} \ |
| 280 | + ${lib.optionalString (cfg.substituters.urls != [ ]) |
| 281 | + "--substitute-urls='${lib.concatStringsSep " " cfg.substituters.urls}'"} \ |
218 | 282 | ${lib.escapeShellArgs cfg.extraArgs} |
219 | 283 | ''; |
220 | 284 | serviceConfig = { |
|
254 | 318 |
|
255 | 319 | # Make transferring files from one store to another easier with the usual |
256 | 320 | # case being of most substitutes from the official Guix CI instance. |
257 | | - system.activationScripts.guix-authorize-keys = '' |
258 | | - for official_server_keys in ${package}/share/guix/*.pub; do |
259 | | - ${lib.getExe' package "guix"} archive --authorize < $official_server_keys |
260 | | - done |
261 | | - ''; |
| 321 | + environment.etc."guix/acl".source = aclFile; |
262 | 322 |
|
263 | 323 | # Link the usual Guix profiles to the home directory. This is useful in |
264 | 324 | # ephemeral setups where only certain part of the filesystem is |
|
270 | 330 | in '' |
271 | 331 | [ -d "${userProfile}" ] && ln -sfn "${userProfile}" "${location}" |
272 | 332 | ''; |
273 | | - linkProfileToPath = acc: profile: location: let |
274 | | - in acc + (linkProfile profile location); |
| 333 | + linkProfileToPath = acc: profile: location: |
| 334 | + acc + (linkProfile profile location); |
275 | 335 |
|
276 | 336 | # This should contain export-only Guix user profiles. The rest of it is |
277 | 337 | # handled manually in the activation script. |
|
387 | 447 | Type = "oneshot"; |
388 | 448 |
|
389 | 449 | PrivateDevices = true; |
390 | | - PrivateNetworks = true; |
| 450 | + PrivateNetwork = true; |
391 | 451 | ProtectControlGroups = true; |
392 | 452 | ProtectHostname = true; |
393 | 453 | ProtectKernelTunables = true; |
|
0 commit comments