Last active
February 19, 2023 18:13
-
-
Save aciceri/153ae85c63940847c8d3138895d77dd2 to your computer and use it in GitHub Desktop.
A Nix Flake example for an Haskell application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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