WIP. Posting just to make sure people know this is something I'd like to do. Context: https://matrix.to/#/!PvnunzXUk4Vm1CmKS4:auxolotl.org/$bOm6iaBpWbo-KRJgo7FUZdeFIv9StzRHxklbx7OQ23g?via=auxolotl.org&via=matrix.org&via=catgirl.cloud Reasons: 1. Why should GCC inflict complication upon all of tidepool just because of its own architectural deficiencies? 2. Most other compilers are multi-target so it doesn't matter 2. Target is useless for 99.9% of packages and only leads to user confusion, especially since many compilers also call what would be host here "target". 3. Canadian-cross is not very well supported. GCC barely supports it, and is broken in many cases. Nixpkgs does not support it (regardless of what its API may imply) and no one has ever complained. Plan: 1. Remove most target related things. No reason to have it. 2. Add configuration parameter on GCC that selects its target What does this mean: This basically moves target to be a GCC-specific artifact rather than an official parameter every package must endure the cognitive load of. This is because it is. Nixpkgs plans on dumping target in the future as well because of this. Or at least making it an alias. If you want to create a compiler with a different target, then override GCC to do so. No need to pervade all of tidepool just for GCC. Co-authored-by: Victor Fuentes <vlinkz@snowflakeos.org> Reviewed-on: #31 Reviewed-by: vlinkz <vlinkz@snowflakeos.org> Co-authored-by: Ross Smyth <snix@treefroog.com> Co-committed-by: Ross Smyth <snix@treefroog.com> |
||
|---|---|---|
| .. | ||
| npins | ||
| src | ||
| default.nix | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
Aux Tidepool
Aux Tidepool is an initial package set built on top of Aux Foundation. Packages are created and managed using Aux Lib's module system to allow for highly dynamic and extensible configuration.
Installation
Packages can be imported both with and without Nix Flakes. To import them using Nix Flakes, add this repository as an input.
inputs.tidepool.url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz?dir=tidepool";
To import this library without using Nix Flakes, you will need to use fetchTarball and
import the library entrypoint.
let
labs = builtins.fetchTarball {
url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz";
sha256 = "<sha256>";
};
tidepool = import "${labs}/tidepool" {};
in
# ...
Usage
To build a package, you can run the following command inside of the tidepool directory:
nix-build -A packages.foundation.bash.latest.packages.x86_64-linux.x86_64-linux.x86_64-linux.package
If you have nix-command experimental feature enabled, you can v3 CLI instead:
nix build -f . packages.foundation.bash.latest.packages.x86_64-linux.x86_64-linux.x86_64-linux.package
Using flakes, the difference is only in calling:
nix build .#packages.foundation.bash.latest.packages.x86_64-linux.x86_64-linux.x86_64-linux.package
This interface is verbose, but stable. We are still working out the details for a friendlier interface!
The full command syntax looks like this:
nix-build -A packages.${package-set}.${package}.${version}.packages.${build}.${host}.${target}.package
Tidepool packages can have multiple versions available. Tidepool also provides aliases
for convenience, currently "stable" and "latest". Aliases go directly after ${package}:
nix-build -A packages.${package-set}.${package}.${alias}.packages.${build}.${host}.${target}.package
The actual available versions live one level deeper, under versions namespace:
nix-build -A packages.${package-set}.${package}.versions.${version}.packages.${build}.${host}.${target}.package
Here are a few practical examples for Tidepool. We can use a specific Bash version:
nix-build -A packages.foundation.bash.versions."5.2.15-stage1".packages.x86_64-linux.x86_64-linux.x86_64-linux.package
Get Bash cross-compiled from i686-linux to x86_64-linux:
nix build .#packages.foundation.bash.latest.packages.i686-linux.x86_64-linux.x86_64-linux.package
Or a native aarch64-linux Bash:
nix build .#packages.foundation.bash.latest.packages.aarch64-linux.aarch64-linux.aarch64-linux.package
Running this command will:
- Bootstrap
i686-linuxgccas a dependency ofx86_64-linuxgcc - Incrementally bootstrap the actual
x86_64-linuxgcc - Incrementally bootstrap
aarch64-linuxgccfromx86_64-linuxgcc - Build the native
aarch64-linuxgcc - Build the native
aarch64-linuxbash
It's very early in Tidepool's development, and this syntax and UX is expected to change! For now, the only syntax available is this developer-facing style. You can expect improvements to be made!
Development
Tidepool is built with Aux's portable submodules. They function similarly to submodules used by NixOS. Using the submodules, Tidepool provides a nice and easy-to-work-with API.
Tidepool can be used with flakes or without them. The solution we recommend
for non-flake usage is npins.
Tidepool exports an attribute set, which can be viewed using nix repl.
We can visualize it!
tidepool
├───builders
├───lib
├───mirrors
├───packages
│ ├───aux
│ │ ├───a
│ │ ├───b
│ │ └───c
│ ├───foundation
│ │ ├───bash
│ │ ├─── ...
│ │ └───zlib
│ ├───context
│ │ └─── ...
│ └───...
├───extend
├───internal
├───new
└───preferences
There are 4 outputs that share the name with folders under src/:
builders- this is a set of Tidepool builderslib- this is the Tidepool library. It defines some nice-to-haves for packagingmirrors- this is set of mirrors. Many projects, like GNU, provide many mirrors - you can change a mirror to the one your preferpackages- this is a set for all of the Tidepool packages
You may learn more about those attributes in their corresponding folders.
Additionally, there are several other attributes, which don't have corresponding folders:
extend- this is a function to extend Tidepool's package set by providing additional package modules. Here's how to use it:
let
tidepool = import ./tidepool;
in
tidepool.extend {
modules = [
# Put additional modules you want to include here.
];
}
internal- this is the internal attribute set. Currently, it only brings Tidepool's dependencies into scope: more concretely, it exposes thefoundationnamespace from the (perhaps confusingly-named) Foundation repository, which does the bootstrap chain from a 357-byte file. It is not the same as Tidepool'sfoundationnamespace, which makes those early-bootstrap packages integrate with Tidepool (e.g., enabling cross-compilation)new- this is a function that allows to create a new empty package set. It allows you to create a package set from scratch. Using this function, you will get access to Tidepool library functions and the interface for defining your own builders (but you don't get builder implementations). Here's how to use it:
let
tidepool = import ./tidepool;
module = { config }: {
config = {
# Create a new package set from scratch, no packages exist unless you define them.
};
};
in
tidepool.new module;
preferences- this is an attribute set that lists your preferences for the package sets. It has the following shape:
{
packages = {
allow = {
broken = false;
incompatible = false;
};
version = "latest";
};
}