dev-templates/dhall/flake.nix

45 lines
1,004 B
Nix
Raw Normal View History

2022-07-29 00:29:33 +02:00
{
description = "A Nix-flake-based Dhall development environment";
2022-08-20 12:06:53 +02:00
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
};
2022-07-29 00:29:33 +02:00
outputs =
{ self
, flake-utils
, nixpkgs
}:
2022-07-31 13:12:34 +02:00
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
# Helper function for building dhall-* tools
mkDhallTools = ls:
builtins.map (tool: pkgs.haskellPackages."dhall-${tool}") ls;
dhallTools = mkDhallTools [
"bash"
"docs"
"json"
"lsp-server"
"nix"
"nixpkgs"
"openapi"
"toml"
"yaml"
] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) (mkDhallTools [ "csv" "text" ]); # Linux only
in
{
2022-10-12 23:42:34 +02:00
devShells.default = pkgs.mkShell {
buildInputs = (with pkgs; [ dhall ]) ++ dhallTools;
shellHook = ''
echo "dhall `${pkgs.dhall}/bin/dhall --version`"
'';
};
});
2022-07-29 00:29:33 +02:00
}