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> {} ;
mkShell {
  buildInputs = [
    (haskellPackages.ghcWithPackages ( p: 
      [ p.bytestring p.string-conversions
        p.lens p.aeson p.lens-aeson p.avro p.hw-kafka-avro 
        p.conduit p.hw-kafka-conduit

You can find a solution here : nix-shell command line option to print target derivation to stdout · Issue #711 · NixOS/nix · GitHub

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

1 Like

Take a read caching your nix-shell | Farid Zakaria’s Blog

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

1 Like