summaryrefslogtreecommitdiff
path: root/README.rst
blob: 334e138c0a8ee65eea3898e739769437d39e110c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
..
	┏┓╻+╻ ╱┏┳┓┏┓┏┳┓┏┓╻
	┃┃┃┃┗━┓╹┃╹┣┫┃┃┃┣┫┃
	╹┗┛╹╱ ╹ ╹ ╹╹╹ ╹╹╹┗┛
================================================================================
Nixtamal
================================================================================
--------------------------------------------------------------------------------
Fulfilling input pinning for Nix (& hopefully more)
--------------------------------------------------------------------------------

:author: toastal

.. role:: ac
.. role:: del
.. role:: t

Pronunciation
	/nɪʃ.təˈmal/ *or* /ˈnɪkstəˌmɑːl/
Alternative spellings
	• ·𐑯𐑦𐑖𐑑𐑩𐑥𐑭𐑤
Maker
	toastal
Put out
	2025-12
Languages
	• OCaml
	• Nix
	• :ac:`KDL`:ac:`JSON`


Purpose
================================================================================

Nixtamal is a tool to pin input version like its predecessors :t:`niv`,
:t:`npins`, :t:`Pinch`, :t:`Yae`\, & so on — as well as Nix’s experimental
:t:`flakes`. Features include:

• keeps a stable reference pin to supported :ac:`VCS`\s
• supports mirrors for fetching [1]_
• supports patch-based :ac:`VCS`\s, like Pijul & Darcs, in a first-class sense
  (tho ``nixpkgs`` will be required due to Nix ``builtins`` fetchers
  limitations)
• uses a :ac:`KDL` manifest file with templating instead of :ac:`CLI` input
• supports arbitrary commands for getting the latest change for inputs
• refreshes inputs; skips frozen
• locks new sources
• supports arbitrary commands for getting the latest change which can be used to
  avoid costly downloads/clones as well as for templating for inputs
• does not give any special privilege to any specific code forges
• source code & community will never be hosted on a proprietary,
  privacy-invasive, megacorporate platform with obligations to shareholders or
  venture capital
• licensed for your freedom
• ML-family programming (feels closer to Nix)

Future goals:

• migrations from prior manifest × lockfile versions
• migrations from Flakes, Npins, & Niv
• more :ac:`VCS`\s
• ``nixtamal heal`` for common pitfalls in ``manifest.kdl``:ac:`TUI`?
• provide a flake-like specification for project layout, but with less holes

.. warning::

	As this software is in the alpha stage, the maker reserves the right make
	breaking changes file schemas & :ac:`CLI` :ac:`API`. Additionally, anything
	after tagged, the maker reserves the right to obliterate & amend patches.

Quickstart
================================================================================

Set up
--------------------------------------------------------------------------------

.. code:: console

	$ nixtamal set-up
	┏┓╻+╻ ╱┏┳┓┏┓┏┳┓┏┓╻
	┃┃┃┃┗━┓╹┃╹┣┫┃┃┃┣┫┃
	╹┗┛╹╱ ╹ ╹ ╹╹╹ ╹╹╹┗┛

	Creating Nixtamal directory @ ./nix/tamal
	Writing new Nixtamal EditorConfig @ ./nix/tamal/.editorconfig …
	Fetching latest value for 「nixpkgs」 …
	Prefetching input 「nixpkgs」 … (this may take a while)
	Prefetched 「nixpkgs」.
	Making manifest file @ version:0.1.0

	$ tree nix/tamal
	nix/tamal
	├── default.nix
	├── lock.json
	└── manifest.kdl

	1 directory, 3 files


Use with a Nix project — such as in a ``release.nix``
--------------------------------------------------------------------------------

.. code:: nix

	let
		inputs = import nix/tamal { };
		pkgs = import inputs.nixpkgs { };
	in
	{
		inherit (pkgs) hello;
	}

Add a new input to pin
--------------------------------------------------------------------------------

See: `<docs/manifest.rst>`_

.. code:: console

	$ nixtamal tweak

Opens text editor. & After editing …

Lock or refresh you inputs
--------------------------------------------------------------------------------

.. code:: console

	$ nixtamal lock
	$ nixtamal refresh

What next?
--------------------------------------------------------------------------------

As they say: read the manpages

.. code:: console

	$ man nixtamal
	$ man nixtamal-manifest


Building / hacking
================================================================================

Working setup
--------------------------------------------------------------------------------

If you don’t have Darcs install, you can use from Nixpkgs such as

.. code:: console

	$ nix-shell -p darcs

After/else

.. code:: console

	$ darcs clone https://darcs.toastal.in.th/nixtamal/trunk/ nixtamal
	$ darcs setpref boringfile .boring
	$ cd nixtamal

Development environment setup
--------------------------------------------------------------------------------

Base Nix shell

.. code:: console

	$ nix-shell

Or with Direnv

.. code:: console

	$ echo "use nix" >> .envrc
	$ direnv allow

Building with Dune
--------------------------------------------------------------------------------

.. code:: console

	$ dune build

Building with Nix
--------------------------------------------------------------------------------

Basic

.. code:: console

	$ nix-build

Everything else

.. code:: console

	$ nix-build release.nix
	$ nix-build release.nix -A nixtamal

Darcs hooks (can skip)
--------------------------------------------------------------------------------

.. code:: console

   $ $EDITOR _darcs/prefs/defaults

.. code::

	apply posthook nix-shell --run mk-darcs-weak-hash && nix-build --no-out-link release.nix
	obliterate posthook nix-shell --run mk-darcs-weak-hash
	record posthook nix-shell --run mk-darcs-weak-hash

Hooks here can:
	• Build the entire project before applying patches to make sure it works.
	• Show the WeakHash ``_darcs/weak_hash`` which is good for querying project
	  state, such as for ``latest-cmd``s (hint, hink).


License
================================================================================

Depending on the content, this project is licensed under one of

• :t:`GNU General Public License, version 3.0 later` (``GPL-3.0-or-later``)
• :t:`GNU Lesser General Public License version 2.1 or later`
  (``LGPL-2.1-or-later``) with & without the :t:`OCaml LGPL Linking Exception`
  (``OCaml-LGPL-linking-exception``)
• :t:`ISC License` (``ISC``)
• :t:`Creative Commons Attribution-ShareAlike 4.0 International`
  (``CC-BY-SA-4.0``)
• :t:`Mozilla Public License Version 2.0` (``MPL-2.0``)

For details read ``LICENSE.txt`` with full license texts at ``license/``.


Pitching in
================================================================================

Currently this is best done by sending a patchset to
`toastal+nixtamal@posteo.net`_ or :ac:`DM` me a remote to clone @
`toastal@toastal.in.th`_.

Community is in an :ac:`XMPP` :ac:`MUC` (chatroom) with future hopes to have an
:ac:`IRC` gateway. Join @ <xmpp:nixtamal@chat.toastal.in.th?join>.

..
	Additionally, please read the ``PITCHING_IN.rst`` file for other
	information/expectations.

.. _toastal+nixtamal@posteo.net: mailto:toastal+nixtamal@posteo.net
.. _toastal@toastal.in.th: xmpp:toastal@toastal.in.th


Funding
================================================================================

See choices at the `maker’s website <https://toast.al/funding/>`_.


.. [1] :ac:`WIP` with upstream Nixpkgs

	• :del:`Darcs: https://github.com/NixOS/nixpkgs/pull/467172`:del:`Pijul: https://github.com/NixOS/nixpkgs/pull/467890`

.. vim: set textwidth=80