Updated networking for sampledb and media

This commit is contained in:
Random936 2024-10-31 13:23:46 -07:00
parent 0b5337ec0f
commit 1ce83d0f37
5 changed files with 53 additions and 37 deletions

View File

@ -3,22 +3,13 @@
imports = [
../hardware/media.nix
./headless.nix
(import ./networking.nix {
hostname = "sampledb-dev";
ip_address = "192.168.100.40";
})
];
users.users.media = import ./user.nix;
networking.hostName = "r330-media";
# Conigure a static IP address.
networking.defaultGateway = "192.168.100.1";
networking.nameservers = [ "192.168.100.1" ];
networking.firewall.allowedTCPPorts = [ 80 443 32400 ];
networking.interfaces.enp6s18.ipv4.addresses = [
{
address = "192.168.100.40";
prefixLength = 24;
}
];
# Setup drivers for NVIDIA GPU
services.xserver = {

23
config/networking.nix Normal file
View File

@ -0,0 +1,23 @@
{ ip_address, hostname }:
{
# Configure hostname.
networking.hostName = hostname;
# Conigure a static IP address.
networking.useDHCP = false;
networking.useNetworkd= true;
networking.defaultGateway = {
address = ip_address;
interface = "enp6s18";
};
networking.nameservers = [ "192.168.100.1" ];
networking.firewall.allowedTCPPorts = [ 80 443 ];
networking.interfaces.enp6s18.ipv4.addresses = [
{
address = ip_address;
prefixLength = 24;
}
];
}

View File

@ -3,19 +3,11 @@
imports = [
../hardware/sampledb.nix
./headless.nix
(import ./networking.nix {
hostname = "sampledb-dev";
ip_address = "192.168.100.42";
})
];
users.users.sampledb = import ./user.nix;
networking.hostName = "sampledb-dev";
# Conigure a static IP address.
networking.defaultGateway = "192.168.100.1";
networking.nameservers = [ "192.168.100.1" ];
networking.firewall.allowedTCPPorts = [ 80 443 32400 ];
networking.interfaces.ens18.ipv4.addresses = [
{
address = "192.168.100.42";
prefixLength = 24;
}
];
}

View File

@ -8,20 +8,21 @@
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/bc530c66-1e41-4c32-9ea0-e9e644677300";
fsType = "ext4";
};
fileSystems."/" =
{ device = "/dev/disk/by-uuid/8d1d0298-307f-4d9a-84f8-0434fafa0c55";
fsType = "ext4";
};
fileSystems."/mnt/sampledb" = {
device = "/dev/disk/by-uuid/9d0bc50c-7382-4085-a3ea-5bc0fb52c1f8";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/4821-12F7";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
@ -30,7 +31,7 @@
# 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.ens18.useDHCP = lib.mkDefault true;
# networking.interfaces.enp6s18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View File

@ -1,14 +1,23 @@
#!/usr/bin/env bash
STATE_VERSION="24.05"
STATE_VERSION="$1"
if [ $(id -u) != 0 ]; then
echo "This script must be run as root."
exit
fi
if [[ $1 == "" ]]; then
echo "Usage: $0 <STATE_VERSION|unstable>"
exit
fi
echo "Adding home-manager:${STATE_VERSION} to nix channels..."
nix-channel --add "https://github.com/nix-community/home-manager/archive/release-${STATE_VERSION}.tar.gz" home-manager
if [[ $STATE_VERSION == "unstable" ]]; then
nix-channel --add "https://github.com/nix-community/home-manager/archive/master.tar.gz" home-manager
else
nix-channel --add "https://github.com/nix-community/home-manager/archive/release-${STATE_VERSION}.tar.gz" home-manager
fi
echo "Updating nix channels..."
nix-channel --update