NixOS system configurations + dotfiles via home-manager
1{
2 flake.modules.nixos.core =
3 { config, lib, ... }:
4 {
5 options.local.ethernetInterface = lib.mkOption {
6 default =
7 let
8 interfaces =
9 lib.attrByPath [ "hardware" "network_interface" ] [ ] config.hardware.facter.report
10 |> map (interface: interface.unix_device_names |> builtins.head)
11 |> builtins.filter (lib.hasPrefix "enp");
12 in
13 if interfaces == [ ] then "eth0" else builtins.head interfaces;
14 };
15 };
16}