add nodeinfo package
This commit is contained in:
parent
14a073c35a
commit
986217d5d3
@ -3,10 +3,9 @@
|
|||||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
|
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
let
|
||||||
{
|
nodeinfo = (import pkgs/nodeinfo.nix);
|
||||||
|
in {
|
||||||
|
|
||||||
disabledModules = [ "services/security/tor.nix" ];
|
disabledModules = [ "services/security/tor.nix" ];
|
||||||
|
|
||||||
imports =
|
imports =
|
||||||
@ -14,15 +13,18 @@
|
|||||||
./modules/default.nix
|
./modules/default.nix
|
||||||
./modules/tor.nix
|
./modules/tor.nix
|
||||||
./modules/onionnode.nix
|
./modules/onionnode.nix
|
||||||
|
./modules/nodeinfo.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking.hostName = "nix-bitcoin"; # Define your hostname.
|
networking.hostName = "nix-bitcoin"; # Define your hostname.
|
||||||
time.timeZone = "UTC";
|
time.timeZone = "UTC";
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
wget vim tmux bitcoin git nginx
|
wget vim tmux git nginx nodeinfo
|
||||||
];
|
];
|
||||||
|
nixpkgs.config.packageOverrides = pkgs: {
|
||||||
|
inherit nodeinfo;
|
||||||
|
};
|
||||||
|
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
|
|
||||||
|
17
modules/nodeinfo.nix
Normal file
17
modules/nodeinfo.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
systemd.services.nodeinfo = {
|
||||||
|
description = "Get node info";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${pkgs.bash}/bin/bash -c ${pkgs.nodeinfo}/bin/nodeinfo";
|
||||||
|
user = "root";
|
||||||
|
type = "oneshot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
14
pkgs/nodeinfo.nix
Normal file
14
pkgs/nodeinfo.nix
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
with import <nixpkgs> {}; # bring all of Nixpkgs into scope
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "nodeinfo";
|
||||||
|
src = ./nodeinfo.sh;
|
||||||
|
|
||||||
|
unpackPhase = "true";
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
mkdir -p $out/bin
|
||||||
|
chmod +wx $src
|
||||||
|
cp $src $out/bin/nodeinfo
|
||||||
|
'';
|
||||||
|
}
|
8
pkgs/nodeinfo.sh
Normal file
8
pkgs/nodeinfo.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
sleep 5
|
||||||
|
OUTFILE=/var/lib/nodeinfo.nix
|
||||||
|
rm -f $OUTFILE
|
||||||
|
{
|
||||||
|
echo \{
|
||||||
|
echo " bitcoind_onion = \"$(cat /var/lib/tor/onion/bitcoind/hostname)\";"
|
||||||
|
echo \}
|
||||||
|
} > $OUTFILE
|
Loading…
Reference in New Issue
Block a user