aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/config_nix.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/config_nix.org')
-rw-r--r--org/config_nix.org433
1 files changed, 101 insertions, 332 deletions
diff --git a/org/config_nix.org b/org/config_nix.org
index 1953533..9c68f88 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
@@ -35,45 +35,23 @@
#+HEADER: :tangle ../.envrc
#+BEGIN_SRC sh
-use flake .
-#use flake .#default
NIX_ENFORCE_PURITY=1
+# - https://github.com/nix-community/nix-direnv
NixDirEnvVersion="2.2.1"
+NixDirEnvSHA="sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
+#NixDirEnvSHAget="sha256-0000000000000000000000000000000000000000000="
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="
+ source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "${NixDirEnvSHA}"
fi
watch_file flake.lock
watch_file flake.nix
-if [ -f .envrc-local ]; then
- source_env_if_exists .envrc-local || source .envrc-local
-fi
+watch_file makefile
+#if [ -f .envrc-local ]; then
+# source_env_if_exists .envrc-local || source .envrc-local
+#fi
PATH_add result/bin
-#nix flake update && nix flake check --show-trace && nix flake show
-# 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 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 run .#default --print-build-logs
-#
-# nix develop --build .#default --print-build-logs
-#
-# nix-shell '<nixpkgs>' -A nix --pure
-# "
+use flake .
+#use flake .#default
#+END_SRC
**** .envrc-local CHECK MODIFY
@@ -103,8 +81,7 @@ export SpineSQLdb='spine.search.db'
#+END_SRC
*** flake :flake:
-**** flake
-***** flake.nix
+**** flake.nix
#+HEADER: :tangle ../flake.nix
#+HEADER: :noweb yes
@@ -150,7 +127,7 @@ export SpineSQLdb='spine.search.db'
inherit shell;
inherit devEnv;
buildInputs = [ sqlite ];
- nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
+ nativeBuildInputs = [ dub ldc gnumake ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
buildPhase = ''
runHook preBuild
for DC_ in dmd ldmd2 ldc2 gdc gdmd; do
@@ -205,25 +182,25 @@ export SpineSQLdb='spine.search.db'
inherit installPhase;
inherit postInstall;
};
- spine-gdc = stdenv.mkDerivation {
- inherit pname;
- inherit version;
- meta.mainProgram = "spine-gdc";
- executable = true;
- src = self;
- inherit shell;
- inherit devEnv;
- buildInputs = [ sqlite ];
- nativeBuildInputs = [ dub gdc gnumake ];
- buildPhase = ''
- runHook preBuild
- dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all
- runHook postBuild
- '';
- inherit checkPhase;
- inherit installPhase;
- inherit postInstall;
- };
+ #spine-gdc = stdenv.mkDerivation {
+ # inherit pname;
+ # inherit version;
+ # meta.mainProgram = "spine-gdc";
+ # executable = true;
+ # src = self;
+ # inherit shell;
+ # inherit devEnv;
+ # buildInputs = [ sqlite ];
+ # nativeBuildInputs = [ dub gdc gnumake ];
+ # buildPhase = ''
+ # runHook preBuild
+ # dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all
+ # runHook postBuild
+ # '';
+ # inherit checkPhase;
+ # inherit installPhase;
+ # inherit postInstall;
+ #};
#vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000=";
});
apps = forAllSystems (system: {
@@ -266,24 +243,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 dev shell default";
+ devShell = mkShell {
+ name = "spine base dev shell";
inherit shell;
inherit devEnv;
#buildInputs = [ sqlite ];
#nativeBuildInputs = [ dub dmd ldc gdc gnumake ];
packages = [
sqlite
- dub dmd ldc gdc gnumake
+ 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
@@ -302,22 +279,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
@@ -326,26 +303,28 @@ 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
];
inherit shellHook;
};
+ default = import ./shell.nix { inherit pkgs; };
});
};
}
@@ -566,74 +545,6 @@ src = fetchTarball {
};
#+END_SRC
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{
- description = "a sisu like parser & document generator";
- inputs = {
- flake-utils.url = "github:numtide/flake-utils";
- nixpkgs.url = "<<nixpkgs_url>>";
- };
- outputs = { self, nixpkgs, flake-utils }:
- let
- pkgs = nixpkgs.legacyPackages.x86_64-linux;
- in {
- packages.x86_64-linux.spine = pkgs.stdenv.mkDerivation {
- name = "spine";
- inherit self;
- src = self;
- shell = ./shell.nix;
- installPhase = ''
- install -m755 spine $out/bin/spine
- '';
- };
- defaultPackage.x86_64-linux = self.packages.x86_64-linux.spine;
- };
-}
-#+END_SRC
-
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{
- description = "a sisu like document parser";
- inputs = {
- flake-utils.url = "github:numtide/flake-utils";
- nixpkgs.url = "<<nixpkgs_url>>";
- d2sqlite3 = {
- url = "github:dlang-community/d2sqlite3";
- flake = false;
- };
- tinyendian = {
- url = "github:kiith-sa/tinyendian";
- flake = false;
- };
- dyaml = {
- url = "github:dlang-community/D-YAML";
- flake = false;
- };
- imageformats = {
- url = "github:lgvz/imageformats";
- flake = false;
- };
- };
- outputs = { self, d2sqlite3, tinyendian, dyaml, imageformats, nixpkgs, flake-utils }:
- let
- pkgs = nixpkgs.legacyPackages.x86_64-linux;
- in {
- packages.x86_64-linux.spine = pkgs.stdenv.mkDerivation {
- name = "spine";
- inherit self;
- src = self;
- shell = ./shell.nix;
- installPhase = ''
- install -m755 spine $out/bin/spine
- '';
- };
- defaultPackage.x86_64-linux = self.packages.x86_64-linux.spine;
- };
-}
-#+END_SRC
-
*** shell.nix :shell:
**** tangle
@@ -646,34 +557,39 @@ src = fetchTarball {
with pkgs;
mkShell {
buildInputs = [
+ # ❯❯❯ nix_related
#nix
direnv
+ #cachix
nixVersions.unstable #nixFlakes
nix-prefetch-git
validatePkgConfig
- nix-tree jq nix-output-monitor
+ nix-output-monitor
+ nix-tree
+ jq
git
gnumake
ps
- ### d_build_related
+ # ❯❯❯ d_build_related
+ # ❯❯ package manager
dub
- ## compiler
+ # ❯❯ compiler
ldc
- rund
- ## linker
+ #rund
+ # ❯❯ linker
#lld
#mold
- ## builder
+ # ❯❯ builder
#ninja
#meson
- ### sqlite search related
+ # ❯❯❯ sqlite search related
sqlite
- ### pdf_latex_related
+ # ❯❯❯ 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
@@ -683,68 +599,33 @@ 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 --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 --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
+ echo '
+ shell.nix echo ❯❯
- nix-build |& nom
+ ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh
- spine -v
+ ❯❯ nix develop
+ ❯❯ nix develop -c zsh
- 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 --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`"
+ ❯❯ 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
+echo "ldc `${pkgs.ldc}/bin/ldc2 -v`"
+
**** Notes
#+BEGIN_SRC text
@@ -867,100 +748,6 @@ mkShell {
./result/bin/spine
#+END_SRC
-**** shell parts (packages)
-***** packages nix related
-
-#+NAME: shell_packages_nix_related
-#+BEGIN_SRC nix
-### nix_related
-direnv
-nixVersions.unstable #nixFlakes
-nix-prefetch-git
-validatePkgConfig
-jq
-git
-ps
-#+END_SRC
-
-***** packages d build related
-
-#+NAME: shell_packages_d_build_related
-#+BEGIN_SRC nix
-### d_build_related
-## package manager
-dub
-## compiler
-ldc
-rund
-## linker
-#lld
-#mold
-## builder
-#ninja
-#meson
-#+END_SRC
-
-***** packages tools
-
-#+NAME: shell_packages_tool_download
-#+BEGIN_SRC nix
-### tools
-#curl
-#wget
-aria
-#+END_SRC
-
-***** packages candy
-
-#+NAME: shell_packages_candy
-#+BEGIN_SRC nix
-### candy
-starship
-#+END_SRC
-
-***** packages search sqlite related
-
-#+NAME: shell_packages_search_related_sqlite
-#+BEGIN_SRC nix
-### sqlite search related
-sqlite
-#+END_SRC
-
-***** packages pdf latex related
-
-#+NAME: shell_packages_pdf_latex_related
-#+BEGIN_SRC nix
-### pdf_latex_related
-source-sans-pro
-source-serif-pro
-source-code-pro
-texlive.combined.scheme-full
-#+END_SRC
-
-***** packages xml epub related
-
-#+NAME: shell_packages_xml_and_epub_related
-#+BEGIN_SRC nix
-### xml_and_epub_related
-libxml2
-html-tidy
-xmlstarlet
-epubcheck
-ebook_tools
-epr
-sigil
-calibre #(suite includes: ebook-viewer)
-foliate
-#+END_SRC
-
-***** packages i18n_translation related
-
-#+NAME: shell_packages_i18n_translation
-#+BEGIN_SRC nix
-### i18n translation related
-perl534Packages.Po4a
-#+END_SRC
-
*** default.nix :default:
- default.nix -I nixpkgs=<provide local nix path>
@@ -1000,60 +787,38 @@ nix profile install .
#+HEADER: :tangle ../devenv.nix
#+HEADER: :tangle-mode (identity #o644)
-#+HEADER: :noweb yes
#+BEGIN_SRC nix
-# profile.nix
-{ pkgs ? import <nixpkgs> { }, name ? "user-env" }: with pkgs;
+{ pkgs ? import <nixpkgs> { }, name ? "user-env" }:
+with pkgs;
buildEnv {
inherit name;
- extraOutputsToInstall = [ "out" "man" "lib" ]; # to get all needed symlinks
+ 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-tree jq nix-output-monitor
+ nix-output-monitor
+ nix-tree
+ jq
git
+ gnumake
ps
- ### d_build_related
+ # ❯❯❯ d_build_related
+ # ❯❯ package manager
dub
- ## compiler
+ # ❯❯ compiler
dmd
ldc
- #gdc
- #rund
- ## linker
- #lld
- #mold
- ## builder
- #ninja
- #meson
- ### sqlite search 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
- # libxml2
- # html-tidy
- # xmlstarlet
- # epubcheck
- # ebook_tools
- # epr
- # sigil
- # calibre #(suite includes: ebook-viewer)
- # foliate
- # ### i18n translation related
- # perl534Packages.Po4a
- ### candy
- #starship
# 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
+ #cd <path-to-flake> || exit 1
nix flake update
nix profile upgrade '.*'
'')
@@ -1293,6 +1058,8 @@ ldc
sqlite
nix-prefetch-git
validatePkgConfig
+nix-output-monitor
+nix-tree
jq
git
#+END_SRC
@@ -1434,6 +1201,8 @@ pkgs.mkShell {
nixVersions.unstable #nixFlakes
nix-prefetch-git
validatePkgConfig
+ nix-output-monitor
+ nix-tree
jq
git
fontconfig