Skip to content

Instantly share code, notes, and snippets.

@ilyaGotfryd
Last active February 18, 2020 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyaGotfryd/530423b8e73c5d40b1a24eabdf07f39b to your computer and use it in GitHub Desktop.
Save ilyaGotfryd/530423b8e73c5d40b1a24eabdf07f39b to your computer and use it in GitHub Desktop.
Issues with passing environment variable to a config
error: while evaluating the attribute 'preVM' of the derivation 'nixos-disk-image' at /nix/store/gv4m5kg1d7z5k1f5s3a3cr8158ng2kky-nixpkgs-20.03pre212770.cc1ae9f21b9/nixpkgs/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'exportReferencesGraph' of the derivation 'closure-info' at /nix/store/gv4m5kg1d7z5k1f5s3a3cr8158ng2kky-nixpkgs-20.03pre212770.cc1ae9f21b9/nixpkgs/pkgs/build-support/closure-info.nix:14:3:
while evaluating the attribute 'activationScript' of the derivation 'nixos-system-nixos-20.03pre212770.cc1ae9f21b9' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/activation/top-level.nix:102:5:
while evaluating the attribute 'system.activationScripts.script' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/activation/activation-script.nix:68:9:
while evaluating 'textClosureMap' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/strings-with-deps.nix:70:35, called from /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/activation/activation-script.nix:89:18:
while evaluating 'id' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/trivial.nix:14:5, called from undefined position:
while evaluating the attribute 'text' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/activation/activation-script.nix:9:5:
while evaluating the attribute 'text' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/strings-with-deps.nix:77:38:
while evaluating the attribute 'sources' of the derivation 'etc' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/etc/etc.nix:12:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/etc/etc.nix:20:20, called from undefined position:
while evaluating the attribute 'source' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:84:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:379:9:
while evaluating the option `environment.etc.systemd/system.source':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:411:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:413:22, called from /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:413:9:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/types.nix:251:15, called from /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:414:14:
while evaluating the attribute 'buildCommand' of the derivation 'system-units' at /nix/store/gv4m5kg1d7z5k1f5s3a3cr8158ng2kky-nixpkgs-20.03pre212770.cc1ae9f21b9/nixpkgs/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'text' of the derivation 'unit-bvla_transmitters.service' at /nix/store/gv4m5kg1d7z5k1f5s3a3cr8158ng2kky-nixpkgs-20.03pre212770.cc1ae9f21b9/nixpkgs/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'text' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:84:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:379:9:
while evaluating the option `systemd.units.bvla_transmitters.service.text':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:411:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:405:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:505:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:391:28, called from /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:391:17:
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:464:25, called from /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:392:62:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:277:44:
while evaluating 'attrsToSection' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/boot/systemd-lib.nix:104:20, called from /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/boot/systemd.nix:344:13:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/boot/systemd-lib.nix:106:12, called from undefined position:
while evaluating 'toOption' at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/boot/systemd-lib.nix:99:14, called from /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/boot/systemd-lib.nix:107:21:
cannot coerce a set to a string, at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/boot/systemd-lib.nix:102:10
{ config, lib, pkgs, ... }:
let
vision_server_api_key_header = builtins.getEnv "BVL_API_KEY_HEADER";
log_adapter_engine = import ./engine_package.nix { inherit pkgs; }
in
{
systemd.services.bvla_transmitters = {
enable = true;
description = "Log Adapter Engine service - Transmitters.";
wantedBy = [ "network.taret" "redis.service" "nsqd.service"];
after = [ "network.target" "redis.service" "nsqd.service" ];
serviceConfig = {
environment = { BVL_API_KEY_HEADER = "${vision_server_api_key_header}"; };
LogsDirectory = "bvla";
ExecStart = "${log_adapter_engine}/bin/transmitters >'$LOGS_DIRECTORY/bvla_transmitters.out' 2>'$LOGS_DIRECTORY/bvla_transmitters.err'";
ExecReload="/run/current-system/sw/bin/kill -HUP $MAINPID";
Type="simple";
KillMode="process";
Restart="on-failure";
RestartSec="10s";
User="root";
};
};
}
{ config, lib, pkgs, ... }:
let
vision_server_api_key_header = builtins.getEnv "BVL_API_KEY_HEADER";
log_adapter_engine = import ./engine_package.nix { inherit pkgs; }
in
{
systemd.services.bvla_transmitters = {
enable = true;
description = "Log Adapter Engine service - Transmitters.";
wantedBy = [ "network.taret" "redis.service" "nsqd.service"];
after = [ "network.target" "redis.service" "nsqd.service" ];
environment = { BVL_API_KEY_HEADER = "${vision_server_api_key_header}"; };
serviceConfig = {
LogsDirectory = "bvla";
ExecStart = "${log_adapter_engine}/bin/transmitters >'$LOGS_DIRECTORY/bvla_transmitters.out' 2>'$LOGS_DIRECTORY/bvla_transmitters.err'";
ExecReload="/run/current-system/sw/bin/kill -HUP $MAINPID";
Type="simple";
KillMode="process";
Restart="on-failure";
RestartSec="10s";
User="root";
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment