Switch to stable channel but pull the bitcoind and clightning packages and the tor module from unstable

This commit is contained in:
Jonas Nick 2019-01-01 19:16:24 +00:00
parent 54b4eb24a6
commit 5e4e959e26
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
7 changed files with 75 additions and 56 deletions

View File

@ -6,7 +6,7 @@ Work in progress.
Profiles
---
`nixbitcoin.nix` provides the two profiles "minimal" and "all":
`nix-bitcoin.nix` provides the two profiles "minimal" and "all":
* minimal
* bitcoind (pruned) with outbound connections through Tor and inbound connections through a hidden

View File

@ -1,38 +0,0 @@
{ config, pkgs, ... }:
let
# Custom packages
nodeinfo = (import pkgs/nodeinfo.nix);
lightning-charge = import pkgs/lightning-charge.nix { inherit pkgs; };
nanopos = import pkgs/nanopos.nix { inherit pkgs; };
spark-wallet = import pkgs/spark-wallet.nix { inherit pkgs; };
liquidd = import pkgs/liquidd.nix;
in {
imports =
[
./modules/nixbitcoin.nix
];
# Turn off binary cache by setting binaryCaches to empty list
# nix.binaryCaches = [];
nixpkgs.config.packageOverrides = pkgs: {
inherit nodeinfo;
inherit lightning-charge;
inherit nanopos;
inherit spark-wallet;
liquidd = (pkgs.callPackage liquidd { });
};
time.timeZone = "UTC";
services.openssh.enable = true;
networking.firewall.enable = true;
environment.systemPackages = with pkgs; [
vim tmux
htop
];
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "18.09"; # Did you read the comment?
}

View File

@ -4,25 +4,43 @@
{ config, pkgs, ... }:
{
services.nixbitcoin.enable = true;
# Install and use minimal or all modules
services.nixbitcoin.modules = "all";
# FIXME: Define your hostname.
networking.hostName = "nix-bitcoin";
imports = [
./configuration-nixbitcoin.nix
./nix-bitcoin.nix
# FIXME: Uncomment next line to import your hardware configuration. If so,
# add the hardware configuration file to the same directory as this file.
#./hardware-configuration.nix
];
services.nix-bitcoin.enable = true;
# FIXME Install and use minimal or all modules
services.nix-bitcoin.modules = "all";
# FIXME: Define your hostname.
networking.hostName = "nix-bitcoin";
time.timeZone = "UTC";
# FIXME: Add your SSH pubkey
services.openssh.enable = true;
users.users.root = {
openssh.authorizedKeys.keys = [ "" ];
};
# FIXME: add packages you need in your system
environment.systemPackages = with pkgs; [
vim
];
# FIXME: Turn off the binary cache by setting binaryCaches to empty list.
# This means that it will take a while for all packages to be built but it
# prevents a compromised cache taking over your system. As a result, the next
# line should be uncommented in production systems.
# nix.binaryCaches = [];
# FIXME: Add custom options options (like boot options):
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "18.09"; # Did you read the comment?
}

View File

@ -35,7 +35,7 @@ in {
'';
};
port = mkOption {
type = types.port;
type = types.ints.u16;
default = 9116;
description = ''
"The port on which to listen for connections.";

View File

@ -3,7 +3,7 @@
with lib;
let
cfg = config.services.nixbitcoin-webindex;
cfg = config.services.nix-bitcoin-webindex;
indexFile = pkgs.writeText "index.html" ''
<html>
<body>
@ -35,7 +35,7 @@ let
sed -i "s/CLIGHTNING_ID/$CLIGHTNING_ID/g" /var/www/index.html
'';
in {
options.services.nixbitcoin-webindex = {
options.services.nix-bitcoin-webindex = {
enable = mkOption {
type = types.bool;
default = false;

View File

@ -3,7 +3,7 @@
with lib;
let
cfg = config.services.nixbitcoin;
cfg = config.services.nix-bitcoin;
minimalPackages = with pkgs; [
tor
bitcoin
@ -36,12 +36,12 @@ in {
./clightning.nix
./lightning-charge.nix
./nanopos.nix
./nixbitcoin-webindex.nix
./nix-bitcoin-webindex.nix
./liquid.nix
./spark-wallet.nix
];
options.services.nixbitcoin = {
options.services.nix-bitcoin = {
enable = mkOption {
type = types.bool;
default = false;
@ -59,6 +59,8 @@ in {
};
config = mkIf cfg.enable {
networking.firewall.enable = true;
# Tor
services.tor.enable = true;
services.tor.client.enable = true;
@ -69,7 +71,7 @@ in {
port = 22;
}];
version = 3;
}
};
# bitcoind
services.bitcoind.enable = true;
@ -143,7 +145,7 @@ in {
services.lightning-charge.enable = cfg.modules == "all";
services.nanopos.enable = cfg.modules == "all";
services.nixbitcoin-webindex.enable = cfg.modules == "all";
services.nix-bitcoin-webindex.enable = cfg.modules == "all";
services.clightning.autolisten = cfg.modules == "all";
services.spark-wallet.enable = cfg.modules == "all";
services.tor.hiddenServices.spark-wallet = {

37
nix-bitcoin.nix Normal file
View File

@ -0,0 +1,37 @@
{ config, pkgs, ... }:
let
unstable-pkgs-git = builtins.fetchGit {
url = "https://github.com/nixos/nixpkgs-channels";
ref = "nixos-unstable";
rev = "201d739b0ffbebceb444864d1856babcd1a666a8";
};
unstable-pkgs = import unstable-pkgs-git { };
# Custom packages
nodeinfo = (import pkgs/nodeinfo.nix);
lightning-charge = import pkgs/lightning-charge.nix { inherit pkgs; };
nanopos = import pkgs/nanopos.nix { inherit pkgs; };
spark-wallet = import pkgs/spark-wallet.nix { inherit pkgs; };
liquidd = import pkgs/liquidd.nix;
in {
disabledModules = [ "services/security/tor.nix" ];
imports =
[
./modules/nix-bitcoin.nix
(unstable-pkgs-git + "/nixos/modules/services/security/tor.nix")
];
nixpkgs.config.packageOverrides = pkgs: {
# Use bitcoin and clightning from unstable
bitcoin = unstable-pkgs.bitcoin.override { };
altcoins.bitcoind = unstable-pkgs.altcoins.bitcoind.override { };
clightning = unstable-pkgs.clightning.override { };
# Add custom packages
inherit nodeinfo;
inherit lightning-charge;
inherit nanopos;
inherit spark-wallet;
liquidd = (pkgs.callPackage liquidd { });
};
}