Skip to content

Instantly share code, notes, and snippets.

@danderson
Last active October 13, 2019 21:50
Show Gist options
  • Save danderson/3ccead0709988ec2a2f86de8b71ec531 to your computer and use it in GitHub Desktop.
Save danderson/3ccead0709988ec2a2f86de8b71ec531 to your computer and use it in GitHub Desktop.
<...>
networking.pppd.centurylink = {
config = "test";
};
# nixos-rebuild dry-build --show-trace
building the system configuration...
error: while evaluating the attribute 'activationScript' of the derivation 'nixos-system-sirius-b-19.09.783.322a2732e40' at /nix/var/nix/profiles/per-user/root/channels/nixos/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/nixos/nixos/modules/system/activation/activation-script.nix:68:9:
while evaluating 'textClosureMap' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings-with-deps.nix:70:35, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:89:18:
while evaluating 'id' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:14:5, called from undefined position:
while evaluating the attribute 'text' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:9:5:
while evaluating the attribute 'text' at /nix/var/nix/profiles/per-user/root/channels/nixos/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/nixos/nixos/modules/system/etc/etc.nix:12:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/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/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:336:9:
while evaluating the option `environment.etc.systemd/system.source':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:32, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:19:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:246:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:369:10:
while evaluating the attribute 'buildCommand' of the derivation 'system-units' at /nix/store/x918rw26g0qrqq1fj8h8hpgnv634zylz-nixos-19.09.783.322a2732e40/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:234:10, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd-lib.nix:190:46, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:234:16:
while evaluating 'concatMapStrings' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings.nix:31:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd-lib.nix:191:11:
while evaluating the attribute 'wantedBy' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:336:9:
while evaluating the option `systemd.units.pppd-centurylink.service.wantedBy':
while evaluating the attribute 'isDefined' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:373:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:456:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:415:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:349:62:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:234:44:
while evaluating the attribute 'wantedBy' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:336:9:
while evaluating the option `systemd.services.pppd-centurylink.wantedBy':
while evaluating the attribute 'isDefined' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:373:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:456:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:415:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:349:62:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:234:44:
value is a set while a Boolean was expected
{ config, lib, pkgs, ... }:
with lib;
let
enabledConfigs = filter (f: f.enable) (attrValues config.networking.pppd);
mkEtc = cfg: {
"ppp/peers/${cfg.name}".text = cfg.config;
};
mkSystemd = cfg: {
"pppd-${cfg.name}" = {
before = ["network.target"];
wants = ["network.target"];
after = ["network-pre.target"];
serviceConfig = {
ExecStart = "/usr/sbin/pppd call ${cfg.name} nodetach nolog";
Restart = "always";
};
# TODO: this seems to not get reflected into the generated systemd unit. Why?
wantedBy = if cfg.autostart then ["multi-user.target"] else [];
};
};
etcFiles = map mkEtc enabledConfigs;
systemdConfigs = map mkSystemd enabledConfigs;
in {
options = {
networking.pppd = mkOption {
default = {};
type = types.loaOf (types.submodule (
{ name, ... }:
{
options = {
enable = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable this PPP peer.
'';
};
autostart = {
type = types.bool;
default = true;
description = ''
Whether the PPP session is automatically started at boot time.
'';
};
config = mkOption {
type = types.str;
default = "";
description = ''
pppd configuration for this peer, see the pppd(8) man page.
'';
};
name = mkOption {
example = "dialup";
type = types.str;
description = "Name of the PPP peer.";
};
};
config = {
name = mkDefault name;
};
}));
};
};
config = {
environment.etc = mkMerge etcFiles;
systemd.services = mkMerge systemdConfigs;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment