diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml new file mode 100644 index 00000000..20b4da85 --- /dev/null +++ b/.github/workflows/iso.yml @@ -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 + diff --git a/README.adoc b/README.adoc index 1eb895da..305b9315 100644 --- a/README.adoc +++ b/README.adoc @@ -121,7 +121,7 @@ In order of priority: * [x] Create custom modules. * [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] Manage secrets with agenix. * [ ] Create a good workflow for tests. diff --git a/hosts/bootstrap/README.adoc b/hosts/bootstrap/README.adoc new file mode 100644 index 00000000..6b853b0b --- /dev/null +++ b/hosts/bootstrap/README.adoc @@ -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. diff --git a/hosts/bootstrap/default.nix b/hosts/bootstrap/default.nix new file mode 100644 index 00000000..87d00e24 --- /dev/null +++ b/hosts/bootstrap/default.nix @@ -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; +}