From c4935008dca816d655754e97a4cb70610b309502 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Sat, 24 Nov 2018 22:34:39 +0000 Subject: [PATCH] add lightning charge package --- configuration.nix | 7 ++++--- modules/bitcoind.nix | 5 +---- pkgs/lightning-charge.nix | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 pkgs/lightning-charge.nix diff --git a/configuration.nix b/configuration.nix index 3256d27..1a7966f 100644 --- a/configuration.nix +++ b/configuration.nix @@ -4,8 +4,9 @@ { config, pkgs, ... }: let - # custom package + # custom packages nodeinfo = (import pkgs/nodeinfo.nix); + lightning-charge = import pkgs/lightning-charge.nix { inherit pkgs; }; in { disabledModules = [ "services/security/tor.nix" ]; @@ -14,7 +15,6 @@ in { ./modules/nixbitcoin.nix ]; - # TODO: does that destroy the channels symlink? # turn off binary cache by passing the empty list #nix.binaryCaches = []; @@ -25,9 +25,11 @@ in { vim tmux clightning bitcoin nodeinfo jq + lightning-charge.package ]; nixpkgs.config.packageOverrides = pkgs: { inherit nodeinfo; + inherit lightning-charge; }; services.openssh.enable = true; @@ -36,7 +38,6 @@ in { # openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILacgZRwLsiICNHGHY2TG2APeuxFsrw6Cg13ZTMQpNqA nickler@rick" ]; # }; - # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; networking.firewall.enable = true; diff --git a/modules/bitcoind.nix b/modules/bitcoind.nix index a24a741..ad199e6 100644 --- a/modules/bitcoind.nix +++ b/modules/bitcoind.nix @@ -74,10 +74,7 @@ in { par=16 rpcthreads=16 logips=1 - assumevalid=0000000000000000000726d186d6298b5054b9a5c49639752294b322a305d240 - addnode=ecoc5q34tmbq54wl.onion - discover=0 - printtoconsole=1 + ''; description = "Additional configurations to be appended to bitcoin.conf."; }; diff --git a/pkgs/lightning-charge.nix b/pkgs/lightning-charge.nix new file mode 100644 index 0000000..91d52e1 --- /dev/null +++ b/pkgs/lightning-charge.nix @@ -0,0 +1,36 @@ +{pkgs ? import { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-8_x"}: + + +with pkgs; +let + d1 = stdenv.mkDerivation { + name = "lightning-charge-sources"; + src = fetchurl { + url = "https://registry.npmjs.org/lightning-charge/-/lightning-charge-0.4.4.tgz"; + sha256 = "4cd3c918664e99deca3317238856b3c12c314d4ab9f3a61540bee75f9bfed3d7"; + }; + + buildInputs = [ nodePackages.node2nix git ]; + + unpackPhase = '' + mkdir -p $out + tar -xzf $src -C $out + ''; + + installPhase = '' + mkdir -p $out + cd $out/package + ${nodePackages.node2nix}/bin/node2nix -8 package.json + + # terrible hack but I'm really exhausted + sed -i "17iglobalBuildInputs = [ pkgs.nodePackages_8_x.node-pre-gyp ];" default.nix + ''; + }; + # import from derivation (IFD) + packages = import (d1 + "/package/default.nix") { + inherit pkgs system; + }; +in +packages