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.
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")"
|
commit="$(jq -r .commit.sha <<< "$head_info")"
|
||||||
# extract commit timestamp and convert to date
|
# extract commit timestamp and convert to date
|
||||||
date="$(date "--date=$(jq -r .commit.commit.committer.date <<< "$head_info")" +%F)"
|
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
|
# generate nix expression from cabal file, replacing the version with the commit date
|
||||||
output=pkgs/development/haskell-modules/cabal2nix-unstable.nix
|
function mkPackage() {
|
||||||
echo '# This file defines cabal2nix-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh.' > "$output"
|
output=pkgs/development/haskell-modules/cabal2nix-unstable/$1.nix
|
||||||
cabal2nix --subpath cabal2nix "https://github.com/NixOS/cabal2nix/archive/$commit.tar.gz" | sed -Ee 's/version = "(.*)"/version = "\1-unstable-'"$date"'"/' >> "$output"
|
echo "# This file defines $1-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh." > "$output"
|
||||||
nixfmt "$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-08-10";
|
||||||
|
src = fetchzip {
|
||||||
|
url = "https://github.com/NixOS/cabal2nix/archive/31c6db234a905bbf4e8f34c5a986f294b231de0a.tar.gz";
|
||||||
|
sha256 = "1ifbmcm5k8mxcpq4kscfc5ddcknawxz6a4ak30jmf0kk1lrfsikf";
|
||||||
|
};
|
||||||
|
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-08-10";
|
||||||
|
src = fetchzip {
|
||||||
|
url = "https://github.com/NixOS/cabal2nix/archive/31c6db234a905bbf4e8f34c5a986f294b231de0a.tar.gz";
|
||||||
|
sha256 = "1ifbmcm5k8mxcpq4kscfc5ddcknawxz6a4ak30jmf0kk1lrfsikf";
|
||||||
|
};
|
||||||
|
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-08-10";
|
||||||
|
src = fetchzip {
|
||||||
|
url = "https://github.com/NixOS/cabal2nix/archive/31c6db234a905bbf4e8f34c5a986f294b231de0a.tar.gz";
|
||||||
|
sha256 = "1ifbmcm5k8mxcpq4kscfc5ddcknawxz6a4ak30jmf0kk1lrfsikf";
|
||||||
|
};
|
||||||
|
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;
|
||||||
|
}
|
||||||
@@ -191,6 +191,7 @@ with haskellLib;
|
|||||||
|
|
||||||
# cabal2nix depends on hpack which doesn't support Cabal >= 3.16
|
# cabal2nix depends on hpack which doesn't support Cabal >= 3.16
|
||||||
cabal2nix-unstable = super.cabal2nix-unstable.override (
|
cabal2nix-unstable = super.cabal2nix-unstable.override (
|
||||||
|
prev:
|
||||||
# Manually override the relevant dependencies to reduce rebuild amount
|
# Manually override the relevant dependencies to reduce rebuild amount
|
||||||
let
|
let
|
||||||
cabalOverride = {
|
cabalOverride = {
|
||||||
@@ -199,7 +200,7 @@ with haskellLib;
|
|||||||
in
|
in
|
||||||
cabalOverride
|
cabalOverride
|
||||||
// lib.mapAttrs (_: drv: drv.override cabalOverride) {
|
// lib.mapAttrs (_: drv: drv.override cabalOverride) {
|
||||||
inherit (self)
|
inherit (prev)
|
||||||
distribution-nixpkgs
|
distribution-nixpkgs
|
||||||
hackage-db
|
hackage-db
|
||||||
hpack
|
hpack
|
||||||
|
|||||||
@@ -341,22 +341,24 @@ self: super:
|
|||||||
# after verifying they are indeed erroneous (e.g. cabal2nix) or just disable
|
# 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 check, sticking with the status quo. Ideally there'll be zero cases of
|
||||||
# the latter in the future!
|
# the latter in the future!
|
||||||
inherit
|
cabal2nix = overrideCabal (old: {
|
||||||
(lib.mapAttrs (
|
postInstall = ''
|
||||||
_:
|
remove-references-to -t ${self.hpack} "$out/bin/cabal2nix"
|
||||||
overrideCabal (old: {
|
# Note: The `data` output is needed at runtime.
|
||||||
postInstall = ''
|
remove-references-to -t ${self.distribution-nixpkgs.out} "$out/bin/hackage2nix"
|
||||||
remove-references-to -t ${self.hpack} "$out/bin/cabal2nix"
|
|
||||||
# Note: The `data` output is needed at runtime.
|
|
||||||
remove-references-to -t ${self.distribution-nixpkgs.out} "$out/bin/hackage2nix"
|
|
||||||
|
|
||||||
${old.postInstall or ""}
|
${old.postInstall or ""}
|
||||||
'';
|
'';
|
||||||
})
|
}) super.cabal2nix;
|
||||||
) super)
|
cabal2nix-unstable = overrideCabal (old: {
|
||||||
cabal2nix
|
postInstall = ''
|
||||||
cabal2nix-unstable
|
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
|
# https://github.com/fpco/unliftio/issues/87
|
||||||
unliftio = dontCheck super.unliftio;
|
unliftio = dontCheck super.unliftio;
|
||||||
|
|||||||
@@ -28,7 +28,16 @@ self: super:
|
|||||||
|
|
||||||
# Used by maintainers/scripts/regenerate-hackage-packages.sh, and generated
|
# Used by maintainers/scripts/regenerate-hackage-packages.sh, and generated
|
||||||
# from the latest master instead of the current version on Hackage.
|
# 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 { };
|
ghc-settings-edit = self.callPackage ../tools/haskell/ghc-settings-edit { };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user