init new repo
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# TODO: Parameterize this to combine with iso-config.nix
|
||||
# Currently hardcoded to rhemawavekiosk-commercial; should accept target config as param
|
||||
targetSystem =
|
||||
self.nixosConfigurations.rhemawavekiosk-commercial.config.system.build.toplevel;
|
||||
|
||||
diskoScript =
|
||||
self.nixosConfigurations.rhemawavekiosk-commercial.config.system.build.diskoScript;
|
||||
in
|
||||
{
|
||||
nix.settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
|
||||
substituters = [
|
||||
"https://cache.nixos.org"
|
||||
];
|
||||
|
||||
flake-registry = "";
|
||||
};
|
||||
|
||||
nix.registry.nixpkgs = pkgs.lib.mkForce {
|
||||
to = {
|
||||
type = "path";
|
||||
path = "${inputs.nixpkgs}";
|
||||
};
|
||||
};
|
||||
|
||||
environment.variables.KIOSK_FLAKE = "${self}";
|
||||
|
||||
virtualisation.vmVariant = {
|
||||
virtualisation.memorySize = 8096;
|
||||
virtualisation.diskSize = 100000;
|
||||
virtualisation.cores = 4;
|
||||
virtualisation.qemu.options = [
|
||||
# "-nic none"
|
||||
];
|
||||
virtualisation.forwardPorts = [
|
||||
{ from = "host"; host.port = 2222; guest.port = 22; }
|
||||
];
|
||||
};
|
||||
|
||||
environment.etc."nix/netrc" = {
|
||||
text = ''
|
||||
password eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjIwODgzODk2ODEsIm5iZiI6MTc3MjgxMzY4MSwic3ViIjoia2lvc2siLCJodHRwczovL2p3dC5hdHRpYy5ycy92MSI6eyJjYWNoZXMiOnsia2lvc2siOnsiciI6MX19fX0.N6Ktrmmu1LSy2PP8uNF25VHRP1dxPZJ4M0MR1kUpVi0
|
||||
'';
|
||||
mode = "0400";
|
||||
};
|
||||
|
||||
nix.extraOptions = ''
|
||||
netrc-file = /etc/nix/netrc
|
||||
'';
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
systemd.services.NetworkManager-wait-online.enable = false;
|
||||
|
||||
nix.settings.connect-timeout = 0;
|
||||
|
||||
services.openssh.enable = true;
|
||||
|
||||
users.users.root.openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB4vXx7sOOVAyxdS/N1LEI+L8wYICf+gbzs6Kz7K8Je5 cnclack@pm.me:Thinkpad"
|
||||
];
|
||||
|
||||
systemd.services.zero-touch-install = {
|
||||
description = "Zero-Touch Kiosk Installation";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
wants = [ ];
|
||||
after = [ "systemd-udev-settle.service" ];
|
||||
|
||||
path = with pkgs; [
|
||||
nix
|
||||
git
|
||||
util-linux
|
||||
nixos-install-tools
|
||||
curl
|
||||
networkmanager
|
||||
mount
|
||||
umount
|
||||
disko
|
||||
];
|
||||
|
||||
environment = {
|
||||
NIX_PATH = "nixpkgs=${inputs.nixpkgs}";
|
||||
KIOSK_FLAKE = "${self}";
|
||||
DISKO_SCRIPT = "${diskoScript}";
|
||||
};
|
||||
|
||||
script = ''
|
||||
set -euo pipefail
|
||||
|
||||
echo "Running disko script..."
|
||||
echo "Script: $DISKO_SCRIPT"
|
||||
|
||||
${diskoScript}
|
||||
|
||||
echo "Installing RhemaWave"
|
||||
echo "Closure Path: ${targetSystem}"
|
||||
|
||||
nixos-install \
|
||||
--system "${targetSystem}" \
|
||||
--no-root-passwd \
|
||||
--no-channel-copy
|
||||
|
||||
# Redirect to console and show completion message
|
||||
exec > /dev/tty1 2>&1
|
||||
echo ""
|
||||
echo "============================================="
|
||||
echo " Installation complete!"
|
||||
echo ""
|
||||
echo " Please remove the USB drive and reboot."
|
||||
echo "============================================="
|
||||
|
||||
# Wait indefinitely for user action
|
||||
sleep infinity
|
||||
''; };
|
||||
}
|
||||
Reference in New Issue
Block a user