os/hosts/bootstrap.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
2 KiB
Nix
Raw Normal View History

2023-01-28 20:49:10 +00:00
{
config,
lib,
pkgs,
profiles,
...
}:
let
inherit (lib) mkForce;
# Gets hostname of host to be bundled inside iso
# Copied from https://github.com/divnix/digga/blob/30ffa0b02272dc56c94fd3c7d8a5a0f07ca197bf/modules/bootstrap-iso.nix#L3-L11
2023-01-28 20:49:10 +00:00
getFqdn =
config:
let
net = config.networking;
fqdn =
if (net ? domain) && (net.domain != null) then "${net.hostName}.${net.domain}" else net.hostName;
in
fqdn;
in
{
2022-08-29 09:53:55 +00:00
# build with: `nix build ".#nixosConfigurations.bootstrap.config.system.build.isoImage"`
2021-08-06 01:16:53 +00:00
imports = [
# profiles.networking
profiles.users.root # make sure to configure ssh keys
profiles.users.pub-solar
profiles.base-user
2021-10-24 18:13:18 +00:00
profiles.graphical
2021-10-24 20:03:28 +00:00
profiles.pub-solar-iso
2021-08-06 01:16:53 +00:00
];
config = {
boot.loader.systemd-boot.enable = true;
2021-08-06 01:16:53 +00:00
# will be overridden by the bootstrapIso instrumentation
2023-01-28 20:49:10 +00:00
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
};
2022-07-08 12:13:41 +00:00
system.nixos.label = "PubSolarOS-" + config.system.nixos.version;
# mkForce because a similar transformation gets double applied otherwise
# https://github.com/divnix/digga/blob/30ffa0b02272dc56c94fd3c7d8a5a0f07ca197bf/modules/bootstrap-iso.nix#L17
# https://github.com/NixOS/nixpkgs/blob/aecd4d8349b94f9bd5718c74a5b789f233f67326/nixos/modules/installer/cd-dvd/installation-cd-base.nix#L21-L22
isoImage = {
2023-01-28 20:49:10 +00:00
isoBaseName = mkForce (getFqdn config);
isoName = mkForce "${config.system.nixos.label}-${config.isoImage.isoBaseName}-${pkgs.stdenv.hostPlatform.system}.iso";
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.05"; # Did you read the comment?
};
2021-08-06 01:16:53 +00:00
}