From d4d345ca1278862bb3893cf3cc2ee56a63dc72f0 Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 14 Jul 2022 16:21:59 -0700 Subject: [PATCH] machines: add a `rescue` machine for live-booting --- flake.nix | 1 + machines/rescue/default.nix | 15 +++++++++++++++ machines/rescue/fs.nix | 13 +++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 machines/rescue/default.nix create mode 100644 machines/rescue/fs.nix diff --git a/flake.nix b/flake.nix index ea53e8a87..28b74ca95 100644 --- a/flake.nix +++ b/flake.nix @@ -72,6 +72,7 @@ machines.desko = decl-bootable-machine { name = "desko"; system = "x86_64-linux"; }; machines.lappy = decl-bootable-machine { name = "lappy"; system = "x86_64-linux"; }; machines.moby = decl-bootable-machine { name = "moby"; system = "aarch64-linux"; }; + machines.rescue = decl-bootable-machine { name = "rescue"; system = "x86_64-linux"; }; in { nixosConfigurations = builtins.mapAttrs (name: value: value.nixosConfiguration) machines; imgs = builtins.mapAttrs (name: value: value.img) machines; diff --git a/machines/rescue/default.nix b/machines/rescue/default.nix new file mode 100644 index 000000000..bd9287e5f --- /dev/null +++ b/machines/rescue/default.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +{ + imports = [ + ./fs.nix + ]; + + boot.loader.generic-extlinux-compatible.enable = true; + boot.loader.efi.canTouchEfiVariables = false; + colinsane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ]; + + # TODO: enable root login via ssh + + # docs: https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion + system.stateVersion = "21.05"; +} diff --git a/machines/rescue/fs.nix b/machines/rescue/fs.nix new file mode 100644 index 000000000..97e5e3147 --- /dev/null +++ b/machines/rescue/fs.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + # root is a tmpfs so that we have an ephemeral system ("impermanence" handles the state) + fileSystems."/" = { + device = "/dev/disk/by-uuid/44445555-6666-7777-8888-999900001111"; + fsType = "ext4"; + }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/2222-3333"; + fsType = "vfat"; + }; +}