From cfbf83c3d513c83a7d9b64581e5d975e25b92b78 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 9 May 2023 12:33:39 -0700 Subject: [PATCH] Simplify and fix flake.nix. We don't need the workarounds any more. We no longer include pandoc-cli, pandoc-server, or pandoc-lua-engine in the packages. Instead, add some of the heavier dependencies to the list of build inputs. This is at least a temporary solution to #8818. --- flake.lock | 87 ++++++++++++++++-------------------------------------- flake.nix | 80 ++++++++++++++++++++++++------------------------- 2 files changed, 66 insertions(+), 101 deletions(-) diff --git a/flake.lock b/flake.lock index e33ea123bcfb..cb4c63efadbe 100644 --- a/flake.lock +++ b/flake.lock @@ -1,94 +1,59 @@ { "nodes": { - "flake-parts": { + "flake-utils": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "systems": "systems" }, "locked": { - "lastModified": 1677714448, - "narHash": "sha256-Hq8qLs8xFu28aDjytfxjdC96bZ6pds21Yy09mSC156I=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "dc531e3a9ce757041e1afaff8ee932725ca60002", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "haskell-flake": { - "locked": { - "lastModified": 1678304177, - "narHash": "sha256-ms+K54ajqL8SIRfsMg6+zRZBdWUcAg/ceTF56NWwjcQ=", - "owner": "srid", - "repo": "haskell-flake", - "rev": "a5824246eaae0be7e9589dc24cb444d9d35b5afd", - "type": "github" - }, - "original": { - "owner": "srid", - "repo": "haskell-flake", + "owner": "numtide", + "repo": "flake-utils", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1678268259, - "narHash": "sha256-q+ZWNJfXKgIKwsZBir0yXrmIV/4tOv5BflxDAfGISps=", - "owner": "nixos", + "lastModified": 1683594133, + "narHash": "sha256-iUhLhEAgOCnexSGDsYT2ouydis09uDoNzM7UC685XGE=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "90ef5c3c337d8d9f0c97e7641ece70a41f6c16a2", + "rev": "8d447c5626cfefb9b129d5b30103344377fe09bc", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-140774-workaround": { - "locked": { - "lastModified": 1677708284, - "narHash": "sha256-syAhlmvVlVDwgoKS6b3EfrQKfaeCY3zjT2q7VBk/yx8=", - "owner": "srid", - "repo": "nixpkgs-140774-workaround", - "rev": "5fe054e8560cf474b3c89622c1ea7688023425c1", - "type": "github" - }, - "original": { - "owner": "srid", - "repo": "nixpkgs-140774-workaround", - "type": "github" + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" } }, - "nixpkgs-lib": { + "systems": { "locked": { - "dir": "lib", - "lastModified": 1677407201, - "narHash": "sha256-3blwdI9o1BAprkvlByHvtEm5HAIRn/XPjtcfiunpY7s=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "7f5639fa3b68054ca0b062866dc62b22c3f11505", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", + "owner": "nix-systems", + "repo": "default", "type": "github" } - }, - "root": { - "inputs": { - "flake-parts": "flake-parts", - "haskell-flake": "haskell-flake", - "nixpkgs": "nixpkgs", - "nixpkgs-140774-workaround": "nixpkgs-140774-workaround" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index d695bd94166f..c3d128c7da66 100644 --- a/flake.nix +++ b/flake.nix @@ -1,47 +1,47 @@ { 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"; - nixpkgs-140774-workaround.url = "github:srid/nixpkgs-140774-workaround"; - }; - outputs = inputs@{ self, nixpkgs, flake-parts, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { - systems = nixpkgs.lib.systems.flakeExposed; - imports = [ - inputs.haskell-flake.flakeModule - ]; - perSystem = { self', system, lib, config, pkgs, ... }: { - haskellProjects.main = { - imports = [ - inputs.nixpkgs-140774-workaround.haskellFlakeProjectModules.default - ]; - overrides = self: super: { }; - devShell = { - tools = hp: { - inherit (hp) - hlint - ormolu - weeder - stylish-haskell - ghcid; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = inputs: + let + overlay = final: prev: { + haskell = prev.haskell // { + packageOverrides = hfinal: hprev: + prev.haskell.packageOverrides hfinal hprev // { + pandoc = hfinal.callCabal2nix "pandoc" ./. { }; }; - hlsCheck.enable = true; - }; - 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.pandoc; - - devShells.default = self'.devShells.main; + pandoc = final.haskell.lib.compose.justStaticExecutables final.haskellPackages.pandoc; }; - }; + perSystem = system: + let + pkgs = import inputs.nixpkgs { inherit system; overlays = [ overlay ]; }; + hspkgs = pkgs.haskellPackages; + in + { + devShell = hspkgs.shellFor { + withHoogle = true; + packages = p : [ + p.pandoc + ]; + buildInputs = [ + hspkgs.cabal-install + hspkgs.haskell-language-server + hspkgs.hlint + hspkgs.ghcid + hspkgs.ormolu + hspkgs.stylish-haskell + hspkgs.weeder + hspkgs.servant-server + hspkgs.hslua + pkgs.bashInteractive + ]; + }; + defaultPackage = pkgs.pandoc; + }; + in + { inherit overlay; } // + inputs.flake-utils.lib.eachDefaultSystem perSystem; }