{ # Builds a tiny Haskell executable from a local Cabal package, and # provides a matching dev shell for editing and running it. description = "A minimal Haskell project with Cabal and flakes"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs, ... }: let system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; inherit (pkgs) haskellPackages; project = haskellPackages.callCabal2nix "mini-haskell" ./. { }; checkedProject = pkgs.haskell.lib.doCheck project; in { packages.${system}.default = project; apps.${system}.default = { type = "app"; program = "${self.packages.${system}.default}/bin/mini-haskell"; meta.description = "Run the minimal Haskell example."; }; devShells.${system}.default = pkgs.mkShell { packages = [ haskellPackages.ghc pkgs.cabal-install pkgs.haskell-language-server ]; }; # `doCheck` turns on the Cabal test suite when this derivation is built. checks.${system}.test-suite = checkedProject; }; }