Antikythera, named in honor of the first computer in history, is a tool to help you achieve a reproducible configuration, whatever that may mean for your use-case, and in the context you use it.
If you like my work, please support me by buying me a cup of coffee ☕ so I can continue with a lot of motivation.
Inspired by knowledge of old, and in natural structures, physics and chemistry.
This tool is written completely in Haskell, using modern practices, and is developer friendly. Consequently, the main way to use this is to write your own YAML files.
We strive to make the type system work for us and value the elegant solutions that Haskell has brought to the world, and the incredible techniques it has allowed for Antikythera. We are in love with Haskell’s beautiful and expressive type system.
Antikythera keeps track of atoms that have already been executed in a state file, configurable for you, to help reliably reproduce a set of instructions at least once, or more, as needed.
Yes you read it right, atoms. Antikythera takes inspiration from nature to define hierarchies, and interactions between them. We thus work with atoms, which are the most indivisible unit, which make up molecules. These molecules form cells. We actually are interested in the reactions that occur on molecules and atoms, and thus work with those concepts, as reaction inputs, reaction products, and reaction product journals.
Antikythera reads an input from the command line, and processes the atoms it finds, according to an optionally present reaction product journal file, skipping if wanted the already completed tasks.
You can define atoms easily in YAML syntax. You can learn more about the data model by looking at the resources
folder at the root of this repository or by looking at the Haskell data model definition.
Imagine you want to have a handy way to always update your system with this tool, meaning the Void GNU/Linux packages as well as the Flatpak packages, automating a routine task of many people, like:
molecules: - alwaysRun: true identifier: void-xbps-install-su atoms: - composition: |- xbps-install -Suy asSuperUser: true - composition: |- flatpak update -y
Create easily a reproducible setup, enabling you to setup any computer
molecules: - identifier: void-text-editors-install atoms: - composition: | xbps-install -y neovim emacs-x11 asSuperUser: true - identifier: void-nerd-install atoms: - composition: | xbps-install -y neofetch pandoc feh asSuperUser: true
The stdin, stdout and stderr of the child processes that Antikythera spawns simply inherit Antikythera’s one, for maximum flexibility.
This means that if you run Antikythera from a terminal emulator, in a bash session, you will get all handles piped to it. I would very much like to develop more advanced mechanisms of output redirection, including into log files, at a later stage.
You can run interactive scripts with Antikythera, feel free to explore the boundaries of what is possible 🙂
When a state file is used, Antikythera will attempt to run any task it does not find in the state, and any atoms that currently have a false success state in the last run.
reactionProductJournals:
- entries:
2vi-test2:
completedSuccessfully: true
completionInstant: 2023-06-06T20:44:31.016102616Z
messages: null
firefox-install:
completedSuccessfully: true
completionInstant: 2023-06-06T20:44:25.75330006Z
messages: null
vi-test:
completedSuccessfully: true
completionInstant: 2023-06-06T20:44:25.75839743Z
messages: null
reactionInputLocation: /home/void/Ontwikkeling/Persoonlijk/antikythera/resources/samples/sample.yaml
(-r|--reaction-inputs)
is a required string option, that specifies one or more glob patterns that specify what files to read reaction inputs from. See the glob section below for more explanation. Bear in mind that if your shell auto-expands glob patterns (like Bash does) you might need to escape the asterisks.
[-q|--quiet]
is an optional switch that specifies if Antikythera should reduce output as much as possible. Note that output generated from the invoked scripts will still be redirected and shown. Quiet means no Antikythera messages.
[-d|--directory]
is an optional string option that specifies the working directory to operate from. This affects the glob patterns and the execution of scripts too. If not specified, this defaults to the current working directory.
[-j|--reaction-product-journal]
is an optional string option that specifies what file should be used to read and store the state of the desired execution.
[-i|--interpreter]
is an optional string option that specifies what interpreter should run the composition from your scripts. This defaults to /bin/bash
.
[-s|--super-user-prefix]
is an optional string option that specifies what prefix should be used to run things as super user. Think apt update
vs sudo apt update
.
Example runs:
stack run -- -r resources/samples/*.yaml ./antikythera -j test-state.yaml -r resources/samples/*.yaml
Antikythera uses the glob standard, as defined by POSIX, described in the Glob Haskell library, to determine which files to load scripts from.
In order to pass several glob patterns in one go to Antikythera it currently supports the __%%__
delimiter such that you can the run the tool like ./antikythera -f my-void-scripts/**/*.yaml__%%__my-browser-scripts/*.yaml
.
This program is licensed under the GNU General Public License v3.0 or newer. This ensures that we can continue to guarantee your four essential freedoms, as defined by the Free Software Foundation:
- The freedom to run the program as you wish, for any purpose (freedom 0).
- The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.
- The freedom to redistribute copies so you can help others (freedom 2).
- The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.
I recommend GHCUp as your standard way to install Haskell, Stack, Cabal and Haskell Language Server.
To build the project, on Void Linux, you should be using Stack, Cabal, GHC, HLS and such, all from GHCUp.
Then also install gmp-devel
in Void Linux.
I currently use only Void GNU/Linux so I am offering pre-built Antikythera binaries on every tag for Void GNU/Linux users. Ping me at <[email protected]> if you want to also work on distributing binaries for other operating systems, it should be trivial.
For Void GNU/Linux binaries, you can download them from AWS, by specifying the tag you want in the URL (for example v0.3.0.2):
https://antikythera-releases.s3.eu-north-1.amazonaws.com/void-gnu-linux/antikythera-(tag version here).tar.gz
You can run the test suite by executing stack test
at the root of the project. This project uses RIO and HTF (Haskell Testing Framework) for tests. This combines HUnit and QuickCheck, and gives lots of powerful possibilities.
Several commandline options are available for HTF tests. Use stack test –ta –help or cabal test –test-options –help to see the list of options.
It’s recommended for full IDE support to also do stack install HTF
in this directory. My recommended setup anyway is to use Emacs + Eglot along with Haskell and Stack installed via GHCup.