nostr://delirehberi@emre.xyz
RELAYS: OK [RSS] [ADMIN]

# I am a veteran Full-Stack Engineer, Open Source Contributor, and Web Generalist. Having shipped applications continuously since 2005, I don't just write code—I architect scalable digital systems that drive business value. Building Nostr tools: - https://nostr.emre.xyz - https://photo.emre.xyz - https://snips.emre.xyz - https://nostr.org.tr - https://rehber.dev - https://jotstr.com - https://ulasocial.com

$ cat ./posts/nix-integration-for-stack.md

Nix integration for stack

TIMESTAMP: 2023-09-10T12:52:25.000Z | 1 MIN_READ

Original date 2020-02-25T00:00:00.000Z

You might want to build your Haskell application with #Nix even if you did start with #Stack.

#Stack has support for building with #Nix. You need to add nix.enable: true to your stack.yaml file.

yaml
nix:
  enable: true
  packages: [glpk, pcre]

You can build your app with Nix now. Also, you can specify a custom shell file for defining environment variables or anything else. You need to remove the packages parameter and to add the shell-file parameter to stack.yaml file.

yaml
nix:
  enable: true
  shell-file: shell.nix 

After that, you can write your shell.nix file.

nix
{ghc}:
with (import <nixpkgs> {});
 
haskell.lib.buildStackProject {
    inherit ghc;
    name = "ScottyEnv";
    buildInputs = [pkgs.figlet zlib.dev zlib.out glpk pcre];
    shellHook = ''
    export PORT=3003;
    figlet "LISTENING ON PORT "$PORT;
    '';
}

And then, just run stack build or stack run or stack ghci commands.

Emre Yilmaz
Emre Yilmaz
delirehberi@emre.xyz
About Author
Emre Yilmaz
Emre Yilmaz ✓ delirehberi@emre.xyz

I am a veteran Full-Stack Engineer, Open Source Contributor, and Web Generalist. Having shipped applications continuously since 2005, I don't just write code—I architect scalable digital systems that drive business value. Building Nostr tools: - https://nostr.emre.xyz - https://photo.emre.xyz - https://snips.emre.xyz - https://nostr.org.tr - https://rehber.dev - https://jotstr.com - https://ulasocial.com

Value 4 Value

Comments & Discussions (0)

Decentralized replies powered by Nostr (NIP-22 / NIP-10)
Loading Nostr comments...
🏷️ Topics
No items in this list.