diff options
author | Lluís Batlle i Rossell <viric@vicerveza.homeunix.net> | 2010-02-15 23:27:51 +0000 |
---|---|---|
committer | Lluís Batlle i Rossell <viric@vicerveza.homeunix.net> | 2010-02-15 23:27:51 +0000 |
commit | 1dd3162d7cae31814dcc468d78c1f59e5351da0d (patch) | |
tree | f52ca43931573ae7e33b270e06ab6cb6f951be49 /lib/make-system-tarball.nix | |
parent | 97f30fb17bbfdbc0352dba68b4c14f8f863daf9f (diff) | |
download | nixpkgs-1dd3162d7cae31814dcc468d78c1f59e5351da0d.tar nixpkgs-1dd3162d7cae31814dcc468d78c1f59e5351da0d.tar.gz nixpkgs-1dd3162d7cae31814dcc468d78c1f59e5351da0d.tar.bz2 nixpkgs-1dd3162d7cae31814dcc468d78c1f59e5351da0d.tar.lz nixpkgs-1dd3162d7cae31814dcc468d78c1f59e5351da0d.tar.xz nixpkgs-1dd3162d7cae31814dcc468d78c1f59e5351da0d.tar.zst nixpkgs-1dd3162d7cae31814dcc468d78c1f59e5351da0d.zip |
First attempt at trying to get a tarball of a bootable nixos system.
What I want with this derivation is to allow the sheevaplug nixos to build a tarball with all the needed files to boot. Then, this can be unpacked into an SD card, or into a NFS/TFTP server, and then the user can boot the system with help of the uboot console. By now, I have only tried to build the tarball in a PC, in order to develop the nix expressions quicker. There is nothing written specialy for the Sheevaplug in all this, by now. svn path=/nixos/trunk/; revision=20035
Diffstat (limited to 'lib/make-system-tarball.nix')
-rw-r--r-- | lib/make-system-tarball.nix | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/make-system-tarball.nix b/lib/make-system-tarball.nix new file mode 100644 index 00000000000..0fa34a186ad --- /dev/null +++ b/lib/make-system-tarball.nix @@ -0,0 +1,38 @@ +{ stdenv, perl, xz, pathsFromGraph + +, # The file name of the resulting tarball + fileName ? "nixos-built.tar.bz2" + +, # The files and directories to be placed in the tarball. + # This is a list of attribute sets {source, target} where `source' + # is the file system object (regular file or directory) to be + # grafted in the file system at path `target'. + contents + +, # In addition to `contents', the closure of the store paths listed + # in `packages' are also placed in the Nix store of the tarball. This is + # a list of attribute sets {object, symlink} where `object' if a + # store path whose closure will be copied, and `symlink' is a + # symlink to `object' that will be added to the tarball. + storeContents ? [] +}: + +stdenv.mkDerivation { + name = "tarball"; + builder = ./make-system-tarball.sh; + buildInputs = [perl xz]; + + inherit fileName pathsFromGraph; + + # !!! should use XML. + sources = map (x: x.source) contents; + targets = map (x: x.target) contents; + + # !!! should use XML. + objects = map (x: x.object) storeContents; + symlinks = map (x: x.symlink) storeContents; + + # For obtaining the closure of `storeContents'. + exportReferencesGraph = + map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents; +} |