diff --git a/system-nix/configuration.nix b/system-nix/configuration.nix index bb16293..3f202df 100755 --- a/system-nix/configuration.nix +++ b/system-nix/configuration.nix @@ -1,6 +1,9 @@ { lib, pkgs, config, modulesPath, specialArgs, ... }: let hostname = specialArgs.hostname; enableSSH = specialArgs.enableSSH or true; + networking = {hostName = hostname;} // (specialArgs.networking or {}); + boot = specialArgs.boot or {}; + services = specialArgs.services or {}; in with lib; { @@ -8,7 +11,9 @@ with lib; ./profiles/${hostname}/hardware-configuration.nix "${modulesPath}/profiles/minimal.nix" ]; - networking.hostName = hostname; + inherit networking; + inherit boot; + inherit services; system.stateVersion = "22.05"; # users.users..uid = 1000; @@ -19,19 +24,12 @@ with lib; nix.extraOptions = '' experimental-features = nix-command flakes ''; - # users.users.hungtr = { - # isNormalUser = true; - # home = "/home/hungtr"; - # description = "pegasust/hungtr"; - # extraGroups = [ "wheel" "networkmanager" ]; - # openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile ../ssh/authorized_keys); - # }; - - # Let's just open ssh server in general, even though it may not be - # network-accessible - services.openssh = { - permitRootLogin = "no"; - enable = enableSSH; + users.users.hungtr = { + isNormalUser = true; + home = "/home/hungtr"; + description = "pegasust/hungtr"; + extraGroups = [ "wheel" "networkmanager" ]; + openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile ../ssh/authorized_keys); }; # Some basic programs diff --git a/system-nix/flake.nix b/system-nix/flake.nix index 7e7d2f0..8c7d192 100644 --- a/system-nix/flake.nix +++ b/system-nix/flake.nix @@ -25,6 +25,21 @@ ]; specialArgs = { hostname = "lizzi"; + networking = { + interfaces.eth1.ipv4.addresses = [{ + address = "71.0.0.1"; + prefixLength = 24; + }]; + firewall.enable = false; + useDHCP = false; + interfaces.eth0.useDHCP = true; + }; + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + services.openssh = { + permitRootLogin = "no"; + enable = enableSSH; + }; }; }; nixosConfigurations.nyx = nixpkgs.lib.nixosSystem { @@ -34,6 +49,21 @@ ]; specialArgs = { hostname = "nyx"; + networking = { + interfaces.eth1.ipv4.addresses = [{ + address = "71.0.0.2"; + prefixLength = 24; + }]; + firewall.enable = false; + useDHCP = false; + interfaces.eth0.useDHCP = true; + }; + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + services.openssh = { + permitRootLogin = "no"; + enable = enableSSH; + }; }; }; nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { diff --git a/system-nix/profiles/nyx/hardware-configuration.nix b/system-nix/profiles/nyx/hardware-configuration.nix index e69de29..1d9e233 100644 --- a/system-nix/profiles/nyx/hardware-configuration.nix +++ b/system-nix/profiles/nyx/hardware-configuration.nix @@ -0,0 +1,42 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + boot.kernelParams = ["console=ttyS0,19200n8"]; + boot.loader.grub.extraConfig = '' + serial --speed19200 --unit=0 --word=8 --parity=no --stop=1 + terminal_input serial; + terminal_output serial; + ''; + boot.loader.grub.forceInstall = true; + boot.loader.grub.device = "nodev"; + boot.loader.timeout = 10; + fileSystems."/" = + { device = "/dev/sda"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/sdb"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}