diff options
| author | John MacFarlane <[email protected]> | 2023-03-08 20:44:07 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-03-08 21:38:20 -0800 |
| commit | b8ce955e675776240718dc68c2eb80485cbe0817 (patch) | |
| tree | fdee9791fe49fb7ef3661f1ea098edba06cd32f2 | |
| parent | c879fed90c17f084f897e08c7052c9ff72ff9d6a (diff) | |
Improve flake.nix.
| -rw-r--r-- | flake.lock | 61 | ||||
| -rw-r--r-- | flake.nix | 84 |
2 files changed, 19 insertions, 126 deletions
diff --git a/flake.lock b/flake.lock index a3771e4b5..e33ea123b 100644 --- a/flake.lock +++ b/flake.lock @@ -18,28 +18,13 @@ "type": "github" } }, - "flake-root": { - "locked": { - "lastModified": 1671378805, - "narHash": "sha256-yqGxyzMN2GuppwG3dTWD1oiKxi+jGYP7D1qUSc5vKhI=", - "owner": "srid", - "repo": "flake-root", - "rev": "dc7ba6166e478804a9da6881aa48c45d300075cf", - "type": "github" - }, - "original": { - "owner": "srid", - "repo": "flake-root", - "type": "github" - } - }, "haskell-flake": { "locked": { - "lastModified": 1678224654, - "narHash": "sha256-HZKnkkDKXvcK45KPVISzioyGjRfg7Ee0jmxUPjOvmRg=", + "lastModified": 1678304177, + "narHash": "sha256-ms+K54ajqL8SIRfsMg6+zRZBdWUcAg/ceTF56NWwjcQ=", "owner": "srid", "repo": "haskell-flake", - "rev": "b1f266999065443a2a038a0bf17b3a836e64d245", + "rev": "a5824246eaae0be7e9589dc24cb444d9d35b5afd", "type": "github" }, "original": { @@ -48,21 +33,6 @@ "type": "github" } }, - "mission-control": { - "locked": { - "lastModified": 1675195908, - "narHash": "sha256-nQv35C7svZFluwy2uoZFxwPqiT16XoKAoMlIQYmvg3A=", - "owner": "Platonic-Systems", - "repo": "mission-control", - "rev": "feb06872ac4dc977f70f6388c87d36fc3c3c3693", - "type": "github" - }, - "original": { - "owner": "Platonic-Systems", - "repo": "mission-control", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1678268259, @@ -115,32 +85,9 @@ "root": { "inputs": { "flake-parts": "flake-parts", - "flake-root": "flake-root", "haskell-flake": "haskell-flake", - "mission-control": "mission-control", "nixpkgs": "nixpkgs", - "nixpkgs-140774-workaround": "nixpkgs-140774-workaround", - "treefmt-nix": "treefmt-nix" - } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1678277086, - "narHash": "sha256-fQ1G72KhLWWf2z+ug9+4ErTEayvlcVQMul0qusKKBgk=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "ec39cfa24342fdf0b04ae44592a191c4765f9c74", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" + "nixpkgs-140774-workaround": "nixpkgs-140774-workaround" } } }, @@ -1,14 +1,9 @@ { - description = "srid/haskell-template: Nix template for Haskell projects"; + description = "Pandoc development"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; haskell-flake.url = "github:srid/haskell-flake"; - treefmt-nix.url = "github:numtide/treefmt-nix"; - treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; - flake-root.url = "github:srid/flake-root"; - mission-control.url = "github:Platonic-Systems/mission-control"; - nixpkgs-140774-workaround.url = "github:srid/nixpkgs-140774-workaround"; }; @@ -17,85 +12,36 @@ systems = nixpkgs.lib.systems.flakeExposed; imports = [ inputs.haskell-flake.flakeModule - inputs.treefmt-nix.flakeModule - inputs.flake-root.flakeModule - inputs.mission-control.flakeModule ]; perSystem = { self', system, lib, config, pkgs, ... }: { - # The "main" project. You can have multiple projects, but this template - # has only one. haskellProjects.main = { imports = [ inputs.nixpkgs-140774-workaround.haskellFlakeProjectModules.default ]; - # packages.haskell-template.root = ./.; # Auto-discovered by haskell-flake overrides = self: super: { }; devShell = { tools = hp: { - treefmt = config.treefmt.build.wrapper; - } // config.treefmt.build.programs; + inherit (hp) + hlint + ormolu + weeder + stylish-haskell + ghcid; + }; hlsCheck.enable = true; }; - }; - - # Auto formatters. This also adds a flake check to ensure that the - # source tree was auto formatted. - treefmt.config = { - inherit (config.flake-root) projectRootFile; - package = pkgs.treefmt; - - programs.ormolu.enable = true; - programs.nixpkgs-fmt.enable = true; - programs.cabal-fmt.enable = true; - programs.hlint.enable = true; - - # We use fourmolu - programs.ormolu.package = pkgs.haskellPackages.fourmolu; - settings.formatter.ormolu = { - options = [ - "--ghc-opt" - "-XImportQualifiedPost" - ]; - }; - }; - - # Dev shell scripts. - mission-control.scripts = { - docs = { - description = "Start Hoogle server for project dependencies"; - exec = '' - echo http://127.0.0.1:8888 - hoogle serve -p 8888 --local - ''; - category = "Dev Tools"; - }; - repl = { - description = "Start the cabal repl"; - exec = '' - cabal repl "$@" - ''; - category = "Dev Tools"; - }; - fmt = { - description = "Format the source tree"; - exec = "${lib.getExe config.treefmt.build.wrapper}"; - category = "Dev Tools"; - }; - run = { - description = "Run the project with ghcid auto-recompile"; - exec = '' - ghcid -c "cabal repl exe:haskell-template" --warnings -T :main - ''; - category = "Primary"; + packages = { + pandoc.root = ./.; + pandoc-cli.root = ./pandoc-cli; + pandoc-server.root = ./pandoc-server; + pandoc-lua-engine.root = ./pandoc-lua-engine; }; }; # Default package. - packages.default = self'.packages.main-haskell-template; + packages.default = self'.packages.pandoc; - # Default shell. - devShells.default = - config.mission-control.installToDevShell self'.devShells.main; + devShells.default = self'.devShells.main; }; }; } |
