~jack/libtelnet-haskell

ref: e345c0f2e7108bf8a28b59582f47de9fef0b4159 libtelnet-haskell/flake.nix -rw-r--r-- 1.3 KiB
e345c0f2Jack Kelly Rename flake 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  description = "libtelnet-haskell";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs";
    flake-compat = {
      url = "github:edolstra/flake-compat";
      flake = false;
    };
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system:
    let
      nixpkgs = import inputs.nixpkgs { inherit system; };
      inherit (nixpkgs.haskell.packages) ghc884 ghc8107 ghc902 ghc922;

      # Because the package is called libtelnet, we have to pass in
      # its pkgconfig dependency explicitly. Also turn on the example.
      makeLibtelnet = haskellPackages:
        let
          pkg = haskellPackages.callPackage ./libtelnet.nix  {
            inherit (nixpkgs) libtelnet;
          };
        in with nixpkgs.haskell.lib;
          enableCabalFlag
          (addBuildDepends pkg
            (with haskellPackages; [monad-loops network-simple]))
          "example";
    in rec
    {
      defaultPackage = packages.ghc922;
      packages = {
        ghc884 = makeLibtelnet ghc884;
        ghc8107 = makeLibtelnet ghc8107;
        ghc902 = makeLibtelnet ghc902;
        ghc922 = makeLibtelnet ghc922;
      };
      devShell = devShells.ghc922;
      devShells = builtins.mapAttrs (_: v: v.env) packages;
    }
  );
}