mirror of
https://codeberg.org/jopejoe1/nix-conf.git
synced 2025-01-01 16:26:51 +01:00
use systemd network
This commit is contained in:
parent
b0f7166e12
commit
ce98dc1481
2 changed files with 65 additions and 14 deletions
|
@ -18,13 +18,11 @@ in {
|
||||||
|
|
||||||
systemd.services."moodle-dl" = {
|
systemd.services."moodle-dl" = {
|
||||||
script = ''
|
script = ''
|
||||||
${lib.getExe pkgs.moodle-dl} --path /var/moodle-dl
|
moodle-dl --path /var/lib/moodle-dl
|
||||||
${lib.getExe pkgs.git} -C /var/moodle-dl add .
|
git -C /var/lib/moodle-dl add .
|
||||||
${
|
git -C /var/lib/moodle-dl commit -m "moodle-dl updated on `$(date)`"
|
||||||
lib.getExe pkgs.git
|
|
||||||
} -C /var/moodle-dl commit -m "moodle-dl updated on `$(${pkgs.coreutils}/bin/date)`"
|
|
||||||
'';
|
'';
|
||||||
path = [ pkgs.openssh ];
|
path = with pkgs; [ openssh moodle-dl git coreutils ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = "root";
|
User = "root";
|
||||||
|
|
|
@ -24,6 +24,67 @@
|
||||||
|
|
||||||
zramSwap.enable = true;
|
zramSwap.enable = true;
|
||||||
|
|
||||||
|
boot.kernel.sysctl = {
|
||||||
|
"net.ipv4.ip_forward" = "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.dnsmasq = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
interface = [ "enp6s0" ];
|
||||||
|
dhcp-range = [ "10.0.0.2,10.0.0.255,255.255.255.0,24h" ];
|
||||||
|
listen-address = "10.0.0.1";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
wireless = {
|
||||||
|
enable = true;
|
||||||
|
networks = {
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
firewall = {
|
||||||
|
allowedUDPPorts = [ 53 ];
|
||||||
|
allowedTCPPorts = [ 53 ];
|
||||||
|
};
|
||||||
|
nameservers = [ "2a07:a8c0::fe:e334" "2a07:a8c1::fe:e334" ];
|
||||||
|
useDHCP = lib.mkDefault true;
|
||||||
|
dhcpcd.extraConfig = "nohook resolv.conf";
|
||||||
|
networkmanager.enable = lib.mkForce false;
|
||||||
|
nftables = {
|
||||||
|
enable = true;
|
||||||
|
ruleset = ''
|
||||||
|
table ip nat {
|
||||||
|
chain postrouting {
|
||||||
|
type nat hook postrouting priority 100;
|
||||||
|
oifname "wlo1" masquerade
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.network = {
|
||||||
|
enable = true;
|
||||||
|
networks = {
|
||||||
|
# Connect the bridge ports to the bridge
|
||||||
|
"30-enp6s0" = {
|
||||||
|
matchConfig.Name = "enp6s0";
|
||||||
|
networkConfig = {
|
||||||
|
Address = "10.0.0.1/24";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"30-wlo1" = {
|
||||||
|
matchConfig.Name = "wlo1";
|
||||||
|
networkConfig = {
|
||||||
|
DHCP = "yes";
|
||||||
|
IgnoreCarrierLoss = "3s";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
fileSystems = {
|
fileSystems = {
|
||||||
"/" = {
|
"/" = {
|
||||||
device = "/dev/disk/by-uuid/ec151a68-5886-4747-b5e3-2f9bdb89e162";
|
device = "/dev/disk/by-uuid/ec151a68-5886-4747-b5e3-2f9bdb89e162";
|
||||||
|
@ -43,14 +104,6 @@
|
||||||
|
|
||||||
swapDevices = [ ];
|
swapDevices = [ ];
|
||||||
|
|
||||||
# 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.enp6s0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
#nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
#nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
|
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
|
Loading…
Reference in a new issue