Skip to content

Commit

Permalink
Add nix-bitcoin.lib for utility functions and types
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasnick committed Aug 20, 2020
1 parent 95342c0 commit 390af32
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/clightning.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ in {
'';
};
bind-addr = mkOption {
type = types.addCheck types.str (s: builtins.length (builtins.split ":" s) == 1);
type = pkgs.nix-bitcoin.lib.ipv4Address;
default = "127.0.0.1";
description = "Set an IP address or UNIX domain socket to listen to";
};
Expand Down
2 changes: 1 addition & 1 deletion modules/lnd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ in {
description = "The data directory for LND.";
};
listen = mkOption {
type = types.addCheck types.str (s: builtins.length (builtins.split ":" s) == 1);
type = pkgs.nix-bitcoin.lib.ipv4Address;
default = "localhost";
description = "Bind to given address to listen to peer connections";
};
Expand Down
2 changes: 2 additions & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@
lightning-loop = pkgs.callPackage ./lightning-loop { };

pinned = import ./pinned.nix;

lib = import ./lib.nix { inherit (pkgs) lib; };
}
5 changes: 5 additions & 0 deletions pkgs/lib.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ lib }:
{
# An address type that checks that there's no port
ipv4Address = lib.types.addCheck lib.types.str (s: builtins.length (builtins.split ":" s) == 1);
}

0 comments on commit 390af32

Please sign in to comment.