Merge fort-nix/nix-bitcoin#399: examples: Fix shell on non-Linux systems

46af0b1a8d examples: fix shell on non-Linux systems (Erik Arvstedt)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 46af0b1a8d

Tree-SHA512: bc3c24c75b2d26a30f9f4f88700da8a78d8276802b47ddaf3d52097ba6ed16a7b7ca662085e2775a2cd1654b07c1759c36918ee0ab05eb90fbfeac3265576510
This commit is contained in:
Jonas Nick 2021-09-27 09:14:40 +00:00
commit e86d1ff0ff
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
2 changed files with 9 additions and 9 deletions

View File

@ -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 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.\ - [`./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 - [`./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).\ 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 - [`./deploy-container-minimal.sh`](deploy-container-minimal.sh) creates a
container defined by [importable-configuration.nix](importable-configuration.nix).\ container defined by [importable-configuration.nix](importable-configuration.nix).\

View File

@ -1,20 +1,20 @@
{ configDir, shellVersion ? null, extraShellInitCmds ? (pkgs: "") }: { configDir, shellVersion ? null, extraShellInitCmds ? (pkgs: "") }:
let let
inherit (pkgs) lib;
nixpkgs = (import ../pkgs/nixpkgs-pinned.nix).nixpkgs; nixpkgs = (import ../pkgs/nixpkgs-pinned.nix).nixpkgs;
pkgs = import nixpkgs {}; pkgs = import nixpkgs {};
nbPkgs = import ../pkgs { inherit pkgs; }; nbPkgs = import ../pkgs { inherit pkgs; };
cfgDir = toString configDir; cfgDir = toString configDir;
path = lib.optionalString pkgs.stdenv.isLinux ''
export PATH="${lib.makeBinPath [ nbPkgs.extra-container ]}''${PATH:+:}$PATH"
'';
in in
with pkgs; pkgs.stdenv.mkDerivation {
stdenv.mkDerivation rec {
name = "nix-bitcoin-environment"; name = "nix-bitcoin-environment";
path = lib.makeBinPath [ nbPkgs.extra-container ];
shellHook = '' shellHook = ''
export NIX_PATH="nixpkgs=${nixpkgs}:nix-bitcoin=${toString ../.}:." export NIX_PATH="nixpkgs=${nixpkgs}:nix-bitcoin=${toString ../.}:."
export PATH="${path}''${PATH:+:}$PATH" ${path}
export NIX_BITCOIN_EXAMPLES_DIR="${cfgDir}" export NIX_BITCOIN_EXAMPLES_DIR="${cfgDir}"
# Set isInteractive=1 if # Set isInteractive=1 if
@ -111,7 +111,7 @@ stdenv.mkDerivation rec {
} }
if [[ $isInteractive ]]; then if [[ $isInteractive ]]; then
${figlet}/bin/figlet "nix-bitcoin" ${pkgs.figlet}/bin/figlet "nix-bitcoin"
echo 'Enter "h" or "help" for documentation.' echo 'Enter "h" or "help" for documentation.'
fi fi