Skip to content

debarchito/.bootstrap

Repository files navigation

0. What is this repo about?

.bootstrap implements a bootstrapping framework (hence the name) around flake-parts's flakeModules using the Dendritic pattern. It implements almost everything as host-agnostic feature options making them portable and reusable across any .bootstrap project. It also standardizes a convention to implements packages that can be directly built and consumed via nix build and nix run commands. For e.g.

# Run CUDA-enabled Blender; upstream nixpkgs doesn't enable CUDA by default
nix run sourcehut:~debarchito/.bootstrap#blender

It also standardizes global overlays in one place among many other things.

.bootstrap builds a subset of packages on GitHub Actions and uploads the artifacts to my cache registry at debarchito.cachix.org. You can take a look at what's built every commit here. If you want to use these packages, add my cachix as a substituter:

nix.settings = {
  substituters = [ "https://debarchito.cachix.org" ];
  trusted-public-keys = [
    "debarchito.cachix.org-1:md/bk3JZDoFjVOa6bsIDqaY5hcSec4KPWn8q3PbpCl8="
  ];
};

Alternatively, the options-trustedSubstituters feature module can be enabled to set this up among others substituters. This module is part of the nixos class and will not work inside a homeManager class.

1. Preparation (TODO)

Apply the disk layout using disko:

Warning

This will erase all existing data on disk!

run0 nix --extra-experimental-features 'nix-command flakes' \
  run github:nix-community/disko/latest -- --mode destroy,format,mount \
  ./modules/hosts/<host>/_raw/disko-configuration.nix

NOTE: Disko isn't automatically integrated at the moment of writing. Although, it can already be used to apply the layout. This will be addressed in future revisions. \

2. Applying the configurations

Clone this repository to ~/.bootstrap. This is the assumption throughout the steps.

git clone https://git.sr.ht/~debarchito/.bootstrap ~/.bootstrap
# or
git clone git@git.sr.ht:~debarchito/.bootstrap ~/.bootstrap

Fresh installs generate their fresh /etc/nixos/hardware-configuration.nix. This is the configuration your system should build against. Override the old hardware configuration using:

cp /etc/nixos/hardware-configuration.nix ~/.bootstrap/modules/hosts/<host>/_raw/hardware-configuration.nix
# DO NOT REPLACE ~/.bootstrap/modules/hosts/<host>/hardware-configuration.nix by mistake! Notice the "_raw".

When applying the NixOS configuration for the first time, pass these options temporarily:

cd ~/.bootstrap
run0 nixos-rebuild switch --flake .#<host> \
  --option experimental-features \
    'nix-command flakes' \
  --option extra-substituters \
    'https://install.determinate.systems https://attic.xuyh0120.win/lantian' \
  --option extra-trusted-public-keys \
    'cache.flakehub.com-3:hJuILl5sVK4iKm86JzgdXW12Y2Hwd5G07qKtHTOcDCM= lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc='

This is 'cause the configuration depends on Determinate Nix and the CachyOS kernel from xddxdd/nix-cachyos-kernel. Substituters are required to avoid compiling these packages locally.

Once done, subsequent applications can be triggered using:

run0 nixos-rebuild switch --flake .#<host>

The nh utility is also available as an alternative (NH_FLAKE is set to ~/.bootstrap):

nh os switch -c <host>

Now, apply the Home-Manager configuration using:

home-manager switch --flake .#<user>@<host>
# or:
nh home switch -c <user>@<host>

The first activation is going to take a bit of time since it installs the Papirus Icon Theme during this stage.

3. Templates

This repo also contains a templating engine alongside tailored development templates. Get started using:

nix run sourcehut:~debarchito/.bootstrap#generate

Initialize a template (e.g Rust) using:

nix run sourcehut:~debarchito/.bootstrap#generate \
    rust ./hello-world \
    name="hello-world" description="Say hello to the world!"

Then run using:

nix run ./hello-world

4. Licensing

The repository is licensed under the zlib license unless stated otherwise.

About

All my Nix/NixOS bootstrap things. Mirror of https://git.sr.ht/~debarchito/.bootstrap

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors