diff options
25 files changed, 356 insertions, 1477 deletions
diff --git a/default.nix b/default.nix index f3ad1cd..fa1969f 100755 --- a/default.nix +++ b/default.nix @@ -1,22 +1,110 @@ -{ pkgs ? import <nixpkgs> {} }: -with import ./nix/mkDub.nix { inherit pkgs; }; +#!/usr/bin/env -S nix-build +{ pkgs ? import <nixpkgs> {}, + stdenv ? pkgs.stdenv, + lib ? pkgs.lib, + ldc ? null, + dcompiler ? pkgs.ldc, + dub ? pkgs.dub +}: +assert dcompiler != null; +with ( + assert dcompiler != null; + with lib; + let + # Filter function to remove the .dub package folder from src + filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( + type == "directory" && baseName == ".dub" + ); + targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; + # Remove reference to build tools and library sources + disallowedReferences = deps: [ dcompiler dub ]; + removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; + in { + mkDubDerivation = lib.makeOverridable ({ + src, + nativeBuildInputs ? [], + dubJSON ? src + "/dub.json", + passthru ? {}, + package ? lib.importJSON dubJSON, + ... + } @ attrs: stdenv.mkDerivation (attrs // { + pname = package.name; + nativeBuildInputs = [ dcompiler dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; + disallowedReferences = disallowedReferences deps; + passthru = passthru // { + inherit dub dcompiler pkgs; + }; + src = lib.cleanSourceWith { + filter = filterDub; + src = lib.cleanSource src; + }; + preFixup = '' + find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true + ''; + buildPhase = '' + runHook preBuild + export HOME=$PWD + for dc_ in dmd ldmd2 gdmd; do + echo "- check for D compiler $dc_" + dc=$(type -P $dc_ || echo "") + if [ ! "$dc" == "" ]; then + break + fi + done + if [ "$dc" == "" ]; then + exit "Error: could not find D compiler" + fi + echo "$dc_ used as D compiler to build $pname" + dub build --compiler=$dc --build=release --combined --skip-registry=all + runHook postBuild + ''; + checkPhase = '' + runHook preCheck + export HOME=$PWD + dub test --combined --skip-registry=all + runHook postCheck + ''; + installPhase = '' + runHook preInstall + mkdir -p $out/bin + cp -r "${targetOf package}" $out/bin + runHook postInstall + ''; + meta = lib.optionalAttrs (package ? description) { + description = package.description; + } // attrs.meta or {}; + } // lib.optionalAttrs (!(attrs ? version)) { + # Use name from dub.json, unless pname and version are specified + name = package.name; + })); + } +); mkDubDerivation rec { name = "spine-${version}"; version = "0.11.3"; src = ./.; buildInputs = [ pkgs.sqlite - (import ./nix/pkglst/shell-pkgs.nix { inherit pkgs; }) + ( + with pkgs; [ + nixFlakes + rund + dub + ldc + sqlite + ] + ) ]; - # installPhase = '' - # install -m755 -D spine $out/bin/spine - # echo "built $out/bin/spine" - # ''; + # buildPhase = [ ]; + installPhase = '' + install -m755 -D spine $out/bin/spine + echo "built $out/bin/spine" + ''; meta = with pkgs.lib; { - homepage = https://sisudoc.org; + homepage = https://sisudoc.org; description = "a sisu like document parser"; - license = licenses.agpl3Plus; - platforms = platforms.linux; + license = licenses.agpl3Plus; + platforms = platforms.linux; maintainers = [ RalphAmissah ]; }; } @@ -3,12 +3,8 @@ inputs = { flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "/nixpkgs-ra/nixpkgs"; - dub2nix-src = { - url = "github:lionello/dub2nix"; - flake = false; - }; }; - outputs = { self, dub2nix-src, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils }: let pkgs = nixpkgs.legacyPackages.x86_64-linux; in { @@ -133,25 +133,6 @@ get_depends: fi; \ fi; \ done; \ - ewd="$${hwd}/src/build_depends" && \ - dirs=$$(echo `ls -gx $${ewd}`) && \ - cd $${ewd} && \ - for dir in $${dirs}; do \ - if [ -d $${dir} ]; then \ - echo $${dir} && \ - if [[ "dub2nix" == $${dir} ]]; then \ - echo $${dir} && \ - rm -rf $${dir} && \ - git clone --depth=1 https://github.com/lionello/$${dir} && \ - cd $${dir} && \ - echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ - echo "https://github.com/lionello/$${dir}" >> ../$${dir}.meta && \ - echo "MIT License" >> ../$${dir}.meta && \ - cd $${ewd} && \ - rm -rf $${dir}/.git; \ - fi; \ - fi; \ - done; \ cd $${hwd} set_depends: get_depends dub describe | sed 's~$(shell echo `pwd | sed 's_/_\\/_g'`)~.~g' > dub_describe.json diff --git a/nix/dub.selections.nix b/nix/dub.selections.nix deleted file mode 100644 index 9316b60..0000000 --- a/nix/dub.selections.nix +++ /dev/null @@ -1,2 +0,0 @@ -# This file was generated by https://github.com/lionello/dub2nix v0.2.3 -[ ] diff --git a/nix/mkDub.nix b/nix/mkDub.nix deleted file mode 100644 index 2121166..0000000 --- a/nix/mkDub.nix +++ /dev/null @@ -1,108 +0,0 @@ -{ pkgs ? import <nixpkgs> {}, - stdenv ? pkgs.stdenv, - lib ? pkgs.lib, - ldc ? null, - dcompiler ? pkgs.ldc, - dub ? pkgs.dub -}: -assert dcompiler != null; -with stdenv lib; -let - # Filter function to remove the .dub package folder from src - filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( - type == "directory" && baseName == ".dub" - ); - # Convert a GIT rev string (tag) to a simple semver version - rev-to-version = builtins.replaceStrings ["v" "refs/tags/v"] ["" ""]; - dep2src = dubDep: pkgs.fetchgit { inherit (dubDep.fetch) url rev sha256 fetchSubmodules; }; - # Fetch a dependency (source only for now) - fromDub = dubDep: mkDerivation rec { - name = "${src.name}-${version}"; - version = rev-to-version dubDep.fetch.rev; - nativeBuildInputs = [ dcompiler dub ]; - src = dep2src dubDep; - buildPhase = '' - runHook preBuild - export HOME=$NIX_BUILD_TOP - #export HOME=$PWD - dub build -b=release - runHook postBuild - ''; - # outputs = [ "lib" ]; - # installPhase = '' - # runHook preInstall - # mkdir -p $out/bin - # runHook postInstall - # ''; - }; - # Adds a local package directory (e.g. a git repository) to Dub - dub-add-local = dubDep: "dub add-local ${(fromDub dubDep).src.outPath} ${rev-to-version dubDep.fetch.rev}"; - # The target output of the Dub package - targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; - # Remove reference to build tools and library sources - disallowedReferences = deps: [ dcompiler dub ] ++ builtins.map dep2src deps; - removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; -in { - inherit fromDub; - mkDubDerivation = lib.makeOverridable ({ - src, - nativeBuildInputs ? [], - dubJSON ? src + "/dub.json", - selections ? src + "/nix/dub.selections.nix", - deps ? import selections, - passthru ? {}, - package ? lib.importJSON dubJSON, - ... - } @ attrs: stdenv.mkDerivation (attrs // { - pname = package.name; - nativeBuildInputs = [ dcompiler dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; - disallowedReferences = disallowedReferences deps; - passthru = passthru // { - inherit dub dcompiler pkgs; - }; - src = lib.cleanSourceWith { - filter = filterDub; - src = lib.cleanSource src; - }; - preFixup = '' - find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true - ''; - buildPhase = '' - runHook preBuild - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - for dc_ in dmd ldmd2 gdmd; do - echo "- check for D compiler $dc_" - dc=$(type -P $dc_ || echo "") - if [ ! "$dc" == "" ]; then - break - fi - done - if [ "$dc" == "" ]; then - exit "Error: could not find D compiler" - fi - echo "$dc_ used as D compiler to build $pname" - dub build --compiler=$dc --build=release --combined --skip-registry=all - runHook postBuild - ''; - checkPhase = '' - runHook preCheck - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - dub test --combined --skip-registry=all - runHook postCheck - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/bin - cp -r "${targetOf package}" $out/bin - runHook postInstall - ''; - meta = lib.optionalAttrs (package ? description) { - description = package.description; - } // attrs.meta or {}; - } // lib.optionalAttrs (!(attrs ? version)) { - # Use name from dub.json, unless pname and version are specified - name = package.name; - })); -} diff --git a/nix/pkglst/shell-pkgs.nix b/nix/pkglst/shell-pkgs.nix deleted file mode 100644 index b11ae94..0000000 --- a/nix/pkglst/shell-pkgs.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs ? import <nixpkgs> {} }: -let - dub2nix-src = ./src/build_depends/dub2nix/.; - dub2nix = (import dub2nix-src) { inherit pkgs; }; -in -with pkgs; [ - nixFlakes - rund - dub - ldc - sqlite - nix-prefetch-git - validatePkgConfig - jq - git -] diff --git a/nix/shell/shell_spine.nix b/nix/shell/shell_spine.nix deleted file mode 100755 index 766f6ee..0000000 --- a/nix/shell/shell_spine.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs ? import <nixpkgs> {} }: -pkgs.mkShell { - buildInputs = with pkgs; [ - (import ../pkglst/shell-pkgs.nix { inherit pkgs; }) - ]; - buildPhase = "nix build -f default.nix"; - shellHook = '' - if [[ -e ".envrc" ]]; then - source .envrc - fi - nix-build - RUN="./result/bin/spine --very-verbose --theme-light --html --epub --sqlite-discrete --output=/tmp/www ./data/pod/sisu-spine-markup" - $RUN - echo "built spine ... @ ./result/bin/spine" - echo "& (tested with) run:" - echo " $RUN" - ''; -} diff --git a/org/spine_build_scaffold.org b/org/spine_build_scaffold.org index be0bbab..0b8f763 100644 --- a/org/spine_build_scaffold.org +++ b/org/spine_build_scaffold.org @@ -394,25 +394,6 @@ get_depends: fi; \ fi; \ done; \ - ewd="$${hwd}/src/build_depends" && \ - dirs=$$(echo `ls -gx $${ewd}`) && \ - cd $${ewd} && \ - for dir in $${dirs}; do \ - if [ -d $${dir} ]; then \ - echo $${dir} && \ - if [[ "dub2nix" == $${dir} ]]; then \ - echo $${dir} && \ - rm -rf $${dir} && \ - git clone --depth=1 https://github.com/lionello/$${dir} && \ - cd $${dir} && \ - echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ - echo "https://github.com/lionello/$${dir}" >> ../$${dir}.meta && \ - echo "MIT License" >> ../$${dir}.meta && \ - cd $${ewd} && \ - rm -rf $${dir}/.git; \ - fi; \ - fi; \ - done; \ cd $${hwd} set_depends: get_depends dub describe | sed 's~$(shell echo `pwd | sed 's_/_\\/_g'`)~.~g' > dub_describe.json @@ -2052,67 +2033,6 @@ tinyendian_dep = declare_dependency( - default.nix - shell.nix -- dub2.nix - -** dub2nix notes (from author (Lionello Lunesu) email reply, 2020-10-12) NOTE - -- https://github.com/lionello/dub2nix - -- see shell.nix minimal content: - -- run: nix-shell - -- run: dub init - -- add d2sqlite3 dependency (provide as dependency during “dub init” or add it to - the dub.json manually) - -#+BEGIN_SRC json :NO-tangle ../dub.json -{ - "authors": [ - "Ralph Amissah" - ], - "copyright": "Copyright © 2021, Ralph Amissah", - "description": "A minimal D application.", - "license": "AGPL-3", - "name": "d2sqlite3_dub2nix", - "dependencies": { - "d2sqlite3": "~><<version_d2sqlite3>>" - }, - "subConfigurations": { - "d2sqlite3": "with-lib" - } -} -#+END_SRC - -- run: dub build - -- run: dub2nix save - creates: dub.selections.nix - -- Create a new file default.nix with this content: - -#+BEGIN_SRC nix :NO-tangle default.nix -{ pkgs ? import <nixpkgs> {} }: -with import ./mkDub.nix { inherit pkgs; }; -mkDubDerivation { - src = ./.; - buildInputs = [ - pkgs.sqlite - ]; -} -#+END_SRC - -- Copy mkDub.nix from the dub2nix project. - -#+BEGIN_SRC sh -aria2c https://raw.githubusercontent.com/lionello/dub2nix/master/mkDub.nix -#+END_SRC - -make modificatons if desired - -- run: nix-build - nix-build -I nixpkgs=[path-to]/nixpkgs ** envrc :envrc: *** .envrc @@ -2179,6 +2099,7 @@ fi export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos #export NIX_PATH=nixpkgs=<<nixpkgs_path>> ## reload when these files change +use flake watch_file flake.nix # watch_file flake.lock ## load the flake devShell @@ -2188,6 +2109,7 @@ export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1 export SpineSRC=<<project_path_local_src>> export SpineDOC=<<project_path_local_doc>> export SpineOUT=<<project_path_local_out>> +export SpineOUTstatic=<<project_path_local_out_static>> echo '-*- mode: org -*- @@ -2209,6 +2131,8 @@ echo ' nix-instantiate | nix-build nix build `nix-instantiate` + nix develop + nix-instantiate | nix show-derivation | jq nix-instantiate | nix show-derivation --recursive | jq @@ -2224,6 +2148,7 @@ echo ' SpineSRC=<<project_path_local_src>> SpineDOC=<<project_path_local_doc>> SpineOUT=<<project_path_local_out>> + SpineOUTstatic=<<project_path_local_out_static>> ,* spine run instruction examples ,** parallelized tasks @@ -2264,14 +2189,38 @@ echo ' - composite command: source pod, html, epub, harvest, sqlite $SpineSRC/result/bin/spine --verbose --no-parallel --dark --pod --epub --html --html-link-harvest --harvest --sqlite-discrete --output="$SpineOUT" $SpineDOC/markup/pod/* -,** config [./pod/].dr/config_local_site +,** cgi operations (output to $SpineOUTstatic /var/www) cat $SpineDOC/markup/pod/.dr/config_local_site $SpineSRC/result/bin/spine --show-config $SpineDOC/markup/pod $SpineSRC/result/bin/spine --show-config --output="$SpineOUT" $SpineDOC/markup/pod +,** cgi operations (output to /var/www) + + $SpineSRC/result/bin/spine --very-verbose --sqlite-db-create --output="$SpineOUTstatic" $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --cgi-search-form-codegen --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --show-config --config=$SpineDOC/markup/pod/.dr + + $SpineSRC/result/bin/spine --html $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --sqlite-db-create --sqlite-filename="spine.search.db" --output="$SpineOUTstatic/html" $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --sqlite-db-create --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --sqlite-db-recreate --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --sqlite-update --sqlite-filename="spine.search.db" --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + + - make search form + $SpineSRC/result/bin/spine -v --cgi-search-form-codegen --config=$SpineDOC/markup/pod/.dr/config_local_site + - generate html linked to search form + $SpineSRC/result/bin/spine -v --html --html-link-search --html-link-harvest --harvest --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + ' >> SHELL_NIX_NOTE_ cat SHELL_NIX_NOTE_ +echo "cat SHELL_NIX_NOTE_" #+END_SRC @@ -2318,6 +2267,11 @@ cat SHELL_NIX_NOTE_ /tmp/spine/$SpineVER/www #+END_SRC +#+NAME: project_path_local_out_static +#+BEGIN_SRC nix +/var/www +#+END_SRC + ** flake :flake: - flake.nix @@ -2327,9 +2281,7 @@ cat SHELL_NIX_NOTE_ ./pkgs/shell-pkgs.nix - pkgs/shell-pkgs.nix - default.nix - ./nix/mkDub.nix - - mkdub.nix - ./nix/dub.selections.nix + ./nix/dub.selections.nix # - dub.selections.nix nix develop @@ -2342,12 +2294,8 @@ nix flake update inputs = { flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "/nixpkgs-ra/nixpkgs"; - dub2nix-src = { - url = "github:lionello/dub2nix"; - flake = false; - }; }; - outputs = { self, dub2nix-src, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils }: let pkgs = nixpkgs.legacyPackages.x86_64-linux; in { @@ -2387,12 +2335,8 @@ nix flake update url = "github:lgvz/imageformats"; flake = false; }; - dub2nix-src = { - url = "github:lionello/dub2nix"; - flake = false; - }; }; - outputs = { self, d2sqlite3, tinyendian, dyaml, imageformats, dub2nix-src, nixpkgs, flake-utils }: + outputs = { self, d2sqlite3, tinyendian, dyaml, imageformats, nixpkgs, flake-utils }: let pkgs = nixpkgs.legacyPackages.x86_64-linux; in { @@ -2479,7 +2423,19 @@ nix flake update { pkgs ? import <nixpkgs> {} }: pkgs.mkShell { buildInputs = with pkgs; [ - (import ./nix/pkglst/shell-pkgs.nix { inherit pkgs; }) + ( + with pkgs; [ + nixFlakes + rund + dub + ldc + sqlite + nix-prefetch-git + validatePkgConfig + jq + git + ] + ) ]; shellHook = '' if [[ -e ".envrc" ]]; then @@ -2489,7 +2445,6 @@ pkgs.mkShell { } #+END_SRC - #+BEGIN_SRC nix :NO-tangle ../shell.nix :tangle-mode (identity #o755) :-shebang "#!/usr/bin/env -S nix-shell" { pkgs ? import <nixpkgs> {} }: pkgs.mkShell { @@ -2505,101 +2460,6 @@ pkgs.mkShell { nix-instantiate | nix show-derivation | jq ''; } - -nix-shell nix/shell/shell_spine.nix --pure - -#+BEGIN_SRC nix :tangle ../nix/shell/shell_spine.nix :tangle-mode (identity #o755) :-shebang "#!/usr/bin/env -S nix-shell" -{ pkgs ? import <nixpkgs> {} }: -pkgs.mkShell { - buildInputs = with pkgs; [ - (import ../pkglst/shell-pkgs.nix { inherit pkgs; }) - ]; - buildPhase = "nix build -f default.nix"; - shellHook = '' - if [[ -e ".envrc" ]]; then - source .envrc - fi - nix-build - RUN="./result/bin/spine --very-verbose --theme-light --html --epub --sqlite-discrete --output=/tmp/www ./data/pod/sisu-spine-markup" - $RUN - echo "built spine ... @ ./result/bin/spine" - echo "& (tested with) run:" - echo " $RUN" - ''; -} -#+END_SRC - -- combining shell.nix & default.nix to build package: - -#+BEGIN_SRC nix :NO-tangle ../shell.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-shell" -#!/usr/bin/env -S nix-shell -{ pkgs ? import <nixpkgs> {} }: -with import ./nix/mkDub.nix { inherit pkgs; }; -mkDubDerivation rec { - name = "spine-${version}"; - version = "<<version_spine>>"; - src = ./.; - buildInputs = with pkgs; [( - import ./nix/pkglst/shell-pkgs.nix - { inherit pkgs; } - )]; - meta = with pkgs.lib; { - homepage = https://sisudoc.org; - description = "a sisu like document parser"; - license = licenses.agpl3Plus; - platforms = platforms.linux; - maintainers = [ RalphAmissah ]; - }; -} -#+END_SRC - -- package import incorporated, all in one file - -#+BEGIN_SRC nix :NO-tangle ../shell.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-shell" -{ pkgs ? import <nixpkgs> {}, - stdenv ? pkgs.stdenv, -}: -with import ./nix/mkDub.nix { inherit pkgs; }; -mkDubDerivation rec { - name = "spine-${version}"; - version = "<<version_spine>>"; - src = ./.; - buildInputs = [ - pkgs.sqlite - ( - let - dub2nix-src = fetchTarball { - url = "https://github.com/lionello/dub2nix/archive/master.tar.gz"; - }; - dub2nix = (import dub2nix-src) { inherit pkgs; }; - in - with pkgs; [ - nixFlakes - dub - ldc - sqlite - nix-prefetch-git - validatePkgConfig - ] - ) - ]; - shellHook = '' - # nix-build -I nixpkgs=<provide local nix path> - nix-build - echo "built spine" - ''; - installPhase = '' - install -m755 -D spine $out/bin/spine - echo "built $out/bin/spine" - ''; - meta = with pkgs.lib; { - homepage = https://sisudoc.org; - description = "a sisu like document parser"; - license = licenses.agpl3Plus; - platforms = platforms.linux; - maintainers = [ RalphAmissah ]; - }; -} #+END_SRC ** default.nix :default: @@ -2621,52 +2481,7 @@ mkDubDerivation rec { nix build -f project.nix nix build -f spine.nix -#+BEGIN_SRC nix :tangle ../default.nix :tangle-mode (identity #o755) :-shebang "#!/usr/bin/env -S nix-build" -{ pkgs ? import <nixpkgs> {} }: -with import ./nix/mkDub.nix { inherit pkgs; }; -mkDubDerivation rec { - name = "spine-${version}"; - version = "<<version_spine>>"; - src = ./.; - buildInputs = [ - pkgs.sqlite - (import ./nix/pkglst/shell-pkgs.nix { inherit pkgs; }) - ]; - # installPhase = '' - # install -m755 -D spine $out/bin/spine - # echo "built $out/bin/spine" - # ''; - <<nix_project_meta>> -} -#+END_SRC - -** project.nix :project: - -#+BEGIN_SRC nix :tangle ../project.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-build" -{ pkgs ? import <nixpkgs> {} }: -with import ./nix/mkDub.nix { inherit pkgs; }; -mkDubDerivation rec { - name = "spine-${version}"; - version = "<<version_spine>>"; - src = ./.; - buildInputs = [ - pkgs.sqlite - ( - <<nix_dub2nix_with_pkgs>> - ) - ]; - # buildPhase = [ ]; - installPhase = '' - install -m755 -D spine $out/bin/spine - echo "built $out/bin/spine" - ''; - <<nix_project_meta>> -} -#+END_SRC - -** spine.nix (project.nix including import mkDub.nix) :project: - -#+BEGIN_SRC nix :tangle ../spine.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-build" +#+BEGIN_SRC nix :tangle ../default.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-build" { pkgs ? import <nixpkgs> {}, stdenv ? pkgs.stdenv, lib ? pkgs.lib, @@ -2675,9 +2490,77 @@ mkDubDerivation rec { dub ? pkgs.dub }: assert dcompiler != null; -#with import ./nix/mkDub.nix { inherit pkgs; }; -with ( # mkDub.nix - <<mkDub_nix>> +with ( + assert dcompiler != null; + with lib; + let + # Filter function to remove the .dub package folder from src + filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( + type == "directory" && baseName == ".dub" + ); + targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; + # Remove reference to build tools and library sources + disallowedReferences = deps: [ dcompiler dub ]; + removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; + in { + mkDubDerivation = lib.makeOverridable ({ + src, + nativeBuildInputs ? [], + dubJSON ? src + "/dub.json", + passthru ? {}, + package ? lib.importJSON dubJSON, + ... + } @ attrs: stdenv.mkDerivation (attrs // { + pname = package.name; + nativeBuildInputs = [ dcompiler dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; + disallowedReferences = disallowedReferences deps; + passthru = passthru // { + inherit dub dcompiler pkgs; + }; + src = lib.cleanSourceWith { + filter = filterDub; + src = lib.cleanSource src; + }; + preFixup = '' + find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true + ''; + buildPhase = '' + runHook preBuild + export HOME=$PWD + for dc_ in dmd ldmd2 gdmd; do + echo "- check for D compiler $dc_" + dc=$(type -P $dc_ || echo "") + if [ ! "$dc" == "" ]; then + break + fi + done + if [ "$dc" == "" ]; then + exit "Error: could not find D compiler" + fi + echo "$dc_ used as D compiler to build $pname" + dub build --compiler=$dc --build=release --combined --skip-registry=all + runHook postBuild + ''; + checkPhase = '' + runHook preCheck + export HOME=$PWD + dub test --combined --skip-registry=all + runHook postCheck + ''; + installPhase = '' + runHook preInstall + mkdir -p $out/bin + cp -r "${targetOf package}" $out/bin + runHook postInstall + ''; + meta = lib.optionalAttrs (package ? description) { + description = package.description; + } // attrs.meta or {}; + } // lib.optionalAttrs (!(attrs ? version)) { + # Use name from dub.json, unless pname and version are specified + name = package.name; + })); + } ); mkDubDerivation rec { name = "spine-${version}"; @@ -2686,7 +2569,13 @@ mkDubDerivation rec { buildInputs = [ pkgs.sqlite ( - <<nix_dub2nix_with_pkgs>> + with pkgs; [ + nixFlakes + rund + dub + ldc + sqlite + ] ) ]; # buildPhase = [ ]; @@ -2714,149 +2603,14 @@ installPhase = '' #+NAME: nix_project_meta #+BEGIN_SRC nix meta = with pkgs.lib; { - homepage = https://sisudoc.org; + homepage = https://sisudoc.org; description = "a sisu like document parser"; - license = licenses.agpl3Plus; - platforms = platforms.linux; + license = licenses.agpl3Plus; + platforms = platforms.linux; maintainers = [ RalphAmissah ]; }; #+END_SRC -** mkDub.nix :mkDub: - -Get current mkDub.nix from the dub2nix project: - -#+BEGIN_SRC sh -aria2c https://raw.githubusercontent.com/lionello/dub2nix/master/mkDub.nix ./nix/. -#+END_SRC - -*** dub2nix - -#+BEGIN_SRC nix :tangle ../nix/pkglst/shell-pkgs.nix -{ pkgs ? import <nixpkgs> {} }: -<<nix_dub2nix_with_pkgs>> -#+END_SRC - -*** mkDub - -#+BEGIN_SRC nix :tangle ../nix/mkDub.nix -{ pkgs ? import <nixpkgs> {}, - stdenv ? pkgs.stdenv, - lib ? pkgs.lib, - ldc ? null, - dcompiler ? pkgs.ldc, - dub ? pkgs.dub -}: -<<mkDub_nix>> -#+END_SRC - -** mkDub.nix shared - -#+NAME: mkDub_nix -#+BEGIN_SRC nix -assert dcompiler != null; -with stdenv lib; -let - # Filter function to remove the .dub package folder from src - filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( - type == "directory" && baseName == ".dub" - ); - # Convert a GIT rev string (tag) to a simple semver version - rev-to-version = builtins.replaceStrings ["v" "refs/tags/v"] ["" ""]; - dep2src = dubDep: pkgs.fetchgit { inherit (dubDep.fetch) url rev sha256 fetchSubmodules; }; - # Fetch a dependency (source only for now) - fromDub = dubDep: mkDerivation rec { - name = "${src.name}-${version}"; - version = rev-to-version dubDep.fetch.rev; - nativeBuildInputs = [ dcompiler dub ]; - src = dep2src dubDep; - buildPhase = '' - runHook preBuild - export HOME=$NIX_BUILD_TOP - #export HOME=$PWD - dub build -b=release - runHook postBuild - ''; - # outputs = [ "lib" ]; - # installPhase = '' - # runHook preInstall - # mkdir -p $out/bin - # runHook postInstall - # ''; - }; - # Adds a local package directory (e.g. a git repository) to Dub - dub-add-local = dubDep: "dub add-local ${(fromDub dubDep).src.outPath} ${rev-to-version dubDep.fetch.rev}"; - # The target output of the Dub package - targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; - # Remove reference to build tools and library sources - disallowedReferences = deps: [ dcompiler dub ] ++ builtins.map dep2src deps; - removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; -in { - inherit fromDub; - mkDubDerivation = lib.makeOverridable ({ - src, - nativeBuildInputs ? [], - dubJSON ? src + "/dub.json", - selections ? src + "/nix/dub.selections.nix", - deps ? import selections, - passthru ? {}, - package ? lib.importJSON dubJSON, - ... - } @ attrs: stdenv.mkDerivation (attrs // { - pname = package.name; - nativeBuildInputs = [ dcompiler dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; - disallowedReferences = disallowedReferences deps; - passthru = passthru // { - inherit dub dcompiler pkgs; - }; - src = lib.cleanSourceWith { - filter = filterDub; - src = lib.cleanSource src; - }; - preFixup = '' - find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true - ''; - buildPhase = '' - runHook preBuild - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - for dc_ in dmd ldmd2 gdmd; do - echo "- check for D compiler $dc_" - dc=$(type -P $dc_ || echo "") - if [ ! "$dc" == "" ]; then - break - fi - done - if [ "$dc" == "" ]; then - exit "Error: could not find D compiler" - fi - echo "$dc_ used as D compiler to build $pname" - dub build --compiler=$dc --build=release --combined --skip-registry=all - runHook postBuild - ''; - checkPhase = '' - runHook preCheck - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - dub test --combined --skip-registry=all - runHook postCheck - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/bin - cp -r "${targetOf package}" $out/bin - runHook postInstall - ''; - meta = lib.optionalAttrs (package ? description) { - description = package.description; - } // attrs.meta or {}; - } // lib.optionalAttrs (!(attrs ? version)) { - # Use name from dub.json, unless pname and version are specified - name = package.name; - })); -} -#+END_SRC - ** dub.selections.json #+BEGIN_SRC nix :NO-tangle ../dub.selections.json @@ -2929,35 +2683,13 @@ in { ** dub2nix & shared pkgs SHARED *** dub2nix with pkgs shared -#+NAME: nix_dub2nix_with_pkgs +#+NAME: nix_with_pkgs #+BEGIN_SRC nix -let - <<nix_shell_dub2nix_srcLocalPreFetched>> -in with pkgs; [ <<nix_shell_with_pkgs_list>> ] #+END_SRC -*** get dub2nix -**** source local - -#+NAME: nix_shell_dub2nix_srcLocalPreFetched -#+BEGIN_SRC nix -dub2nix-src = ./src/build_depends/dub2nix/.; -dub2nix = (import dub2nix-src) { inherit pkgs; }; -#+END_SRC - -**** source remote (github) - -#+NAME: nix_shell_dub2nix_srcRemoteGitHub -#+BEGIN_SRC nix -dub2nix-src = fetchTarball { - url = "https://github.com/lionello/dub2nix/archive/master.tar.gz"; -}; -dub2nix = (import dub2nix-src) { inherit pkgs; }; -#+END_SRC - *** with pkgs list #+NAME: nix_shell_with_pkgs_list @@ -3386,16 +3118,54 @@ table toc #+END_SRC +** dub REFERENCE +*** SET version + +#+NAME: version_dub +#+BEGIN_SRC nix +<<version_dub_next>> +#+END_SRC + +#+NAME: nix_sha_dub +#+BEGIN_SRC nix +<<nix_sha_dub_next>> +#+END_SRC + +*** SELECT version +**** dub 1.24.0 + +#+NAME: version_dub_next +#+BEGIN_SRC nix +1.24.0 +#+END_SRC + +#+NAME: nix_sha_dub_next +#+BEGIN_SRC nix +0wirm6msz8kw2a7v2ax9ab6i48cmfv6qjwpfrl9vrr4k4xdg3vn6 +#+END_SRC + +**** dub 1.23.0 + +#+NAME: version_dub_current +#+BEGIN_SRC nix +1.23.0 +#+END_SRC + +#+NAME: nix_sha_dub_current +#+BEGIN_SRC nix +06a4whsl1m600k096nwif83n7za3vr7pj1xwapncy5fcad1gmady +#+END_SRC + *** dub (using ldc rather than dmd) overlay REFERENCE :overlay: #+BEGIN_SRC nix :NO-tangle ~/nixpkgs/pkgs/development/tools/build-managers/dub/default.nix -{ lib, stdenv, fetchFromGitHub, curl, libevent, rsync, ldc ? null, dcompiler ? ldc }: +{ lib, stdenv, fetchFromGitHub, curl, libevent, rsync, ldc, dcompiler ? ldc }: assert dcompiler != null; stdenv.mkDerivation rec { pname = "dub"; - version = "1.23.0"; + version = "<<version_dub>>"; enableParallelBuilding = true; @@ -3403,8 +3173,7 @@ stdenv.mkDerivation rec { owner = "dlang"; repo = "dub"; rev = "v${version}"; - sha256 = "06a4whsl1m600k096nwif83n7za3vr7pj1xwapncy5fcad1gmady"; - # nix-prefetch-url https://github.com/dlang/dub/archive/v1.23.0.tar.gz + sha256 = "<<nix_sha_dub>>"; }; postUnpack = '' @@ -3423,7 +3192,7 @@ stdenv.mkDerivation rec { buildPhase = '' for dc_ in dmd ldmd2 gdmd; do - echo "- check for D compiler $dc_" + echo "... check for D compiler $dc_ ..." dc=$(type -P $dc_ || echo "") if [ ! "$dc" == "" ]; then break @@ -3432,7 +3201,8 @@ stdenv.mkDerivation rec { if [ "$dc" == "" ]; then exit "Error: could not find D compiler" fi - echo "$dc_ used as D compiler to build $pname" + export DC_NAME=$dc_ + echo "$dc_ found and used as D compiler to build $pname" $dc ./build.d ./build ''; @@ -3442,104 +3212,18 @@ stdenv.mkDerivation rec { checkPhase = '' export DUB=$NIX_BUILD_TOP/source/bin/dub export PATH=$PATH:$NIX_BUILD_TOP/source/bin/ - export DC=${dcompiler.out}/bin/${dcompiler.pname} + export DC=${dcompiler.out}/bin/$DC_NAME echo "DC out --> $DC" export HOME=$TMP - #rm -rf test/* - rm -rf test/issue502-root-import - rm test/issue674-concurrent-dub.sh - rm test/issue672-upgrade-optional.sh - rm test/issue990-download-optional-selected.sh - rm test/issue877-auto-fetch-package-on-run.sh - rm test/issue1037-better-dependency-messages.sh - # rm test/issue1040-run-with-ver.sh - rm test/issue1416-maven-repo-pkg-supplier.sh - rm test/issue1180-local-cache-broken.sh - rm test/issue1574-addcommand.sh - rm test/issue1524-maven-upgrade-dependency-tree.sh - rm test/issue1773-lint.sh - rm test/ddox.sh - rm test/fetchzip.sh - rm test/feat663-search.sh - rm -rf test/git-dependency - rm test/interactive-remove.sh - rm test/timeout.sh - rm test/version-spec.sh - rm test/0-init-multi.sh - rm test/4-describe-data-1-list.sh - rm test/4-describe-data-3-zero-delim.sh - rm test/4-describe-import-paths.sh - rm test/4-describe-string-import-paths.sh - rm test/4-describe-json.sh - rm test/5-convert-stdout.sh - rm test/0-init-multi-json.sh - rm test/issue1003-check-empty-ld-flags.sh - rm test/issue103-single-file-package.sh - rm test/issue1040-run-with-ver.sh - rm test/issue1091-bogus-rebuild.sh - # rm test/issue1180-local-cache-broken.sh - rm test/issue1194-warn-wrong-subconfig.sh - rm test/issue1277.sh - rm test/issue1372-ignore-files-in-hidden-dirs.sh - rm test/issue1447-build-settings-vars.sh - rm test/issue1531-toolchain-requirements.sh - # rm test/issue1773-lint.sh - rm test/issue346-redundant-flags.sh - rm test/issue361-optional-deps.sh - rm test/issue564-invalid-upgrade-dependency.sh - rm test/issue586-subpack-dep.sh - rm test/issue616-describe-vs-generate-commands.sh - rm test/issue686-multiple-march.sh - rm test/issue813-fixed-dependency.sh - rm test/issue813-pure-sub-dependency.sh - rm test/issue820-extra-fields-after-convert.sh - # rm test/issue877-auto-fetch-package-on-run.sh - rm test/issue923-subpackage-deps.sh - rm test/single-file-sdl-default-name.sh - rm test/subpackage-common-with-sourcefile-globbing.sh - rm test/issue934-path-dep.sh - # rm test/version-spec.sh - rm -rf test/1-dynLib-simple - rm -rf test/1-exec-simple-package-json - rm -rf test/1-exec-simple - rm -rf test/1-staticLib-simple - rm -rf test/2-dynLib-dep - rm -rf test/2-staticLib-dep - rm -rf test/2-dynLib-with-staticLib-dep - rm -rf test/2-sourceLib-dep/ - rm -rf test/3-copyFiles - rm -rf test/custom-source-main-bug487 - rm -rf test/custom-unittest - rm -rf test/issue1262-version-inheritance-diamond - rm -rf test/git-dependency - rm -rf test/issue1003-check-empty-ld-flags - rm -rf test/ignore-hidden-1 - rm -rf test/ignore-hidden-2 - rm -rf test/issue1427-betterC - rm -rf test/issue130-unicode-* - rm -rf test/issue1262-version-inheritance - rm -rf test/issue1372-ignore-files-in-hidden-dirs - rm -rf test/issue1350-transitive-none-deps - rm -rf test/issue1775 - rm -rf test/issue1447-build-settings-vars - rm -rf test/issue1408-inherit-linker-files - rm -rf test/issue1551-var-escaping - rm -rf test/issue754-path-selection-fail - rm -rf test/issue1788-incomplete-string-import-override - rm -rf test/subpackage-ref - rm -rf test/issue777-bogus-path-dependency - rm -rf test/issue959-path-based-subpack-dep - rm -rf test/issue97-targettype-none-nodeps - rm -rf test/issue97-targettype-none-onerecipe - rm -rf test/path-subpackage-ref - rm -rf test/sdl-package-simple + + <<build_dub_tests>> + ./test/run-unittest.sh ''; installPhase = '' mkdir -p $out/bin cp bin/dub $out/bin - #cp $NIX_BUILD_TOP/dub $out/bin ''; meta = with lib; { @@ -3551,3 +3235,65 @@ stdenv.mkDerivation rec { }; } #+END_SRC + +***** removed failing tests + +#+NAME: build_dub_tests +#+BEGIN_SRC nix +rm test/0-init-multi.sh +rm test/0-init-multi-json.sh +rm test/5-convert-stdout.sh +rm test/dc-env.sh +rm test/ddox.sh +rm test/feat663-search.sh +rm test/fetchzip.sh +rm test/interactive-remove.sh +rm test/issue672-upgrade-optional.sh +rm test/issue674-concurrent-dub.sh +rm test/issue820-extra-fields-after-convert.sh +rm test/issue877-auto-fetch-package-on-run.sh +rm test/issue990-download-optional-selected.sh +rm test/issue1003-check-empty-ld-flags.sh +rm test/issue1037-better-dependency-messages.sh +rm test/issue1040-run-with-ver.sh +rm test/issue1091-bogus-rebuild.sh +rm test/issue1180-local-cache-broken.sh +rm test/issue1194-warn-wrong-subconfig.sh +rm test/issue1277.sh +rm test/issue1372-ignore-files-in-hidden-dirs.sh +rm test/issue1416-maven-repo-pkg-supplier.sh +rm test/issue1447-build-settings-vars.sh +rm test/issue1574-addcommand.sh +rm test/issue1524-maven-upgrade-dependency-tree.sh +rm test/issue1773-lint.sh +rm test/removed-dub-obj.sh +rm test/version-spec.sh +rm -r test/git-dependency +rm -r test/issue502-root-import +#+END_SRC + +* NOTE +** manually set version + +DRV=0.10.0; git tag -f doc-reform_v\${DRV} -m\"doc-reform spine-\${DRV}\" e5452d46475785c78fe4462717bdb74f17c4197 + +V_MAJOR=0; V_MINOR=10; V_PATCH=0 +for i in org/spine.org; do; sed -i "s/Version(\s*[0-9]\+,\s\+[0-9]\+,\s\+[0-9]\+\s*)/Version(${V_MAJOR}, ${V_MINOR}, ${V_PATCH})/g" $i; done +for i in org/spine_build_scaffold.org; do; sed -i "0,/\(version:\)\s\+['][0-9]\+\.[0-9]\+\.[0-9]\+['],/s//\1 \'${V_MAJOR}.${V_MINOR}.${V_PATCH}\',/g" $i; done + +** check cgi build operations + +~dr/bin/spine-ldc -v --cgi-search-form-codegen --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod + +~dr/bin/spine-ldc -v --show-config --config=/grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/.dr +~dr/bin/spine-ldc --show-config --html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/* + +~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-filename="spine.search.db" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod +~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod +~dr/bin/spine-ldc -v --sqlite-db-recreate --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod + +~dr/bin/spine-ldc -v --sqlite-update --sqlite-filename="spine.search.db" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/* + +~dr/bin/spine-ldc -v --cgi-search-form-codegen --config=/grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/.dr/config_local_site + +~dr/bin/spine-ldc -v --html --html-link-search --html-link-harvest --harvest --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/* diff --git a/project.nix b/project.nix deleted file mode 100755 index bfd44fb..0000000 --- a/project.nix +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env -S nix-build -{ pkgs ? import <nixpkgs> {} }: -with import ./nix/mkDub.nix { inherit pkgs; }; -mkDubDerivation rec { - name = "spine-${version}"; - version = "0.11.3"; - src = ./.; - buildInputs = [ - pkgs.sqlite - ( - let - dub2nix-src = ./src/build_depends/dub2nix/.; - dub2nix = (import dub2nix-src) { inherit pkgs; }; - in - with pkgs; [ - nixFlakes - rund - dub - ldc - sqlite - nix-prefetch-git - validatePkgConfig - jq - git - ] - ) - ]; - # buildPhase = [ ]; - installPhase = '' - install -m755 -D spine $out/bin/spine - echo "built $out/bin/spine" - ''; - meta = with pkgs.lib; { - homepage = https://sisudoc.org; - description = "a sisu like document parser"; - license = licenses.agpl3Plus; - platforms = platforms.linux; - maintainers = [ RalphAmissah ]; - }; -} @@ -1,7 +1,19 @@ { pkgs ? import <nixpkgs> {} }: pkgs.mkShell { buildInputs = with pkgs; [ - (import ./nix/pkglst/shell-pkgs.nix { inherit pkgs; }) + ( + with pkgs; [ + nixFlakes + rund + dub + ldc + sqlite + nix-prefetch-git + validatePkgConfig + jq + git + ] + ) ]; shellHook = '' if [[ -e ".envrc" ]]; then diff --git a/spine.nix b/spine.nix deleted file mode 100755 index cc45422..0000000 --- a/spine.nix +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env -S nix-build -{ pkgs ? import <nixpkgs> {}, - stdenv ? pkgs.stdenv, - lib ? pkgs.lib, - ldc ? null, - dcompiler ? pkgs.ldc, - dub ? pkgs.dub -}: -assert dcompiler != null; -#with import ./nix/mkDub.nix { inherit pkgs; }; -with ( # mkDub.nix - assert dcompiler != null; - with stdenv lib; - let - # Filter function to remove the .dub package folder from src - filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( - type == "directory" && baseName == ".dub" - ); - # Convert a GIT rev string (tag) to a simple semver version - rev-to-version = builtins.replaceStrings ["v" "refs/tags/v"] ["" ""]; - dep2src = dubDep: pkgs.fetchgit { inherit (dubDep.fetch) url rev sha256 fetchSubmodules; }; - # Fetch a dependency (source only for now) - fromDub = dubDep: mkDerivation rec { - name = "${src.name}-${version}"; - version = rev-to-version dubDep.fetch.rev; - nativeBuildInputs = [ dcompiler dub ]; - src = dep2src dubDep; - buildPhase = '' - runHook preBuild - export HOME=$NIX_BUILD_TOP - #export HOME=$PWD - dub build -b=release - runHook postBuild - ''; - # outputs = [ "lib" ]; - # installPhase = '' - # runHook preInstall - # mkdir -p $out/bin - # runHook postInstall - # ''; - }; - # Adds a local package directory (e.g. a git repository) to Dub - dub-add-local = dubDep: "dub add-local ${(fromDub dubDep).src.outPath} ${rev-to-version dubDep.fetch.rev}"; - # The target output of the Dub package - targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; - # Remove reference to build tools and library sources - disallowedReferences = deps: [ dcompiler dub ] ++ builtins.map dep2src deps; - removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; - in { - inherit fromDub; - mkDubDerivation = lib.makeOverridable ({ - src, - nativeBuildInputs ? [], - dubJSON ? src + "/dub.json", - selections ? src + "/nix/dub.selections.nix", - deps ? import selections, - passthru ? {}, - package ? lib.importJSON dubJSON, - ... - } @ attrs: stdenv.mkDerivation (attrs // { - pname = package.name; - nativeBuildInputs = [ dcompiler dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; - disallowedReferences = disallowedReferences deps; - passthru = passthru // { - inherit dub dcompiler pkgs; - }; - src = lib.cleanSourceWith { - filter = filterDub; - src = lib.cleanSource src; - }; - preFixup = '' - find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true - ''; - buildPhase = '' - runHook preBuild - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - for dc_ in dmd ldmd2 gdmd; do - echo "- check for D compiler $dc_" - dc=$(type -P $dc_ || echo "") - if [ ! "$dc" == "" ]; then - break - fi - done - if [ "$dc" == "" ]; then - exit "Error: could not find D compiler" - fi - echo "$dc_ used as D compiler to build $pname" - dub build --compiler=$dc --build=release --combined --skip-registry=all - runHook postBuild - ''; - checkPhase = '' - runHook preCheck - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - dub test --combined --skip-registry=all - runHook postCheck - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/bin - cp -r "${targetOf package}" $out/bin - runHook postInstall - ''; - meta = lib.optionalAttrs (package ? description) { - description = package.description; - } // attrs.meta or {}; - } // lib.optionalAttrs (!(attrs ? version)) { - # Use name from dub.json, unless pname and version are specified - name = package.name; - })); - } -); -mkDubDerivation rec { - name = "spine-${version}"; - version = "0.11.3"; - src = ./.; - buildInputs = [ - pkgs.sqlite - ( - let - dub2nix-src = ./src/build_depends/dub2nix/.; - dub2nix = (import dub2nix-src) { inherit pkgs; }; - in - with pkgs; [ - nixFlakes - rund - dub - ldc - sqlite - nix-prefetch-git - validatePkgConfig - jq - git - ] - ) - ]; - # buildPhase = [ ]; - installPhase = '' - install -m755 -D spine $out/bin/spine - echo "built $out/bin/spine" - ''; - meta = with pkgs.lib; { - homepage = https://sisudoc.org; - description = "a sisu like document parser"; - license = licenses.agpl3Plus; - platforms = platforms.linux; - maintainers = [ RalphAmissah ]; - }; -} diff --git a/src/build_depends/dub2nix.meta b/src/build_depends/dub2nix.meta deleted file mode 100644 index 211a6f0..0000000 --- a/src/build_depends/dub2nix.meta +++ /dev/null @@ -1,3 +0,0 @@ -dub2nix 8f68d27c -https://github.com/lionello/dub2nix -MIT License diff --git a/src/build_depends/dub2nix/.github/workflows/main.yml b/src/build_depends/dub2nix/.github/workflows/main.yml deleted file mode 100644 index fe9e10a..0000000 --- a/src/build_depends/dub2nix/.github/workflows/main.yml +++ /dev/null @@ -1,31 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: CI - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - - name: Install Nix - uses: cachix/install-nix-action@v12 - with: - nix_path: nixpkgs=channel:nixos-unstable - - - name: Build in shell - run: nix-shell --run "dub test" diff --git a/src/build_depends/dub2nix/.gitignore b/src/build_depends/dub2nix/.gitignore deleted file mode 100644 index 19eefee..0000000 --- a/src/build_depends/dub2nix/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -dub2nix -/.dub/ -/result -/bin -.envrc diff --git a/src/build_depends/dub2nix/LICENSE b/src/build_depends/dub2nix/LICENSE deleted file mode 100644 index 88e0035..0000000 --- a/src/build_depends/dub2nix/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Lionello Lunesu - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/src/build_depends/dub2nix/README.md b/src/build_depends/dub2nix/README.md deleted file mode 100644 index bfb8e3a..0000000 --- a/src/build_depends/dub2nix/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# dub2nix -CLI tool to create Nix expressions for D-lang Dub projects. - -![CI](https://github.com/lionello/dub2nix/workflows/CI/badge.svg) - -## Installation -Install with `nix-env`: -```sh -nix-env -if https://github.com/lionello/dub2nix/archive/master.tar.gz -``` -or add to your `shell.nix` and run `nix-shell`: -```nix -with import <nixpkgs> {}; -let - dub2nix-src = fetchTarball { - url = "https://github.com/lionello/dub2nix/archive/master.tar.gz"; - }; - dub2nix = (import dub2nix-src) { inherit pkgs; }; -in mkShell { - buildInputs = [ - dub2nix # dub dmd rdmd ldc etc.. - ]; -} -``` - -## Development -Do `git clone` and `nix-shell` to build with `dub`: -```sh -nix-shell -dub -``` -Alternatively, use `direnv`: -```sh -echo use nix >> .envrc -direnv allow -dub -``` - -## Usage -``` -Usage: dub2nix [OPTIONS] COMMAND - -Create Nix derivations for Dub package dependencies. - -Commands: - save Write Nix files for Dub project - -Options: --i --input Path of selections JSON; defaults to ./dub.selections.json --o --output Output Nix file for Dub project --r --registry URL to Dub package registry; default http://code.dlang.org/packages/ --d --deps-file Output Nix file with dependencies; defaults to ./dub.selections.nix --h --help This help information. -``` -First, use `dub build` to generate the `dub.selections.json` for your Dub project. -Then, run `dub2nix save` to read the `dub.selections.json` in the current folder and write a new file `dub.selections.nix`. - -This `dub.selections.nix` is used in `mkDubDerivation` (from `mkDub.nix`) to create a new derivation for your Dub project: -```nix -{pkgs}: -with (import ./mkDub.nix { - inherit pkgs; -}); -mkDubDerivation { - version = "0.1.0"; # optional - src = ./.; -} -``` - -When your project has no dependencies at all, this will fail because `dub.selections.nix` is missing. Set `deps` to override the dependencies: -```nix -{pkgs}: -with (import ./mkDub.nix { - inherit pkgs; -}); -mkDubDerivation { - src = ./.; - deps = []; -} -``` - -Use the `--output` option to write a `.nix` file with a skeleton derivation for your dub project. This will also create the `mkDub.nix` file for importing into the derivation. diff --git a/src/build_depends/dub2nix/default.nix b/src/build_depends/dub2nix/default.nix deleted file mode 100644 index d967504..0000000 --- a/src/build_depends/dub2nix/default.nix +++ /dev/null @@ -1,2 +0,0 @@ -{ pkgs ? import <nixpkgs> {} }: -pkgs.callPackage ./dub2nix.nix {} diff --git a/src/build_depends/dub2nix/dub.json b/src/build_depends/dub2nix/dub.json deleted file mode 100644 index 18ed81d..0000000 --- a/src/build_depends/dub2nix/dub.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "dub2nix", - "authors": [ - "Lionello Lunesu" - ], - "dependencies": { - "vibe-d:data": "*" - }, - "stringImportPaths": ["."], - "description": "Create Nix derivations for Dub package dependencies", - "targetPath": "./bin/", - "copyright": "Copyright © 2020, Lionello Lunesu", - "license": "MIT", - "targetType": "executable" -} diff --git a/src/build_depends/dub2nix/dub.selections.json b/src/build_depends/dub2nix/dub.selections.json deleted file mode 100644 index de6fe4d..0000000 --- a/src/build_depends/dub2nix/dub.selections.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "stdx-allocator": "2.77.5", - "vibe-d": "0.8.5" - } -} diff --git a/src/build_depends/dub2nix/dub.selections.nix b/src/build_depends/dub2nix/dub.selections.nix deleted file mode 100644 index 26a9c05..0000000 --- a/src/build_depends/dub2nix/dub.selections.nix +++ /dev/null @@ -1,26 +0,0 @@ -# This file was generated by https://github.com/lionello/dub2nix v0.2.4 -[ { - fetch = { - type = "git"; - url = "https://github.com/vibe-d/vibe.d.git"; - rev = "v0.8.5"; - sha256 = "0s1caxqmq2497j5x8h06f44nr597h9zac8qxxml953lkaqkhbzgy"; - fetchSubmodules = false; - date = "2019-03-24T14:45:15+01:00"; - deepClone = false; - leaveDotGit = false; - path = "/nix/store/kz5g44dncvznlkm38a74cmm4qyl9nr6b-vibe.d"; - }; -} { - fetch = { - type = "git"; - url = "https://github.com/wilzbach/stdx-allocator.git"; - rev = "v2.77.5"; - sha256 = "03av8zp5p6vf6fg005xbmwnjfw96jyrr4dcj4m56c4a3vx7v72pk"; - fetchSubmodules = false; - date = "2018-12-23T13:54:22+01:00"; - deepClone = false; - leaveDotGit = false; - path = "/nix/store/b3h25asfh205wzwjfzjf2k2kkccpp96k-stdx-allocator"; - }; -} ]
\ No newline at end of file diff --git a/src/build_depends/dub2nix/dub2nix.nix b/src/build_depends/dub2nix/dub2nix.nix deleted file mode 100644 index ef4bd5f..0000000 --- a/src/build_depends/dub2nix/dub2nix.nix +++ /dev/null @@ -1,17 +0,0 @@ -{pkgs}: -with (import ./mkDub.nix { - inherit pkgs; -}); -mkDubDerivation { - src = pkgs.lib.cleanSource ./.; - # dubJSON = ./dub.json; - # selections = ./dub.selections.nix; - version = "0.2.4"; - # doCheck = true; - propagatedBuildInputs = [ pkgs.nix-prefetch-git pkgs.cacert ]; - meta = with pkgs.stdenv.lib; { - homepage = "https://github.com/lionello/dub2nix"; - maintainers = [ maintainers.lionello ]; - license = licenses.mit; - }; -} diff --git a/src/build_depends/dub2nix/mkDub.nix b/src/build_depends/dub2nix/mkDub.nix deleted file mode 100644 index 7fddf14..0000000 --- a/src/build_depends/dub2nix/mkDub.nix +++ /dev/null @@ -1,121 +0,0 @@ -{ pkgs ? import <nixpkgs> {}, - stdenv ? pkgs.stdenv, - rdmd ? pkgs.rdmd, - dmd ? pkgs.dmd, - dub ? pkgs.dub }: - -with stdenv; -let - # Filter function to remove the .dub package folder from src - filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( - type == "directory" && baseName == ".dub" - ); - - # Convert a GIT rev string (tag) to a simple semver version - rev-to-version = builtins.replaceStrings ["v" "refs/tags/v"] ["" ""]; - - dep2src = dubDep: pkgs.fetchgit { inherit (dubDep.fetch) url rev sha256 fetchSubmodules; }; - - # Fetch a dependency (source only for now) - fromDub = dubDep: mkDerivation rec { - name = "${src.name}-${version}"; - version = rev-to-version dubDep.fetch.rev; - nativeBuildInputs = [ rdmd dmd dub ]; - src = dep2src dubDep; - - buildPhase = '' - runHook preBuild - export HOME=$PWD - dub build -b=release - runHook postBuild - ''; - - # outputs = [ "lib" ]; - - # installPhase = '' - # runHook preInstall - # mkdir -p $out/bin - # runHook postInstall - # ''; - }; - - # Adds a local package directory (e.g. a git repository) to Dub - dub-add-local = dubDep: "dub add-local ${(fromDub dubDep).src.outPath} ${rev-to-version dubDep.fetch.rev}"; - - # The target output of the Dub package - targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; - - # Remove reference to build tools and library sources - disallowedReferences = deps: [ dmd rdmd dub ] ++ builtins.map dep2src deps; - - removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; - -in { - inherit fromDub; - - mkDubDerivation = lib.makeOverridable ({ - src, - nativeBuildInputs ? [], - dubJSON ? src + "/dub.json", - selections ? src + "/dub.selections.nix", - deps ? import selections, - passthru ? {}, - package ? lib.importJSON dubJSON, - ... - } @ attrs: stdenv.mkDerivation ((removeAttrs attrs ["package" "deps" "selections" "dubJSON"]) // { - - pname = package.name; - - nativeBuildInputs = [ rdmd dmd dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; - disallowedReferences = disallowedReferences deps; - - passthru = passthru // { - inherit dub dmd rdmd pkgs; - }; - - src = lib.cleanSourceWith { - filter = filterDub; - src = lib.cleanSource src; - }; - - preFixup = '' - find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true - ''; - - buildPhase = '' - runHook preBuild - - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - dub build -b release --combined --skip-registry=all - - runHook postBuild - ''; - - checkPhase = '' - runHook preCheck - - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - dub test --combined --skip-registry=all - - runHook postCheck - ''; - - installPhase = '' - runHook preInstall - - mkdir -p $out/bin - cp -r "${targetOf package}" $out/bin - - runHook postInstall - ''; - - meta = lib.optionalAttrs (package ? description) { - description = package.description; - } // attrs.meta or {}; - } // lib.optionalAttrs (!(attrs ? version)) { - # Use name from dub.json, unless pname and version are specified - name = package.name; - })); -} diff --git a/src/build_depends/dub2nix/shell.nix b/src/build_depends/dub2nix/shell.nix deleted file mode 100644 index 002ff55..0000000 --- a/src/build_depends/dub2nix/shell.nix +++ /dev/null @@ -1,16 +0,0 @@ -with import <nixpkgs> {}; - -let - pkg = import ./default.nix { inherit pkgs; }; - -in mkShell { - - buildInputs = [ - # additional runtime dependencies go here - ] ++ pkg.buildInputs ++ pkg.propagatedBuildInputs; - - nativeBuildInputs = [ - # additional dev dependencies go here - ] ++ pkg.nativeBuildInputs; - -} diff --git a/src/build_depends/dub2nix/src/dub2nix.d b/src/build_depends/dub2nix/src/dub2nix.d deleted file mode 100644 index e92ecf8..0000000 --- a/src/build_depends/dub2nix/src/dub2nix.d +++ /dev/null @@ -1,263 +0,0 @@ -#!/usr/bin/env dub -/+ dub.sdl: - name "dub2nix" - stringImportPaths "." - dependency "vibe-d:data" version="*" -+/ -import vibe.data.json, std.string; - -enum mkDubNix = import("./mkDub.nix"); -enum VERSION = "0.2.4"; -enum HEADER = "# This file was generated by https://github.com/lionello/dub2nix v"~VERSION~"\n"; - -unittest { - static assert(import("./dub2nix.nix").indexOf(VERSION) > 0, "VERSION does not match version in dub2nix.nix"); -} - -struct DubSelections { - int fileVersion; - string[string] versions; -} - -struct DubRepo { - string owner; - string kind; - string project; -} - -private string packageRegistry = "http://code.dlang.org/packages/"; - -private auto download(string url) @trusted { -version(none) { - // This works, but causes "leaking eventcore driver" warnings at shutdown - import vibe.http.client : requestHTTP; - scope res = requestHTTP(); - return res.readJson(); -} else { - import std.net.curl: get, HTTP; - auto http = HTTP(); - // Using deflate saves A LOT of traffic, ~40x - http.addRequestHeader("accept-encoding", "deflate"); - http.addRequestHeader("accept", "application/json"); - const data = get(url, http); - // Only accepting application/json, so anything else must be compressed - if (data[0] != '{') { - import std.zlib : uncompress; - return parseJsonString(cast(string)uncompress(data)); - } else { - // parseJsonString takes immutable string, so need the .idup here - return parseJsonString(data.idup); - } -} -} - -/// Query Dub registry for the repository information of a package -auto findRepo(string pname) @safe { - const url = packageRegistry ~ pname ~ ".json"; - const json = download(url); - return deserializeJson!DubRepo(json["repository"]); -} - -struct NixPrefetchGit { - @optional string type; /// set to "git", like Go deps.nix - string url; /// URL of GIT repository - string rev; /// sha1 or tag - string sha256; /// calculated by from nix-prefetch-git - @optional bool fetchSubmodules; /// optional; defaults to true - @optional string date; /// ignored; fetchgit doesn't actually want this - @optional bool deepClone; /// ignored - @optional bool leaveDotGit; /// ignored; if the .git directory should be preserved - @optional string path; /// ignored; a path in the Nix store? -} - -/// Invoke nix-prefetch-git and return the parsed JSON -auto nixPrefetchGit(string url, string rev) @safe { - import std.process : executeShell, Config; - const cmd = "nix-prefetch-git --quiet " ~ url ~ " " ~ rev; - return deserializeJson!NixPrefetchGit( - executeShell(cmd, null, Config.stderrPassThrough).output - ); -} - -struct DubDep { - NixPrefetchGit fetch; /// like Go deps.nix -} - -/// Fetch the repo information for package `pname` and version `ver` -auto prefetch(string pname, string ver) @safe { - const repo = findRepo(pname); - assert(repo.kind == "github"); - const url = "https://" ~ repo.kind ~ ".com/" ~ repo.owner ~ '/' ~ repo.project ~ ".git"; - const tag = "v" ~ ver; - auto set = nixPrefetchGit(url, tag); - // Overwrite the sha1 ref with the tag instead, so we have the version info as well - set.rev = tag; - set.type = "git"; - return DubDep(set); -} - -/// Convert D string to Nix string literal -auto toNixString(in string s, int indent = 0) pure @safe { - if (s is null) { - return "null"; - } else if (s.indexOfAny("\"\n") >= 0) - return "''\n" ~ s ~ "''"; - else - return '"' ~ s ~ '"'; -} - -unittest { - static assert(toNixString(null) == "null"); - static assert(toNixString("hello") == `"hello"`); - static assert(toNixString("with\nnewline") == "''\nwith\nnewline''"); - static assert(toNixString(`with "quotes"`) == "''\nwith \"quotes\"''"); -} - -/// Convert D bool to Nix boolean literal -auto toNixString(bool b, int indent = 0) pure @safe { - return b ? "true" : "false"; -} - -unittest { - static assert(toNixString(true) == "true"); - static assert(toNixString(false) == "false"); -} - -private enum INDENT = " "; - -/// Convert D struct to Nix set -auto toNixString(T)(in T pod, int indent = 0) pure @safe if (is(T == struct)) { - string prefix = INDENT[0..indent * 2 + 2]; - string set = "{\n"; - foreach(i, ref key; pod.tupleof) { - const id = __traits(identifier, pod.tupleof[i]); - set ~= prefix ~ id ~ " = " ~ toNixString(key, indent + 1) ~ ";\n"; - } - return set ~ INDENT[0..indent * 2] ~ "}"; -} - -unittest { - struct TestStruct { bool b; } - static assert(toNixString(TestStruct.init) == "{\n b = false;\n}"); - static assert(toNixString(TestStruct.init, 1) == "{\n b = false;\n }"); -} - -/// Convert D AArray to Nix set -auto toNixString(T)(in T[string] aa, int indent = 0) pure @safe { - string prefix = INDENT[0..indent * 2 + 2]; - string set = "{\n"; - foreach(id, ref key; aa) { - set ~= prefix ~ id ~ " = " ~ toNixString(key, indent + 1) ~ ";\n"; - } - return set ~ INDENT[0..indent * 2] ~ "}"; -} - -unittest { - static assert(toNixString(["s": "x"]) == "{\n s = \"x\";\n}"); - static assert(toNixString(["s": ["x": true]]) == "{\n s = {\n x = true;\n };\n}"); -} - -/// Convert D array/range to Nix list -import std.range : isForwardRange; -auto toNixString(R)(in R range, int indent = 0) pure @safe if (isForwardRange!R && !is(R : string)) { - string list = "[ "; - foreach(const ref item; range) { - list ~= toNixString(item, indent) ~ " "; - } - return list ~ "]"; -} - -unittest { - static assert(toNixString(["a"]) == `[ "a" ]`); -} - -/// Create Nix expression for all dependencies in the selections JSON -auto createNixDeps(string selectionsJson) { - import std.parallelism : taskPool; - import std.array : byPair, array; - import std.stdio : writeln; - - const selections = deserializeJson!DubSelections(selectionsJson); - assert(selections.fileVersion == 1); - - static auto progress(Tuple)(in Tuple pair) { - writeln("# Prefetching ", pair.key, "-", pair.value); - return prefetch(pair.key, pair.value); - } - - // Fetch all dependency information in parallel - debug scope(success) writeln("# Done."); - return HEADER ~ toNixString(taskPool.amap!progress(selections.versions.byPair.array)); -} - -unittest { - enum json = import("./dub.selections.json"); - enum fixture = import("./dub.selections.nix"); - assert(createNixDeps(json) == fixture); -} - -// No "main" when we're running with unittests -version(unittest) {} else { - -int main(string[] args) { - import std.stdio : writeln; - import std.file : readText, write; - import std.getopt: getopt, defaultGetoptPrinter; - - bool showVersion; - string input = "./dub.selections.json", deps = "./dub.selections.nix", output; - auto result = getopt(args, - "input|i|in", "Path of selections JSON; defaults to " ~ input, &input, - "output|o|out", "Output Nix file for Dub project.", &output, - "registry|r", "URL to Dub package registry; default " ~ packageRegistry, &packageRegistry, - "deps-file|d", "Output Nix file with dependencies; defaults to " ~ deps, &deps, - "version", "Show version information.", &showVersion); - - if (showVersion) { - writeln(VERSION); - return 0; - } else if (result.helpWanted || args.length != 2 || args[1] != "save") { - defaultGetoptPrinter(`Usage: dub2nix [OPTIONS] COMMAND - -Create Nix derivations for Dub package dependencies. - -Commands: - save Write Nix files for Dub project - -Options:`, result.options); - return 0; - } - - try { - const nix = createNixDeps(readText(input)); - if (deps == "-") { - writeln(nix); - } else { - write(deps, nix.representation); - } - if (output) { - write("mkDub.nix", mkDubNix); - write(output, HEADER ~ ` -{ pkgs ? import <nixpkgs> {} }: -with import ./mkDub.nix { inherit pkgs; }; - -mkDubDerivation { - src = ./.; - # version = "0.0.1"; - # buildInputs = [ add any runtime deps here ]; -} -`); - } - return 0; - } catch (Exception e) { - debug { - // Only dump callstack in debug builds - writeln(e.toString()); - } else { - writeln("Error: ", e.message); - } - return 1; - } -} - -}//!unittest diff --git a/src/build_depends/shaHEADdep_dub2nix b/src/build_depends/shaHEADdep_dub2nix deleted file mode 100644 index 85c4d2c..0000000 --- a/src/build_depends/shaHEADdep_dub2nix +++ /dev/null @@ -1 +0,0 @@ -8f68d27c - dub2nix |