mirror of
https://forgejo.merr.is/annika/nixos.git
synced 2025-12-11 21:06:44 -05:00
Trying to improve Netbird Setup
This commit is contained in:
parent
f030235976
commit
514205e1d9
4 changed files with 55 additions and 14 deletions
|
|
@ -6,25 +6,58 @@
|
|||
description = "Enable Netbird";
|
||||
default = false;
|
||||
};
|
||||
opts = {
|
||||
setup_key = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
Setup key obtained from the Management Service Dashboard (used to register peer)
|
||||
'';
|
||||
default = "";
|
||||
};
|
||||
management_url = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
Management Service URL [http|https]://[host]:[port]
|
||||
'';
|
||||
default = "https://api.wiretrustee.com:443";
|
||||
};
|
||||
admin_url = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
Admin Panel URL [http|https]://[host]:[port]
|
||||
'';
|
||||
default = "https://app.netbird.io";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
# TODO: This code should live somewhere else and be available to everything.
|
||||
# mkIfElse = p: yes: no: lib.mkMerge [
|
||||
# (lib.mkIf p yes)
|
||||
# (lib.mkif (!p) no)
|
||||
# ];
|
||||
config = lib.mkIf (config.netbird.enable)
|
||||
(lib.mkMerge [
|
||||
(lib.mkIf (config.gui.enable) {
|
||||
{
|
||||
services.netbird.tunnels = {
|
||||
wt0.environment = (lib.mkMerge [
|
||||
{
|
||||
NB_MANAGEMENT_URL = config.netbird.opts.management_url;
|
||||
NB_ADMIN_URL = config.netbird.opts.admin_url;
|
||||
}
|
||||
# isString e
|
||||
(lib.mkIf (config.netbird.opts.setup_key != "") {
|
||||
NB_SETUP_KEY = config.netbird.opts.setup_key;
|
||||
})
|
||||
]);
|
||||
};
|
||||
}
|
||||
(lib.mIf (config.gui.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = [
|
||||
pkgs.netbird-ui
|
||||
];
|
||||
};
|
||||
services.netbird.enable = true;
|
||||
})
|
||||
(lib.mkIf (!config.gui.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = [
|
||||
pkgs.netbird
|
||||
];
|
||||
};
|
||||
services.netbird.enable = true;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue