about summary refs log tree commit diff
path: root/pkgs/tools/package-management/akku/default.nix
blob: 78cbcace5d5c825f3a01149ba6afd49332a15eaf (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib, newScope, stdenv, fetchurl }:
lib.makeScope newScope (self: rec {

  fetchAkku = { name, url, sha256, ... }:
    fetchurl {
      inherit url sha256;
    };

  akkuDerivation = self.callPackage ./akkuDerivation.nix { };
  akku = self.callPackage ./akku.nix { };

  akkuPackages =
    let
      overrides = self.callPackage ./overrides.nix { };
      makeAkkuPackage = akkuself: pname:
        { version, dependencies, dev-dependencies, license, url, sha256, source, synopsis ? "", homepage ? "", ... }:
        (akkuDerivation rec {
          inherit version pname;
          src = fetchAkku {
            inherit url sha256;
            name = pname;
          };
          buildInputs = builtins.map (x: akkuself.${x}) dependencies;
          r7rs = source == "snow-fort";
          nativeBuildInputs = builtins.map (x: akkuself.${x}) dev-dependencies;
          unpackPhase = "tar xf $src";

          meta.homepage = homepage;
          meta.description = synopsis;
          meta.license =
            let
              stringToLicense = s: (lib.licenses // (with lib.licenses; {
                "agpl" = agpl3Only;
                "artistic" = artistic2;
                "bsd" = bsd3;
                "bsd-1-clause" = bsd1;
                "bsd-2-clause" = bsd2;
                "bsd-3-clause" = bsd3;
                "gpl" = gpl3Only;
                "gpl-2" = gpl2Only;
                "gplv2" = gpl2Only;
                "gpl-3" = gpl3Only;
                "gpl-3.0" = gpl3Only;
                "gplv3" = gpl3Only;
                "lgpl" = lgpl3Only;
                "lgpl-2" = lgpl2Only;
                "lgpl-2.0+" = lgpl2Plus;
                "lgpl-2.1" = lgpl21Only;
                "lgpl-2.1-or-later" = lgpl21Plus;
                "lgpl-3" = lgpl3Only;
                "lgplv3" = lgpl3Only;
                "public-domain" = publicDomain;
                "srfi" = bsd3;
                "unicode" = ucd;
                "zlib-acknowledgement" = zlib;
              })).${s} or s;
            in
            if builtins.isList license
            then map stringToLicense license
            else stringToLicense license;
        }).overrideAttrs ({ "${pname}" = lib.id; } // overrides)."${pname}";
      deps = lib.importTOML ./deps.toml;
      packages = lib.makeScope self.newScope (akkuself: lib.mapAttrs (makeAkkuPackage akkuself) deps);
    in
    lib.recurseIntoAttrs packages;
})