aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.envrc25
-rw-r--r--.envrc-local_5
-rw-r--r--dub.json4
-rw-r--r--flake.lock6
-rw-r--r--flake.nix154
-rw-r--r--org/config_dub.org4
-rw-r--r--org/config_nix.org232
-rwxr-xr-xshell.nix8
8 files changed, 291 insertions, 147 deletions
diff --git a/.envrc b/.envrc
index 82f6ad1..ccf3cbf 100644
--- a/.envrc
+++ b/.envrc
@@ -1,5 +1,5 @@
-# nix_direnv_watch_file provided-filename
use flake .
+#use flake .#default
NIX_ENFORCE_PURITY=1
NixDirEnvVersion="2.2.0"
if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then
@@ -7,6 +7,29 @@ if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then
# source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000="
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
fi
+# reload when these files change
+watch_file flake.lock
+watch_file flake.nix
+nix flake update && nix flake check --show-trace && nix flake show
if [ -f .envrc-local ]; then
source_env_if_exists .envrc-local || source .envrc-local
fi
+echo "
+
+- nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell
+
+- nix build .#default --print-build-logs
+- nix build .#spine-dmd --print-build-logs
+- nix build .#spine-ldc --print-build-logs
+- nix build .#spine-gdc --print-build-logs
+
+nix-shell '<nixpkgs>' -A nix --pure
+
+nix run .#default --print-build-logs
+
+nix develop --build .#default --print-build-logs
+
+nix shell .#default --print-build-logs --command spine -v
+nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" ./markup/pod
+nix shell .#default --print-build-logs --command spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" ./markup/pod
+"
diff --git a/.envrc-local_ b/.envrc-local_
index 2a660d4..902526a 100644
--- a/.envrc-local_
+++ b/.envrc-local_
@@ -1,8 +1,3 @@
-# reload when these files change
-watch_file flake.lock
-watch_file flake.nix
-nix flake update; nix flake check; nix flake show
-#use flake .#default
PATH_add result/bin
export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
#export NIX_PATH=/srv/nix/nixpkgs
diff --git a/dub.json b/dub.json
index 801e119..530a9fe 100644
--- a/dub.json
+++ b/dub.json
@@ -119,6 +119,10 @@
{
"name": "gdc",
"targetName": "spine-gdc"
+ },
+ {
+ "name": "gdmd",
+ "targetName": "spine-gdc"
}
]
}
diff --git a/flake.lock b/flake.lock
index 5154297..fcd9096 100644
--- a/flake.lock
+++ b/flake.lock
@@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1672428209,
- "narHash": "sha256-eejhqkDz2cb2vc5VeaWphJz8UXNuoNoM8/Op8eWv2tQ=",
+ "lastModified": 1674487464,
+ "narHash": "sha256-Jgq50e4S4JVCYpWLqrabBzDp/1mfaxHCh8/OOorHTy0=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847",
+ "rev": "3954218cf613eba8e0dcefa9abe337d26bc48fd0",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index e615ae9..56883a9 100644
--- a/flake.nix
+++ b/flake.nix
@@ -18,13 +18,12 @@
meta.mainProgram = "spine";
executable = true;
src = self;
- shell = ./default.nix;
- devEnv = ./devenv.nix;
+ #shell = ./shell.nix; # ./default.nix;
+ #devEnv = ./shell.nix; # ./default.nix;
buildInputs = [ sqlite ];
- nativeBuildInputs = [ dub dmd ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
+ nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
buildPhase = ''
runHook preBuild
- HOME="$PWD"
for DC_ in dmd ldmd2 ldc2 gdc gdmd; do
echo "- check for D compiler $DC_"
DC=$(type -P $DC_ || echo "")
@@ -37,7 +36,150 @@
'';
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
+ '';
+ postInstall = ''
+ echo `ls -la $out/bin/spine`
+ echo "
+ nix build or nix develop? (suggestions):
+ - nix build
+ nix build .#default --print-build-logs
+ nix flake update; nix build .#default --print-build-logs
+ nix build --print-build-logs
+ - nix run
+ nix run .#default --print-build-logs
+ nix run default.nix --print-build-logs
+ - nix shell
+ nix shell .#default --print-build-logs --command spine -v
+ - nix develop
+ nix develop --profile .#default --print-build-logs --command spine -v
+ nix develop ; eval \"$buildPhase\"
+ nix develop --build -f derivation.nix -I .envrc --print-build-logs
+ - nix profile install . --print-build-logs
+ spine -v
+ nix-instantiate | nix show-derivation | jq
+ "
+ $out/bin/spine -v
+ '';
+ };
+ spine-dmd = stdenv.mkDerivation {
+ pname = "spine";
+ inherit version;
+ meta.mainProgram = "spine-dmd";
+ executable = true;
+ src = self;
+ buildInputs = [ sqlite ];
+ nativeBuildInputs = [ dub dmd gnumake ];
+ buildPhase = ''
+ runHook preBuild
+ dub build --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all
+ runHook postBuild
+ '';
+ checkPhase = ''
+ runHook preCheck
+ dub test --combined --skip-registry=all
+ runHook postCheck
+ '';
+ installPhase = ''
+ runHook preInstall
+ mkdir -p $out/bin
+ install -m755 ./bin/spine $out/bin/spine
+ runHook postInstall
+ '';
+ postInstall = ''
+ echo `ls -la $out/bin/spine`
+ echo "
+ nix build or nix develop? (suggestions):
+ - nix build
+ nix build .#default --print-build-logs
+ nix flake update; nix build .#default --print-build-logs
+ nix build --print-build-logs
+ - nix run
+ nix run .#default --print-build-logs
+ nix run default.nix --print-build-logs
+ - nix shell
+ nix shell .#default --print-build-logs --command spine -v
+ - nix develop
+ nix develop --profile .#default --print-build-logs --command spine -v
+ nix develop ; eval \"$buildPhase\"
+ nix develop --build -f derivation.nix -I .envrc --print-build-logs
+ - nix profile install . --print-build-logs
+ spine -v
+ nix-instantiate | nix show-derivation | jq
+ "
+ $out/bin/spine -v
+ '';
+ };
+ spine-ldc = stdenv.mkDerivation {
+ pname = "spine";
+ inherit version;
+ meta.mainProgram = "spine-ldc";
+ executable = true;
+ src = self;
+ buildInputs = [ sqlite ];
+ nativeBuildInputs = [ dub ldc gnumake ];
+ buildPhase = ''
+ runHook preBuild
+ dub build --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all
+ runHook postBuild
+ '';
+ checkPhase = ''
+ runHook preCheck
+ dub test --combined --skip-registry=all
+ runHook postCheck
+ '';
+ installPhase = ''
+ runHook preInstall
+ mkdir -p $out/bin
+ install -m755 ./bin/spine $out/bin/spine
+ runHook postInstall
+ '';
+ postInstall = ''
+ echo `ls -la $out/bin/spine`
+ echo "
+ nix build or nix develop? (suggestions):
+ - nix build
+ nix build .#default --print-build-logs
+ nix flake update; nix build .#default --print-build-logs
+ nix build --print-build-logs
+ - nix run
+ nix run .#default --print-build-logs
+ nix run default.nix --print-build-logs
+ - nix shell
+ nix shell .#default --print-build-logs --command spine -v
+ - nix develop
+ nix develop --profile .#default --print-build-logs --command spine -v
+ nix develop ; eval \"$buildPhase\"
+ nix develop --build -f derivation.nix -I .envrc --print-build-logs
+ - nix profile install . --print-build-logs
+ spine -v
+ nix-instantiate | nix show-derivation | jq
+ "
+ $out/bin/spine -v
+ '';
+ };
+ spine-gdc = stdenv.mkDerivation {
+ pname = "spine";
+ inherit version;
+ meta.mainProgram = "spine-gdc";
+ executable = true;
+ src = self;
+ buildInputs = [ sqlite ];
+ nativeBuildInputs = [ dub gdc gnumake ];
+ buildPhase = ''
+ runHook preBuild
+ dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all
+ runHook postBuild
+ '';
+ checkPhase = ''
+ runHook preCheck
dub test --combined --skip-registry=all
runHook postCheck
'';
@@ -82,7 +224,7 @@
devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in with pkgs; {
- devShell = mkShell { buildInputs = [ git dub dmd ldc gdc sqlite ]; };
+ devShell = mkShell { };
});
};
}
diff --git a/org/config_dub.org b/org/config_dub.org
index 3a41711..ae25f5a 100644
--- a/org/config_dub.org
+++ b/org/config_dub.org
@@ -168,6 +168,10 @@
{
"name": "gdc",
"targetName": "spine-gdc"
+ },
+ {
+ "name": "gdmd",
+ "targetName": "spine-gdc"
}
]
}
diff --git a/org/config_nix.org b/org/config_nix.org
index df999ad..dd8c548 100644
--- a/org/config_nix.org
+++ b/org/config_nix.org
@@ -35,8 +35,8 @@
#+HEADER: :tangle ../.envrc
#+BEGIN_SRC sh
-# nix_direnv_watch_file provided-filename
use flake .
+#use flake .#default
NIX_ENFORCE_PURITY=1
NixDirEnvVersion="2.2.0"
if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then
@@ -44,9 +44,32 @@ if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then
# source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000="
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
fi
+# reload when these files change
+watch_file flake.lock
+watch_file flake.nix
+nix flake update && nix flake check --show-trace && nix flake show
if [ -f .envrc-local ]; then
source_env_if_exists .envrc-local || source .envrc-local
fi
+echo "
+
+- nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell
+
+- nix build .#default --print-build-logs
+- nix build .#spine-dmd --print-build-logs
+- nix build .#spine-ldc --print-build-logs
+- nix build .#spine-gdc --print-build-logs
+
+nix-shell '<nixpkgs>' -A nix --pure
+
+nix run .#default --print-build-logs
+
+nix develop --build .#default --print-build-logs
+
+nix shell .#default --print-build-logs --command spine -v
+nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" ./markup/pod
+nix shell .#default --print-build-logs --command spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" ./markup/pod
+"
#+END_SRC
**** .envrc-local CHECK MODIFY
@@ -56,11 +79,6 @@ fi
#+HEADER: :tangle ../.envrc-local_
#+HEADER: :noweb yes
#+BEGIN_SRC sh
-# reload when these files change
-watch_file flake.lock
-watch_file flake.nix
-nix flake update; nix flake check; nix flake show
-#use flake .#default
PATH_add result/bin
export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
#export NIX_PATH=/srv/nix/nixpkgs
@@ -115,11 +133,68 @@ export PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" |
meta.mainProgram = "spine";
executable = true;
src = self;
- shell = ./default.nix;
- devEnv = ./devenv.nix;
+ #shell = ./shell.nix; # ./default.nix;
+ #devEnv = ./shell.nix; # ./default.nix;
+ buildInputs = [ sqlite ];
+ nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
+ buildPhase = ''
+ runHook preBuild
+ for DC_ in dmd ldmd2 ldc2 gdc 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=$DC_ --combined --skip-registry=all
+ runHook postBuild
+ '';
+ <<flake_phases_other_than_build>>
+ };
+ spine-dmd = stdenv.mkDerivation {
+ pname = "spine";
+ inherit version;
+ meta.mainProgram = "spine-dmd";
+ executable = true;
+ src = self;
+ buildInputs = [ sqlite ];
+ nativeBuildInputs = [ dub dmd gnumake ];
+ buildPhase = ''
+ runHook preBuild
+ dub build --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all
+ runHook postBuild
+ '';
+ <<flake_phases_other_than_build>>
+ };
+ spine-ldc = stdenv.mkDerivation {
+ pname = "spine";
+ inherit version;
+ meta.mainProgram = "spine-ldc";
+ executable = true;
+ src = self;
+ buildInputs = [ sqlite ];
+ nativeBuildInputs = [ dub ldc gnumake ];
+ buildPhase = ''
+ runHook preBuild
+ dub build --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all
+ runHook postBuild
+ '';
+ <<flake_phases_other_than_build>>
+ };
+ spine-gdc = stdenv.mkDerivation {
+ pname = "spine";
+ inherit version;
+ meta.mainProgram = "spine-gdc";
+ executable = true;
+ src = self;
buildInputs = [ sqlite ];
- nativeBuildInputs = [ dub dmd ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
- <<flake_phases>>
+ nativeBuildInputs = [ dub gdc gnumake ];
+ buildPhase = ''
+ runHook preBuild
+ dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all
+ runHook postBuild
+ '';
+ <<flake_phases_other_than_build>>
};
#vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000=";
});
@@ -132,132 +207,12 @@ export PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" |
devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in with pkgs; {
- devShell = mkShell { buildInputs = [ git dub dmd ldc gdc sqlite ]; };
+ devShell = mkShell { };
});
};
}
#+END_SRC
-**** some other possible flakes (samples)
-***** flake 0
-
-#+NAME: flake_0
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{
- description = "a sisu like parser & document generator";
- inputs.<<flake_inputs_nix>>
- outputs = { <<flake_outputs>> }: {
- <<flake_output_spine>>
- <<flake_output_default>>
- };
-}
-#+END_SRC
-
-***** flake single system
-
-#+NAME: flake_single_sytem
-#+HEADER: :tangle ../flake-1-single-system_.nix
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{
- description = "a sisu like parser & document generator";
- inputs.<<flake_inputs_nix>>
- outputs = { <<flake_outputs>> }: {
- 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 {
- <<flake_metadata>>
- inherit self;
- src = self;
- #shell = ./shell.nix;
- shell = ./default.nix;
- devEnv = ./devenv.nix;
- <<flake_phases>>
- buildInputs = [ sqlite ];
- nativeBuildInputs = with pkgs; [ dub <<d-compiler>> ]; # [ dmd dub ]; [ ldc dub ]; [ gdc dub ];
- };
- <<flake_output_default>>
- };
-}
-#+END_SRC
-
-***** flake 2
-
-#+NAME: flake_2
-#+HEADER: :tangle ../flake-2_.nix
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{
- description = "a sisu like parser & document generator";
- inputs.<<flake_inputs_nix>>
- outputs = { <<flake_outputs>> }:
- let
- system = "x86_64-linux";
- pkgs = import nixpkgs {
- inherit system;
- };
- #lib = nixpkgs.lib;
- in {
- packages.x86_64-linux.spine = pkgs.stdenv.mkDerivation {
- inherit system;
- <<flake_metadata>>
- inherit self;
- src = self;
- #shell = ./shell.nix;
- shell = ./default.nix;
- devEnv = ./devenv.nix;
- <<flake_phases>>
- buildInputs = [ sqlite ];
- nativeBuildInputs = with pkgs; [ dub <<d-compiler>> ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
- };
- <<flake_output_default>>
- };
-}
-#+END_SRC
-
-***** flake (multi-system)
-
-#+NAME: flake_multi_system_possible
-#+HEADER: :tangle ../flake-0-multi-system_.nix
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{
- description = "a sisu like parser & document generator";
- inputs.<<flake_inputs_nix>>
- outputs = { <<flake_outputs>> }:
- let
- version = "<<spine_version_set>>";
- supportedSystems = [ "x86_64-linux" ]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
- # helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
- forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
- nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); # nixpkgs instantiated for supported system types.
- <<flake_devshells>>
- in {
- packages = forAllSystems (system:
- let
- pkgs = nixpkgsFor.${system};
- in {
- default = pkgs.stdenv.mkDerivation {
- pname = "spine";
- inherit version;
- src = self;
- shell = ./default.nix;
- devEnv = ./devenv.nix;
- <<flake_phases>>
- buildInputs = [ sqlite ];
- nativeBuildInputs = with pkgs; [ dub <<d-compiler>> ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
- };
- #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000=";
- });
- };
-}
-#+END_SRC
-
*** flake :flake:
**** notes?
@@ -387,9 +342,14 @@ buildPhase = ''
dub build --compiler=$DC --build=$DC_ --combined --skip-registry=all
runHook postBuild
'';
+<<flake_phases_other_than_build>>
+#+END_SRC
+
+#+NAME: flake_phases_other_than_build
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
checkPhase = ''
runHook preCheck
- HOME="$PWD"
dub test --combined --skip-registry=all
runHook postCheck
'';
@@ -578,12 +538,14 @@ src = fetchTarball {
with pkgs;
mkShell {
buildInputs = [
+ #nix
direnv
nixVersions.unstable #nixFlakes
nix-prefetch-git
validatePkgConfig
nix-tree jq nix-output-monitor
git
+ gnumake
ps
### d_build_related
dub
@@ -665,6 +627,12 @@ mkShell {
nix-build . --no-out-link | xargs -o nix-tree
nix-tree --derivation .#default
+ nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell
+ nix build .#default --print-build-logs
+
+ - nix build .#spine-dmd --print-build-logs
+ - nix build .#spine-ldc --print-build-logs
+ - nix build .#spine-gdc --print-build-logs
"
#echo "ldc `${pkgs.ldc}/bin/ldc2 -v`"
'';
diff --git a/shell.nix b/shell.nix
index c31d0a6..8f86997 100755
--- a/shell.nix
+++ b/shell.nix
@@ -4,12 +4,14 @@
with pkgs;
mkShell {
buildInputs = [
+ #nix
direnv
nixVersions.unstable #nixFlakes
nix-prefetch-git
validatePkgConfig
nix-tree jq nix-output-monitor
git
+ gnumake
ps
### d_build_related
dub
@@ -91,6 +93,12 @@ mkShell {
nix-build . --no-out-link | xargs -o nix-tree
nix-tree --derivation .#default
+ nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell
+ nix build .#default --print-build-logs
+
+ - nix build .#spine-dmd --print-build-logs
+ - nix build .#spine-ldc --print-build-logs
+ - nix build .#spine-gdc --print-build-logs
"
#echo "ldc `${pkgs.ldc}/bin/ldc2 -v`"
'';