rewrite nixu scripts to use nix-push. Install the whole NixU environment in
two main steps: 1 - first build everything (nix-push) 2 - install everything on a seperate disk/machine (nix-pull) svn path=/nixu/trunk/; revision=3291
This commit is contained in:
parent
c29ea5dd01
commit
1e607c9221
|
@ -34,6 +34,7 @@ for i in $boot $halt $login $env; do
|
||||||
-e "s^@gnugrep\@^$gnugrep^g" \
|
-e "s^@gnugrep\@^$gnugrep^g" \
|
||||||
-e "s^@gzip\@^$gzip^g" \
|
-e "s^@gzip\@^$gzip^g" \
|
||||||
-e "s^@gcc\@^$gcc^g" \
|
-e "s^@gcc\@^$gcc^g" \
|
||||||
|
-e "s^@mingetty\@^$mingetty^g" \
|
||||||
-e "s^@out\@^$out^g" \
|
-e "s^@out\@^$out^g" \
|
||||||
< $i > $dst
|
< $i > $dst
|
||||||
chmod +x $dst
|
chmod +x $dst
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ stdenv, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs
|
{ stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs
|
||||||
, nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh
|
, nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh
|
||||||
, binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep
|
, binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep
|
||||||
, gnutar, gzip}:
|
, gnutar, gzip, mingetty}:
|
||||||
|
|
||||||
derivation {
|
derivation {
|
||||||
name = "boot";
|
name = "boot";
|
||||||
|
@ -11,8 +11,8 @@ derivation {
|
||||||
halt = ./halt.sh;
|
halt = ./halt.sh;
|
||||||
login = ./login.sh;
|
login = ./login.sh;
|
||||||
env = ./env.sh;
|
env = ./env.sh;
|
||||||
inherit stdenv bash coreutils findutils utillinux sysvinit
|
inherit stdenv kernel bash coreutils findutils utillinux sysvinit
|
||||||
e2fsprogs nettools nix subversion gcc wget which vim less screen
|
e2fsprogs nettools nix subversion gcc wget which vim less screen
|
||||||
openssh binutils strace shadowutils iputils gnumake curl gnused
|
openssh binutils strace shadowutils iputils gnumake curl gnused
|
||||||
gnutar gnugrep gzip;
|
gnutar gnugrep gzip mingetty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin
|
export PATH=@nix@/bin:@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@sysvinit@/bin:@sysvinit@/sbin:@e2fsprogs@/bin:@e2fsprogs@/sbin:@nettools@/bin:@nettools@/sbin:@gcc@/bin:@subversion@/bin:@which@/bin:@wget@/bin:@vim@/bin:@less@/bin:@screen@/bin:@openssh@/bin:@binutils@/bin:@strace@/bin:@shadowutils@/bin:@shadowutils@/sbin:@iputils@/bin:@gnumake@/bin:@curl@/bin:@gnused@/bin:@gnutar@/bin:@gnugrep@/bin:@gzip@/bin:@mingetty@/sbin
|
||||||
|
|
40
make-disk.sh
40
make-disk.sh
|
@ -1,42 +1,16 @@
|
||||||
#! /bin/sh -e
|
#! /bin/sh -e
|
||||||
|
|
||||||
image=/tmp/disk.img
|
archivesDir=/tmp/arch
|
||||||
size=$(expr 2048 \* 1024 \* 1024)
|
manifest=${archivesDir}/MANIFEST
|
||||||
storePaths=/tmp/mystorepaths
|
|
||||||
successors=/tmp/mysuccessors
|
|
||||||
|
|
||||||
if ! test -f $image; then
|
|
||||||
|
|
||||||
echo creating empty disk of $size bytes in $image...
|
|
||||||
# Note: this is a sparse file.
|
|
||||||
dd if=/dev/zero of=$image bs=1 seek=$(expr $size - 1) count=1
|
|
||||||
|
|
||||||
echo creating disk image in $image...
|
|
||||||
/sbin/mke2fs -F $image
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# What to copy?
|
|
||||||
|
|
||||||
NIX_CMD_PATH=/nix/bin
|
NIX_CMD_PATH=/nix/bin
|
||||||
|
|
||||||
storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -)
|
storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiate -v -v -)
|
||||||
$NIX_CMD_PATH/nix-store -rB $storeExpr
|
$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr)
|
||||||
$NIX_CMD_PATH/nix-store -qn --requisites $storeExpr > $storePaths
|
$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -))
|
||||||
|
|
||||||
(while read storepath; do
|
|
||||||
$NIX_CMD_PATH/nix-store -q --predecessors $storepath | (while read predecessor; do
|
|
||||||
echo $predecessor $storepath
|
|
||||||
done)
|
|
||||||
done) < $storePaths > $successors
|
|
||||||
|
|
||||||
# Location of sysvinit?
|
# Location of sysvinit?
|
||||||
sysvinitPath=$($NIX_CMD_PATH/nix-store -qn $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))
|
#sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))
|
||||||
|
|
||||||
# Location of Nix boot scripts?
|
# Location of Nix boot scripts?
|
||||||
bootPath=$($NIX_CMD_PATH/nix-store -qn $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))
|
#bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))
|
||||||
|
|
||||||
# Fill the disk with the minimal Nix store.
|
|
||||||
if ! test -d /tmp/mnt; then mkdir /tmp/mnt; fi
|
|
||||||
linux ubd0=$image root=/dev/root rootflags=/ rootfstype=hostfs \
|
|
||||||
init="$(pwd)/fill-disk.sh $sysvinitPath $bootPath"
|
|
||||||
|
|
10
pkgs.nix
10
pkgs.nix
|
@ -1,13 +1,13 @@
|
||||||
rec {
|
rec {
|
||||||
inherit (import /home/armijn/pkgs/system/i686-linux.nix)
|
inherit (import /nixpkgs/trunk/pkgs/system/i686-linux.nix)
|
||||||
stdenv bash coreutils findutils utillinux sysvinit e2fsprogs
|
stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs
|
||||||
nettools nix subversion gcc wget which vim less screen openssh binutils
|
nettools nix subversion gcc wget which vim less screen openssh binutils
|
||||||
strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip;
|
strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip mingetty;
|
||||||
|
|
||||||
boot = (import ./boot) {inherit stdenv bash coreutils findutils
|
boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils
|
||||||
utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim
|
utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim
|
||||||
less screen openssh binutils strace shadowutils iputils gnumake curl
|
less screen openssh binutils strace shadowutils iputils gnumake curl
|
||||||
gnused gnutar gnugrep gzip;};
|
gnused gnutar gnugrep gzip mingetty;};
|
||||||
|
|
||||||
everything = [boot sysvinit];
|
everything = [boot sysvinit];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue