Skip to content

Commit 6a803c3

Browse files
Pass through dhall types directory (#660)
1 parent 30db95d commit 6a803c3

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

flake.nix

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
}
3939
}/Prelude/package.dhall";
4040

41+
# The location of the Dhall type specifications, used to type-check manifests.
4142
DHALL_TYPES = ./types;
4243

4344
# We disable git-lfs files explicitly, as this is intended for large files
4445
# (typically >4GB), and source packgaes really ought not be shipping large
4546
# files — just source code.
4647
GIT_LFS_SKIP_SMUDGE = 1;
47-
4848
registryOverlay = final: prev: rec {
4949
nodejs = prev.nodejs_20;
5050

@@ -232,10 +232,6 @@
232232
in
233233
builtins.listToAttrs (builtins.map toKeyPair noComments);
234234

235-
# Print an attrset of env vars { ENV_VAR = "value"; } as a newline-delimited
236-
# string of "ENV_VAR=value" lines.
237-
printEnv = env: pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (name: value: "${name}=${value}") env);
238-
239235
# Allows you to run a local VM with the registry server, mimicking the
240236
# actual deployment.
241237
run-vm = let
@@ -746,6 +742,12 @@
746742
# Enable the registry server
747743
services.registry-server.enable = true;
748744
services.registry-server.host = host;
745+
services.registry-server.envVars = {
746+
# These env vars are known to Nix so we set them in advance.
747+
# Others, like credentials, must be set in a .env file in
748+
# the state directory, unless there are viable defaults.
749+
inherit DHALL_PRELUDE DHALL_TYPES GIT_LFS_SKIP_SMUDGE;
750+
};
749751

750752
# Don't change this.
751753
system.stateVersion = "23.05";

nix/module.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,14 @@ in {
7979
systemd.services = let
8080
# Print an attrset of env vars { ENV_VAR = "value"; } as a newline-delimited
8181
# string of "ENV_VAR=value" lines, then write the text to the Nix store.
82-
defaultEnvFile =
83-
pkgs.writeText ".env"
84-
(pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (name: value:
82+
printEnv = vars:
83+
pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (name: value:
8584
if (builtins.typeOf value == "int")
8685
then "${name}=${toString value}"
8786
else "${name}=${value}")
88-
cfg.envVars));
87+
vars);
88+
defaultEnvFile =
89+
pkgs.writeText ".env" (printEnv cfg.envVars);
8990
in {
9091
server = {
9192
description = "registry server";

0 commit comments

Comments
 (0)