theseus-os / Theseus

Theseus is a modern OS written from scratch in Rust that explores 𝐢𝐧𝐭𝐫𝐚𝐥𝐢𝐧𝐠𝐮𝐚𝐥 𝐝𝐞𝐬𝐢𝐠𝐧: closing the semantic gap between compiler and hardware by maximally leveraging the power of language safety and affine types. Theseus aims to shift OS responsibilities like resource management into the compiler.
https://www.theseus-os.com/
MIT License
2.92k stars 172 forks source link

Add support for Nix/NixOS #1101

Open JustAnotherCodemonkey opened 5 months ago

JustAnotherCodemonkey commented 5 months ago

Rationale

The build instructions in the README are not only not idiomatic to those who use Nix as their package manager, but do not work on NixOS itself. This PR addresses this by not only modifying the README for Nix/NixOS users but providing powerful utilities for Nix users, specifically, a Nix shell (shell.nix), a (maybe) Nix derivation (default.nix), and a (maybe) Nix flake (flake.nix). There may also be small things to tie up or patch as well before the PR is considered fully polished.

State of the PR

The PR is technically ready to merge now and it would add basic functionality with few/no loose ends. However, there are more features planned that have yet to be implemented. Some of them are considered "important" as they patch notable missing functionality for being able to create a Nix development shell (such as the ability to use the Limine bootloader, or the ability to build Theseus for other architectures). Others are considered "nice-to-have" and many of these will likely not fully make their way into this PR, and it may simply end up being Nix shells, with the other parts possibly coming in another PR. The desired features and their state of completion are as follows:

Important Features

"Would be Nice" Features

Considerations

Important Questions to be Answered

JustAnotherCodemonkey commented 4 months ago

This is quickly becoming an issue. I've been relying on the Makefile, but for supporting non-x86_64 users and cross-compilation, it seems I will need to write a derivation (or maybe even just a flake) that re-creates the steps of the Makefile. This is really bad news to me, as the derivation/flake will need to be updated every time there is a change in the build process.