forked from input-output-hk/haskell.nix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move cabal-install, nix-tools building logic to overlay files
- Loading branch information
1 parent
1de979c
commit 3b6ae81
Showing
3 changed files
with
56 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; | ||
}; | ||
}; | ||
} |