From ac6cee5c128990e7a5c661bb634b461812a92f70 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sun, 27 Sep 2020 12:43:23 +0200 Subject: [PATCH] pkgs: add extra-container --- examples/shell.nix | 7 +------ pkgs/default.nix | 1 + pkgs/extra-container/default.nix | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 pkgs/extra-container/default.nix diff --git a/examples/shell.nix b/examples/shell.nix index 2298134..66d0f3b 100644 --- a/examples/shell.nix +++ b/examples/shell.nix @@ -11,11 +11,6 @@ let nixpkgs = import nixpkgs-path {}; nix-bitcoin = nixpkgs.callPackage nix-bitcoin-path {}; - extraContainer = nixpkgs.callPackage (builtins.fetchTarball { - url = "https://github.com/erikarvstedt/extra-container/archive/6cced2c26212cc1c8cc7cac3547660642eb87e71.tar.gz"; - sha256 = "0qr41mma2iwxckdhqfabw3vjcbp2ffvshnc3k11kwriwj14b766v"; - }) {}; - nix-bitcoin-unpacked = (import {}).runCommand "nix-bitcoin-src" {} '' mkdir $out; tar xf ${builtins.fetchurl nix-bitcoin-release} -C $out ''; @@ -25,7 +20,7 @@ with nixpkgs; stdenv.mkDerivation rec { name = "nix-bitcoin-environment"; - buildInputs = [ nix-bitcoin.nixops19_09 figlet extraContainer ]; + buildInputs = [ nix-bitcoin.nixops19_09 nix-bitcoin.extra-container figlet ]; shellHook = '' export NIX_PATH="nixpkgs=${nixpkgs-path}:nix-bitcoin=${toString nix-bitcoin-path}:." diff --git a/pkgs/default.nix b/pkgs/default.nix index fa30d02..26031b4 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -13,6 +13,7 @@ nixops19_09 = pkgs.callPackage ./nixops { }; netns-exec = pkgs.callPackage ./netns-exec { }; lightning-loop = pkgs.callPackage ./lightning-loop { }; + extra-container = pkgs.callPackage ./extra-container { }; pinned = import ./pinned.nix; diff --git a/pkgs/extra-container/default.nix b/pkgs/extra-container/default.nix new file mode 100644 index 0000000..0cccec0 --- /dev/null +++ b/pkgs/extra-container/default.nix @@ -0,0 +1,25 @@ +{ stdenv, lib }: + +stdenv.mkDerivation rec { + name = "extra-container-${version}"; + version = "0.3"; + + src = builtins.fetchTarball { + url = "https://github.com/erikarvstedt/extra-container/archive/6cced2c26212cc1c8cc7cac3547660642eb87e71.tar.gz"; + sha256 = "0qr41mma2iwxckdhqfabw3vjcbp2ffvshnc3k11kwriwj14b766v"; + }; + + buildCommand = '' + install -D $src/extra-container $out/bin/extra-container + patchShebangs $out/bin + install $src/eval-config.nix -Dt $out/src + sed -i "s|evalConfig=.*|evalConfig=$out/src/eval-config.nix|" $out/bin/extra-container + ''; + + meta = with lib; { + description = "Run declarative containers without full system rebuilds"; + homepage = https://github.com/erikarvstedt/extra-container; + license = licenses.mit; + maintainers = [ maintainers.earvstedt ]; + }; +}