From eff4a98d150ac52e90e77c43b9ec755777882bba Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 23 Jun 2023 18:58:56 -0400 Subject: nix flake, overlays from spine --- .env/nix-commands | 22 +-- .envrc-local | 29 ++++ .envrc-local_ | 16 +++ .gitattributes | 4 + .gitignore | 2 + flake.lock | 82 +++++++++-- flake.nix | 72 +++++----- org/config_env.org | 16 +++ org/config_git.org | 6 + org/config_nix.org | 396 +++++++++++------------------------------------------ shell.nix | 16 --- 11 files changed, 270 insertions(+), 391 deletions(-) create mode 100644 .envrc-local diff --git a/.env/nix-commands b/.env/nix-commands index 7cfa723..8a16dbf 100644 --- a/.env/nix-commands +++ b/.env/nix-commands @@ -1,20 +1,20 @@ - 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 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 develop - - nix develop .#devShell --print-build-logs - - nix develop .#devShell-html --print-build-logs - - nix develop .#devShell-epub --print-build-logs - - nix develop .#devShell-latex-pdf --print-build-logs - - nix develop .#devShell-sqlite --print-build-logs - - nix develop .#devShell-i18n --print-build-logs + - nix develop ".#devShell" --print-build-logs + - nix develop ".#devShell-html" --print-build-logs + - nix develop ".#devShell-epub" --print-build-logs + - nix develop ".#devShell-latex-pdf" --print-build-logs + - nix develop ".#devShell-sqlite" --print-build-logs + - nix develop ".#devShell-i18n" --print-build-logs nix run .#default --print-build-logs -nix develop --build .#default --print-build-logs +nix develop --build ".#default" --print-build-logs nix-shell '' -A nix --pure diff --git a/.envrc-local b/.envrc-local new file mode 100644 index 0000000..0c7d21f --- /dev/null +++ b/.envrc-local @@ -0,0 +1,29 @@ +if [[ ! -d ./.git ]]; then + git init + git add . +fi +export DFLAGS="-O2 -inline -boundscheck=on -color=on" +export SpineBIN=result/bin +export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine +export SpineDOC=. +export SpinePOD=${SpineDOC}/markup/pod +export SpineOUT=/srv/www/spine +export SpineSearchActionLocal='http://localhost/spine_search' +export SpineSearchActionRemote='https://sisudoc.org/spine_search' +export SpineCGIform='spine_search' +export SpineSQLdb='spine.search.db' +export SpineCGIbin=/var/www/cgi/cgi-bin +export SpineDBpath=/var/www/sqlite +#export SpineDBpath=/srv/www/spine/sqlite +echo ' + .envrc-local echo ❯❯ + + ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh + + ❯❯ nix develop + ❯❯ nix develop -c zsh + ❯❯ nix develop ".#dsh-overlay-ldc" --print-build-logs + + ❯❯ nix build + ❯❯ nix build ".#default" --print-build-logs +' diff --git a/.envrc-local_ b/.envrc-local_ index 76d499d..0c7d21f 100644 --- a/.envrc-local_ +++ b/.envrc-local_ @@ -1,3 +1,7 @@ +if [[ ! -d ./.git ]]; then + git init + git add . +fi export DFLAGS="-O2 -inline -boundscheck=on -color=on" export SpineBIN=result/bin export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine @@ -11,3 +15,15 @@ export SpineSQLdb='spine.search.db' export SpineCGIbin=/var/www/cgi/cgi-bin export SpineDBpath=/var/www/sqlite #export SpineDBpath=/srv/www/spine/sqlite +echo ' + .envrc-local echo ❯❯ + + ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh + + ❯❯ nix develop + ❯❯ nix develop -c zsh + ❯❯ nix develop ".#dsh-overlay-ldc" --print-build-logs + + ❯❯ nix build + ❯❯ nix build ".#default" --print-build-logs +' diff --git a/.gitattributes b/.gitattributes index d883b29..97d2ccd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,9 @@ /org export-ignore .gitattributes export-ignore +/.dub export-ignore +/.direnv export-ignore +/*_ export-ignore +*_ export-ignore #.gitignore export-ignore tangle export-ignore flake.lock export-ignore diff --git a/.gitignore b/.gitignore index fccf60e..59710bd 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ !*.nix !flake.lock !.envrc +!.envrc-local +!.envrc-local_ !.envrc-nix !.env !.env/** diff --git a/flake.lock b/flake.lock index 066554b..684c05b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,15 +1,33 @@ { "nodes": { + "d-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1686518136, + "narHash": "sha256-HWqgvb6sgx9i/IivQLd57JGE+ZKLs2o9BFttTesJd6Y=", + "type": "git", + "url": "file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/packages/nix-flakes/dlang/dlang-nix-flakes" + }, + "original": { + "type": "git", + "url": "file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/packages/nix-flakes/dlang/dlang-nix-flakes" + } + }, "flake-utils": { "inputs": { "systems": "systems" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1687171271, + "narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c", "type": "github" }, "original": { @@ -23,11 +41,29 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1687171271, + "narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1687171271, + "narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c", "type": "github" }, "original": { @@ -38,11 +74,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1682779028, - "narHash": "sha256-tFfSbwSLobpHRznAa35KEU3R+fsFWTlmpFhTUdXq8RE=", + "lastModified": 1687518131, + "narHash": "sha256-KirltRIc4SFfk8bTNudIqgKAALH5oqpW3PefmkfWK5M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "54abe781c482f51ff4ff534ebaba77db5bd97442", + "rev": "3d8a93602bc54ece7a4e689d9aea1a574e2bbc24", "type": "github" }, "original": { @@ -54,24 +90,25 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", + "d-overlay": "d-overlay", + "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs", "spine": "spine" } }, "spine": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1682825487, - "narHash": "sha256-WLJQjNca136QVybyDyxCWy5lqvoUAcfu8bfy9MRIGzo=", + "lastModified": 1687558377, + "narHash": "sha256-9jalMMTAuW6J8K+5x9UFBpS/Ri33htiwx50uGnc+Lzs=", "ref": "refs/heads/main", - "rev": "d7930ad07cb9e511928b13e8d37015a56b6341b4", - "revCount": 578, + "rev": "badd5fe16d04828bdd6d38b9ec3f237555760e0c", + "revCount": 584, "type": "git", "url": "file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine" }, @@ -109,6 +146,21 @@ "repo": "default", "type": "github" } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index c98f513..ca13b8e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,34 +1,40 @@ { description = "spine (sisu like parser & document generator) made available to process markup samples"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # "github:nixos/nixpkgs"; - flake-utils.url = "github:numtide/flake-utils"; - spine = { - url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine"; - inputs.nixpkgs.follows = "nixpkgs"; - flake = true; - }; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.spine = { + url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine"; + inputs.nixpkgs.follows = "nixpkgs"; + flake = true; + }; + inputs.d-overlay = { + url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/packages/nix-flakes/dlang/dlang-nix-flakes"; + inputs.nixpkgs.follows = "nixpkgs"; + flake = true; }; outputs = { self, nixpkgs, flake-utils, spine, + d-overlay, } @ inputs: let version = "0.12.0"; shell = ./shell.nix; # ./default.nix; devEnv = ./.envrc; # ./shell.nix; # ./default.nix; supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types. + nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types in { packages = forAllSystems (system: let pkgs = nixpkgsFor.${system}; in { default = spine.packages.${system}.default; - spine-dmd = spine.packages.${system}.spine-dmd; - spine-ldc = spine.packages.${system}.spine-ldc; - #spine-gdc = spine.packages.${system}.spine-gdc; + spine-overlay-ldc = spine.packages.${system}.spine-overlay-ldc; + spine-nixpkgs-ldc = spine.packages.${system}.spine-nixpkgs-ldc; + #spine-overlay-dmd = spine.packages.${system}.spine-overlay-dmd; + #spine-overlay-ldc = spine.packages.${system}.spine-overlay-ldc; + #spine-overlay-gdc = spine.packages.${system}.spine-overlay-gdc; #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; }); apps = forAllSystems (system: { @@ -40,35 +46,37 @@ devShells = forAllSystems (system: let pkgs = nixpkgsFor.${system}; shellHook = '' - export DFLAGS="-O2 -inline -boundscheck=on -color=on" + export DFLAGS="-O2 -boundscheck=on" export Date=`date "+%Y%m%d"` ## set local values in .envrc-local (or here if you must) ''; in with pkgs; { - devShell = mkShell { + dsh = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; #buildInputs = [ sqlite ]; #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ - sqlite - dub - #dmd ldc + #dmd + dub gnumake + sqlite ]; inherit shellHook; }; - devShell-epub = mkShell { + dsh-spine = spine.devShells.${system}.default; + dsh-overlay-ldc = d-overlay.devShells.${system}.default; + dsh-epub = mkShell { name = "spine dev shell for epub output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite libxml2 @@ -88,27 +96,27 @@ ]; inherit shellHook; }; - devShell-html = mkShell { + dsh-html = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite ]; inherit shellHook; }; - devShell-latex-pdf = mkShell { + dsh-latex-pdf = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite source-sans-pro @@ -118,27 +126,27 @@ ]; inherit shellHook; }; - devShell-sqlite = mkShell { + dsh-sqlite = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite ]; inherit shellHook; }; - devShell-i18n = mkShell { + dsh-i18n = mkShell { name = "spine dev shell internationalization, po4a"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite perl534Packages.Po4a diff --git a/org/config_env.org b/org/config_env.org index b9f7264..9ded9ef 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -86,6 +86,10 @@ direnv fetchurl https://raw.githubusercontent.com/nix-community/nix-direnv/${Nix #+HEADER: :tangle ../.envrc-local_ #+HEADER: :noweb yes #+BEGIN_SRC sh +if [[ ! -d ./.git ]]; then + git init + git add . +fi export DFLAGS="-O2 -inline -boundscheck=on -color=on" export SpineBIN=result/bin export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine @@ -99,6 +103,18 @@ export SpineSQLdb='spine.search.db' export SpineCGIbin=/var/www/cgi/cgi-bin export SpineDBpath=/var/www/sqlite #export SpineDBpath=/srv/www/spine/sqlite +echo ' + .envrc-local echo ❯❯ + + ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh + + ❯❯ nix develop + ❯❯ nix develop -c zsh + ❯❯ nix develop ".#dsh-overlay-ldc" --print-build-logs + + ❯❯ nix build + ❯❯ nix build ".#default" --print-build-logs +' #+END_SRC #+BEGIN_SRC sh diff --git a/org/config_git.org b/org/config_git.org index b204063..f62055f 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -32,6 +32,8 @@ !*.nix !flake.lock !.envrc +!.envrc-local +!.envrc-local_ !.envrc-nix !.env !.env/** @@ -102,6 +104,10 @@ tmp/** #+BEGIN_SRC sh /org export-ignore .gitattributes export-ignore +/.dub export-ignore +/.direnv export-ignore +/*_ export-ignore +,*_ export-ignore #.gitignore export-ignore tangle export-ignore flake.lock export-ignore diff --git a/org/config_nix.org b/org/config_nix.org index 7cfd1a5..8e6aa66 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -15,10 +15,8 @@ #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t -- [[./doc-reform.org][doc-reform.org]] [[../org/][org/]] - [[./config_env.org][config_env.org]] - * nix :nix: ** flake.nix :flake: @@ -27,35 +25,41 @@ #+BEGIN_SRC nix { description = "spine (sisu like parser & document generator) made available to process markup samples"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # "github:nixos/nixpkgs"; - flake-utils.url = "github:numtide/flake-utils"; - spine = { - url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine"; - inputs.nixpkgs.follows = "nixpkgs"; - flake = true; - }; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.spine = { + url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine"; + inputs.nixpkgs.follows = "nixpkgs"; + flake = true; + }; + inputs.d-overlay = { + url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/packages/nix-flakes/dlang/dlang-nix-flakes"; + inputs.nixpkgs.follows = "nixpkgs"; + flake = true; }; outputs = { self, nixpkgs, flake-utils, spine, + d-overlay, } @ inputs: let version = "<>"; shell = ./shell.nix; # ./default.nix; devEnv = ./.envrc; # ./shell.nix; # ./default.nix; supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types. + nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types in { packages = forAllSystems (system: let pkgs = nixpkgsFor.${system}; in { default = spine.packages.${system}.default; - spine-dmd = spine.packages.${system}.spine-dmd; - spine-ldc = spine.packages.${system}.spine-ldc; - #spine-gdc = spine.packages.${system}.spine-gdc; + spine-overlay-ldc = spine.packages.${system}.spine-overlay-ldc; + spine-nixpkgs-ldc = spine.packages.${system}.spine-nixpkgs-ldc; + #spine-overlay-dmd = spine.packages.${system}.spine-overlay-dmd; + #spine-overlay-ldc = spine.packages.${system}.spine-overlay-ldc; + #spine-overlay-gdc = spine.packages.${system}.spine-overlay-gdc; #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; }); apps = forAllSystems (system: { @@ -67,35 +71,37 @@ devShells = forAllSystems (system: let pkgs = nixpkgsFor.${system}; shellHook = '' - export DFLAGS="-O2 -inline -boundscheck=on -color=on" + export DFLAGS="-O2 -boundscheck=on" export Date=`date "+%Y%m%d"` ## set local values in .envrc-local (or here if you must) ''; in with pkgs; { - devShell = mkShell { + dsh = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; #buildInputs = [ sqlite ]; #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ - sqlite - dub - #dmd ldc + #dmd + dub gnumake + sqlite ]; inherit shellHook; }; - devShell-epub = mkShell { + dsh-spine = spine.devShells.${system}.default; + dsh-overlay-ldc = d-overlay.devShells.${system}.default; + dsh-epub = mkShell { name = "spine dev shell for epub output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite libxml2 @@ -115,27 +121,27 @@ ]; inherit shellHook; }; - devShell-html = mkShell { + dsh-html = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite ]; inherit shellHook; }; - devShell-latex-pdf = mkShell { + dsh-latex-pdf = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite source-sans-pro @@ -145,27 +151,27 @@ ]; inherit shellHook; }; - devShell-sqlite = mkShell { + dsh-sqlite = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite ]; inherit shellHook; }; - devShell-i18n = mkShell { + dsh-i18n = mkShell { name = "spine dev shell internationalization, po4a"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite perl534Packages.Po4a @@ -178,164 +184,7 @@ } #+END_SRC -*** flake :flake: -**** notes? - -- flake.nix - /srv/nix/nixpkgs - ./shell.nix - - shell.nix - ./pkgs/shell-pkgs.nix - - pkgs/shell-pkgs.nix - - default.nix - ./nix/dub.selections.nix # - - dub.selections.nix - -- nix develop - -- nix flake update - -- nix shell -f default.nix --print-build-logs -- nix shell -c default.nix - -- nix build `nix-instantiate` -- nix build -f default.nix --print-build-logs -- nix shell -f default.nix --print-build-logs -- nix develop --build -f derivation.nix -I .envrc --print-build-logs -- nix develop --profile .#default --print-build-logs --command spine -v - -- nix search --json 2>/dev/null |jq -- nix flake show -- nix show-derivation - -nix shell git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine --print-build-logs -nix build "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine" --print-build-logs -nix develop 'git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine#default' -nix flake clone git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine/ - -# nix-instantiate | nix-build - -***** flake inputs -****** flake inputs static - -#+NAME: flake_inputs_nix -#+HEADER: :noweb yes -#+BEGIN_SRC nix -nixpkgs.url = "github:nixos/nixpkgs"; -flake-utils.url = "github:numtide/flake-utils"; -#+END_SRC - -#+NAME: flake_inputs_spine -#+HEADER: :noweb yes -#+BEGIN_SRC nix -spine.url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine"; -spine.flake = true; -#+END_SRC - -***** flake outputs -****** flake outputs static - -#+NAME: flake_outputs -#+HEADER: :noweb yes -#+BEGIN_SRC nix -self, nixpkgs, flake-utils -#+END_SRC - -***** flake devshells - -#+NAME: flake_devshells -#+HEADER: :noweb yes -#+BEGIN_SRC nix -devShells = forAllSystems (system: - let pkgs = nixpkgsFor.${system}; - in { - default = pkgs.mkShell { - buildInputs = with pkgs; [ - git - dub - #dmd - ldc - sqlite - ]; - }; -}); -#+END_SRC - -***** flake output default - -#+NAME: flake_output_default -#+HEADER: :noweb yes -#+BEGIN_SRC nix -packages.x86_64-linux.default = self.packages.x86_64-linux.spine; -#+END_SRC - -#+NAME: flake_output_spine -#+HEADER: :noweb yes -#+BEGIN_SRC nix -packages.x86_64-linux.spine = spine.packages.x86_64-linux.default; -#+END_SRC - -#+NAME: flake_output_spine_tarball -#+HEADER: :noweb yes -#+BEGIN_SRC nix -packages.x86_64-linux.spine-tarball = spine-tarball.packages.x86_64-linux.default; -#+END_SRC - -**** flake result/lib/spine-markup-samples - -#+NAME: flake_output_spine_markup_samples -#+HEADER: :noweb yes -#+BEGIN_SRC nix -packages.x86_64-linux.spine-markup-samples = - let - pkgs = import nixpkgs { - system = "x86_64-linux"; - }; - in - pkgs.stdenv.mkDerivation { - pname = "spine-markup-samples"; - version = "<>"; - description = "markup samples for spine, a sisu like parser & document generator"; - inherit self; - src = self; - shell = ./shell.nix; - buildPhase = '' - runHook preBuild - HOME="$PWD" - runHook postBuild - ''; - checkPhase = '' - runHook preCheck - HOME="$PWD" - runHook postCheck - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/lib/spine-markup-samples - echo "pwd: $PWD" - cp -rv ./markup $out/lib/spine-markup-samples/. - runHook postInstall - ''; - }; -#+END_SRC - -postInstall = '' - #${spine} -v - #echo "built:" - #$out/share/spine-markup-samples -''; - -***** flake misc - -#+BEGIN_SRC nix -inputs.spine.url = fetchTarball { - url = "<>"; - sha256 = "<>"; -}; -#+END_SRC - -*** shell.nix :shell: -**** tangle +** shell.nix :shell: #+HEADER: :tangle ../shell.nix #+HEADER: :tangle-mode (identity #o755) @@ -392,6 +241,12 @@ with pkgs; # ❯❯❯ i18n translation related # perl534Packages.Po4a ]; + shellHook = '' + ''; + } +#+END_SRC + +#+BEGIN_SRC nix shellHook = '' echo ' shell.nix echo ❯❯ @@ -400,116 +255,17 @@ with pkgs; ❯❯ nix develop ❯❯ nix develop -c zsh + ❯❯ nix develop ".#default" -c zsh + ❯❯ nix develop ".#devShell-ldc-overlay" -c zsh ❯❯ nix build ❯❯ nix build ".#default" --print-build-logs - ❯❯ nix build ".#spine-dmd" --print-build-logs |& nom ❯❯ nix build ".#spine-ldc" --print-build-logs |& nom - ❯❯ nix build ".#spine-gdc" --print-build-logs |& nom + ❯❯ nix profile install . ' ''; - } -#+END_SRC - -**** Notes - -#+BEGIN_SRC text -#% Notes - -# - shell.nix -I .envrc -# - shell.nix -I .envrc --pure - -# [ nix-shell ] - - # - nix-shell -I nixpkgs=/nixpkgs-ra/nixpkgs --pure - # - nix-shell -p "with import /nixpkgs-ra/nixpkgs {}; ldc" --pure - # - nix-shell -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]" --pure - - # - nix-shell -p nixFlakes - # - nix-shell -p nixFlakes --pure - # - nix-shell -p nixFlakes --pure -p "with import /nixpkgs-ra/nixpkgs {}; [nix dub ldc git ps]" - # - nix-shell shell.nix direnv: export +IN_NIX_SHELL - # - nix-shell shell.nix - -# [ nix-build ] - - # - nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs # --pure - # - nix-build -I .envrc --pure - # - nix-build default.nix -I .envrc && result/bin/spine -v - -# [ nix-instantiate ] - - # - nix-instantiate | nix show-derivation | jq - # - nix-instantiate -I .envrc | nix show-derivation -f derivation.nix -I .envrc | jq - # - nix-instantiate | nix show-derivation --recursive | jq - # - nix-instantiate -I .envrc | nix show-derivation -f derivation.nix --recursive -I .envrc | jq - # - nix-instantiate | nix-build - # - nix-instantiate -I .envrc | nix-build -I .envrc - -# [ nix shell ] - - # - nix shell -c default.nix - # - nix shell -f default.nix --print-build-logs - -# [ nix build ] - - # - nix build -I .envrc --print-build-logs - # - nix build -f default.nix --print-build-logs - # - nix build -f derivation.nix --print-build-logs - - # - nix build `nix-instantiate` - # - nix build `nix-instantiate -I .envrc` - - # - nix build -f default.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine" - # - nix build .#default - -# [ nix run ] - - # - nix run default.nix --print-build-logs - # - nix run -I .envrc default.nix --print-build-logs - # - nix run .#default - -# - nix-shell -I .envrc --pure -# - nix develop --build -f derivation.nix -I .envrc --print-build-logs - -# - nix-shell -p nixFlakes --pure -p "with import /nixpkgs-ra/nixpkgs {}; [nix dub ldc git ps]" -# - nix-build -# - nix build `nix-instantiate -I .envrc` - -# - nix develop --build -f default.nix -I .envrc - -# - nix-shell -I .envrc --pure -# - nix-build default.nix -I .envrc && result/bin/spine -v - -# - nix shell -f default.nix --print-build-logs -# - nix-instantiate -I .envrc | nix-build -I .envrc -#+END_SRC - -*** default.nix :default: - -- default.nix -I nixpkgs= - e.g. default.nix -I nixpkgs=/srv/nix/nixpkgs - -- nix-build -I nixpkgs= - e.g. nix-build -I nixpkgs=<> - -#+HEADER: :noweb yes -#+BEGIN_SRC sh -nix-build -I nixpkgs=<> -nix-build -I .envrc-local -nix-build -I .envrc -default.nix -I .envrc -default.nix - -nix build -f default.nix --print-build-logs -nix build -f derivation.nix --print-build-logs -nix shell -f default.nix --print-build-logs -nix develop --build -f derivation.nix -I .envrc --print-build-logs - -# nix build -f project.nix -# nix build -f spine.nix #+END_SRC #+HEADER: :tangle ../default.nix @@ -574,7 +330,7 @@ with pkgs; } #+END_SRC -*** derivation.nix :default: +** derivation.nix :default: #+HEADER: :tangle ../derivation.nix #+HEADER: :tangle-mode (identity #o644) @@ -696,18 +452,9 @@ with ( } #+END_SRC -#url = "file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/tarball/${pname}-${version}.tar.gz"; -#url = "file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine/tarballGitHEAD/${pname}-${version}.tar.gz"; -#sha256 = "sha256:0000000000000000000000000000000000000000000000000000"; - -# src = fetchTarball { -# url = "file:///[path]/${pname}-${version}.tar.gz"; -# sha256 = "sha256:0000000000000000000000000000000000000000000000000000"; -# }; - #src = ./.; -** variables +** variables used SET *** spine version SET VERSION :version:set:project: #+NAME: spine_version_set @@ -783,37 +530,52 @@ sha256:0000000000000000000000000000000000000000000000000000 github:nixos/nixpkgs #+END_SRC +#+BEGIN_SRC nix +github:NixOS/nixpkgs/nixpkgs-unstable +#+END_SRC + +#+BEGIN_SRC nix +"nixpkgs/nixos-unstable"; +#+END_SRC + +#+BEGIN_SRC nix +"nixpkgs/nixos-23.05"; +#+END_SRC + #+HEADER: :noweb yes #+BEGIN_SRC nix <> #+END_SRC -**** .env/echo-nixNote CHECK MODIFY +** .env/echo-nixNote CHECK MODIFY +*** notes on nix commands #+HEADER: :tangle ../.env/nix-commands #+BEGIN_SRC text - 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 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 develop - - nix develop .#devShell --print-build-logs - - nix develop .#devShell-html --print-build-logs - - nix develop .#devShell-epub --print-build-logs - - nix develop .#devShell-latex-pdf --print-build-logs - - nix develop .#devShell-sqlite --print-build-logs - - nix develop .#devShell-i18n --print-build-logs + - nix develop ".#devShell" --print-build-logs + - nix develop ".#devShell-html" --print-build-logs + - nix develop ".#devShell-epub" --print-build-logs + - nix develop ".#devShell-latex-pdf" --print-build-logs + - nix develop ".#devShell-sqlite" --print-build-logs + - nix develop ".#devShell-i18n" --print-build-logs nix run .#default --print-build-logs -nix develop --build .#default --print-build-logs +nix develop --build ".#default" --print-build-logs nix-shell '' -A nix --pure #+END_SRC +*** echo-nixNote + #+HEADER: :tangle ../.env/echo-nixNote #+BEGIN_SRC sh echo '-*- mode: org -*- diff --git a/shell.nix b/shell.nix index c3203df..8a5429c 100755 --- a/shell.nix +++ b/shell.nix @@ -51,21 +51,5 @@ with pkgs; # perl534Packages.Po4a ]; shellHook = '' - echo ' - shell.nix echo ❯❯ - - ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh - - ❯❯ nix develop - ❯❯ nix develop -c zsh - - ❯❯ nix build - ❯❯ nix build ".#default" --print-build-logs - ❯❯ nix build ".#spine-dmd" --print-build-logs |& nom - ❯❯ nix build ".#spine-ldc" --print-build-logs |& nom - ❯❯ nix build ".#spine-gdc" --print-build-logs |& nom - - ❯❯ nix profile install . - ' ''; } -- cgit v1.2.3