on master help sign in
Initial commit
commit5d4a181152bc07f7294273c053ae3d23072fff93 authorMatthew Bauer <mjbauer95@gmai.com> dateTue 14 Jun 2016, 19:52 (10 years ago)
5 files changed+76
.gitignore+2 default.nix+22 makedir.nix+16 makeself.nix+14 nix-bootstrap.nix+22
.gitignorenew file+2
@@ -0,0 +1,2 @@
1+*~
2+result
default.nixnew file+22
@@ -0,0 +1,22 @@
1+{nixpkgs ? import <nixpkgs> {}}:
2+
3+with nixpkgs;
4+
5+let
6+
7+ makeself = callPackage ./makeself.nix {};
8+ makedir = callPackage ./makedir.nix {};
9+ nix-bootstrap = callPackage ./nix-bootstrap.nix {};
10+
11+ nixdir = makedir {
12+ name = "nixdir";
13+ toplevel = nix-bootstrap;
14+ };
15+
16+in
17+
18+ makeself {
19+ name = "nix-installer.sh";
20+ startup = ".${nix-bootstrap}/install";
21+ archive = nixdir;
22+ }
makedir.nixnew file+16
@@ -0,0 +1,16 @@
1+{ stdenv, perl, pathsFromGraph }:
2+
3+{ name, toplevel }:
4+
5+ stdenv.mkDerivation {
6+ inherit toplevel name;
7+ exportReferencesGraph = [ "closure" toplevel ];
8+ buildInputs = [ perl ];
9+ buildCommand = ''
10+ storePaths=$(${perl}/bin/perl ${pathsFromGraph} ./closure)
11+ mkdir -p $out
12+ for path in $storePaths; do
13+ cp --parents -r $path $out/
14+ done
15+ '';
16+ }
makeself.nixnew file+14
@@ -0,0 +1,14 @@
1+{ stdenv, makeself }:
2+
3+{ name
4+, archive
5+, startup
6+}:
7+
8+ stdenv.mkDerivation {
9+ inherit name archive startup;
10+ nativeBuildInputs = [ makeself ];
11+ buildCommand = ''
12+ ${makeself}/bin/makeself $archive $out $name $startup
13+ '';
14+ }
nix-bootstrap.nixnew file+22
@@ -0,0 +1,22 @@
1+{ stdenv, fetchFromGitHub, nix, cacert }:
2+
3+ stdenv.mkDerivation {
4+ name = "nix-bootstrap";
5+
6+ src = fetchFromGitHub {
7+ owner = "matthewbauer";
8+ repo = "nix-bootstrap";
9+ rev = "47bc67bbc5cd71fba9c9b0d07f967023b94e8ffa";
10+ sha256 = "1jy52hhmbdn1hgc10x73kqx8dc38piz589mjbj07rp4vx0qc9alw";
11+ };
12+
13+ propagatedBuildInputs = [ nix cacert ];
14+
15+ installPhase = ''
16+ mkdir -p $out/
17+ substitute install-nix-from-closure.sh $out/install \
18+ --subst-var-by nix .${nix} \
19+ --subst-var-by cacert .${cacert}
20+ chmod +x $out/install
21+ '';
22+ }