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