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

Mathijs Kwik mathijs at bluescreen303.nl
Wed Apr 11 15:16:49 CEST 2012


On Wed, Apr 11, 2012 at 2:48 PM, Eelco Dolstra
<eelco.dolstra at logicblox.com> wrote:
> 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.

Cool, thanks.
That's indeed a start I think.

I don't mind nix-env -q. With my current setup, users have only 1
package installed, which is a buildEnv of which they have to manage
the paths themselves through ~/.nixpkgs/config.nix. So loosing that
info doesn't matter much :)





>
> --
> Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list