Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

My personal NixOS config

License

NotificationsYou must be signed in to change notification settings

jhvst/nix-config

Repository files navigation

Abstract -- We argue that the main benefit of an ephemeral Linux distribution is that a cluster of nodes categorically commutes over its initial state, and, by extension, by the help of well-defined configuration, any state after that. In practice, given an initial Linux configuration in the form of a NixOS declaration (acategory of$X$) and a way to reset oneself state (afunction of$g \circ f$) gives us a commuting graph. In this graph, we can denote the initial state as$A$,$A \xrightarrow[]{f} B$ as amutation$f$ from$A$ to$B$ over any time after Linux stage 1 boot, towards an arbitrary moment in time whichkexec is issued (call this function$g$), which commutes back to$A$ via$B \xrightarrow[]{g}A$. This categorical property also known asisomorphism is elementary in theory, but untrivial in practice in the context of operating systems. What we want to showcase is that a tedious "side-effect" of NixOS, what we insist boils down toextensive documentation coupled with a memefied concept oferase your darlings taken into its extreme gives us the morphism$B\xrightarrow[]{g}A$. In effect, ephemeral system configurations provide us the capability to reset the state of a$A$ at any given time (i.e.,$1_A = g \circ f$). We have implemented the isomoprhism by building a Linux rootfs as atmpfs, and provide a script to generate a Linux kernel (abzImage) and initial ramdisk (initrd) from a givennixosConfiguration.

Background

A prominent direction in the Linux distribution scene lately has been the concept ofimmutable desktop operating systems. Recent examples includeFedora Silverblue (2018) andVanilla OS (2022). But, on my anecdotal understanding of the timelines concerning Linux distros, both are spiritual successors toCoreOS (2013).

The first time the concepts of CoreOS extended to a desktop system came to my radar wasin a blog post by Jessie Frazelle (2017). Here, Jessie modified the base image of CoreOS using Gentooemerge to include graphics drivers. To a vast extent, this project does the same but withNixOS.

But there's more to my approach to operating systems than immutability:ephemerality. In NixOS circles, ephemerality is arguably more widely known as the concept oferasing your darlings, as blogged by Graham Christensen (2020). NixOS has tooling around maintaining these kinds of temporary Linux root filesystems, most notably,impermanence. In effect, these approaches help to maintain a reproducible Linux distribution by ensuring that the NixOS configuration isverbatim (Finnish:sanansamukainen) of the running system. Otherwise, undocumented state changes may creep into the system over time, hence mangling the difference between what is part of the OS and what is part of the user configuration. Over time, this demeans the point of using NixOS in the first place.

Another approach to a clean root filesystem is to delete the whole OS. This is the approach that I switched to in 2021 after readingRunning Fedora CoreOS directly from RAM. Historically, these so-calledlive-boot environments have been around for a long time in the form of Preboot eXecution Environments (PXEs). For example, most university and library computers boot using PXE. Technically speaking, what happens is that the BIOS of the computer asks a DHCP server for an operating system to start. The DHCP server then points to a TFTP server from which the boot files are loaded on put into RAM. When the computer shuts down, the RAM is cleared, hence the OS state destroyed. Coincidentally, I like this approach because it avoids needing a separate boot manager -- the "boot manager" is a PXE text file on the TFTP server. Before moving to NixOS in 2022, I maintained configuration files for this kind of system on a GitHub projectstateless-fcos.

The timeline now continues from this repository in the form of NixOS configurations. Spiritually, it is a successor of both CoreOS and Jessie's graphical CoreOS. And what made the switch for me was that I initially wanted the graphics drivers for myrivi-loader project. The idea was that my CoreOS server would also act as a remote GPU computing host for my own programming language, which I call Rivi.

What made getting into NixOS particularly easy was that my CoreOS server was already reproducible fromignition configurations. Further, everything ran in apodman container. So, to make the initial switch to NixOS, I merely had to translate thesystemd processes fromignition to NixOS option format.

Useful links

three-phased booting:

Game streaming


[8]ページ先頭

©2009-2025 Movatter.jp