Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ cabal.project.local
bench.html
splitmix-hugs
hugs.output

# nix
result
result-*
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,20 @@ generate-mix32 :
doctest :
perl -i -e 'while (<ARGV>) { print unless /package-id base-compat-\d+(\.\d+)*/; }' .ghc.environment.*
doctest src

native:
nix-build -A native.splitmix
Comment on lines +38 to +39
Copy link
Author

@alexfmpe alexfmpe Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not needed I think, given the normal cabal flow, mostly added out of completeness


freebsd:
nix-build -A freebsd.splitmix

android:
nix-build -A android.splitmix

js:
nix-build -A js.splitmix

wasm:
Copy link
Author

@alexfmpe alexfmpe Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in nixpkgs yet, so we're using ghc-wasm-meta for now.

nix shell \
'gitlab:haskell-wasm/ghc-wasm-meta/7927129e42bcd6a54b9e06e26455803fa4878261?host=gitlab.haskell.org' \
--command sh -c "wasm32-wasi-cabal update && wasm32-wasi-cabal test all --ghc-options='-single-threaded' --test-wrapper=wasmtime"
Copy link
Author

@alexfmpe alexfmpe Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if -single-threaded should instead be conditionally enabled in the .cabal since wasm backend does not currently support -threaded so for now downstream will have to disable at least that test suite

7 changes: 7 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ tests: True
allow-newer: async-2.2.5:base
allow-newer: hashable-1.4.4.0:base
allow-newer: hashable-1.4.4.0:containers

-- Due to error when building 'splitmix-tests': undefined symbol: gethostname
if arch(wasm32)
source-repository-package
type: git
location: https://github.com/haskell-wasm/hostname
tag: 8d110f03b3117af233683ac90b125fcfc767a2ef
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this will eventually get upstreamed (we are the inconvenienced downstream in this case)

43 changes: 43 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
let
pins = {
# merge ancestor of https://github.com/NixOS/nixpkgs/pull/413046
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/3ea4dc04503b4370e06eca0e43c062c8b11883fa.tar.gz";
sha256 = "sha256:04ygvidh3l3ls755b2wgl148567n9rnj168s87j03agly5wrf19c";
};
};

defaultNixpkgs = import pins.nixpkgs {};

cachedPackageSetVersion = "ghc" + builtins.replaceStrings ["."] [""] defaultNixpkgs.haskellPackages.ghc.version;

mkNixpkgs = version: import pins.nixpkgs {
config = {
packageOverrides = nixpkgs: with nixpkgs.haskell.lib.compose; {
haskell = nixpkgs.haskell // {
packages = nixpkgs.haskell.packages // {
"${version}" = nixpkgs.haskell.packages.${version}.override(old: {
overrides = self: super: {
# callCabal2nix is broken because of testu01 being missing so re-use splitmix drv
splitmix = overrideSrc
{ src = nixpkgs.lib.sourceFilesBySuffices ./. [ ".hs" ".cabal" ".c" ".md" "LICENSE" ]; }
super.splitmix;
};
});
};
};
};
};
};

build = version: getPkgs: ((getPkgs (mkNixpkgs version)).haskell.packages.${version});

in {
native = build cachedPackageSetVersion (ps: ps);

freebsd = build cachedPackageSetVersion (ps: ps.pkgsCross.x86_64-freebsd);

android = build "ghc910" (ps: ps.pkgsCross.aarch64-android-prebuilt.pkgsStatic);

js = build "ghc912" (ps: ps.pkgsCross.ghcjs);
}
Loading