-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nix: refatored how shell & tools are provided
- Loading branch information
Showing
5 changed files
with
158 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,47 @@ | ||
{ pkgs }: | ||
with pkgs; | ||
let | ||
src = haskell-nix.haskellLib.cleanGit { | ||
name = "network-docs"; | ||
inputs: final: prev: { | ||
network-docs = final.stdenvNoCC.mkDerivation { | ||
name = "ouroboros-network-docs"; | ||
src = ../.; | ||
subDir = "docs"; | ||
}; | ||
cddl-specs = ../ouroboros-network-protocols/test-cddl/specs; | ||
in pkgs.runCommand "network-docs" { | ||
meta.platforms = with pkgs.lib.platforms; [ linux darwin ]; | ||
nativeBuildInputs = [ imagemagick ]; | ||
buildInputs = [ | ||
(texlive.combine { | ||
inherit (texlive) | ||
cleveref framed scheme-small collection-fontsrecommended stmaryrd | ||
kpfonts geometry hyperref todonotes amsmath mathtools colortbl polytable | ||
lazylist fancyvrb | ||
#graphicx | ||
pstricks wrapfig | ||
# build tools | ||
latexmk; | ||
}) | ||
]; | ||
} '' | ||
for d in network-design network-spec; do | ||
mkdir -p docs/$d | ||
ln -s ${src}/$d/* docs/$d/ | ||
done | ||
nativeBuildInputs = [ | ||
(final.texlive.combine { | ||
inherit (final.texlive) | ||
collection-latexextra | ||
collection-latexrecommended | ||
collection-mathscience | ||
latexmk; | ||
}) | ||
]; | ||
buildPhase = | ||
let src = ../.; | ||
cddl-specs = ../ouroboros-network-protocols/test-cddl/specs; in | ||
'' | ||
for d in network-design network-spec; do | ||
mkdir -p docs/$d | ||
ln -s ${src}/$d/* docs/$d/ | ||
done | ||
mkdir -p ouroboros-network-protocols/test-cddl/specs | ||
cp ${cddl-specs}/*.cddl ouroboros-network-protocols/test-cddl/specs | ||
mkdir -p ouroboros-network-protocols/test-cddl/specs | ||
cp ${cddl-specs}/*.cddl ouroboros-network-protocols/test-cddl/specs | ||
mkdir -p $out | ||
mkdir -p $out | ||
( | ||
cd docs/network-design | ||
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" | ||
cp -a *.pdf $out/ | ||
) | ||
( | ||
cd docs/network-design | ||
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" | ||
cp -a *.pdf $out/ | ||
) | ||
( | ||
cd docs/network-spec | ||
make all | ||
cp -a *.pdf $out/ | ||
) | ||
( | ||
cd docs/network-spec | ||
make all | ||
cp -a *.pdf $out/ | ||
) | ||
mkdir -p $out/nix-support | ||
mkdir -p $out/nix-support | ||
for pdf in $out/*.pdf; do | ||
echo "file binary-dist $pdf" >> $out/nix-support/hydra-build-products | ||
done | ||
'' | ||
for pdf in $out/*.pdf; do | ||
echo "file binary-dist $pdf" >> $out/nix-support/hydra-build-products | ||
done | ||
''; | ||
}; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ hls, inputs, pkgs, ouroboros-network }: | ||
|
||
let | ||
inherit (pkgs) lib; | ||
in | ||
ouroboros-network.shellFor { | ||
nativeBuildInputs = [ | ||
pkgs.cabal | ||
pkgs.fd | ||
pkgs.nixpkgs-fmt | ||
pkgs.stylish-haskell | ||
pkgs.ghcid | ||
(pkgs.texlive.combine { | ||
inherit (pkgs.texlive) | ||
collection-latexextra | ||
collection-latexrecommended | ||
collection-mathscience | ||
latexmk; | ||
}) | ||
]; | ||
|
||
# This is the place for tools that are required to be built with the same GHC | ||
# version as used in ouroboros-network. | ||
tools = | ||
lib.optionalAttrs hls | ||
{ | ||
haskell-language-server = { | ||
src = inputs.haskellNix.inputs."hls-2.7"; | ||
configureArgs = "--disable-benchmarks --disable-tests"; | ||
}; | ||
}; | ||
|
||
shellHook = '' | ||
export LANG="en_US.UTF-8" | ||
'' + lib.optionalString | ||
(pkgs.glibcLocales != null && pkgs.stdenv.hostPlatform.libc == "glibc") '' | ||
export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive" | ||
''; | ||
|
||
withHoogle = true; | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
inputs: final: prev: | ||
|
||
let | ||
inherit (final) lib; | ||
tool-index-state = "2024-07-04T00:00:00Z"; | ||
tool = name: version: other: | ||
final.haskell-nix.tool final.ouroboros-network.args.compiler-nix-name name ({ | ||
version = version; | ||
index-state = tool-index-state; | ||
} // other); | ||
in | ||
{ | ||
inherit tool-index-state; | ||
cabal = tool "cabal" "3.12.1.0" { }; | ||
stylish-haskell = tool "stylish-haskell" "0.14.6.0" { }; | ||
haskellBuildUtils = prev.haskellBuildUtils.override { | ||
inherit (final.ouroboros-network.args) compiler-nix-name; | ||
index-state = tool-index-state; | ||
}; | ||
} | ||
|