Heyo, I’ve been trying to make a custom installation ISO that includes a few install scripts and my dotfiles.
However, for some reason using isoImage.contents
hasn’t worked for me. Before trying this I’ve used environment.etc
, which did work, but wasn’t as nice.
I’m using nixos-generate --format iso --flake ./flake.nix#minimal -o result --show-trace
to generate the iso.
# flake.nix
{
description = "Basic System Flake";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
unstable.url = "nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
helpers = import ./helpers.nix { inherit nixpkgs; inherit home-manager; };
# ...
minimalConfig = {
name = "minimal";
systemSettings = helpers.newSystemSettings {
system = "aarch64-linux";
};
# systemSettings = helpers.newSystemSettings {};
userSettings = helpers.newUserSettings {};
inherit inputs;
};
in {
# ...
nixosConfigurations.minimal = (helpers.newSystemConfiguration minimalConfig);
};
}
# profiles/minimal/configuration.nix
{ config, pkgs, systemSettings, userSettings, modulesPath, lib, ... }:
let
newIsoContent = source: target:
pkgs.lib.trivial.id { inherit source; inherit target; };
in
{
imports = [
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
# ...
];
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.supportedFilesystems = lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ];
environment.systemPackages = with pkgs; [
parted
neovim
disko
git
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
isoImage.contents = [
(newIsoContent ./bootstrap "/bootstrap/scripts/")
(newIsoContent ./../../. "/bootstrap/dotfiles/")
];
system.stateVersion = "23.11";
}
This is my helper file for setting up my configurations:
# helpers.nix
{ nixpkgs, home-manager, ... }:
let
newSystemSettings = {
system ? "x86_64-linux",
hostname ? "nixos",
keymap ? "de",
en-locale ? "en_US.UTF-8",
de-locale ? "de_DE.UTF-8",
timezone ? "Europe/Berlin", # America/Vancouver
}: nixpkgs.lib.trivial.id {
system = system;
hostname = hostname;
keymap = keymap;
en-locale = en-locale;
de-locale = de-locale;
timezone = timezone;
};
newUserSettings = {
username ? "user",
displayname ? "user",
terminal ? "kitty",
browser ? "firefox",
editor ? "nvim",
wm ? "gnome",
font ? "...",
}: nixpkgs.lib.trivial.id {
username = username;
displayname = displayname;
dotfilesDir = "/home/${username}/.dotfiles";
terminal = terminal;
browser = browser;
editor = editor;
wm = wm;
font = font;
# fontPkg = fontPkg;
};
newSystemConfiguration = config:
nixpkgs.lib.trivial.id nixpkgs.lib.nixosSystem {
system = config.systemSettings.system;
modules = [ ./profiles/${config.name}/configuration.nix ];
specialArgs = {
systemSettings = config.systemSettings;
userSettings = config.userSettings;
inputs = config.inputs;
};
};
in {
inherit newSystemSettings;
inherit newUserSettings;
inherit newSystemConfiguration;
inherit newHomeManagerConfiguration;
}
When the iso is built, I upload it to my VPS provider and boot into it. But when I try to access the /bootstrap/
directory, it isn’t there…
It’s probably a stupid mistake, but I can’t for the life of me find it, so any help would be greatly appreciated.
If any more infos are required, feel free to ask.