1. {config, lib, pkgs, ...}:
  2. {
  3. imports = [
  4. <nixpkgs/nixos/modules/installer/cd-dvd/iso-image.nix>
  5. <nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
  6. <nixpkgs/nixos/modules/installer/tools/tools.nix>
  7. <nixpkgs/nixos/modules/profiles/all-hardware.nix>
  8. <nixpkgs/nixos/modules/profiles/base.nix>
  9. <nixpkgs/nixos/modules/profiles/installation-device.nix>
  10. ./your_extras_if_any.nix
  11. ];
  12. system.stateVersion = "21.11";
  13. isoImage.isoBaseName = "YourOwnIsoName";
  14. isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.iso";
  15. isoImage.makeEfiBootable = true;
  16. isoImage.makeUsbBootable = true;
  17. isoImage.volumeID = "AsYouWishNamedInVolLive";
  18. boot.supportedFilesystems = [ "zfs" ];
  19. hardware = {
  20. enableRedistributableFirmware = true;
  21. cpu.intel.updateMicrocode = true;
  22. cpu.amd.updateMicrocode = true;
  23. }; # hardware
  24. networking = {
  25. wireless.enable = false;
  26. networkmanager = {
  27. enable = true;
  28. insertNameservers = [
  29. "91.239.100.100" # Censurfri
  30. "193.183.98.66" # OpenNIC 1
  31. "87.98.175.85" # OpenNIC 2
  32. "9.9.9.9" # IBM Quad9
  33. "8.8.4.4" # Google secondary
  34. "208.67.222.222" # Cisco OpenDNS primary
  35. ];
  36. }; # networkmanager
  37. }; # networking
  38. environment = {
  39. systemPackages = with pkgs; [
  40. avahi bind unwrapped
  41. ...
  42. ]; # systemPackages
  43. shellAliases = {
  44. sysup = "sudo nixos-rebuild switch --upgrade && nix-env -u";
  45. sysclean = "sudo nix-collect-garbage -d ; sudo nix-store --gc; sudo nix-store --optimize";
  46. ne = "sudo nixos-enter --root /mnt";
  47. ni = "sudo nixos-install --root /mnt";
  48. automount = "/etc/myenv/automount";
  49. extraswap = "/etc/myenv/mkzfsswap";
  50. autoreinstall = "/etc/myenv/autoreinstall";
  51. }; # shellAliases
  52. }; # environment
  53. systemd.services.sshd.enable = true;
  54. programs.mtr.enable = true;
  55. # this is the core, a simple script indeed
  56. systemd.services.mydeploy = {
  57. description = "Automation built after first test deploy";
  58. wantedBy = [ "multi-user.target" ];
  59. after = [ "getty.target" "nscd.service" "local-fs.target" ];
  60. serviceConfig = {
  61. Type="oneshot";
  62. RemainAfterExit="yes";
  63. StandardInput="tty-force";
  64. StandardOutput="inherit";
  65. StandardError="inherit";
  66. TTYReset="yes";
  67. TTYVHangup="yes";
  68. }; # serviceConfig
  69. path = [ "/run/current-system/sw" ];
  70. environment = config.nix.envVars // {
  71. inherit (config.environment.sessionVariables) NIX_PATH;
  72. HOME = "/root";
  73. };
  74. script = ''
  75. # do what you want, partitioning, with sgdisk + ...
  76. # mount + nixos-install etc
  77. ''; # script
  78. }; # mydeploy
  79. }