Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jmackie/staskell
👷♀️ Nix helpers for building static Haskell executables
https://github.com/jmackie/staskell
haskell nix static-link-binary
Last synced: about 1 month ago
JSON representation
👷♀️ Nix helpers for building static Haskell executables
- Host: GitHub
- URL: https://github.com/jmackie/staskell
- Owner: jmackie
- Created: 2020-10-20T09:21:24.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-06T17:56:59.000Z (almost 2 years ago)
- Last Synced: 2024-08-16T16:22:21.057Z (5 months ago)
- Topics: haskell, nix, static-link-binary
- Language: Nix
- Homepage:
- Size: 18.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `staskell`
![.github/workflows/ci.yaml](https://github.com/jmackie/staskell/workflows/.github/workflows/ci.yaml/badge.svg)
[![Cachix Cache](https://img.shields.io/badge/cachix-staskell-blue.svg)](https://staskell.cachix.org)Quickly and easily write static Haskell executables with help from [Nix](https://nixos.org/).
Essentially just some high-level helpers on top of [`static-haskell-nix`](https://github.com/nh2/static-haskell-nix)
and a ready baked [cachix](https://staskell.cachix.org) 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`:
```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:
```bash
$ cachix use staskell
```And finally `nix-build` your static executable 🎉
(See the [examples](https://github.com/jmackie/staskell/tree/master/examples/) folder for more)
## CI example
Commit a [workflow](https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/introduction-to-github-actions) like the following:
```yaml
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/*
```