add nyx config

nix-components
pegasust 2022-11-14 22:10:46 +00:00
parent 142152e7c0
commit 3dd94f71b5
3 changed files with 84 additions and 14 deletions

View File

@ -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.<defaultUser>.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

View File

@ -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 {

View File

@ -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.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s5.useDHCP = lib.mkDefault true;
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}