2022-04-11 11:48:04 +03:00
|
|
|
{
|
2022-11-30 06:22:32 +03:00
|
|
|
description =
|
|
|
|
"Foliage is a tool to create custom Haskell package repositories, in a fully reproducible way.";
|
2022-04-11 11:48:04 +03:00
|
|
|
|
|
|
|
inputs = {
|
2022-05-16 12:54:15 +03:00
|
|
|
nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
|
|
|
|
haskell-nix.url = "github:input-output-hk/haskell.nix";
|
2023-03-22 08:23:34 +03:00
|
|
|
haskell-nix.inputs.hackage.follows = "hackage-nix";
|
|
|
|
hackage-nix.url = "github:input-output-hk/hackage.nix";
|
|
|
|
hackage-nix.flake = false;
|
2023-01-09 06:01:02 +03:00
|
|
|
flake-utils.follows = "haskell-nix/flake-utils";
|
2022-04-11 11:48:04 +03:00
|
|
|
};
|
|
|
|
|
2023-03-22 08:23:34 +03:00
|
|
|
outputs = { self, nixpkgs, flake-utils, haskell-nix, ... }:
|
2023-04-20 08:40:01 +03:00
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
2022-11-30 06:22:32 +03:00
|
|
|
let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
inherit (haskell-nix) config;
|
|
|
|
overlays = [ haskell-nix.overlay ];
|
2022-05-16 12:54:15 +03:00
|
|
|
};
|
2023-04-27 12:59:57 +03:00
|
|
|
inherit (pkgs) lib;
|
2022-11-30 06:32:17 +03:00
|
|
|
|
2023-04-27 12:59:57 +03:00
|
|
|
project = pkgs.haskell-nix.cabalProject' {
|
2023-01-09 06:01:02 +03:00
|
|
|
src = ./.;
|
2023-03-03 09:48:11 +03:00
|
|
|
compiler-nix-name = "ghc926";
|
2023-04-27 12:59:57 +03:00
|
|
|
shell.tools = {
|
|
|
|
cabal = "latest";
|
|
|
|
hlint = "latest";
|
|
|
|
haskell-language-server = "latest";
|
|
|
|
};
|
2023-01-09 06:01:02 +03:00
|
|
|
};
|
2022-12-13 05:26:26 +03:00
|
|
|
|
2023-05-03 07:32:07 +03:00
|
|
|
flake = project.flake (
|
|
|
|
lib.attrsets.optionalAttrs (system == "x86_64-linux")
|
|
|
|
{ crossPlatforms = p: [ p.musl64 ]; }
|
|
|
|
);
|
2023-06-30 19:47:53 +03:00
|
|
|
|
|
|
|
# Wrap the foliage executable with the needed dependencies in PATH.
|
|
|
|
# See #71.
|
|
|
|
wrapExe = drv:
|
|
|
|
pkgs.runCommand "foliage" {
|
|
|
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
|
|
|
} ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
makeWrapper ${drv}/bin/foliage $out/bin/foliage \
|
|
|
|
--prefix PATH : ${with pkgs; lib.makeBinPath [ curl patch ]}:$out/bin
|
|
|
|
'';
|
|
|
|
|
2023-03-03 07:31:29 +03:00
|
|
|
in
|
2023-05-03 07:32:07 +03:00
|
|
|
|
2023-04-27 12:59:57 +03:00
|
|
|
flake // {
|
|
|
|
inherit project;
|
|
|
|
|
2023-05-03 07:32:07 +03:00
|
|
|
# This is way too much boilerplate. I only want the default package to
|
|
|
|
# be the main exe (package or app) and "static" the static version on
|
|
|
|
# the systems where it is available.
|
|
|
|
|
|
|
|
apps = { default = flake.apps."foliage:exe:foliage"; }
|
|
|
|
// lib.attrsets.optionalAttrs (system == "x86_64-linux")
|
2023-06-30 19:47:53 +03:00
|
|
|
{ static = wrapExe flake.apps."x86_64-unknown-linux-musl:foliage:exe:foliage"; }
|
2023-05-03 07:32:07 +03:00
|
|
|
// lib.attrsets.optionalAttrs (system == "aarch64-linux")
|
2023-06-30 19:47:53 +03:00
|
|
|
{ static = wrapExe flake.apps."aarch64-multiplatform-musl:foliage:exe:foliage"; };
|
2023-04-27 12:59:57 +03:00
|
|
|
|
2023-05-03 07:32:07 +03:00
|
|
|
packages = { default = flake.packages."foliage:exe:foliage"; }
|
|
|
|
// lib.attrsets.optionalAttrs (system == "x86_64-linux")
|
|
|
|
{ static = flake.packages."x86_64-unknown-linux-musl:foliage:exe:foliage"; }
|
2023-05-03 09:55:58 +03:00
|
|
|
;
|
2023-05-03 07:32:07 +03:00
|
|
|
}
|
|
|
|
);
|
2022-05-16 12:54:15 +03:00
|
|
|
|
|
|
|
nixConfig = {
|
2022-12-13 04:37:01 +03:00
|
|
|
extra-substituters = [
|
|
|
|
"https://cache.iog.io"
|
|
|
|
"https://foliage.cachix.org"
|
2022-12-13 04:52:23 +03:00
|
|
|
"https://cache.zw3rk.com"
|
2022-12-13 05:26:26 +03:00
|
|
|
];
|
2022-05-16 12:54:15 +03:00
|
|
|
extra-trusted-public-keys = [
|
|
|
|
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
|
2022-08-23 17:34:39 +03:00
|
|
|
"foliage.cachix.org-1:kAFyYLnk8JcRURWReWZCatM9v3Rk24F5wNMpEj14Q/g="
|
2022-12-13 04:37:01 +03:00
|
|
|
"loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk="
|
2022-05-16 12:54:15 +03:00
|
|
|
];
|
|
|
|
};
|
2022-04-11 11:48:04 +03:00
|
|
|
}
|