From 7fcc95817d466ed3ac421725a86813497217d76f Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Thu, 12 Oct 2023 12:04:38 +0200 Subject: [PATCH] custom installer ISO with SSH --- README.md | 9 ++++++++- iso.nix | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 iso.nix diff --git a/README.md b/README.md index 54ba7f5..da1a139 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ # nixos-anywhere-workshop template -[docs](./template/README.md) \ No newline at end of file +[docs](./template/README.md) + +## Build installer ISO with SSH + +```shell +nix-build '' -A config.system.build.isoImage -I nixos-config=iso.nix +ls result/iso/ +``` diff --git a/iso.nix b/iso.nix new file mode 100644 index 0000000..fde5531 --- /dev/null +++ b/iso.nix @@ -0,0 +1,19 @@ +# This module defines a small NixOS installation CD. It does not +# contain any graphical stuff. +# https://nixos.wiki/wiki/Creating_a_NixOS_live_CD +{ config, pkgs, ... }: +{ + imports = [ + + + # Provide an initial copy of the NixOS channel so that the user + # doesn't need to run "nix-channel --update" first. + + ]; + + # Enable SSH in the boot process. + systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ]; + users.users.root.openssh.authorizedKeys.keys = [ + (builtins.readFile ./template/nitrokey.pub) + ]; +}