diff --git a/overlays/cabal-install.nix b/overlays/cabal-install.nix index b8257d3b5..702d1f9d8 100644 --- a/overlays/cabal-install.nix +++ b/overlays/cabal-install.nix @@ -1,38 +1,26 @@ -{ stdenv, fetchurl, lib }: - -stdenv.mkDerivation rec { - pname = "cabal-install"; - version = "3.14.1.1"; - - src = fetchurl { - url = "https://downloads.haskell.org/~cabal/cabal-install-${version}/cabal-install-${version}-x86_64-linux-alpine3_18.tar.xz"; - sha256 = "sha256-KA273YDQ3grmr0dkNghQkUjLLs8JZ80lW1q8skHZWd4="; - }; - - # Prevent Nix from automatically unpacking the source - dontUnpack = true; - - # No build steps are required - buildPhase = ""; - - installPhase = '' - mkdir -p $out/bin - # Manually extract the tarball - tar -xJf ${src} - # Move the 'cabal' binary to $out/bin - cp -v cabal $out/bin/ - # Ensure the binary is executable - chmod +x $out/bin/cabal - ''; - - # No dependencies are needed since the binary is statically linked - buildInputs = []; - - meta = with lib; { - description = "The cabal-install tool (binary distribution)"; - homepage = "https://www.haskell.org/cabal/"; - license = licenses.bsd3; - platforms = platforms.linux; - maintainers = []; - }; +final: prev: +{ bootstrap-cabal-install = + let + cabal-install-src = final.pkgs.fetchurl { + url = "https://hackage.haskell.org/package/cabal-install-3.14.1.1/cabal-install-3.14.1.1.tar.gz"; + sha256 = "sha256-8R02Srh/tGJ1qYfmBFOFdzIUd4CoxZJGDuyKFtu2us4="; + }; + cabal-install-pkgs = final.haskell-nix.cabalProjectWithPlan + { src = cabal-install-src; + compiler-nix-name = "ghc912"; + cabalProject = '' + packages: + ./cabal-install.cabal + package cabal-install + tests: false + ''; + } + (_: { + "extra-hackages" = []; + "index-state-max" = "2025-01-17T00:00:00Z"; + "projectNix" = ../materialized/cabal-install-3.14.1.1; + "sourceRepos" = []; + "src" = cabal-install-src; + }); + in cabal-install-pkgs.hsPkgs.cabal-install.components.exes.cabal; } diff --git a/overlays/default.nix b/overlays/default.nix index 4065d17bd..a9e12831a 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,73 +1,13 @@ { sources }: let overlays = { - cabal-install-overlay = final: prev: - { bootstrap-cabal-install = - let - cabal-install-src = final.pkgs.fetchurl { - url = "https://hackage.haskell.org/package/cabal-install-3.14.1.1/cabal-install-3.14.1.1.tar.gz"; - sha256 = "sha256-8R02Srh/tGJ1qYfmBFOFdzIUd4CoxZJGDuyKFtu2us4="; - }; - cabal-install-pkgs = final.haskell-nix.cabalProjectWithPlan - { src = cabal-install-src; - compiler-nix-name = "ghc912"; - cabalProject = '' - packages: - ./cabal-install.cabal - package cabal-install - tests: false - ''; - } - (_: { - "extra-hackages" = []; - "index-state-max" = "2025-01-17T00:00:00Z"; - "projectNix" = ../materialized/cabal-install-3.14.1.1; - "sourceRepos" = []; - "src" = cabal-install-src; - }); - in cabal-install-pkgs.hsPkgs.cabal-install.components.exes.cabal; - }; + cabal-install-overlay = import ./cabal-install.nix; haskell = import ./haskell.nix { inherit sources; }; # Here is where we import nix-tools into the overlays that haskell.nix is # going to use. - nix-tools = (final: prev: - let - - # Import the overlay from nix-tools' subdirectory - nix-tools-exes = final.callPackage ./nix-tools.nix {}; - - in - { - haskell-nix = - prev.haskell-nix // { - nix-tools = - let nix-tools-pkgs = final.haskell-nix.cabalProjectWithPlan - { src = ../nix-tools; compiler-nix-name = "ghc912"; } - (_: { - "extra-hackages" = []; - "index-state-max" = "2025-01-17T00:00:00Z"; - "projectNix" = ../materialized/nix-tools; - "sourceRepos" = [ - (final.pkgs.fetchgit { - url = "https://github.com/kronor-io/hackage-db"; - sha256 = "11g395vrrsaasl1ssk8qfbcc9wx6aygipsldyclgn4szpm4xzm7h"; - rev = "83f819cb08742d3c86a83b407d45c1f6c1c7e299"; - }) - ]; - "src" = ../nix-tools; - }); - in { - exes = { - truncate-index = nix-tools-pkgs.hsPkgs.nix-tools.components.exes.truncate-index; - make-install-plan = nix-tools-pkgs.hsPkgs.nix-tools.components.exes.make-install-plan; - plan-to-nix = nix-tools-pkgs.hsPkgs.nix-tools.components.exes.plan-to-nix; - hackage-to-nix = nix-tools-pkgs.hsPkgs.nix-tools.components.exes.hackage-to-nix; - }; - }; - }; - }); + nix-tools = import ./nix-tools.nix; bootstrap = import ./bootstrap.nix; ghc = import ./ghc.nix; diff --git a/overlays/nix-tools.nix b/overlays/nix-tools.nix index 9bc9ecffe..4163870a9 100644 --- a/overlays/nix-tools.nix +++ b/overlays/nix-tools.nix @@ -1,40 +1,30 @@ -{ stdenv, fetchurl, lib }: - -stdenv.mkDerivation rec { - pname = "nix-tools"; - version = "0.1.0.0"; - - src = fetchurl { - url = "https://pgnb.s3.ap-south-2.amazonaws.com/nix-tools-alpine-amd.tar.xz"; - sha256 = "sha256-/qff9cYlWGvlWPHgsgC9OXxidK4lrF754u91gh9BbTA="; - }; - - # Prevent Nix from automatically unpacking the source - dontUnpack = true; - - # No build steps are required - buildPhase = ""; - - installPhase = '' - mkdir -p $out/bin - # Manually extract the tarball - tar -xJf ${src} - - # Move all binaries to $out/bin - find ./dist-newstyle/ -type f -executable | xargs -I {} cp -v {} $out/bin/ - - # Ensure the binaries are executable - chmod +x $out/bin/* - ''; - - # No dependencies are needed since the binary is statically linked - buildInputs = []; - - meta = with lib; { - description = "nix-tools"; - homepage = "https://github.com/input-output-hk/haskell.nix"; - license = licenses.bsd3; - platforms = platforms.linux; - maintainers = []; - }; +final: prev: +{ + haskell-nix = + prev.haskell-nix // { + nix-tools = + let nix-tools-pkgs = final.haskell-nix.cabalProjectWithPlan + { src = ../nix-tools; compiler-nix-name = "ghc912"; } + (_: { + "extra-hackages" = []; + "index-state-max" = "2025-01-17T00:00:00Z"; + "projectNix" = ../materialized/nix-tools; + "sourceRepos" = [ + (final.pkgs.fetchgit { + url = "https://github.com/kronor-io/hackage-db"; + sha256 = "11g395vrrsaasl1ssk8qfbcc9wx6aygipsldyclgn4szpm4xzm7h"; + rev = "83f819cb08742d3c86a83b407d45c1f6c1c7e299"; + }) + ]; + "src" = ../nix-tools; + }); + in { + exes = { + truncate-index = nix-tools-pkgs.hsPkgs.nix-tools.components.exes.truncate-index; + make-install-plan = nix-tools-pkgs.hsPkgs.nix-tools.components.exes.make-install-plan; + plan-to-nix = nix-tools-pkgs.hsPkgs.nix-tools.components.exes.plan-to-nix; + hackage-to-nix = nix-tools-pkgs.hsPkgs.nix-tools.components.exes.hackage-to-nix; + }; + }; + }; }