From 8eb7ef0be709f97bb51faf50443ecd266df29371 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Tue, 18 Jul 2023 02:00:38 +0000 Subject: [PATCH] fix avahi and dhcp, mark swan as physical --- modules/nixos/hardware/boot.nix | 2 +- modules/nixos/hardware/networking.nix | 7 +------ modules/nixos/hardware/server.nix | 4 ++-- modules/nixos/hardware/sleep.nix | 2 +- modules/nixos/hardware/zfs.nix | 30 +++++++++++++-------------- 5 files changed, 19 insertions(+), 26 deletions(-) diff --git a/modules/nixos/hardware/boot.nix b/modules/nixos/hardware/boot.nix index 34733f3..0d045fb 100644 --- a/modules/nixos/hardware/boot.nix +++ b/modules/nixos/hardware/boot.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, ... }: { - boot.loader = lib.mkIf config.physical { + boot.loader = lib.mkIf (config.physical && !config.server) { grub = { enable = true; diff --git a/modules/nixos/hardware/networking.nix b/modules/nixos/hardware/networking.nix index e78040d..d0daed2 100644 --- a/modules/nixos/hardware/networking.nix +++ b/modules/nixos/hardware/networking.nix @@ -2,12 +2,7 @@ config = lib.mkIf config.physical { - # The global useDHCP flag is deprecated, therefore explicitly set to false here. - # Per-interface useDHCP will be mandatory in the future, so this generated config - # replicates the default behaviour. - networking.useDHCP = false; - networking.interfaces.enp5s0.useDHCP = true; - networking.interfaces.wlp4s0.useDHCP = true; + networking.useDHCP = true; networking.firewall.allowPing = lib.mkIf config.server true; diff --git a/modules/nixos/hardware/server.nix b/modules/nixos/hardware/server.nix index 67ea035..fee76cd 100644 --- a/modules/nixos/hardware/server.nix +++ b/modules/nixos/hardware/server.nix @@ -1,6 +1,6 @@ -{ config, pkgs, lib, ... }: { +{ config, lib, ... }: { - config = lib.mkIf (pkgs.stdenv.isLinux && config.server) { + config = lib.mkIf config.server { # Servers need a bootloader or they won't start boot.loader.systemd-boot.enable = true; diff --git a/modules/nixos/hardware/sleep.nix b/modules/nixos/hardware/sleep.nix index 342aa80..6821549 100644 --- a/modules/nixos/hardware/sleep.nix +++ b/modules/nixos/hardware/sleep.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, ... }: { - config = lib.mkIf config.physical { + config = lib.mkIf (config.physical && !config.server) { # Prevent wake from keyboard powerManagement.powerDownCommands = '' diff --git a/modules/nixos/hardware/zfs.nix b/modules/nixos/hardware/zfs.nix index e250d20..243c79c 100644 --- a/modules/nixos/hardware/zfs.nix +++ b/modules/nixos/hardware/zfs.nix @@ -1,23 +1,21 @@ -{ config, pkgs, lib, ... }: { +{ config, lib, ... }: { options = { zfs.enable = lib.mkEnableOption "ZFS file system."; }; - config = - lib.mkIf (pkgs.stdenv.isLinux && config.server && config.zfs.enable) { + config = lib.mkIf (config.server && config.zfs.enable) { - # Only use compatible Linux kernel, since ZFS can be behind - boot.kernelPackages = - config.boot.zfs.package.latestCompatibleLinuxPackages; - boot.kernelParams = [ "nohibernate" ]; - boot.supportedFilesystems = [ "zfs" ]; - services.prometheus.exporters.zfs.enable = - config.prometheus.exporters.enable; - prometheus.scrapeTargets = [ - "127.0.0.1:${ - builtins.toString config.services.prometheus.exporters.zfs.port - }" - ]; + # Only use compatible Linux kernel, since ZFS can be behind + boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + boot.kernelParams = [ "nohibernate" ]; + boot.supportedFilesystems = [ "zfs" ]; + services.prometheus.exporters.zfs.enable = + config.prometheus.exporters.enable; + prometheus.scrapeTargets = [ + "127.0.0.1:${ + builtins.toString config.services.prometheus.exporters.zfs.port + }" + ]; - }; + }; }