-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
for nix build, use flake-utils for multi-platform and support libc++/libstdc++ Use InterruptibleFFI for safer Haskell/C++ interactions * use flake-utils. support aarch64-darwin * ghc 9.2.3. remove -Werror for now. * update nixpkgs * remove stdc++ dep * remove ../build-tools in cabal.project * if os(darwin) conditional for libc++/libstdc++ * not use os(darwin) due to cabal2nix problem * don't fix GHC version * use InterruptbileFFI * remove nix flake check in CI due to IFD limitation https://discourse.nixos.org/t/nix-flake-show-fails-when-the-flake-provides-packages-for-other-platforms/18726/2 * fix missing ForeignFunctionInterface and InterruptibleFFI for top-level modules. * make macos case pass
- Loading branch information
Showing
12 changed files
with
167 additions
and
109 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
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 |
---|---|---|
|
@@ -37,6 +37,5 @@ Library | |
Function.h | ||
cpp_magic.h | ||
ghc-options: -Wall | ||
-Werror | ||
-funbox-strict-fields | ||
-fno-warn-unused-do-bind |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,88 +1,97 @@ | ||
{ | ||
description = "fficxx"; | ||
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11"; }; | ||
outputs = { self, nixpkgs }: | ||
let | ||
pkgs = nixpkgs.legacyPackages.x86_64-linux; | ||
inputs = { | ||
# nixpkgs/master on 2022-07-18 | ||
nixpkgs.url = "github:NixOS/nixpkgs/31997025a4d59f09a9b4c55a3c6ff5ade48de2d6"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
outputs = { self, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
}; | ||
|
||
haskellPackages = pkgs.haskell.packages.ghc8107; | ||
haskellPackages = pkgs.haskellPackages; | ||
|
||
newHaskellPackages0 = haskellPackages.override { | ||
overrides = self: super: { | ||
newHaskellPackages0 = haskellPackages.override { | ||
overrides = self: super: { | ||
"fficxx-runtime" = | ||
self.callCabal2nix "fficxx-runtime" ./fficxx-runtime { }; | ||
"fficxx" = self.callCabal2nix "fficxx" ./fficxx { }; | ||
}; | ||
}; | ||
|
||
stdcxxSrc = import ./stdcxx-gen/gen.nix { | ||
inherit (pkgs) lib stdenv; | ||
haskellPackages = newHaskellPackages0; | ||
}; | ||
|
||
finalHaskellOverlay = self: super: { | ||
"fficxx-runtime" = | ||
self.callCabal2nix "fficxx-runtime" ./fficxx-runtime { }; | ||
"fficxx" = self.callCabal2nix "fficxx" ./fficxx { }; | ||
"stdcxx" = self.callCabal2nix "stdcxx" stdcxxSrc { }; | ||
}; | ||
}; | ||
|
||
stdcxxSrc = import ./stdcxx-gen/gen.nix { | ||
inherit (pkgs) stdenv; | ||
haskellPackages = newHaskellPackages0; | ||
}; | ||
|
||
finalHaskellOverlay = self: super: { | ||
"fficxx-runtime" = | ||
self.callCabal2nix "fficxx-runtime" ./fficxx-runtime { }; | ||
"fficxx" = self.callCabal2nix "fficxx" ./fficxx { }; | ||
"stdcxx" = self.callCabal2nix "stdcxx" stdcxxSrc { }; | ||
}; | ||
|
||
newHaskellPackages = haskellPackages.override { | ||
overrides = let | ||
tmfTestSrc = import ./fficxx-multipkg-test/template-member/gen.nix { | ||
inherit (pkgs) stdenv; | ||
haskellPackages = newHaskellPackages0; | ||
}; | ||
tmplDepTestSrc = import ./fficxx-multipkg-test/template-dep/gen.nix { | ||
inherit (pkgs) stdenv; | ||
haskellPackages = newHaskellPackages0; | ||
}; | ||
tmplTopLevelTestSrc = | ||
import ./fficxx-multipkg-test/template-toplevel/gen.nix { | ||
newHaskellPackages = haskellPackages.override { | ||
overrides = let | ||
tmfTestSrc = import ./fficxx-multipkg-test/template-member/gen.nix { | ||
inherit (pkgs) stdenv; | ||
haskellPackages = newHaskellPackages0; | ||
}; | ||
tmplDepTestSrc = import ./fficxx-multipkg-test/template-dep/gen.nix { | ||
inherit (pkgs) stdenv; | ||
haskellPackages = newHaskellPackages0; | ||
}; | ||
tmplTopLevelTestSrc = | ||
import ./fficxx-multipkg-test/template-toplevel/gen.nix { | ||
inherit (pkgs) stdenv; | ||
haskellPackages = newHaskellPackages0; | ||
}; | ||
|
||
in self: super: | ||
finalHaskellOverlay self super // { | ||
"fficxx-test" = self.callCabal2nix "fficxx-test" ./fficxx-test { }; | ||
"fficxx-multipkg-test" = | ||
self.callCabal2nix "fficxx-multipkg-test" ./fficxx-multipkg-test | ||
{ }; | ||
"tmf-test" = self.callCabal2nix "tmf-test" tmfTestSrc { }; | ||
"tmpl-dep-test" = | ||
self.callCabal2nix "tmpl-dep-test" tmplDepTestSrc { }; | ||
"tmpl-dup-inst" = self.callCabal2nix "tmpl-dup-inst" | ||
./fficxx-multipkg-test/tmpl-dup-inst { }; | ||
"tmpl-toplevel-test" = | ||
self.callCabal2nix "tmpl-toplevel-test" tmplTopLevelTestSrc { }; | ||
in self: super: | ||
finalHaskellOverlay self super // { | ||
"fficxx-test" = self.callCabal2nix "fficxx-test" ./fficxx-test { }; | ||
"fficxx-multipkg-test" = | ||
self.callCabal2nix "fficxx-multipkg-test" ./fficxx-multipkg-test | ||
{ }; | ||
"tmf-test" = self.callCabal2nix "tmf-test" tmfTestSrc { }; | ||
"tmpl-dep-test" = | ||
self.callCabal2nix "tmpl-dep-test" tmplDepTestSrc { }; | ||
"tmpl-dup-inst" = self.callCabal2nix "tmpl-dup-inst" | ||
./fficxx-multipkg-test/tmpl-dup-inst { }; | ||
"tmpl-toplevel-test" = | ||
self.callCabal2nix "tmpl-toplevel-test" tmplTopLevelTestSrc { }; | ||
}; | ||
}; | ||
}; | ||
|
||
in { | ||
packages.x86_64-linux = { | ||
inherit (newHaskellPackages) | ||
fficxx fficxx-runtime stdcxx fficxx-test fficxx-multipkg-test tmf-test | ||
tmpl-dep-test tmpl-dup-inst tmpl-toplevel-test; | ||
}; | ||
in { | ||
packages = { | ||
"stdcxx-src" = stdcxxSrc; | ||
inherit (newHaskellPackages) | ||
fficxx fficxx-runtime stdcxx fficxx-test fficxx-multipkg-test tmf-test | ||
tmpl-dep-test tmpl-dup-inst tmpl-toplevel-test; | ||
}; | ||
|
||
# see these issues and discussions: | ||
# - https://github.com/NixOS/nixpkgs/issues/16394 | ||
# - https://github.com/NixOS/nixpkgs/issues/25887 | ||
# - https://github.com/NixOS/nixpkgs/issues/26561 | ||
# - https://discourse.nixos.org/t/nix-haskell-development-2020/6170 | ||
overlay = final: prev: { | ||
haskellPackages = prev.haskellPackages.override (old: { | ||
overrides = final.lib.composeExtensions (old.overrides or (_: _: { })) | ||
finalHaskellOverlay; | ||
}); | ||
}; | ||
# see these issues and discussions: | ||
# - https://github.com/NixOS/nixpkgs/issues/16394 | ||
# - https://github.com/NixOS/nixpkgs/issues/25887 | ||
# - https://github.com/NixOS/nixpkgs/issues/26561 | ||
# - https://discourse.nixos.org/t/nix-haskell-development-2020/6170 | ||
overlay = final: prev: { | ||
haskellPackages = prev.haskellPackages.override (old: { | ||
overrides = final.lib.composeExtensions (old.overrides or (_: _: { })) | ||
finalHaskellOverlay; | ||
}); | ||
}; | ||
|
||
devShell.x86_64-linux = newHaskellPackages0.shellFor { | ||
packages = ps: [ ps.fficxx ps.fficxx-runtime ]; | ||
buildInputs = [ pkgs.cabal-install ]; | ||
withHoogle = false; | ||
}; | ||
}; | ||
devShell = newHaskellPackages0.shellFor { | ||
packages = ps: [ ps.fficxx ps.fficxx-runtime ]; | ||
buildInputs = [ pkgs.cabal-install pkgs.ormolu ]; | ||
withHoogle = false; | ||
}; | ||
} | ||
); | ||
} | ||
|
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
Oops, something went wrong.