aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/config_nix.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/config_nix.org')
-rw-r--r--org/config_nix.org311
1 files changed, 220 insertions, 91 deletions
diff --git a/org/config_nix.org b/org/config_nix.org
index 4a0fe52..313c11d 100644
--- a/org/config_nix.org
+++ b/org/config_nix.org
@@ -139,13 +139,16 @@ fi
#+BEGIN_SRC sh
export NIX_PATH=<<nix_path_channel>>
#export NIX_PATH=<<nixpkgs_path_local>>
+export DFLAGS="-O2 -inline"
# reload when these files change
# watch_file flake.nix
# watch_file flake.lock
## load the flake devShell
# eval "$(nix print-dev-env)"
# echo $NIX_BUILD_TOP
+export Date=`date "+%Y%m%d"`
export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g')
+export SpinePROJ=<<project_path_local_project>>
export SpineSRC=<<project_path_local_src>>
export SpineBIN=<<project_path_local_bin>>
export SpineDOC=<<project_path_local_doc>>
@@ -153,6 +156,13 @@ export SpinePOD=$SpineDOC/markup/pod
export SpineOUTversioned=<<project_path_local_out>>
export SpineOUT=<<project_path_local_out_static>>
export SpineDBpath=<<project_path_sqlite>>
+export SpineSearchActionLocal='http://localhost/spine_search'
+export SpineSearchActionRemote='https://sisudoc.org/spine_search'
+export SpineCGIform='spine_search'
+export SpineSQLdb='spine.search.db'
+export PROG_VER_GIT="`git describe --long --tags | sed -e 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g'`"
+export PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`"
+
if [ -e .env/echo-nixNote ]; then
source .env/echo-nixNote
fi
@@ -395,6 +405,43 @@ ls $SpineOutstatic/latex/*.tex
#echo "cat nixNote_.org"
#+END_SRC
+*** makefile
+
+#+HEADER: :tangle ../makefile_
+#+BEGIN_SRC make
+buildPhase:
+ 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; \
+ echo "D compiler = $${DC}"; \
+ if [ "$${DC}" == "" ]; then \
+ echo "Error: could not find D compiler"; \
+ exit 1; \
+ fi; \
+ echo "$${DC_} used as D compiler to build $${pname}"; \
+ export DFLAGS="-O2 -inline"; \
+ dub build --compiler=$${DC} --build=release --combined --skip-registry=all;
+checkPhase:
+ runHook preCheck; \
+ HOME=$${PWD}; \
+ dub test --combined --skip-registry=all; \
+ runHook postCheck
+installPhase:
+ runHook preInstall; \
+ mkdir -p $${out}/bin; \
+ install -m755 ./bin/spine $${out}/bin/spine; \
+ runHook postInstall
+ #cp -r bin/spine $out/bin/.
+postInstall:
+ echo "$${out}/share/cgi-bin"; \
+ echo `ls -la $${out}/bin/spine`
+#+END_SRC
+
*** flake :flake:
- flake.nix
@@ -407,14 +454,96 @@ ls $SpineOutstatic/latex/*.tex
./nix/dub.selections.nix #
- dub.selections.nix
-nix develop
+- nix develop
-nix flake update
+- nix flake update
+
+- nix shell -f default.nix
+- nix shell -c default.nix
+
+- nix build
+- nix build `nix-instantiate`
+- nix build -f default.nix
+
+- nix search --json 2>/dev/null |jq
+- nix flake show
+- nix show-derivation
+
+# nix-instantiate | nix-build
#+HEADER: :tangle ../flake.nix
#+BEGIN_SRC nix
{
- description = "a sisu like document parser";
+ description = "A sisu like parser and document generator";
+ inputs = {
+ flake-utils.url = "github:numtide/flake-utils";
+ nixpkgs.url = "github:nixos/nixpkgs";
+ #nixpkgs.url = "/nixpkgs-ra/nixpkgs";
+ };
+ outputs = { self, nixpkgs, flake-utils }: {
+ packages.x86_64-linux.spine =
+ let
+ pkgs = import nixpkgs {
+ system = "x86_64-linux";
+ };
+ #targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}";
+ in pkgs.stdenv.mkDerivation {
+ pname = "spine";
+ version = "<<spine_version_set>>";
+ description = "A sisu like parser and document generator";
+ inherit self;
+ src = self;
+ shell = ./shell.nix;
+ buildPhase = ''
+ runHook preBuild
+ HOME="$PWD"
+ DFLAGS="-O2 -inline"
+ 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
+ HOME="$PWD"
+ dub test --combined --skip-registry=all
+ runHook postCheck
+ '';
+ installPhase = ''
+ runHook preInstall
+ mkdir -p $out/bin
+ install -m755 ./bin/spine $out/bin/spine
+ #cp -r bin/spine $out/bin/.
+ runHook postInstall
+ '';
+ postInstall = ''
+ echo "$out/share/cgi-bin"
+ echo `ls -la $out/bin/spine`
+ '';
+ nativeBuildInputs = with pkgs; [
+ ldc dub
+ ];
+ buildInputs = with pkgs; [
+ sqlite
+ ];
+ };
+ defaultPackage.x86_64-linux = self.packages.x86_64-linux.spine;
+ };
+}
+#+END_SRC
+
+#+BEGIN_SRC nix
+{
+ description = "a sisu like parser & document generator";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "<<nixpkgs_url>>";
@@ -478,73 +607,52 @@ nix flake update
}
#+END_SRC
-#+HEADER: :NO-tangle ../flake.nix
-#+BEGIN_SRC nix
-{
- description = "a sisu like document parser";
- inputs = {
- flake-utils.url = "github:numtide/flake-utils";
- nixpkgs.url = "<<nixpkgs_url>>";
- # pkgs /nixpkgs-ra/nixpkgs {}
- #spine.url = "/grotto-ra/repo/git.repo/projects/project-spine/doc-reform";
- #spine.url = "./.";
- };
- outputs = { self, nixpkgs, flake-utils }:
- #flake-utils.lib.eachSystem [ "x86_64-linux" "defaultPackage.x86_64-linux" "packages.x86_64-linux.defaultPackage.x86_64-linux" ] (system:
- flake-utils.lib.eachDefaultSystem (system:
- let
- #pkgs = ${system};
- pkgs = nixpkgs.legacyPackages.${system};
- # project = pkgs.spine.project' {
- # src = ./.;
- # compiler-nix-name = "ldc";
- # };
- in { #project.flake {} // {
- #devShell = project.shellFor {
- # (import ./shell.nix self { inherit pkgs; });
- #};
- devShell = import ./default.nix self { inherit pkgs; };
- }
- );
-}
-#+END_SRC
-
*** shell.nix :shell:
**** NOTES
- nix-shell
+- nix-shell
- shell.nix --pure
- shell.nix --pure -I .envrc
+- shell.nix --pure
+- shell.nix --pure -I .envrc
- nix-shell --pure -I nixpkgs=/nixpkgs-ra/nixpkgs
- nix-shell --pure -p "with import /nixpkgs-ra/nixpkgs {}; ldc"
- nix-shell --pure -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]"
+- nix-shell --pure -I nixpkgs=/nixpkgs-ra/nixpkgs
+- nix-shell --pure -p "with import /nixpkgs-ra/nixpkgs {}; ldc"
+- nix-shell --pure -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]"
- shell.nix direnv: export +IN_NIX_SHELL
+- shell.nix direnv: export +IN_NIX_SHELL
- nix-shell -p nixFlakes
- nix-shell -p nixFlakes --pure
- nix-shell -p nixFlakes --pure -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]"
+- nix-shell -p nixFlakes
+- nix-shell -p nixFlakes --pure
+- nix-shell -p nixFlakes --pure -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]"
- shell.nix -I .envrc
- shell.nix
+- shell.nix -I .envrc
+- nix-shell -I nixpkgs=<provide local nix path>
+- nix-shell -I nixpkgs=<provide local nix path> --pure
+- shell.nix
+- nix-shell shell.nix --pure
+
+- nix shell -c default.nix
- nix develop
+- nix run default.nix --print-build-logs
+- nix run -I .envrc default.nix --print-build-logs
- nix-build
- nix-build -I nixpkgs=<provide local nix path>
- nix-build -I .envrc
+- nix develop
+
+- nix-build
+- nix-build -I nixpkgs=<provide local nix path>
+- nix-build -I .envrc
+
+- nix build --print-build-logs
+- nix build -I .envrc --print-build-logs
+
+- nix build -f default.nix --print-build-logs
+- nix build -f derivation.nix --print-build-logs
+- buildPhase
+
+- nix build -f default.nix && noti
+- nix build -f default.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine"
- nix build
- nix build -f default.nix && noti
- nix build -f default.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine"
- nix build -f spine.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine"
- nix build -f project.nix
- nix build -f spine.nix
- nix-shell shell.nix --pure
- nix build -f default.nix
./result/bin/spine
**** tangle
@@ -620,6 +728,7 @@ aria
#+NAME: shell_packages_candy
#+BEGIN_SRC nix
### candy
+jq
starship
#+END_SRC
@@ -731,15 +840,14 @@ pkgs.callPackage ./derivation.nix {}
}:
assert dcompiler != null;
with (
- assert dcompiler != null;
with lib;
let
- # Filter function to remove the .dub package folder from src
+ # 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
+ # remove reference to build tools and library sources
disallowedReferences = deps: [ dcompiler dub ];
removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
in {
@@ -766,24 +874,25 @@ with (
'';
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
+ HOME="$PWD"
+ DFLAGS="-O2 -inline"
+ 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
+ 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
+ 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
+ HOME="$PWD"
dub test --combined --skip-registry=all
runHook postCheck
'';
@@ -797,30 +906,33 @@ with (
description = package.description;
} // attrs.meta or {};
} // lib.optionalAttrs (!(attrs ? version)) {
- # Use name from dub.json, unless pname and version are specified
+ # use name from dub.json, unless pname and version are specified
name = package.name;
}));
}
);
mkDubDerivation rec {
- name = "spine-${version}";
- version = "<<spine_version_set>>";
- src = ./.;
- buildInputs = with pkgs; [
- nixFlakes
- ## package manager
+ pname = "spine";
+ version = "<<spine_version_set>>";
+ src = ./.;
+ nativeBuildInputs = with pkgs; [
dub
- ## compiler
ldc
- #rund
- ## linker
- #lld
- #mold
- ## builder
- #ninja
+ ];
+ buildInputs = with pkgs; [
+ nixFlakes
sqlite
];
- <<nix_project_meta>>
+ meta = with pkgs.lib; {
+ description = "A sisu like parser and document generator";
+ longDescription = ''
+ A sisu like parser and document generator
+ '';
+ homepage = "https://sisudoc.org";
+ license = licenses.agpl3Plus;
+ platforms = platforms.linux;
+ maintainers = [ "RalphAmissah" ];
+ };
}
#+END_SRC
@@ -840,8 +952,13 @@ installPhase = ''
#+NAME: nix_project_meta
#+BEGIN_SRC nix
meta = with pkgs.lib; {
- homepage = https://sisudoc.org;
+ pname = "spine";
+ version = "<<spine_version_set>>";
description = "a sisu like document parser";
+ longDescription = ''
+ A sisu like parser and document generator
+ '';
+ homepage = "https://sisudoc.org";
license = licenses.agpl3Plus;
platforms = platforms.linux;
maintainers = [ "RalphAmissah" ];
@@ -973,6 +1090,7 @@ export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
# eval "$(nix print-dev-env)"
# echo $NIX_BUILD_TOP
export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g')
+export SpinePROJ=<<project_path_local_project>>
export SpineSRC=<<project_path_local_src>>
export SpineBIN=<<project_path_local_bin>>
export SpineDOC=<<project_path_local_doc>>
@@ -1118,7 +1236,7 @@ nix flake update
description = "a sisu like document parser search form";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
- nixpkgs.url = "github:nixos/nixpkgs";
+ nixpkgs.url = "<<nixpkgs_url>>";
};
outputs = { self, nixpkgs, flake-utils }:
let
@@ -1286,8 +1404,14 @@ mkDubDerivation rec {
)
];
meta = with pkgs.lib; {
- homepage = https://sisudoc.org;
- description = "a sisu like document parser";
+ pname = "spine-search";
+ version = "<<spine_version_set>>";
+ homepage = "https://sisudoc.org";
+ description = "cgi sqlite search form for document object search";
+ longDescription = ''
+ A sisu like parser and document generator
+ ...
+ '';
license = licenses.agpl3Plus;
platforms = platforms.linux;
maintainers = [ "RalphAmissah" ];
@@ -1337,14 +1461,19 @@ spine_search
nixpkgs=<<nixpkgs_path_local>>
#+END_SRC
-#+NAME: project_path_local_src
+#+NAME: project_path_local_project
#+BEGIN_SRC nix
/grotto-ra/repo/git.repo/projects/project-spine/doc-reform
#+END_SRC
+#+NAME: project_path_local_src
+#+BEGIN_SRC nix
+/grotto-ra/repo/git.repo/projects/project-spine/doc-reform/src
+#+END_SRC
+
#+NAME: project_path_local_bin
#+BEGIN_SRC nix
-<<project_path_local_src>>/result/bin
+<<project_path_local_project>>/result/bin
#+END_SRC
#+NAME: project_path_cgi_bin