config

Table of Contents

1. config   project

1.1. Configs suck, use code

https://beepb00p.xyz/configs-suck.html
Infrastructure as Code

  • Another example is database ORM: create a separate, weird language that depends on the web framework that you use (e.g. Django) to avoid learning SQL and its internals


  • The way I’m resolving this dilemma at the moment (programmable, flexible, complex config vs dumb, static, simple config) is by treating the config differently depending on the environment.
  • For example in development environ/servers, I would use programmable config, since I want flexibility even if that means less stability.
  • However, in a production environment, I would dumb down my config by writing it to a static file that I can check manually as many times as I want

1.2. If You Give a Dev a DAG - jmp .home

To increase the expressiveness of your API, let users write arbitrary programs.

  • If You Give a Dev a Directed Acyclic Graph (DAG)…
    • They Will Ask You for Control Flow
    • They Will Ask for Functions and Macros
  • So What Do We Do?Permalink
    tradeoffs between how much of a user’s program we can represent and how difficult it is to implement our API.
    ↑ expressive ⇒ ↓ number of use cases, ↑ level of expertise required to use these advanced features ⇒ you might end up hitting diminishing returns
    1. Tough it out. Make a limited, ad-hoc language and live with the consequences.
    2. Embed yourself in a general purpose language
      Instead of implementing features like control flow and functions yourself, you can design your API to take advantage of your host language’s implementations of these!
      • ↑ expressivity, ↑ familiarity with existing language ⇒ ↓ maintenance burden and ↓ write documentation
      • ↓ opaqueness of how these language features work with your system
    3. Extend a general purpose language
      macros or compiled extensions to the host language (like javascript)
    4. Full send! Write your own programming language
      • ↑ expresiveness, complete control over the semantics
      • ↓ build and maintain a parser, typechecker, and compiler, a language server and documentation. This is all on top of solving the domain-specific problems you originally wanted to address!

1.2.2. A Kardashev scale for interfaces - by Gordon Brander

Contrast with The Pseudo Narrow Waist in Unix – Ilya’s blog
and also with Joe’s Blog — 2016-01-28 A Badass Way to Connect Programs Together (ease of implementation)

  • «Thoughts : Automata theory?»
    • Finite-state machine (Type 1) (Regular language, Type-3 grammar)
    • Pushdown automata (Type 2) (Context-free language, Type-2 grammar)
    • Linear-bounded automata (Type 3) (Context-sensitive language, Type-1 grammar)
    • Turing machine (Type 4) (Recursively enumerable language, Type-0 grammar)

Type 1 / Discrete: You can select discrete verbs and apply them to nouns. Clicking a button. Saving a file. There is no mechanism of composition. Examples:

  • GUIs
  • Hardware control panels

In a discrete interface, you combine actions across time, by manually pointing and clicking. In some discrete interfaces, verbs can only apply to specific nouns. The more expressive discrete interfaces have general-purpose verbs that can act on many nouns.
Type 2 / Composable: Composable interfaces might include composable nouns, composable verbs, or both. Discrete interfaces only let you combine actions across time, by manually pointing and clicking. Composable interfaces let you combine actions across space, using notation.
Composable nouns are data that have the same shape, so you can combine them together.

  • Lego
  • Excel and SQL tables

Composable verbs are actions you can string together into pipelines that can be run over and over with different nouns.

  • Unix pipes
  • Spreadsheet formulas
  • Nodes-and-wires programming
  • Modular synthesizers

Type 3 / Recursively composable: Composed verbs and nouns can themselves be used as verbs and nouns in other compositions.

  • Functions
  • Shell scripts
  • Systems that include scripting languages, like Hypercard or the web.

Recursive composition takes the logic of composition to its most extreme endpoint. You can bundle up complex combinations of verbs or nouns so that they can be treated as a single unit. This starts to get you toward something like general-purpose computing.

Recursion is the root of computation since it trades description for time.
Alan Perlis

You can freely trade between time (actions you take) and space (notation) to get the job done. You might even code yourself out of the loop completely.
The original Kardashev scale only goes to 3, because Kardashev figured that harnessing the energy of an entire universe would be impossible. That’s not going to stop me, however.
Type 4 / Self-authoring. The system itself is defined through the nested composition of a small number of primitives, giving you complete access to the very alphabet that was used to construct the system.

  • Lisp
  • SmallTalk
  • DNA
  • Physics

When an interface is self-authoring, those using the interface can rewrite it completely to meet their needs. A self-authoring interface collapses the distinction between user and programmer.
«It’s now in the article itself but assembly/Turing machines/whatever are also self-authoring»

1.2.2.1. Scales of Language Power
  1. Discrete: unfolds in time.
  2. Composable: unfolds in space.
  3. Recursively composable: unfolds itself.
  4. Self-authoring: unfolds the unfolding.
1.2.2.2. Human Code Injection

Data is a noun
Code is a verb (behavior, actions)
Code injection is saying things (nouns) which turn into actions/behaviors (verbs)
For example inspiring fear, excitement, reminding you of something or generating new ideas
Change/challenge perspectives so that new things become possible
Sharing information, but also manipulation

1.3. YAML

1.3.1. How I learned to stop worrying and love the YAML | lbr.   process

https://leebriggs.co.uk/blog/2022/05/09/learning-to-love-yaml
YAML: people either “love it” or “hate it”

1.3.1.1. The Abstraction Argument

Software developers know nothing about infrastructure, and when they write infrastructure as code in the same language they’re writing their applications in they make it really complex. I then have to fix it, and thats really really hard.

Whether we like it or not, infrastructure is complex.
HCL started as a simple mechanism to express JSON files, and now you can define abstractions (modules), use conditionals (sort of, although if you want optional parts of your infrastructure, you’ll need to abuse the count option) and leverage loops. Its further apparent in Helm which uses Go templates to allow you to express the complexity that inherently exists in Kubernetes deployments.

1.3.1.2. The complexity argument

It’s my opinion that the people who truly loathe Pulumi don’t want to admit they don’t understand the languages it supports very well. They’re worried that adopting Pulumi is going to put them out of a job. I could never prove this of course, but I believe it because I also believed it.

There are more “software engineers” than there are “infrastructure engineers” and they need to ship their software.
The vast majority of those software engineers don’t want to bolt templates on top of configuration languages or use a DSL they can only use for one purpose.

So if you’re an infrastructure engineer clinging on to your DSL, you might want to consider the idea you’re the Betamax of the tech industry. Even if you’re right about configuration languages being the right way to define infrastructure, the entire industry is moving away from them (AWS CDK and Terraform CDK and the investment in them further support this argument) and you’re going to get left in the dust, complexity be damned.

1.4. guix vs nixos

1.4.2. https://news.ycombinator.com/item?id=23528380

Of course, I’m biased towards Guix, but I must say that I’m very fond of the level of integration that Guix achieves. When I look at Nix I see a bunch of seemingly separately developed tools that are written in a mix of languages (with Shell code being rather common). In Guix all tools are written in Scheme, use the same API, behave similarly, etc. It just feels much more polished to me.

Author: Julian Lopez Carballal

Created: 2024-09-15 Sun 04:20