summary refs log tree commit diff
path: root/pkgs/build-support/build-fhs-chrootenv/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/build-fhs-chrootenv/default.nix')
-rw-r--r--pkgs/build-support/build-fhs-chrootenv/default.nix77
1 files changed, 19 insertions, 58 deletions
diff --git a/pkgs/build-support/build-fhs-chrootenv/default.nix b/pkgs/build-support/build-fhs-chrootenv/default.nix
index e807a04628a..461f4762aba 100644
--- a/pkgs/build-support/build-fhs-chrootenv/default.nix
+++ b/pkgs/build-support/build-fhs-chrootenv/default.nix
@@ -1,83 +1,44 @@
-{stdenv, glibc, glibcLocales, gcc, coreutils, diffutils, findutils, gnused, gnugrep, gnutar, gzip, bzip2, 
-bashInteractive, xz, shadow, gawk, less, buildEnv}:
-{name, pkgs ? [], profile ? ""}:
+{ stdenv } : { env } :
 
 let
-  basePkgs = [
-    glibc glibcLocales gcc coreutils diffutils findutils gnused gnugrep gnutar
-    gzip bzip2 bashInteractive xz shadow gawk less
-  ];
-
-  # Compose a global profile for the chroot environment
-  profilePkg = stdenv.mkDerivation {
-    name = "${name}-chrootenv-profile";
-    buildCommand = ''
-      mkdir -p $out/etc
-      cat >> $out/etc/profile << "EOF"
-      export PS1='${name}-chrootenv:\u@\h:\w\$ '
-      ${profile}
-      EOF
-    '';
-  };
-
-  paths = basePkgs ++ [ profilePkg ] ++ pkgs;
-
-  # Composes a /usr like directory structure
-  staticUsrProfile = buildEnv {
-    name = "system-profile";
-    inherit paths;
-  };
-  
   # References to shell scripts that set up or tear down the environment
-  initSh = ./init.sh.in;
-  mountSh = ./mount.sh.in;
-  loadSh = ./load.sh.in;
-  umountSh = ./umount.sh.in;
+  initSh    = ./init.sh.in;
+  mountSh   = ./mount.sh.in;
+  loadSh    = ./load.sh.in;
+  umountSh  = ./umount.sh.in;
   destroySh = ./destroy.sh.in;
-in
-stdenv.mkDerivation {
+
+  name = env.pname;
+
+in stdenv.mkDerivation {
   name = "${name}-chrootenv";
+  preferLocalBuild = true;
   buildCommand = ''
-    mkdir -p $out/sw
-    cd $out/sw
-    
-    for i in ${staticUsrProfile}/{etc,bin,lib{,32,64},sbin,var}
-    do
-        if [ -x "$i" ]
-        then
-            ln -s "$i"
-        fi
-    done
-    
-    ln -s ${staticUsrProfile} usr
-    
-    cd ..
-    
-    mkdir -p bin
-    cd bin
-    
-    sed -e "s|@chrootEnv@|$out|g" \
+    mkdir -p $out/bin
+    cd $out/bin
+
+    sed -e "s|@chrootEnv@|${env}|g" \
         -e "s|@name@|${name}|g" \
         -e "s|@shell@|${stdenv.shell}|g" \
         ${initSh} > init-${name}-chrootenv
     chmod +x init-${name}-chrootenv
-    
+
     sed -e "s|@shell@|${stdenv.shell}|g" \
         -e "s|@name@|${name}|g" \
         ${mountSh} > mount-${name}-chrootenv
     chmod +x mount-${name}-chrootenv
-    
+
     sed -e "s|@shell@|${stdenv.shell}|g" \
         -e "s|@name@|${name}|g" \
         ${loadSh} > load-${name}-chrootenv
     chmod +x load-${name}-chrootenv
-    
+
     sed -e "s|@shell@|${stdenv.shell}|g" \
         -e "s|@name@|${name}|g" \
         ${umountSh} > umount-${name}-chrootenv
     chmod +x umount-${name}-chrootenv
-    
-    sed -e "s|@chrootEnv@|$out|g" \
+
+    sed -e "s|@chrootEnv@|${env}|g" \
         -e "s|@shell@|${stdenv.shell}|g" \
         -e "s|@name@|${name}|g" \
         ${destroySh} > destroy-${name}-chrootenv