This commit is contained in:
Philipp 2024-03-19 19:31:47 +01:00
commit ae68019de1
No known key found for this signature in database
4 changed files with 38 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
uuidfile

16
generate-new-image.sh Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
set -x
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DESTUUID="$(cat $SCRIPT_DIR/uuidfile)"
tmpdir=$(mktemp -d)
mntdir=$(mktemp -d)
if [[ ! -h "/dev/disk/by-uuid/$DESTUUID" ]]; then
echo "Error: Drive not inserted"
exit 1
fi
mount /dev/disk/by-uuid/"$DESTUUID" $mntdir
cp $(nix-shell -p nixos-generators --run "nixos-generate --format iso --configuration './image.nix' -o $tmpdir/nixos-image.iso") $mntdir/nixos-x86_64-$(date --iso).iso
umount $mntdir
rm -rf $tmpdir
rmdir $mntdir

18
image.nix Executable file
View file

@ -0,0 +1,18 @@
{ pkgs, modulesPath, lib, ... }: {
imports = [
"${modulesPath}/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix"
];
users.users.nixos.openssh.authorizedKeys.keys = [
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAINgMYT/3mFn0A/yAkI3BHC246Q+/tZ+3HdBeeyp134e+AAAAGHNzaDp5dWJpa2V5LWJsdWUtZGVza3RvcA== philipp@sarah"
];
boot.supportedFilesystems = [ "bcachefs" ];
isoImage.squashfsCompression = "gzip -Xcompression-level 1";
nix = {
settings.experimental-features = [ "nix-command" "flakes" ];
};
environment.systemPackages = with pkgs; [
keyutils
tmux
];
console.keyMap = "neo";
}

3
readme.md Normal file
View file

@ -0,0 +1,3 @@
* Format thumbdrive with ventoy
* Insert UUID into file uuidfile in this directory (only UUID, nothing else)
* Run script