From 684091e7e5c958561d4c0d7bd6c77f9a5efa80c3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 8 Dec 2022 20:28:06 -0500 Subject: gitignore & things nix --- .envrc-local_ | 30 ++++++++++++++++ .gitignore | 2 +- org/config_git.org | 26 +++++++------- org/config_nix.org | 103 +++++++++++++++++++++++++++++------------------------ shell.nix | 16 +++++---- 5 files changed, 110 insertions(+), 67 deletions(-) create mode 100644 .envrc-local_ diff --git a/.envrc-local_ b/.envrc-local_ new file mode 100644 index 0000000..1c0fa63 --- /dev/null +++ b/.envrc-local_ @@ -0,0 +1,30 @@ +echo ".envrc called .envrc-local" +PATH_add result/bin +export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos +#export NIX_PATH=nixpkgs=/nixpkgs/nixpkgs +#export NIX_PATH=/nixpkgs/nixpkgs +export DFLAGS="-O2 -inline -boundscheck=on -color=on" +# 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=~/grotto/repo/git.repo/projects/project-spine/doc-reform +export SpineSRC=$SpinePROJ/src +export SpineBIN=$SpinePROJ/result/bin +export SpineDOC=~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples +export SpinePOD=$SpineDOC/markup/pod +export SpineOUTversioned=/srv/www/spine/$SpineVER +export SpineOUT=/srv/www/spine +export SpineDBpath=/var/www/sqlite +#export SpineDBpath=/srv/www/spine/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'`" +#direnv allow diff --git a/.gitignore b/.gitignore index 2e5e62e..0514a2e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ !nix !nix/** !*.nix -!flake.lock +#!flake.lock !.envrc !README.md !README diff --git a/org/config_git.org b/org/config_git.org index 3a1083b..328a192 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -23,10 +23,19 @@ #+HEADER: :tangle "../.gitignore" #+BEGIN_SRC sh # git ls-files --others --exclude-from=.git/info/exclude +# git check-ignore -v flake.lock # git clean -ix +# find . -name "*_" | xargs rm -rf +# find . -name "*.o" | xargs rm -rf ,* !.gitignore !.gitattributes +!*.nix +!nix +!nix/** +!*.nix +#!flake.lock +!.envrc !README.md !README !COPYRIGHT @@ -39,6 +48,8 @@ !meson.build !tangle !*.org +!org +!org/*.org !*.d !*.rb !*.txt @@ -47,15 +58,6 @@ !doc/** !man !man/** -!org -!sundry -!sundry/** -!*.nix -!nix -!nix/** -!flake.lock -!.envrc -!.envrc-local_ !.dr !.dr/* !src @@ -72,6 +74,7 @@ !**/*.ssm !subprojects !subprojects/*.wrap +!**/*.lib #!subprojects/*.meson.build #!subprojects/** !pod.manifest @@ -82,7 +85,6 @@ !docs/*.html !notes notes/** -!notes/*.org !notes/sisu-description.sst !notes/reminders !notes/reminders/** @@ -99,9 +101,7 @@ tmp/** ,*~ \#* ,*.\#* -!.env -!.env/local_ -!.env/echo-nixNote +!.envrc-local_ #!*/ #\#* #*.\#* diff --git a/org/config_nix.org b/org/config_nix.org index 7bd1645..86c61ee 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -148,9 +148,10 @@ fi #+BEGIN_SRC nix echo ".envrc called .envrc-local" PATH_add result/bin -export NIX_PATH=<> -#export NIX_PATH=<> -export DFLAGS="-O2 -inline" +export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos +#export NIX_PATH=nixpkgs=/nixpkgs/nixpkgs +#export NIX_PATH=/nixpkgs/nixpkgs +export DFLAGS="-O2 -inline -boundscheck=on -color=on" # reload when these files change # watch_file flake.nix # watch_file flake.lock @@ -159,20 +160,22 @@ export DFLAGS="-O2 -inline" # 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=<> -export SpineSRC=<> -export SpineBIN=<> -export SpineDOC=<> +export SpinePROJ=~/grotto/repo/git.repo/projects/project-spine/doc-reform +export SpineSRC=$SpinePROJ/src +export SpineBIN=$SpinePROJ/result/bin +export SpineDOC=~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples export SpinePOD=$SpineDOC/markup/pod -export SpineOUTversioned=<> -export SpineOUT=<> -export SpineDBpath=<> +export SpineOUTversioned=/srv/www/spine/$SpineVER +export SpineOUT=/srv/www/spine +export SpineDBpath=/var/www/sqlite +#export SpineDBpath=/srv/www/spine/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'`" +#direnv allow #+END_SRC **** .env/echo-nixNote CHECK MODIFY @@ -491,12 +494,10 @@ postInstall: #+HEADER: :noweb yes #+BEGIN_SRC nix { - 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"; - }; + description = "a sisu like parser and document generator"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.nixpkgs.url = "github:nixos/nixpkgs"; + #inputs.nixpkgs.url = "/nixpkgs-ra/nixpkgs"; outputs = { self, nixpkgs, flake-utils }: { packages.x86_64-linux.spine = let @@ -507,7 +508,7 @@ postInstall: in pkgs.stdenv.mkDerivation { pname = "spine"; version = "<>"; - description = "A sisu like parser and document generator"; + description = "a sisu like parser and document generator"; inherit self; src = self; shell = ./shell.nix; @@ -518,9 +519,7 @@ postInstall: for DC_ in dmd ldmd2 gdmd; do echo "- check for D compiler $DC_" DC=$(type -P $DC_ || echo "") - if [ ! "$DC" == "" ]; then - break - fi + if [ ! "$DC" == "" ]; then break; fi done if [ "$DC" == "" ]; then exit "Error: could not find D compiler" @@ -543,6 +542,8 @@ postInstall: runHook postInstall ''; postInstall = '' + echo `ls -la $out/bin/spine` + echo "" echo "nix build or nix develop? (suggestions):" echo '- nix build' echo ' nix build .#spine --print-build-logs' @@ -654,24 +655,21 @@ src = fetchTarball { #+HEADER: :tangle ../shell.nix #+HEADER: :tangle-mode (identity #o755) -#+HEADER: :shebang "#!/usr/bin/env -S nix-shell --pure" +#+HEADER: :shebang "#!/usr/bin/env -S nix-shell --pure\n#!nix-shell -i bash" #+HEADER: :noweb yes #+BEGIN_SRC nix -#!nix-shell -i bash { pkgs ? import {} }: with pkgs; mkShell { buildInputs = [ - ### nix_related direnv nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig - nix-tree jq + nix-tree jq nix-output-monitor git ps ### d_build_related - ## package manager dub ## compiler ldc @@ -718,27 +716,40 @@ mkShell { echo "" echo "nix flake show:" nix flake show - echo "" - echo "nix build or nix develop? (suggestions):" - echo '- nix build' - echo ' nix build .#spine --print-build-logs' - echo ' nix build --print-build-logs' - echo '- nix run' - echo ' nix run .#spine --print-build-logs' - echo ' nix run default.nix --print-build-logs' - echo '- nix shell' - echo ' nix shell --print-build-logs --command spine -v' - echo '- nix develop' - echo ' nix develop --build .#spine --print-build-logs' - echo ' nix develop --build -f derivation.nix -I .envrc --print-build-logs' - echo ' nix develop ; eval "$buildPhase"' - echo "" - echo 'spine -v' - echo "examine" - echo ' nix-instantiate | nix show-derivation | jq' - echo ' nix-build . --no-out-link | xargs -o nix-tree' - echo ' nix-tree --derivation .#spine' - echo "" + echo " + nix flake update + nix flake metadata + nix flake check + nix flake show + + nix build or nix develop? (suggestions): + + - nix build + nix build .#default --print-build-logs + nix build --print-build-logs + nix build .#default --print-build-logs |& nom + + - nix run + nix run .#spine --print-build-logs + nix run default.nix --print-build-logs + + - nix shell + nix shell --print-build-logs --command spine -v + + - nix develop + nix develop --build .#default --print-build-logs + nix develop --build -f derivation.nix -I .envrc --print-build-logs + nix develop ; eval \$buildPhase + + nix-build |& nom + + spine -v + + nix-instantiate | nix show-derivation | jq + nix-build . --no-out-link | xargs -o nix-tree + nix-tree --derivation .#spine + + " #echo "ldc `${pkgs.ldc}/bin/ldc2 -v`" ''; } diff --git a/shell.nix b/shell.nix index d745b40..8a19e80 100755 --- a/shell.nix +++ b/shell.nix @@ -4,16 +4,14 @@ with pkgs; mkShell { buildInputs = [ - ### nix_related direnv nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig - nix-tree jq + nix-tree jq nix-output-monitor git ps ### d_build_related - ## package manager dub ## compiler ldc @@ -60,7 +58,6 @@ mkShell { echo "" echo "nix flake show:" nix flake show - echo "" echo " nix flake update nix flake metadata @@ -70,18 +67,23 @@ mkShell { nix build or nix develop? (suggestions): - nix build - nix build .#spine --print-build-logs + nix build .#default --print-build-logs nix build --print-build-logs + nix build .#default --print-build-logs |& nom - nix run nix run .#spine --print-build-logs nix run default.nix --print-build-logs + - nix shell nix shell --print-build-logs --command spine -v + - nix develop - nix develop --build .#spine --print-build-logs + nix develop --build .#default --print-build-logs nix develop --build -f derivation.nix -I .envrc --print-build-logs - nix develop ; eval $buildPhase + nix develop ; eval \$buildPhase + + nix-build |& nom spine -v -- cgit v1.2.3