[Nix-dev] using nix-build to build a user profile

Eelco Dolstra eelco.dolstra at logicblox.com
Wed Apr 11 14:48:48 CEST 2012


Hi,

On 11/04/12 14:39, Mathijs Kwik wrote:

> Is it possible to build user profiles using nix-build?
> I mean I can build the system profile using
> "nix-build /etc/nixos/nixos -A system"

Here is a starting point (I never tried this before, but it seems to work):

  $ nix-build '<nix/buildenv.nix>' --argstr system x86_64-linux \
      --arg derivations '[((import <nixpkgs> {}).firefox)]' \
      --arg manifest 'builtins.toFile "manifest.nix" "{}"'

"<nix/buildenv.nix>" is the function used by nix-env to build user environments.
 It expects "derivations" to be a list of derivations or store paths, and
"manifest" to be a Nix expression representing the installed packages (for
"nix-env -q").  Since the manifest is {} here, "nix-env -q" won't show anything,
so that would have to be improved.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/


More information about the nix-dev mailing list