Skip to content

jmackie/staskell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

staskell

.github/workflows/ci.yaml Cachix Cache

Quickly and easily write static Haskell executables with help from Nix.

Essentially just some high-level helpers on top of static-haskell-nix and a ready baked cachix so you can get going straight away.

Currently only GHC 8.8.3 is supported (open an issue if you want other versions).

How to use it

First write your Haskell thing (i.e. Main.hs, haskell-thing.cabal, etc).

Then add a default.nix:

let
  staskell = import (builtins.fetchFromGitHub {
    owner = "jmackie";
    repo = "staskell";
    rev = "PICK-ONE";
    sha256 = "FILL-THIS-IN";
  });
in
staskell.ghc883.buildStaticPackage {
  name = "haskell-thing";
  # Might want to `gitignore.nix` this...
  # https://github.com/hercules-ci/gitignore.nix
  src = ./.;
}

Use the staskell cache:

$ cachix use staskell

And finally nix-build your static executable 🎉

(See the examples folder for more)

CI example

Commit a workflow like the following:

name: CI
on: push
jobs:
  build-static-exe:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v2

      - name: Install Nix
        uses: cachix/install-nix-action@v8

      - name: Setup Cachix
        run: |
          nix-env -iA cachix -f https://cachix.org/api/v1/install
          cachix use staskell

      - name: Build
        run: nix-build

      # Might want to also create an artifact from ./result/bin/*

About

👷‍♀️ Nix helpers for building static Haskell executables

Topics

Resources

Stars

Watchers

Forks