Improve flake.nix

This commit is contained in:
Andrea Bedini 2022-05-16 17:54:15 +08:00
parent 4af477a937
commit 8f3c76a262
No known key found for this signature in database
GPG Key ID: EE8DEB94262733BE
2 changed files with 36 additions and 33 deletions

View File

@ -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"
]
}

View File

@ -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="
];
};
}