mirror of
https://github.com/oddlama/nixos-extra-modules.git
synced 2025-10-10 22:00:39 +02:00
fix: don't fail if id file is not set
This commit is contained in:
parent
7565d8554b
commit
4c6b6489a4
2 changed files with 4 additions and 11 deletions
|
@ -36,7 +36,7 @@ in
|
||||||
flip mapAttrsToList memberWG (
|
flip mapAttrsToList memberWG (
|
||||||
networkName: networkCfg:
|
networkName: networkCfg:
|
||||||
let
|
let
|
||||||
assertionPrefix = "While evaluation the wireguard network ${networkName}:";
|
assertionPrefix = "While evaluating the wireguard network ${networkName}:";
|
||||||
hostCfg = networkCfg.hosts.${config.node.name};
|
hostCfg = networkCfg.hosts.${config.node.name};
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
|
|
|
@ -23,7 +23,7 @@ in
|
||||||
options = {
|
options = {
|
||||||
host = mkOption {
|
host = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The host name or IP addresse for reaching the server node.";
|
description = "The host name or IP address under which the server node is reachable from any client.";
|
||||||
};
|
};
|
||||||
idFile = mkOption {
|
idFile = mkOption {
|
||||||
type = types.nullOr types.path;
|
type = types.nullOr types.path;
|
||||||
|
@ -61,16 +61,9 @@ in
|
||||||
config.id =
|
config.id =
|
||||||
let
|
let
|
||||||
inherit (wgConf) idFile;
|
inherit (wgConf) idFile;
|
||||||
|
idFromFile = if (idFile == null) then null else (importJSON idFile).${name} or null;
|
||||||
in
|
in
|
||||||
if (idFile == null) then
|
lib.mkIf (idFromFile != null) idFromFile;
|
||||||
null
|
|
||||||
else
|
|
||||||
(
|
|
||||||
let
|
|
||||||
conf = importJSON idFile;
|
|
||||||
in
|
|
||||||
conf.${name} or null
|
|
||||||
);
|
|
||||||
options = {
|
options = {
|
||||||
server = mkOption {
|
server = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue