summaryrefslogtreecommitdiffhomepage
path: root/org/config_nix.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/config_nix.org')
-rw-r--r--org/config_nix.org287
1 files changed, 0 insertions, 287 deletions
diff --git a/org/config_nix.org b/org/config_nix.org
deleted file mode 100644
index fcf53f3..0000000
--- a/org/config_nix.org
+++ /dev/null
@@ -1,287 +0,0 @@
--*- mode: org -*-
-#+TITLE: configuration nix
-#+DESCRIPTION: configuration nix
-#+FILETAGS: :spine:build:tools:
-#+AUTHOR: Ralph Amissah
-#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
-#+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah
-#+LANGUAGE: en
-#+STARTUP: content hideblocks hidestars noindent entitiespretty
-#+PROPERTY: header-args+ :eval never-export :exports code
-#+PROPERTY: header-args+ :noweb yes :padline no
-#+PROPERTY: header-args+ :results silent :cache no
-#+PROPERTY: header-args+ :mkdirp yes
-#+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t
-- magic single double-quote → " ← FIX changes hilighting behavior (occuring
- after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX
-
-* nix :nix:
-** dlang flake.nix :flake:
-
-#+HEADER: :tangle ../dlang/flake.nix
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{
- description = "ocda-lib: the object-centric document abstraction as a D library";
- inputs.nixpkgs.url = "<<nixpkgs_unstable>>";
- outputs = { self, nixpkgs }:
- let
- system = "x86_64-linux"; # adjust for aarch64-linux / darwin
- pkgs = import nixpkgs { inherit system; };
- /* A library, so the library itself is not a build product: a program
- that uses it compiles its modules alongside its own, as the writer's
- flake does, or takes it as a dub dependency. What is built here are
- programs over it: the reader, and the two that put the library to
- the question - the agreement check, which loads a document's .ssp
- and its .ocda.db and compares the two models, and the dump, which
- writes a loaded model out canonically so that an implementation in
- another language can be diffed against this one.
- .
- `mains` is what is compiled besides the library: the checks are one
- file each in test/, the reader is src/read/.
- */
- mkTool = { tool, binary, what, mains, compiler, compilerBin }:
- pkgs.stdenv.mkDerivation {
- pname = "ocda-lib-${tool}";
- version = "0.1.0";
- src = self;
- nativeBuildInputs = [ compiler ];
- buildInputs = [ pkgs.sqlite pkgs.zstd ];
- buildPhase = ''
- runHook preBuild
- export HOME=$TMPDIR
- ${compilerBin} -I=src -of=${tool} src/ocda/*.d ${mains} -L-lsqlite3 -L-lzstd
- runHook postBuild
- '';
- installPhase = ''
- runHook preInstall
- mkdir -p $out/bin
- install -m755 ${tool} $out/bin/${binary}
- runHook postInstall
- '';
- meta = {
- description = what;
- mainProgram = binary;
- };
- };
- ldc = { compiler = pkgs.ldc; compilerBin = "ldmd2"; };
- ocda-read = mkTool (ldc // {
- tool = "read"; binary = "ocda-read"; mains = "src/read/*.d";
- what = "reads the abstraction in any of its forms and says what is in it";
- });
- ocda-agree = mkTool (ldc // {
- tool = "agree"; binary = "ocda-agree"; mains = "test/agree.d";
- what = "checks that the .ssp and .ocda.db loaders give one model";
- });
- ocda-dump = mkTool (ldc // {
- tool = "dump"; binary = "ocda-dump"; mains = "test/dump.d";
- what = "writes a loaded abstraction out canonically, as an oracle";
- });
- in {
- packages.${system} = {
- /* All three in one bin/, so that one build leaves every program in
- one result link. Built separately into the same link, each build
- replaced the one before, and a script looking for ocda-dump beside
- ocda-agree found nothing.
- */
- default = pkgs.symlinkJoin {
- name = "ocda-lib-programs-0.1.0";
- paths = [ ocda-read ocda-agree ocda-dump ];
- };
- inherit ocda-read ocda-agree ocda-dump;
- };
- devShells.${system}.default = pkgs.mkShell {
- packages = [ pkgs.ldc pkgs.dub pkgs.dtools pkgs.sqlite pkgs.zstd ];
- };
- };
-}
-#+END_SRC
-
-** gleam flake.nix :flake:
-
-#+HEADER: :tangle ../gleam/flake.nix
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{
- description = "ocda-lib: the object-centric document abstraction as a Gleam library";
- inputs.nixpkgs.url = "<<nixpkgs_unstable>>";
- outputs = { self, nixpkgs }:
- let
- system = "x86_64-linux"; # adjust for aarch64-linux / darwin
- pkgs = import nixpkgs { inherit system; };
-
- name = "ocda_lib";
-
- /* rebar3 with the port compiler already in it.
- esqlite builds a NIF, and its rebar3 configuration asks for the
- `pc` plugin, which rebar3 would otherwise fetch from Hex at build
- time: impossible in a sandbox, and the build fails with
- "missing_package pc". nixpkgs carries the plugin, so the answer is
- a rebar3 that has it before it starts.
- */
- rebar3-pc = pkgs.beamPackages.rebar3WithPlugins {
- plugins = [ pkgs.beamPackages.pc ];
- };
-
- /* The Hex dependencies, as manifest.toml pins them.
- .
- There is no Gleam builder in nixpkgs and `gleam build` fetches from
- Hex, so a sandboxed build cannot reach them. A fixed output
- derivation may, because its result is pinned by hash.
- .
- When a dependency changes, manifest.toml changes and this hash must
- change with it: build, take the hash nix reports, put it here.
- */
- deps = pkgs.stdenv.mkDerivation {
- pname = "${name}-deps";
- version = "0.1.0";
- src = ./.;
- nativeBuildInputs = [ pkgs.gleam pkgs.cacert ];
- buildPhase = ''
- export HOME=$TMPDIR
- gleam deps download
- '';
- installPhase = ''
- mkdir -p $out
- cp -r build/packages/* $out/
- '';
- dontFixup = true;
- outputHashMode = "recursive";
- outputHashAlgo = "sha256";
- outputHash = "sha256-nWU753YRsC28gsaGyy+A3aZaWf15ctULYiUlvsfyB1c=";
- };
- in {
- packages.${system} = {
- default = self.packages.${system}.${name};
- /* Shipped as an Erlang shipment rather than as an escript, because
- sqlite on the BEAM is a NIF: esqlite compiles its own sqlite into
- a shared object, and a NIF cannot be loaded from inside an
- escript archive, the runtime needing a real file on disk. The
- shipment keeps priv/ on disk, so it loads.
- */
- ${name} = pkgs.stdenv.mkDerivation {
- pname = "ocda-lib";
- version = "0.1.0";
- src = ./.;
- nativeBuildInputs = [
- pkgs.gleam
- pkgs.erlang
- rebar3-pc
- pkgs.makeWrapper
- ];
- buildPhase = ''
- runHook preBuild
- export HOME=$TMPDIR
- # the dependencies, in place of the fetch gleam would do
- mkdir -p build/packages
- cp -r ${deps}/* build/packages/
- chmod -R u+w build/packages
- gleam export erlang-shipment
- runHook postBuild
- '';
- installPhase = ''
- runHook preInstall
- mkdir -p $out/lib $out/bin
- cp -r build/erlang-shipment $out/lib/${name}
- makeWrapper $out/lib/${name}/entrypoint.sh $out/bin/ocda-lib \
- --add-flags run \
- --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.erlang pkgs.coreutils ]}
- # the reader under its own name, as the D flake installs it
- makeWrapper $out/lib/${name}/entrypoint.sh $out/bin/ocda-read \
- --add-flags "run read" \
- --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.erlang pkgs.coreutils ]}
- runHook postInstall
- '';
- meta = {
- description = "the abstraction as a Gleam library, with its reader, dump and agreement check";
- mainProgram = "ocda-lib";
- };
- };
- };
- devShells.${system}.default = pkgs.mkShell {
- packages = [ pkgs.gleam pkgs.erlang pkgs.rebar3 pkgs.sqlite ];
- };
- };
-}
-#+END_SRC
-
-* versions GET
-** dlang overlays
-*** ldc
-
-#+NAME: ldc_version
-#+HEADER: :noweb yes
-#+BEGIN_SRC emacs-lisp
-<<./nix-develop-dlang-shared.org:ldc-version()>>
-#+END_SRC
-
-*** dmd
-
-#+NAME: dmd_version
-#+HEADER: :noweb yes
-#+BEGIN_SRC emacs-lisp
-<<./nix-develop-dlang-shared.org:dmd-version()>>
-#+END_SRC
-
-*** dub
-
-#+NAME: dub_version
-#+HEADER: :noweb yes
-#+BEGIN_SRC emacs-lisp
-<<./nix-develop-dlang-shared.org:dub-version()>>
-#+END_SRC
-
-*** dtools
-
-#+NAME: dtools_version
-#+HEADER: :noweb yes
-#+BEGIN_SRC emacs-lisp
-<<./nix-develop-dlang-shared.org:dtools-version()>>
-#+END_SRC
-
-** sha256 blank hash
-
-#+NAME: sha256-blank
-#+BEGIN_SRC nix
-<<./nix-develop-dlang-shared.org:sha256-blank()>>
-#+END_SRC
-
-#+NAME: blank_hash
-#+BEGIN_SRC nix
-<<./nix-develop-dlang-shared.org:sha256-blank()>>
-#+END_SRC
-
-* org includes
-** spine project VERSION
-
-#+NAME: spine_version
-#+HEADER: :noweb yes
-#+BEGIN_SRC emacs-lisp
-<<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:spine_project_version()>>
-#+END_SRC
-
-** year
-
-#+NAME: year
-#+HEADER: :noweb yes
-#+BEGIN_SRC emacs-lisp
-<<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:year()>>
-#+END_SRC
-
-** document header including copyright & license
-
-#+NAME: doc_header_including_copyright_and_license
-#+HEADER: :noweb yes
-#+BEGIN_SRC emacs-lisp
-<<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:spine_doc_header_including_copyright_and_license()>>
-#+END_SRC
-
-* nixpkgs source
-
-#+NAME: nixpkgs_unstable
-#+HEADER: :noweb yes
-#+BEGIN_SRC emacs-lisp
-<<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:nixpkgs_unstable()>>
-#+END_SRC
-
-* __END__