How to export nix-shell dependency for deploy

i have a nix-shell script, and i want to export the nix-shell depdencies for deploy.

i think i need to copy the closure and channel to target offline server?

so what’s the way i should do?

[larluo@nixos-larluo:~/my-repo/datahub/contrib/metadata-ingestion]$ cat bin/datahub-producer.hs.nix
with import <nixpkgs> {} ;
let
in
mkShell {
  buildInputs = [
    (haskellPackages.ghcWithPackages ( p: 
      [ p.bytestring p.string-conversions
        p.exceptions 
        p.network-uri p.directory
        p.lens p.aeson p.lens-aeson p.avro p.hw-kafka-avro 
        p.hw-kafka-client 
        p.conduit p.hw-kafka-conduit
      ]
    ))
  ];
}

You can find a solution here : https://github.com/NixOS/nix/issues/711#issuecomment-472521605

I didn’t try it, but it may works…

1 Like

Take a read https://fzakaria.com/2020/08/11/caching-your-nix-shell.html

There’s also an open PR to make it work for multiple output derivations.

1 Like