diff options
Diffstat (limited to 'org/config_nix.org')
-rw-r--r-- | org/config_nix.org | 396 |
1 files changed, 79 insertions, 317 deletions
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 = "<<spine_version_set>>"; 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 = "<<spine_version_set>>"; - 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 = "<<spine_tarball_path_url>>"; - sha256 = "<<spine_tarball_sha256>>"; -}; -#+END_SRC - -*** shell.nix :shell: -**** tangle +** shell.nix :shell: #+HEADER: :tangle ../shell.nix #+HEADER: :tangle-mode (identity #o755) @@ -393,6 +242,12 @@ with pkgs; # 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=<provide local nix path> - e.g. default.nix -I nixpkgs=/srv/nix/nixpkgs - -- nix-build -I nixpkgs=<provide local nix path> - e.g. nix-build -I nixpkgs=<<nixpkgs_local>> - -#+HEADER: :noweb yes -#+BEGIN_SRC sh -nix-build -I nixpkgs=<<nixpkgs_local>> -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 <<nixpkgs_path_local>> #+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 '<nixpkgs>' -A nix --pure #+END_SRC +*** echo-nixNote + #+HEADER: :tangle ../.env/echo-nixNote #+BEGIN_SRC sh echo '-*- mode: org -*- |