From 46af0b1a8d4297af51e13d77e10e849b5cc18eab Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sat, 25 Sep 2021 21:43:31 +0200 Subject: [PATCH] examples: fix shell on non-Linux systems extra-container is not supported on these systems. Also mention that VM examples require Linux. --- examples/README.md | 4 ++-- helper/makeShell.nix | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/README.md b/examples/README.md index 20e3d0f..edaee4f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -18,11 +18,11 @@ By default, [`configuration.nix`](configuration.nix) enables `bitcoind` and `cli Requires: [Nix](https://nixos.org/), a systemd-based Linux distro and root privileges - [`./deploy-qemu-vm.sh`](deploy-qemu-vm.sh) creates a QEMU VM.\ - Requires: [Nix](https://nixos.org/nix/) + Requires: [Nix](https://nixos.org/nix/), Linux - [`./deploy-krops.sh`](deploy-krops.sh) creates a QEMU VM and deploys a nix-bitcoin configuration to it using [krops](https://github.com/krebs/krops).\ - Requires: [Nix](https://nixos.org/nix/) + Requires: [Nix](https://nixos.org/nix/), Linux - [`./deploy-container-minimal.sh`](deploy-container-minimal.sh) creates a container defined by [minimal-configuration.nix](minimal-configuration.nix) that diff --git a/helper/makeShell.nix b/helper/makeShell.nix index 7a2d1b1..d11008d 100644 --- a/helper/makeShell.nix +++ b/helper/makeShell.nix @@ -1,20 +1,20 @@ { configDir, shellVersion ? null, extraShellInitCmds ? (pkgs: "") }: let + inherit (pkgs) lib; nixpkgs = (import ../pkgs/nixpkgs-pinned.nix).nixpkgs; pkgs = import nixpkgs {}; nbPkgs = import ../pkgs { inherit pkgs; }; cfgDir = toString configDir; + path = lib.optionalString pkgs.stdenv.isLinux '' + export PATH="${lib.makeBinPath [ nbPkgs.extra-container ]}''${PATH:+:}$PATH" + ''; in -with pkgs; -stdenv.mkDerivation rec { +pkgs.stdenv.mkDerivation { name = "nix-bitcoin-environment"; - path = lib.makeBinPath [ nbPkgs.extra-container ]; - shellHook = '' export NIX_PATH="nixpkgs=${nixpkgs}:nix-bitcoin=${toString ../.}:." - export PATH="${path}''${PATH:+:}$PATH" - + ${path} export NIX_BITCOIN_EXAMPLES_DIR="${cfgDir}" # Set isInteractive=1 if @@ -111,7 +111,7 @@ stdenv.mkDerivation rec { } if [[ $isInteractive ]]; then - ${figlet}/bin/figlet "nix-bitcoin" + ${pkgs.figlet}/bin/figlet "nix-bitcoin" echo 'Enter "h" or "help" for documentation.' fi