add iso, change networking for fw
This commit is contained in:
@@ -1,9 +1,19 @@
|
|||||||
{ modulesPath, ... }:
|
{ modulesPath, ... }:
|
||||||
{
|
{
|
||||||
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.grub.device = "/dev/sda";
|
|
||||||
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "vmw_pvscsi" "xen_blkfront" ];
|
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "vmw_pvscsi" "xen_blkfront" ];
|
||||||
boot.initrd.kernelModules = [ "nvme" ];
|
boot.initrd.kernelModules = [ "nvme" ];
|
||||||
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
|
|
||||||
|
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-label/boot";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-partlabel/NIXOS";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
{ ... }: {
|
{ ... }: {
|
||||||
|
systemd.network.links."10-wan" = {
|
||||||
|
matchConfig.PermanentMACAddress = "a8:b8:e0:00:43:c1";
|
||||||
|
linkConfig.Name = "wan";
|
||||||
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
useDHCP = false;
|
useDHCP = false;
|
||||||
nameservers = [ "9.9.9.9" "149.112.112.112" ];
|
nameservers = [ "9.9.9.9" "149.112.112.112" ];
|
||||||
# Define VLANS
|
# Define VLANS
|
||||||
vlans = {
|
vlans = {
|
||||||
wan = {
|
|
||||||
id = 10;
|
|
||||||
interface = "enp1s0";
|
|
||||||
};
|
|
||||||
lan = {
|
lan = {
|
||||||
id = 1;
|
id = 1;
|
||||||
interface = "enp2s0";
|
interface = "enp3s0";
|
||||||
};
|
};
|
||||||
server = {
|
server = {
|
||||||
id = 2;
|
id = 2;
|
||||||
interface = "enp3s0";
|
interface = "enp4s0";
|
||||||
};
|
};
|
||||||
multimedia = {
|
multimedia = {
|
||||||
id = 3;
|
id = 3;
|
||||||
interface = "enp4s0";
|
interface = "enp5s0";
|
||||||
};
|
};
|
||||||
smart = {
|
smart = {
|
||||||
id = 4094;
|
id = 4094;
|
||||||
interface = "enp4s0";
|
interface = "enp5s0";
|
||||||
};
|
};
|
||||||
guest = {
|
guest = {
|
||||||
id = 100;
|
id = 100;
|
||||||
interface = "enp4s0";
|
interface = "enp5s0";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
interfaces = {
|
interfaces = {
|
||||||
# Don't request DHCP on the physical interfaces
|
# Don't request DHCP on the physical interfaces
|
||||||
enp1s0.useDHCP = false;
|
|
||||||
enp2s0.useDHCP = false;
|
|
||||||
enp3s0.useDHCP = false;
|
enp3s0.useDHCP = false;
|
||||||
enp4s0.useDHCP = false;
|
enp4s0.useDHCP = false;
|
||||||
|
enp5s0.useDHCP = false;
|
||||||
|
|
||||||
# Handle the VLANs
|
# Handle the VLANs
|
||||||
wan.useDHCP = true;
|
wan.useDHCP = true;
|
||||||
|
|||||||
54
iso/configuration.nix
Normal file
54
iso/configuration.nix
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{ config, lib, pkgs, ... }: {
|
||||||
|
imports = [
|
||||||
|
<nixpkgs/nixos/modules/profiles/all-hardware.nix>
|
||||||
|
<nixpkgs/nixos/modules/profiles/base.nix>
|
||||||
|
#installer-only ./hardware-configuration.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
zramSwap.enable = true;
|
||||||
|
services.logind.lidSwitch = "ignore";
|
||||||
|
|
||||||
|
security.sudo.wheelNeedsPassword = false;
|
||||||
|
|
||||||
|
networking.hostName = "install";
|
||||||
|
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.openssh.settings.PermitRootLogin = "yes";
|
||||||
|
|
||||||
|
users.mutableUsers = false;
|
||||||
|
users.users.root = {
|
||||||
|
# Password is "linux"
|
||||||
|
hashedPassword = lib.mkForce "$6$7IKExnDde920x.YH$ggegnnKJYdmg1Wt33fxuPpM.MmIaX32LXVyjL8ed7ohT385lKotFGzRpitncQ3pd9Lci1QCFGRn2tVJGxkFAm0";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.avahi = {
|
||||||
|
enable = true;
|
||||||
|
ipv4 = true;
|
||||||
|
ipv6 = true;
|
||||||
|
nssmdns = true;
|
||||||
|
publish = { enable = true; domain = true; addresses = true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
coreutils
|
||||||
|
curl
|
||||||
|
file
|
||||||
|
git
|
||||||
|
htop
|
||||||
|
lsof
|
||||||
|
nano
|
||||||
|
openssl
|
||||||
|
pciutils
|
||||||
|
pv
|
||||||
|
tmux
|
||||||
|
tree
|
||||||
|
unar
|
||||||
|
vim_configurable
|
||||||
|
wget
|
||||||
|
zip
|
||||||
|
];
|
||||||
|
|
||||||
|
system.stateVersion = "23.05"; # Did you read the comment?
|
||||||
|
}
|
||||||
84
iso/default.nix
Normal file
84
iso/default.nix
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
{
|
||||||
|
system ? "x86_64-linux",
|
||||||
|
}:
|
||||||
|
(import <nixpkgs/nixos/lib/eval-config.nix> {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
|
||||||
|
./configuration.nix
|
||||||
|
({ config, pkgs, lib, ... }: {
|
||||||
|
systemd.services.install = {
|
||||||
|
description = "Bootstrap a NixOS installation";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" "polkit.service" ];
|
||||||
|
path = [ "/run/current-system/sw/" ];
|
||||||
|
script = with pkgs; ''
|
||||||
|
echo 'journalctl -fb -n100 -uinstall' >>~nixos/.bash_history
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
wait-for() {
|
||||||
|
for _ in seq 10; do
|
||||||
|
if $@; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
dev=/dev/sda
|
||||||
|
[ -b /dev/nvme0n1 ] && dev=/dev/nvme0n1
|
||||||
|
[ -b /dev/vda ] && dev=/dev/vda
|
||||||
|
|
||||||
|
${utillinux}/bin/sfdisk --wipe=always $dev <<-END
|
||||||
|
label: gpt
|
||||||
|
|
||||||
|
name=BOOT, size=512MiB, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B
|
||||||
|
name=NIXOS
|
||||||
|
END
|
||||||
|
mkfs.fat -F 32 -n boot /dev/disk/by-partlabel/BOOT
|
||||||
|
|
||||||
|
sync
|
||||||
|
wait-for [ -b /dev/disk/by-partlabel/BOOT ]
|
||||||
|
|
||||||
|
wait-for mkfs.fat -F 32 -n boot /dev/disk/by-partlabel/BOOT
|
||||||
|
|
||||||
|
wait-for [ -b /dev/disk/by-partlabel/NIXOS ]
|
||||||
|
mkfs.ext4 -L nixos /dev/disk/by-partlabel/NIXOS
|
||||||
|
|
||||||
|
sync
|
||||||
|
mount /dev/disk/by-partlabel/NIXOS /mnt
|
||||||
|
|
||||||
|
mkdir /mnt/boot
|
||||||
|
wait-for mount /dev/disk/by-label/boot /mnt/boot
|
||||||
|
|
||||||
|
install -D ${./configuration.nix} /mnt/etc/nixos/configuration.nix
|
||||||
|
install -D ${./hardware-configuration.nix} /mnt/etc/nixos/hardware-configuration.nix
|
||||||
|
|
||||||
|
sed -i -E 's/(\w*)#installer-only /\1/' /mnt/etc/nixos/*
|
||||||
|
|
||||||
|
${config.system.build.nixos-install}/bin/nixos-install \
|
||||||
|
--system ${(import <nixpkgs/nixos/lib/eval-config.nix> {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
./configuration.nix
|
||||||
|
./hardware-configuration.nix
|
||||||
|
];
|
||||||
|
}).config.system.build.toplevel} \
|
||||||
|
--no-root-passwd \
|
||||||
|
--cores 0
|
||||||
|
|
||||||
|
echo 'Shutting off in 1min'
|
||||||
|
${systemd}/bin/shutdown +1
|
||||||
|
'';
|
||||||
|
environment = config.nix.envVars // {
|
||||||
|
inherit (config.environment.sessionVariables) NIX_PATH;
|
||||||
|
HOME = "/root";
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}).config.system.build.isoImage
|
||||||
13
iso/hardware-configuration.nix
Normal file
13
iso/hardware-configuration.nix
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{ config, pkgs, ... }: {
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-label/boot";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-partlabel/NIXOS";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
}
|
||||||
1
iso/result
Symbolic link
1
iso/result
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/nix/store/awr76nk2v9gambbksl4lj2z1f30b595i-nixos-23.05.4974.d2e4de209881-x86_64-linux.iso
|
||||||
Reference in New Issue
Block a user