- {config, lib, pkgs, ...}:
- {
- imports = [
- <nixpkgs/nixos/modules/installer/cd-dvd/iso-image.nix>
- <nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
- <nixpkgs/nixos/modules/installer/tools/tools.nix>
- <nixpkgs/nixos/modules/profiles/all-hardware.nix>
- <nixpkgs/nixos/modules/profiles/base.nix>
- <nixpkgs/nixos/modules/profiles/installation-device.nix>
- ./your_extras_if_any.nix
- ];
- system.stateVersion = "21.11";
- isoImage.isoBaseName = "YourOwnIsoName";
- isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.iso";
- isoImage.makeEfiBootable = true;
- isoImage.makeUsbBootable = true;
- isoImage.volumeID = "AsYouWishNamedInVolLive";
- boot.supportedFilesystems = [ "zfs" ];
- hardware = {
- enableRedistributableFirmware = true;
- cpu.intel.updateMicrocode = true;
- cpu.amd.updateMicrocode = true;
- }; # hardware
- networking = {
- wireless.enable = false;
- networkmanager = {
- enable = true;
- insertNameservers = [
- "91.239.100.100" # Censurfri
- "193.183.98.66" # OpenNIC 1
- "87.98.175.85" # OpenNIC 2
- "9.9.9.9" # IBM Quad9
- "8.8.4.4" # Google secondary
- "208.67.222.222" # Cisco OpenDNS primary
- ];
- }; # networkmanager
- }; # networking
- environment = {
- systemPackages = with pkgs; [
- avahi bind unwrapped
- ...
- ]; # systemPackages
- shellAliases = {
- sysup = "sudo nixos-rebuild switch --upgrade && nix-env -u";
- sysclean = "sudo nix-collect-garbage -d ; sudo nix-store --gc; sudo nix-store --optimize";
- ne = "sudo nixos-enter --root /mnt";
- ni = "sudo nixos-install --root /mnt";
- automount = "/etc/myenv/automount";
- extraswap = "/etc/myenv/mkzfsswap";
- autoreinstall = "/etc/myenv/autoreinstall";
- }; # shellAliases
- }; # environment
- systemd.services.sshd.enable = true;
- programs.mtr.enable = true;
- # this is the core, a simple script indeed
- systemd.services.mydeploy = {
- description = "Automation built after first test deploy";
- wantedBy = [ "multi-user.target" ];
- after = [ "getty.target" "nscd.service" "local-fs.target" ];
- serviceConfig = {
- Type="oneshot";
- RemainAfterExit="yes";
- StandardInput="tty-force";
- StandardOutput="inherit";
- StandardError="inherit";
- TTYReset="yes";
- TTYVHangup="yes";
- }; # serviceConfig
- path = [ "/run/current-system/sw" ];
- environment = config.nix.envVars // {
- inherit (config.environment.sessionVariables) NIX_PATH;
- HOME = "/root";
- };
- script = ''
- # do what you want, partitioning, with sgdisk + ...
- # mount + nixos-install etc
- ''; # script
- }; # mydeploy
- }