Skip to content

Instantly share code, notes, and snippets.

@aciceri
Last active February 19, 2023 18:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aciceri/153ae85c63940847c8d3138895d77dd2 to your computer and use it in GitHub Desktop.
Save aciceri/153ae85c63940847c8d3138895d77dd2 to your computer and use it in GitHub Desktop.
A Nix Flake example for an Haskell application
{
description = "An Haskell application";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs;
flake-utils.url = github:numtide/flake-utils;
easy-hls-src.url = github:jkachmar/easy-hls-nix;
};
outputs = { self, nixpkgs, flake-utils, easy-hls-src }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
easy-hls = pkgs.callPackage easy-hls-src {};
app = pkgs.haskellPackages.callCabal2nix "Application" (./src) {};
shell = pkgs.mkShell {
buildInputs = [
pkgs.ghc
pkgs.cabal-install
pkgs.hlint
easy-hls
];
shellHook = ''
emacsclient --suppress-output --eval "(progn
(setenv \"PATH\" (concat (getenv \"PATH\") \":$PATH\"))
(setq exec-path (append exec-path (split-string \"$PATH\" \":\")))
)"
'';
};
in
rec {
defaultPackage = app;
defaultApp = flake-utils.lib.mkApp { drv = app; };
devShell = shell;
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment