haskellPackages.cabal2nix-unstable: override with unstable dependencies
These dependencies need to be pulled from the same unstable commit that
cabal2nix is pulled from, otherwise changes to any of them will not be
in effect and possibly break the build.
(cherry picked from commit 631661e66c)
This commit is contained in:
@@ -12,8 +12,16 @@ head_info="$(curl -H "Accept: application/vnd.github.v3+json" https://api.github
|
||||
commit="$(jq -r .commit.sha <<< "$head_info")"
|
||||
# extract commit timestamp and convert to date
|
||||
date="$(date "--date=$(jq -r .commit.commit.committer.date <<< "$head_info")" +%F)"
|
||||
|
||||
# generate nix expression from cabal file, replacing the version with the commit date
|
||||
output=pkgs/development/haskell-modules/cabal2nix-unstable.nix
|
||||
echo '# This file defines cabal2nix-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh.' > "$output"
|
||||
cabal2nix --subpath cabal2nix "https://github.com/NixOS/cabal2nix/archive/$commit.tar.gz" | sed -Ee 's/version = "(.*)"/version = "\1-unstable-'"$date"'"/' >> "$output"
|
||||
nixfmt "$output"
|
||||
function mkPackage() {
|
||||
output=pkgs/development/haskell-modules/cabal2nix-unstable/$1.nix
|
||||
echo "# This file defines $1-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh." > "$output"
|
||||
cabal2nix --subpath "$1" "https://github.com/NixOS/cabal2nix/archive/$commit.tar.gz" | sed -Ee 's/version = "(.*)"/version = "\1-unstable-'"$date"'"/' >> "$output"
|
||||
nixfmt "$output"
|
||||
}
|
||||
|
||||
mkPackage "cabal2nix"
|
||||
mkPackage "distribution-nixpkgs"
|
||||
mkPackage "hackage-db"
|
||||
mkPackage "language-nix"
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
# This file defines distribution-nixpkgs-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh.
|
||||
{
|
||||
mkDerivation,
|
||||
aeson,
|
||||
base,
|
||||
bytestring,
|
||||
Cabal,
|
||||
containers,
|
||||
deepseq,
|
||||
directory,
|
||||
fetchzip,
|
||||
hspec,
|
||||
language-nix,
|
||||
lens,
|
||||
lib,
|
||||
pretty,
|
||||
process,
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "distribution-nixpkgs";
|
||||
version = "1.7.1.1-unstable-2025-09-09";
|
||||
src = fetchzip {
|
||||
url = "https://github.com/NixOS/cabal2nix/archive/987474e0b0ed1c6b0e3fd0d07313f6996ec98b7e.tar.gz";
|
||||
sha256 = "0nixn8incqypsfyfclj40p8bdx2yn4783kzwpqfp19ql2sbc57dc";
|
||||
};
|
||||
postUnpack = "sourceRoot+=/distribution-nixpkgs; echo source root reset to $sourceRoot";
|
||||
enableSeparateDataOutput = true;
|
||||
libraryHaskellDepends = [
|
||||
aeson
|
||||
base
|
||||
bytestring
|
||||
Cabal
|
||||
containers
|
||||
deepseq
|
||||
language-nix
|
||||
lens
|
||||
pretty
|
||||
process
|
||||
];
|
||||
testHaskellDepends = [
|
||||
aeson
|
||||
base
|
||||
Cabal
|
||||
deepseq
|
||||
directory
|
||||
hspec
|
||||
language-nix
|
||||
lens
|
||||
];
|
||||
homepage = "https://github.com/NixOS/cabal2nix/tree/master/distribution-nixpkgs#readme";
|
||||
description = "Types and functions to manipulate the Nixpkgs distribution";
|
||||
license = lib.licenses.bsd3;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
# This file defines hackage-db-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh.
|
||||
{
|
||||
mkDerivation,
|
||||
aeson,
|
||||
base,
|
||||
bytestring,
|
||||
Cabal,
|
||||
containers,
|
||||
directory,
|
||||
exceptions,
|
||||
fetchzip,
|
||||
filepath,
|
||||
lib,
|
||||
tar,
|
||||
time,
|
||||
utf8-string,
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "hackage-db";
|
||||
version = "2.1.3-unstable-2025-09-09";
|
||||
src = fetchzip {
|
||||
url = "https://github.com/NixOS/cabal2nix/archive/987474e0b0ed1c6b0e3fd0d07313f6996ec98b7e.tar.gz";
|
||||
sha256 = "0nixn8incqypsfyfclj40p8bdx2yn4783kzwpqfp19ql2sbc57dc";
|
||||
};
|
||||
postUnpack = "sourceRoot+=/hackage-db; echo source root reset to $sourceRoot";
|
||||
isLibrary = true;
|
||||
isExecutable = true;
|
||||
libraryHaskellDepends = [
|
||||
aeson
|
||||
base
|
||||
bytestring
|
||||
Cabal
|
||||
containers
|
||||
directory
|
||||
exceptions
|
||||
filepath
|
||||
tar
|
||||
time
|
||||
utf8-string
|
||||
];
|
||||
homepage = "https://github.com/NixOS/cabal2nix/tree/master/hackage-db#readme";
|
||||
description = "Access cabal-install's Hackage database via Data.Map";
|
||||
license = lib.licenses.bsd3;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
# This file defines language-nix-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh.
|
||||
{
|
||||
mkDerivation,
|
||||
base,
|
||||
deepseq,
|
||||
fetchzip,
|
||||
lens,
|
||||
lib,
|
||||
parsec-class,
|
||||
pretty,
|
||||
QuickCheck,
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "language-nix";
|
||||
version = "2.2.0-unstable-2025-09-09";
|
||||
src = fetchzip {
|
||||
url = "https://github.com/NixOS/cabal2nix/archive/987474e0b0ed1c6b0e3fd0d07313f6996ec98b7e.tar.gz";
|
||||
sha256 = "0nixn8incqypsfyfclj40p8bdx2yn4783kzwpqfp19ql2sbc57dc";
|
||||
};
|
||||
postUnpack = "sourceRoot+=/language-nix; echo source root reset to $sourceRoot";
|
||||
libraryHaskellDepends = [
|
||||
base
|
||||
deepseq
|
||||
lens
|
||||
parsec-class
|
||||
pretty
|
||||
QuickCheck
|
||||
];
|
||||
homepage = "https://github.com/NixOS/cabal2nix/tree/master/language-nix#readme";
|
||||
description = "Data types and functions to represent the Nix language";
|
||||
license = lib.licenses.bsd3;
|
||||
}
|
||||
@@ -171,12 +171,16 @@ with haskellLib;
|
||||
];
|
||||
|
||||
cabal2nix-unstable = super.cabal2nix-unstable.overrideScope cabalInstallOverlay;
|
||||
distribution-nixpkgs-unstable = super.distribution-nixpkgs-unstable.overrideScope cabalInstallOverlay;
|
||||
hackage-db-unstable = super.hackage-db-unstable.overrideScope cabalInstallOverlay;
|
||||
}
|
||||
)
|
||||
cabal-install
|
||||
cabal-install-solver
|
||||
guardian
|
||||
cabal2nix-unstable
|
||||
distribution-nixpkgs-unstable
|
||||
hackage-db-unstable
|
||||
;
|
||||
|
||||
# Expected test output for these accidentally checks the absolute location of the source directory
|
||||
|
||||
@@ -354,10 +354,7 @@ self: super:
|
||||
# after verifying they are indeed erroneous (e.g. cabal2nix) or just disable
|
||||
# the check, sticking with the status quo. Ideally there'll be zero cases of
|
||||
# the latter in the future!
|
||||
inherit
|
||||
(lib.mapAttrs (
|
||||
_:
|
||||
overrideCabal (old: {
|
||||
cabal2nix = overrideCabal (old: {
|
||||
postInstall = ''
|
||||
remove-references-to -t ${self.hpack} "$out/bin/cabal2nix"
|
||||
# Note: The `data` output is needed at runtime.
|
||||
@@ -365,11 +362,16 @@ self: super:
|
||||
|
||||
${old.postInstall or ""}
|
||||
'';
|
||||
})
|
||||
) super)
|
||||
cabal2nix
|
||||
cabal2nix-unstable
|
||||
;
|
||||
}) super.cabal2nix;
|
||||
cabal2nix-unstable = overrideCabal (old: {
|
||||
postInstall = ''
|
||||
remove-references-to -t ${self.hpack} "$out/bin/cabal2nix"
|
||||
# Note: The `data` output is needed at runtime.
|
||||
remove-references-to -t ${self.distribution-nixpkgs-unstable.out} "$out/bin/hackage2nix"
|
||||
|
||||
${old.postInstall or ""}
|
||||
'';
|
||||
}) super.cabal2nix-unstable;
|
||||
|
||||
# https://github.com/fpco/unliftio/issues/87
|
||||
unliftio = dontCheck super.unliftio;
|
||||
|
||||
@@ -28,7 +28,16 @@ self: super:
|
||||
|
||||
# Used by maintainers/scripts/regenerate-hackage-packages.sh, and generated
|
||||
# from the latest master instead of the current version on Hackage.
|
||||
cabal2nix-unstable = self.callPackage ./cabal2nix-unstable.nix { };
|
||||
cabal2nix-unstable = self.callPackage ./cabal2nix-unstable/cabal2nix.nix {
|
||||
distribution-nixpkgs = self.distribution-nixpkgs-unstable;
|
||||
hackage-db = self.hackage-db-unstable;
|
||||
language-nix = self.language-nix-unstable;
|
||||
};
|
||||
distribution-nixpkgs-unstable = self.callPackage ./cabal2nix-unstable/distribution-nixpkgs.nix {
|
||||
language-nix = self.language-nix-unstable;
|
||||
};
|
||||
hackage-db-unstable = self.callPackage ./cabal2nix-unstable/hackage-db.nix { };
|
||||
language-nix-unstable = self.callPackage ./cabal2nix-unstable/language-nix.nix { };
|
||||
|
||||
ghc-settings-edit = self.callPackage ../tools/haskell/ghc-settings-edit { };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user