From 8f3c76a26209b36ec676dfb3915f7fd66abe2587 Mon Sep 17 00:00:00 2001 From: Andrea Bedini Date: Mon, 16 May 2022 17:54:15 +0800 Subject: [PATCH] Improve flake.nix --- flake.lock | 10 ++++----- flake.nix | 59 ++++++++++++++++++++++++++++-------------------------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/flake.lock b/flake.lock index 586c1f3..5c03379 100644 --- a/flake.lock +++ b/flake.lock @@ -146,7 +146,7 @@ "type": "github" } }, - "haskellNix": { + "haskell-nix": { "inputs": { "HTTP": "HTTP", "cabal-32": "cabal-32", @@ -160,7 +160,7 @@ "hydra": "hydra", "nix-tools": "nix-tools", "nixpkgs": [ - "haskellNix", + "haskell-nix", "nixpkgs-unstable" ], "nixpkgs-2003": "nixpkgs-2003", @@ -204,7 +204,7 @@ "inputs": { "nix": "nix", "nixpkgs": [ - "haskellNix", + "haskell-nix", "hydra", "nix", "nixpkgs" @@ -390,9 +390,9 @@ "root": { "inputs": { "flake-utils": "flake-utils", - "haskellNix": "haskellNix", + "haskell-nix": "haskell-nix", "nixpkgs": [ - "haskellNix", + "haskell-nix", "nixpkgs-unstable" ] } diff --git a/flake.nix b/flake.nix index 8f77b79..ab88e36 100644 --- a/flake.nix +++ b/flake.nix @@ -2,41 +2,44 @@ description = "Foliage is a tool to create custom Haskell package repositories, in a fully reproducible way."; inputs = { - nixpkgs.follows = "haskellNix/nixpkgs-unstable"; - haskellNix.url = "github:input-output-hk/haskell.nix"; + nixpkgs.follows = "haskell-nix/nixpkgs-unstable"; + haskell-nix.url = "github:input-output-hk/haskell.nix"; flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils, haskellNix }: - flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system: + outputs = { self, nixpkgs, flake-utils, haskell-nix }: + flake-utils.lib.eachDefaultSystem (system: let - overlays = [ haskellNix.overlay - (final: prev: { - foliage = - final.haskell-nix.project' { - src = ./.; - compiler-nix-name = "ghc8107"; - shell.tools = { - cabal = {}; - hlint = {}; - haskell-language-server = {}; - }; - shell.buildInputs = with pkgs; [ - nixpkgs-fmt - ]; - modules = [{ - packages.foliage.components.exes.foliage.dontStrip = false; - }]; - }; - }) - ]; - pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; }; - flake = pkgs.foliage.flake { }; - in flake // { - defaultPackage = flake.packages."foliage:exe:foliage"; + pkgs = import nixpkgs { inherit system; inherit (haskell-nix) config; overlays = [haskell-nix.overlay]; }; + project = pkgs.haskell-nix.cabalProject { + src = ./.; + compiler-nix-name = "ghc8107"; + shell.tools = { + cabal = {}; + hlint = {}; + haskell-language-server = {}; + }; + shell.buildInputs = with pkgs; [ + nixpkgs-fmt + ]; + modules = [{ + packages.foliage.components.exes.foliage.dontStrip = false; + }]; + }; + in { + packages.default = project.foliage.components.exes.foliage; devShell = pkgs.mkShell { name = "foliage-dev-shell"; }; }); + + nixConfig = { + extra-substituters = [ + "https://hydra.iohk.io" + ]; + extra-trusted-public-keys = [ + "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" + ]; + }; }