iso-image.nix 886 Bytes
Newer Older
1
2
3
4
5
6
7
8
# Builds a NixOS ISO with a preconfigured OpenSSH server.
# Users from ../common/users.nix can ssh to the booted Image with their SSH keys.
#
# To build the iso, run:
# ```sh
# $ nix build -f ../ isoImage
# ```
# The result of that operation can be found in the `./result` folder
Matthias Adamczyk's avatar
Fix CI    
Matthias Adamczyk committed
9
{ pkgs, ... }:
Matthias Adamczyk's avatar
Matthias Adamczyk committed
10
11

let
Matthias Adamczyk's avatar
Fix CI    
Matthias Adamczyk committed
12
13
  nixos = import (pkgs.path + "/nixos") {
    configuration = { lib, modulesPath, ... }: {
Matthias Adamczyk's avatar
Matthias Adamczyk committed
14
      imports = [
Matthias Adamczyk's avatar
Fix CI    
Matthias Adamczyk committed
15
16
17
        (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")
        (modulesPath + "/installer/cd-dvd/channel.nix")
        ../common
Matthias Adamczyk's avatar
Matthias Adamczyk committed
18
19
20
21
22
23
24
25
26
27
28
      ];
      boot.loader.grub.enable = false;
      boot.kernelParams = [
        "panic=30" "boot.panic_on_fail" # reboot the machine upon fatal boot issues
      ];
      systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
      networking.hostName = "iso";
    };
  };

in nixos.config.system.build.isoImage