More refactoring.

This commit is contained in:
Matthew Bauer 2016-06-14 20:38:17 +00:00
parent 2cb965c186
commit 2ce85648d9
4 changed files with 53 additions and 43 deletions

View File

@ -1,25 +1 @@
{nixpkgs ? import <nixpkgs> {}}:
with nixpkgs;
let
makeself = callPackage ./makeself.nix {};
makedir = callPackage ./makedir.nix {};
nix-bootstrap = callPackage ./nix-bootstrap.nix {};
makebootstrap = {name, script}:
makeself {
inherit name;
startup = ".${script}/install";
archive = makedir {
name = "${name}-dir";
toplevel = script;
};
};
in makebootstrap {
name = "nix-bootstrap.sh";
script = nix-bootstrap;
}
import ./nix-bootstrap.nix

View File

@ -0,0 +1,22 @@
{ stdenv, fetchFromGitHub, nix, cacert }:
stdenv.mkDerivation {
name = "nix-bootstrap";
src = fetchFromGitHub {
owner = "matthewbauer";
repo = "nix-bootstrap";
rev = "cc882b2cb92d8de87dad9cb890ad1745b06a9787";
sha256 = "05w6xjg0cgz6a4szc7jd7v53bmy4zjrgph5xkgyj73g62jyq7ajf";
};
propagatedBuildInputs = [ nix cacert ];
installPhase = ''
mkdir -p $out/
substitute install-nix-from-closure.sh $out/install \
--subst-var-by nix .${nix} \
--subst-var-by cacert .${cacert}
chmod +x $out/install
'';
}

20
makebootstrap.nix Normal file
View File

@ -0,0 +1,20 @@
{nixpkgs ? import <nixpkgs> {}}:
with nixpkgs;
let
makeself = callPackage ./makeself.nix {};
makedir = callPackage ./makedir.nix {};
in
{ name, target, run }:
makeself {
inherit name;
startup = ".${target}${run}";
archive = makedir {
name = "${name}-dir";
toplevel = target;
};
}

View File

@ -1,22 +1,14 @@
{ stdenv, fetchFromGitHub, nix, cacert }:
{nixpkgs ? import <nixpkgs> {}}:
stdenv.mkDerivation {
name = "nix-bootstrap";
with nixpkgs;
src = fetchFromGitHub {
owner = "matthewbauer";
repo = "nix-bootstrap";
rev = "cc882b2cb92d8de87dad9cb890ad1745b06a9787";
sha256 = "05w6xjg0cgz6a4szc7jd7v53bmy4zjrgph5xkgyj73g62jyq7ajf";
};
let
propagatedBuildInputs = [ nix cacert ];
makebootstrap = callPackage ./makebootstrap.nix {};
install-nix-from-closure = callPackage ./install-nix-from-closure.nix {};
installPhase = ''
mkdir -p $out/
substitute install-nix-from-closure.sh $out/install \
--subst-var-by nix .${nix} \
--subst-var-by cacert .${cacert}
chmod +x $out/install
'';
}
in makebootstrap {
name = "nix-bootstrap.sh";
target = install-nix-from-closure;
run = "/install";
}