move mkHiddenService to lib
This commit is contained in:
parent
a26ed03d77
commit
a344ae95c9
@ -10,6 +10,7 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.nix-bitcoin.onionServices;
|
cfg = config.nix-bitcoin.onionServices;
|
||||||
|
nbLib = config.nix-bitcoin.lib;
|
||||||
|
|
||||||
services = builtins.attrNames cfg;
|
services = builtins.attrNames cfg;
|
||||||
|
|
||||||
@ -60,13 +61,10 @@ in {
|
|||||||
let
|
let
|
||||||
service = config.services.${name};
|
service = config.services.${name};
|
||||||
inherit (cfg.${name}) externalPort;
|
inherit (cfg.${name}) externalPort;
|
||||||
in {
|
in nbLib.mkHiddenService {
|
||||||
map = [{
|
port = if externalPort != null then externalPort else service.port;
|
||||||
port = if externalPort != null then externalPort else service.port;
|
toPort = service.port;
|
||||||
toPort = service.port;
|
toHost = if service.address == "0.0.0.0" then "127.0.0.1" else service.address;
|
||||||
toHost = if service.address == "0.0.0.0" then "127.0.0.1" else service.address;
|
|
||||||
}];
|
|
||||||
version = 3;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -4,13 +4,8 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services;
|
cfg = config.services;
|
||||||
|
nbLib = config.nix-bitcoin.lib;
|
||||||
operatorName = config.nix-bitcoin.operator.name;
|
operatorName = config.nix-bitcoin.operator.name;
|
||||||
|
|
||||||
mkHiddenService = map: {
|
|
||||||
map = [ map ];
|
|
||||||
version = 3;
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
../modules.nix
|
../modules.nix
|
||||||
@ -30,7 +25,7 @@ in {
|
|||||||
];
|
];
|
||||||
|
|
||||||
# sshd
|
# sshd
|
||||||
services.tor.hiddenServices.sshd = mkHiddenService { port = 22; };
|
services.tor.hiddenServices.sshd = nbLib.mkHiddenService { port = 22; };
|
||||||
nix-bitcoin.onionAddresses.access.${operatorName} = [ "sshd" ];
|
nix-bitcoin.onionAddresses.access.${operatorName} = [ "sshd" ];
|
||||||
|
|
||||||
services.bitcoind = {
|
services.bitcoind = {
|
||||||
|
@ -65,4 +65,9 @@ let self = {
|
|||||||
type = types.str;
|
type = types.str;
|
||||||
default = "exec";
|
default = "exec";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkHiddenService = map: {
|
||||||
|
map = [ map ];
|
||||||
|
version = 3;
|
||||||
|
};
|
||||||
}; in self
|
}; in self
|
||||||
|
Loading…
Reference in New Issue
Block a user