about summary refs log tree commit diff
path: root/pkgs/tools/package-management/akku/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/package-management/akku/default.nix')
-rw-r--r--pkgs/tools/package-management/akku/default.nix100
1 files changed, 62 insertions, 38 deletions
diff --git a/pkgs/tools/package-management/akku/default.nix b/pkgs/tools/package-management/akku/default.nix
index 4b96fed6d32ab..78cbcace5d5c8 100644
--- a/pkgs/tools/package-management/akku/default.nix
+++ b/pkgs/tools/package-management/akku/default.nix
@@ -1,42 +1,66 @@
-{ lib, stdenv, fetchFromGitLab, autoreconfHook, pkg-config, guile, curl, substituteAll }:
+{ lib, newScope, stdenv, fetchurl }:
+lib.makeScope newScope (self: rec {
 
-stdenv.mkDerivation rec {
-  pname = "akku";
-  version = "1.1.0";
+  fetchAkku = { name, url, sha256, ... }:
+    fetchurl {
+      inherit url sha256;
+    };
 
-  src = fetchFromGitLab {
-    owner = "akkuscm";
-    repo = "akku";
-    rev = "v${version}";
-    sha256 = "1pi18aamg1fd6f9ynfl7zx92052xzf0zwmhi2pwcwjs1kbah19f5";
-  };
+  akkuDerivation = self.callPackage ./akkuDerivation.nix { };
+  akku = self.callPackage ./akku.nix { };
 
-  patches = [
-    # substitute libcurl path
-    (substituteAll {
-      src = ./hardcode-libcurl.patch;
-      libcurl = "${curl.out}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary}";
-    })
-  ];
+  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";
 
-  nativeBuildInputs = [ autoreconfHook pkg-config ];
-
-  buildInputs = [ guile ];
-
-  # Use a dummy package index to boostrap Akku
-  preBuild = ''
-    touch bootstrap.db
-  '';
-
-  makeFlags = [ "GUILE_AUTO_COMPILE=0" ];
-
-  meta = with lib; {
-    homepage = "https://akkuscm.org/";
-    description = "Language package manager for Scheme";
-    changelog = "https://gitlab.com/akkuscm/akku/-/raw/v${version}/NEWS.md";
-    platforms = platforms.all;
-    license = licenses.gpl3Plus;
-    maintainers = with maintainers; [ ];
-    mainProgram = "akku";
-  };
-}
+          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;
+})