From c49926e94ac171bffdaf977b6ace45963f72773d Mon Sep 17 00:00:00 2001 From: Guillaume Bouchard Date: Sat, 29 Jan 2022 11:39:00 +0100 Subject: [PATCH] Move hackage back to flake.nix Apparently `flake-compat` does not work correctly with local flake. Reported by @teto and @smunix in 2621. --- configuration-ghc-921.nix | 12 +++++----- flake.lock | 38 ++++++++++--------------------- flake.nix | 47 +++++++++++++++++++++++++++++++-------- flake_hackage/flake.nix | 44 ------------------------------------ 4 files changed, 56 insertions(+), 85 deletions(-) delete mode 100644 flake_hackage/flake.nix diff --git a/configuration-ghc-921.nix b/configuration-ghc-921.nix index 05d7887698..81a189ba70 100644 --- a/configuration-ghc-921.nix +++ b/configuration-ghc-921.nix @@ -1,5 +1,5 @@ # nix version of cabal-ghc901.project -{ pkgs, hackage }: +{ pkgs, inputs }: let disabledPlugins = [ @@ -10,12 +10,12 @@ let hpkgsOverride = hself: hsuper: with pkgs.haskell.lib; { - fourmolu = hself.callCabal2nix "fourmolu" hackage.fourmolu {}; + fourmolu = hself.callCabal2nix "fourmolu" inputs.fourmolu {}; primitive-extras = hself.primitive-extras_0_10_1_2; - ghc-exactprint = hself.callCabal2nix "ghc-exactprint" hackage.ghc-exactprint {}; - constraints-extras = hself.callCabal2nix "constraints-extras" hackage.constraints-extras {}; - retrie = hself.callCabal2nix "retrie" hackage.retrie {}; - hlint = doJailbreak (hself.callCabal2nix "hlint" hackage.hlint {}); + ghc-exactprint = hself.callCabal2nix "ghc-exactprint" inputs.ghc-exactprint {}; + constraints-extras = hself.callCabal2nix "constraints-extras" inputs.constraints-extras {}; + retrie = hself.callCabal2nix "retrie" inputs.retrie {}; + hlint = doJailbreak (hself.callCabal2nix "hlint" inputs.hlint {}); # Re-generate HLS drv excluding some plugins haskell-language-server = diff --git a/flake.lock b/flake.lock index ade3851966..63fe7a6be4 100644 --- a/flake.lock +++ b/flake.lock @@ -15,11 +15,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1627913399, - "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", + "lastModified": 1641205782, + "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", "owner": "edolstra", "repo": "flake-compat", - "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", + "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", "type": "github" }, "original": { @@ -98,27 +98,6 @@ "type": "github" } }, - "hackage-sources": { - "inputs": { - "constraints-extras": "constraints-extras", - "fourmolu": "fourmolu", - "ghc-exactprint": "ghc-exactprint", - "hlint": "hlint", - "lsp": "lsp", - "lsp-test": "lsp-test", - "lsp-types": "lsp-types", - "retrie": "retrie" - }, - "locked": { - "narHash": "sha256-/F3itZJSZDnaxRGpkTffHDkxC7PloYqxVTW//bP3i20=", - "path": "./flake_hackage", - "type": "path" - }, - "original": { - "path": "./flake_hackage", - "type": "path" - } - }, "hlint": { "flake": false, "locked": { @@ -230,12 +209,19 @@ }, "root": { "inputs": { + "constraints-extras": "constraints-extras", "flake-compat": "flake-compat", "flake-utils": "flake-utils", + "fourmolu": "fourmolu", + "ghc-exactprint": "ghc-exactprint", "gitignore": "gitignore", - "hackage-sources": "hackage-sources", + "hlint": "hlint", + "lsp": "lsp", + "lsp-test": "lsp-test", + "lsp-types": "lsp-types", "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks" + "pre-commit-hooks": "pre-commit-hooks", + "retrie": "retrie" } } }, diff --git a/flake.nix b/flake.nix index d13c9da08c..92a4324aa4 100644 --- a/flake.nix +++ b/flake.nix @@ -22,16 +22,46 @@ flake = false; }; - hackage-sources.url = "path:./flake_hackage"; + # List of hackage dependencies + lsp = { + url = "https://hackage.haskell.org/package/lsp-1.4.0.0/lsp-1.4.0.0.tar.gz"; + flake = false; + }; + lsp-types = { + url = "https://hackage.haskell.org/package/lsp-types-1.4.0.1/lsp-types-1.4.0.1.tar.gz"; + flake = false; + }; + lsp-test = { + url = "https://hackage.haskell.org/package/lsp-test-0.14.0.2/lsp-test-0.14.0.2.tar.gz"; + flake = false; + }; + ghc-exactprint = { + url = "https://hackage.haskell.org/package/ghc-exactprint-1.4.1/ghc-exactprint-1.4.1.tar.gz"; + flake = false; + }; + constraints-extras = { + url = "https://hackage.haskell.org/package/constraints-extras-0.3.2.1/constraints-extras-0.3.2.1.tar.gz"; + flake = false; + }; + retrie = { + url = "https://hackage.haskell.org/package/retrie-1.2.0.1/retrie-1.2.0.1.tar.gz"; + flake = false; + }; + fourmolu = { + url = "https://hackage.haskell.org/package/fourmolu-0.5.0.1/fourmolu-0.5.0.1.tar.gz"; + flake = false; + }; + hlint = { + url = "https://hackage.haskell.org/package/hlint-3.3.6/hlint-3.3.6.tar.gz"; + flake = false; + }; }; outputs = - { self, nixpkgs, flake-compat, flake-utils, pre-commit-hooks, gitignore, hackage-sources }: + inputs@{ self, nixpkgs, flake-compat, flake-utils, pre-commit-hooks, gitignore, ... }: { overlay = final: prev: with prev; let - hackage = hackage-sources.inputs; - haskellOverrides = hself: hsuper: { # we override mkDerivation here to apply the following # tweak to each haskell package: @@ -79,9 +109,9 @@ # We need an older version hiedb = hself.hiedb_0_4_1_0; - lsp = hsuper.callCabal2nix "lsp" hackage.lsp {}; - lsp-types = hsuper.callCabal2nix "lsp-types" hackage.lsp-types {}; - lsp-test = hsuper.callCabal2nix "lsp-test" hackage.lsp-test {}; + lsp = hsuper.callCabal2nix "lsp" inputs.lsp {}; + lsp-types = hsuper.callCabal2nix "lsp-types" inputs.lsp-types {}; + lsp-test = hsuper.callCabal2nix "lsp-test" inputs.lsp-test {}; implicit-hie-cradle = hself.callCabal2nix "implicit-hie-cradle" (builtins.fetchTarball { @@ -135,7 +165,6 @@ } // (flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]) (system: let - hackage = hackage-sources.inputs; pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; @@ -174,7 +203,7 @@ }; ghc901Config = (import ./configuration-ghc-901.nix) { inherit pkgs; }; - ghc921Config = (import ./configuration-ghc-921.nix) { inherit pkgs hackage; }; + ghc921Config = (import ./configuration-ghc-921.nix) { inherit pkgs inputs; }; # GHC versions ghcDefault = pkgs.hlsHpkgs ("ghc" diff --git a/flake_hackage/flake.nix b/flake_hackage/flake.nix deleted file mode 100644 index 212cf1e7f7..0000000000 --- a/flake_hackage/flake.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ - description = "Sources from hackage"; - - inputs = { - lsp = { - url = "https://hackage.haskell.org/package/lsp-1.4.0.0/lsp-1.4.0.0.tar.gz"; - flake = false; - }; - lsp-types = { - url = "https://hackage.haskell.org/package/lsp-types-1.4.0.1/lsp-types-1.4.0.1.tar.gz"; - flake = false; - }; - lsp-test = { - url = "https://hackage.haskell.org/package/lsp-test-0.14.0.2/lsp-test-0.14.0.2.tar.gz"; - flake = false; - }; - ghc-exactprint = { - url = "https://hackage.haskell.org/package/ghc-exactprint-1.4.1/ghc-exactprint-1.4.1.tar.gz"; - flake = false; - }; - - constraints-extras = { - url = "https://hackage.haskell.org/package/constraints-extras-0.3.2.1/constraints-extras-0.3.2.1.tar.gz"; - flake = false; - }; - - retrie = { - url = "https://hackage.haskell.org/package/retrie-1.2.0.1/retrie-1.2.0.1.tar.gz"; - flake = false; - }; - - fourmolu = { - url = "https://hackage.haskell.org/package/fourmolu-0.5.0.1/fourmolu-0.5.0.1.tar.gz"; - flake = false; - }; - - hlint = { - url = "https://hackage.haskell.org/package/hlint-3.3.6/hlint-3.3.6.tar.gz"; - flake = false; - }; - }; - - outputs = {self, ...}: {}; -}