Skip to content
Merged
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
9 changes: 9 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ jobs:
extra_nix_config: |
extra-substituters = https://anmonteiro.nix-cache.workers.dev
extra-trusted-public-keys = ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=
- uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ matrix.platform }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ matrix.platform }}-
gc-max-store-size-linux: 8G
purge: true
purge-prefixes: nix-${{ runner.os }}-${{ matrix.platform }}-
purge-created: 0
purge-primary-key: never
- name: "Run nix-build doi2bib"
run: nix build -L .#${{ matrix.platform }}

Expand Down
2 changes: 1 addition & 1 deletion bibfmt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: "MIT"
homepage: "https://github.com/mseri/doi2bib"
bug-reports: "https://github.com/mseri/doi2bib/issues"
depends: [
"dune" {>= "2.8"}
"dune" {>= "3.0"}
"ocaml" {>= "4.14.0"}
"cmdliner" {>= "1.1.0"}
"re" {>= "1.0.0"}
Expand Down
2 changes: 1 addition & 1 deletion doi2bib.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ build: [
]
dev-repo: "git+https://github.com/mseri/doi2bib.git"
depends: [
"dune" {>= "2.8"}
"dune" {>= "3.0"}
"ocaml" {>= "4.08"}
"bibfmt" {= version}
"astring" {>= "0.8.0"}
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 2.8)
(lang dune 3.0)

(name doi2bib)

Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
in
{
packages = {
inherit native bibfmt-native bibfmt-musl;
inherit native bibfmt-native bibfmt-musl bibfmt-arm64-musl;
musl = pkgsMusl.lib.callPackageWith pkgsMusl ./nix {
static = true;
nix-filter = nix-filter.lib;
Expand Down
27 changes: 13 additions & 14 deletions nix/bibfmt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

with ocamlPackages;

buildDunePackage {
buildDunePackage ({
pname = "bibfmt";
version = "n/a";
src = with nix-filter; filter {
Expand All @@ -20,25 +20,24 @@ buildDunePackage {
];
};

OCAMLFIND_TOOLCHAIN = crossName;
propagatedBuildInputs = [
cmdliner
re
];

buildPhase = ''
echo "running\
${if static then "static" else "release"} build\
${if crossName != null then "for ${crossName}" else ""}"
} // lib.optionalAttrs (crossName == null) {

buildPhase = ''
runHook preBuild
echo "running ${if static then "static" else "release"} build"
dune build -p bibfmt -j $NIX_BUILD_CORES --display=short --profile=${if static then "static" else "release"} @install
${if crossName != null then "ln -sf $out/bin/bibfmt $out/bin/bibfmt-${crossName}" else "echo 'No crossName link needed'"}
${if crossName != null then "ln -sf _build/default/bibfmt.install _build/default/bibfmt-${crossName}.install" else "echo 'No crossName link needed'"}
runHook postBuild
'';
postInstallPhase = ''
mkdir -p $out/bin
mv _build/default/bibfmt/bin/bibfmt.exe $out/bin/bibfmt
${if crossName != null then "ln -sf $out/bin/bibfmt $out/bin/bibfmt-${crossName}" else "echo 'No crossName link needed'"}
${if crossName != null then "ln -sf _build/default/bibfmt.install _build/default/bibfmt-${crossName}.install" else "echo 'No crossName link needed'"}

} // lib.optionalAttrs (crossName != null) {

postInstall = ''
cp $out/${crossName}-sysroot/bin/* $out/bin/
'';
}

})
23 changes: 16 additions & 7 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

with ocamlPackages;

buildDunePackage {
buildDunePackage ({
pname = "doi2bib";
version = "n/a";
src = with nix-filter; filter {
Expand All @@ -21,7 +21,6 @@ buildDunePackage {
];
};

OCAMLFIND_TOOLCHAIN = crossName;
propagatedBuildInputs = [
bibfmt
astring
Expand All @@ -35,15 +34,25 @@ buildDunePackage {
re
];

buildPhase = ''
echo "running\
${if static then "static" else "release"} build\
${if crossName != null then "for ${crossName}" else ""}"
} // lib.optionalAttrs (crossName == null) {

buildPhase = ''
runHook preBuild
echo "running ${if static then "static" else "release"} build"
dune build doi2bib/bin/doi2bib.exe -j $NIX_BUILD_CORES --display=short --profile=${if static then "static" else "release"}
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mv _build/default/doi2bib/bin/doi2bib.exe $out/bin/doi2bib
runHook postInstall
'';

} // lib.optionalAttrs (crossName != null) {

postInstall = ''
cp $out/${crossName}-sysroot/bin/* $out/bin/
'';
}

})
Loading