Create personalized bootstrap ISO

This commit is contained in:
Gabriel Arazas 2022-02-04 23:59:57 +08:00
parent eef2eb6542
commit 11723c53e3
4 changed files with 122 additions and 1 deletions

30
.github/workflows/iso.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: "Build personalized bootstrap ISO"
on:
push:
branches:
- master
- develop
jobs:
build-iso:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Build ISO
id: build-iso
# TODO: Use the registry.
run: |
nix run github:nix-community/nixos-generators/296067b9c7a172d294831dec89d86847f30a7cfc -- --flake .#bootstrap --format iso --out-link result
- name: Create release
id: create-release
uses: marvinpinto/action-automatic-releases@v1.2.1
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: latest
prerelease: true
title: Pre-release development
files:
result/iso/bootstrap-*.iso

View File

@ -121,7 +121,7 @@ In order of priority:
* [x] Create custom modules. * [x] Create custom modules.
* [x] Create a themes system similar to link:https://github.com/hlissner/dotfiles[this NixOS config]. * [x] Create a themes system similar to link:https://github.com/hlissner/dotfiles[this NixOS config].
* [ ] Create a good workflow for creating ISOs. * [x] Create a good workflow for creating ISOs.
* [x] Create development shells. * [x] Create development shells.
* [x] Manage secrets with agenix. * [x] Manage secrets with agenix.
* [ ] Create a good workflow for tests. * [ ] Create a good workflow for tests.

View File

@ -0,0 +1,16 @@
= bootstrap, the NixOS installation medium
My personalized NixOS installation medium.
It is not supposed to be used as a daily system (if you are, you're pretty weird :/).
This is based from how devos link:https://github.com/divnix/digga/blob/760bb9c29063258ba547145de0ab96acd7eba4c0/modules/bootstrap-iso.nix[generates their ISO].
You can also see link:https://nix.dev/tutorials/building-bootable-iso-image[an example from nix.dev].
To make use of this, you can generate an ISO through link:https://github.com/nix-community/nixos-generators[nixos-generators]. footnote:[You can also try this for other hosts as well for MORE BEEFY OFFLINE INSTALLATION MEDIUM!]
[source, shell]
----
nix run github:nix-community/nixos-generators -- --flake .#bootstrap --format iso --out-link result
----
With the ISO built, you can now use it for yourself for whatever reason.

View File

@ -0,0 +1,75 @@
{ self, lib, config, pkgs, inputs, modulesPath, ... }:
{
imports = [
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
];
isoImage = {
isoBaseName = "bootstrap-${config.networking.hostName}";
contents = [{
source = self;
target = "/bootstrap/";
}];
storeContents = [
self.devShell.${config.nixpkgs.system}
] ++ builtins.attrValues inputs;
};
networking.hostName = "bootstrap";
boot.supportedFilesystems = lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ];
nix = {
gc.automatic = true;
optimise.automatic = true;
# Please see `nix-conf.5` manual for more details.
settings = {
# All to make improvement for using Nix.
trusted-users = [ "root" "@wheel" ];
allow-import-from-derivation = true;
allow-dirty = true;
auto-optimise-store = true;
sandbox = true;
# Set several binary caches.
substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
"https://foo-dogsquared.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="
];
};
};
users.users = {
root.password = "";
nixos = {
password = "nixos";
description = "default";
isNormalUser = true;
extraGroups = [ "wheel" ];
};
};
environment.systemPackages = with pkgs; [
binutils
coreutils
moreutils
whois
jq
git
manix
# The coreutils replacement.
ripgrep
fd
bat
];
boot.loader.systemd-boot.enable = true;
}