Chris Stryczynski
Chris Stryczynski

Reputation: 33861

How to specify multiple packages/derivation for installation by nix-env?

I have a single file (dep-terraform.nix) with contents of:

{ sources ? import ./nix/sources.nix
} :
let
  niv = import sources.nixpkgs {
    overlays = [
      (_ : _ : { niv = import sources.niv {}; })
    ] ;
    config = {};
  };
  pkgs = niv.pkgs;
in
pkgs.terraform.withPlugins(p: [p.google])

The above (a single package/derivation) can successfully be installed with nix-env -if dep-terraform.nix. How can specify additional packages to be installed using the above approach (without having to create a file for each dependency)?

Upvotes: 3

Views: 3214

Answers (1)

danbst
danbst

Reputation: 3613

It is possible to install list of packages using nix-env:

$ echo 'with import <nixpkgs>{}; [ htop moreutils ]' > /tmp/tmp.nix

$ nix-env -if /tmp/tmp.nix 
installing 'htop-2.2.0'
installing 'moreutils-0.63'
building '/nix/store/dvhlfnmjska9j55jr4m6cch7xwdgf59a-user-environment.drv'...
created 1419 symlinks in user environment

Upvotes: 4

Related Questions