1

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)?

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
  • 1
    Looks like `buildEnv`. See https://stackoverflow.com/questions/50802880/reproducible-nix-env-i-with-only-nix-no-nixos/50805575#50805575 – Robert Hensing Dec 13 '19 at 19:38

1 Answers1

3

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
danbst
  • 3,363
  • 18
  • 38