aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/config_nix.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2023-02-21 18:56:06 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2023-02-24 22:19:43 -0500
commit89077febca032ff9990a163a8cdb7f3bc62c3954 (patch)
treec309f7a9d06cab67c4bedf4a39da82baabd3d730 /org/config_nix.org
parentnix .envrc, add ./result/bin path, flake.nix minor (diff)
nix flake & build, temp. remove gdc
Diffstat (limited to 'org/config_nix.org')
-rw-r--r--org/config_nix.org231
1 files changed, 117 insertions, 114 deletions
diff --git a/org/config_nix.org b/org/config_nix.org
index d206b6d..896aaed 100644
--- a/org/config_nix.org
+++ b/org/config_nix.org
@@ -6,7 +6,7 @@
#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
#+COPYRIGHT: Copyright (C) 2015 - 2023 Ralph Amissah
#+LANGUAGE: en
-#+STARTUP: content hideblocks hidestars noindent entitiespretty
+#+STARTUP: show4levels hideblocks hidestars noindent entitiespretty
#+PROPERTY: header-args :exports code
#+PROPERTY: header-args+ :noweb yes
#+PROPERTY: header-args+ :results no
@@ -38,38 +38,19 @@
use flake .
#use flake .#default
NIX_ENFORCE_PURITY=1
+# - https://github.com/nix-community/nix-direnv
NixDirEnvVersion="2.2.1"
if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then
-# - https://github.com/nix-community/nix-direnv
# 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-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
watch_file flake.lock
watch_file flake.nix
-#nix flake update && nix flake check --show-trace && nix flake show
+watch_file makefile
if [ -f .envrc-local ]; then
source_env_if_exists .envrc-local || source .envrc-local
fi
PATH_add result/bin
-# 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
@@ -97,8 +78,7 @@ export SpineSQLdb='spine.search.db'
#+END_SRC
*** flake :flake:
-**** flake static :flake:static:
-***** flake.nix
+**** flake.nix
#+HEADER: :tangle ../flake.nix
#+HEADER: :noweb yes
@@ -127,9 +107,15 @@ export SpineSQLdb='spine.search.db'
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-gdc = spine.packages.${system}.spine-gdc;
#vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000=";
- });
+ });
+ apps = forAllSystems (system: {
+ default = {
+ type = "app";
+ program = "${self.packages.${system}.default}/bin/spine";
+ };
+ });
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
@@ -160,24 +146,24 @@ export SpineSQLdb='spine.search.db'
#export spineSqlite="spine --very-verbose --sqlite-update --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\" --output=\"\$SpineOUT\" $SpinePOD/*"
'';
in with pkgs; {
- devShell = mkShell rec {
- name = "spine base dev shell";
+ devShell = mkShell {
+ name = "spine base dev shell";
inherit shell;
inherit devEnv;
#buildInputs = [ sqlite ];
#nativeBuildInputs = [ dub dmd ldc gdc gnumake ];
packages = [
- dub dmd ldc gdc gnumake
sqlite
+ dub dmd ldc gnumake
];
inherit shellHook;
};
- devShell-epub = mkShell rec {
- name = "spine dev shell for epub output";
+ devShell-epub = mkShell {
+ name = "spine dev shell for epub output";
inherit shell;
inherit devEnv;
- packages = [
- dub dmd ldc gdc gnumake
+ packages = [
+ dub dmd ldc gnumake
sqlite
libxml2
html-tidy
@@ -196,22 +182,22 @@ export SpineSQLdb='spine.search.db'
];
inherit shellHook;
};
- devShell-html = mkShell rec {
- name = "spine dev shell for latex & pdf output";
+ devShell-html = mkShell {
+ name = "spine dev shell for latex & pdf output";
inherit shell;
inherit devEnv;
- packages = [
- dub dmd ldc gdc gnumake
+ packages = [
+ dub dmd ldc gnumake
sqlite
];
inherit shellHook;
};
- devShell-latex-pdf = mkShell rec {
- name = "spine dev shell for latex & pdf output";
+ devShell-latex-pdf = mkShell {
+ name = "spine dev shell for latex & pdf output";
inherit shell;
inherit devEnv;
- packages = [
- dub dmd ldc gdc gnumake
+ packages = [
+ dub dmd ldc gnumake
sqlite
source-sans-pro
source-serif-pro
@@ -220,21 +206,22 @@ export SpineSQLdb='spine.search.db'
];
inherit shellHook;
};
- devShell-sqlite = mkShell rec {
- name = "spine dev shell for latex & pdf output";
+ devShell-sqlite = mkShell {
+ name = "spine dev shell for latex & pdf output";
inherit shell;
inherit devEnv;
- packages = [
- dub dmd ldc gdc gnumake
+ packages = [
+ dub dmd ldc gnumake
sqlite
];
inherit shellHook;
};
devShell-i18n = mkShell {
+ name = "spine dev shell internationalization, po4a";
inherit shell;
inherit devEnv;
- packages = [
- dub dmd ldc gdc gnumake
+ packages = [
+ dub dmd ldc gnumake
sqlite
perl534Packages.Po4a
];
@@ -408,7 +395,7 @@ inputs.spine.url = fetchTarball {
with pkgs;
mkShell {
buildInputs = [
- ### nix_related
+ # ❯❯❯ nix_related
# direnv
# nixVersions.unstable #nixFlakes
# nix-prefetch-git
@@ -416,26 +403,26 @@ mkShell {
# nix-tree jq nix-output-monitor
# git
# ps
- ### d_build_related
- ### package manager
+ # ❯❯❯ d_build_related
+ # ❯❯ package manager
# dub
- ### compiler
+ # ❯❯ compiler
# ldc
# rund
- ### linker
+ # ❯❯ linker
# #lld
# #mold
- ## builder
+ # ❯❯ builder
# #ninja
# #meson
- ### sqlite search related
- # sqlite
- ### pdf_latex_related
+ # ❯❯❯ sqlite search related
+ #sqlite
+ # ❯❯❯ pdf_latex_related
# source-sans-pro
# source-serif-pro
# source-code-pro
# texlive.combined.scheme-full
- ### xml_and_epub_related
+ # ❯❯❯ xml_and_epub_related
# libxml2
# html-tidy
# xmlstarlet
@@ -445,59 +432,27 @@ mkShell {
# sigil
# calibre #(suite includes: ebook-viewer)
# foliate
- ### i18n translation related
+ # ❯❯❯ i18n translation related
# perl534Packages.Po4a
];
shellHook = ''
- #if [[ -f ".envrc" ]]; then
- # source .envrc
- #fi
- #nix flake update
- #echo ""
- #echo "nix flake metadata:"
- #nix flake metadata
- #echo ""
- #echo "nix flake check:"
- #nix flake check
- #echo ""
- #echo "nix flake show:"
- #nix flake show
- 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 .#default-tarball --print-build-logs
- nix build .#default-markup-samples --print-build-logs
- nix build --print-build-logs
- nix build .#default --print-build-logs |& nom
-
- - 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 --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 .#default
-
- "
+ nix flake update
+ nix flake check
+ nix flake show
+ 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
+ '
'';
}
#+END_SRC
@@ -579,7 +534,7 @@ mkShell {
*** default.nix :default:
- default.nix -I nixpkgs=<provide local nix path>
- e.g. default.nix -I nixpkgs=/nixpkgs-ra/nixpkgs
+ 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>>
@@ -606,7 +561,58 @@ nix develop --build -f derivation.nix -I .envrc --print-build-logs
#+HEADER: :shebang "#!/usr/bin/env -S nix-build"
#+BEGIN_SRC nix
{ pkgs ? import <nixpkgs> {} }:
-pkgs.callPackage ./derivation.nix {}
+pkgs.callPackage ./devenv.nix {}
+#+END_SRC
+
+* devEnv
+
+nix profile install .
+
+#+HEADER: :tangle ../devenv.nix
+#+HEADER: :tangle-mode (identity #o644)
+#+BEGIN_SRC nix
+{ pkgs ? import <nixpkgs> { }, name ? "user-env" }:
+with pkgs;
+buildEnv {
+ inherit name;
+ extraOutputsToInstall = [ "out" "man" "lib" ]; # to get all needed symlinks
+ paths = [
+ # ❯❯❯ nix_related
+ #nix # if not on NixOS, this is needed
+ direnv
+ #cachix
+ nixVersions.unstable #nixFlakes
+ nix-prefetch-git
+ validatePkgConfig
+ nix-output-monitor
+ nix-tree
+ jq
+ git
+ gnumake
+ ps
+ # ❯❯❯ d_build_related
+ # ❯❯ package manager
+ dub
+ # ❯❯ compiler
+ dmd
+ ldc
+ # ❯❯❯ sqlite search related
+ sqlite
+ # this will create a script that will rebuild and upgrade your setup; using shell script syntax
+ (writeScriptBin "nix-rebuild" ''
+ #!${stdenv.shell}
+ cd <path-to-flake> || exit 1
+ nix flake update
+ nix profile upgrade '.*'
+ '')
+ # puts in your root the nixpkgs version
+ (writeTextFile {
+ name = "nixpkgs-version";
+ destination = "/nixpkgs-version";
+ text = lib.version;
+ })
+ ];
+}
#+END_SRC
*** derivation.nix :default:
@@ -700,7 +706,7 @@ with (
);
mkDubDerivation rec {
pname = "spine";
- version = "0.12.0";
+ version = "<<spine_version_set>>";
zipfile = "<<spine_tarball_filename>>";
src = fetchTarball {
#url = "file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/tarball/${pname}-${version}.tar.gz";
@@ -710,10 +716,7 @@ mkDubDerivation rec {
sha256 = "<<spine_tarball_sha256>>";
};
nativeBuildInputs = with pkgs; [ dub ldc ];
- buildInputs = with pkgs; [
- nixVersions.unstable #nixFlakes
- sqlite
- ];
+ buildInputs = with pkgs; [ nixVersions.unstable sqlite ];
meta = with pkgs.lib; {
description = "A sisu like parser & document generator";
longDescription = ''