From 31da52f412ddc6b895cb0f0f63eaa023e851c4ec Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 7 Dec 2024 23:45:31 +0100 Subject: [PATCH] Allow configuriong `systemd-networkd` --- lib/modules/programs.nix | 3 +-- lib/modules/programs/systemd-networkd.nix | 24 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 lib/modules/programs/systemd-networkd.nix diff --git a/lib/modules/programs.nix b/lib/modules/programs.nix index cc33329e..2a6a1eba 100644 --- a/lib/modules/programs.nix +++ b/lib/modules/programs.nix @@ -65,7 +65,6 @@ let [ "plasma" "Plasma" ] [ "pyenv" "pyenv" ] [ "sddm" "SDDM" ] - [ "systemd-networkd" "systemd-networkd" ] [ "vim" "Vim" ] [ "virt-manager" "Virtual Machine Manager" ] [ "waydroid" "Waydroid" ] @@ -96,10 +95,10 @@ in ./programs/btrfs.nix ./programs/docker.nix ./programs/git.nix - ./programs/systemd-networkd.nix ./programs/nextcloud.nix ./programs/oh-my-posh.nix ./programs/rclone.nix + ./programs/systemd-networkd.nix ]; options = { diff --git a/lib/modules/programs/systemd-networkd.nix b/lib/modules/programs/systemd-networkd.nix new file mode 100644 index 00000000..e5a009b8 --- /dev/null +++ b/lib/modules/programs/systemd-networkd.nix @@ -0,0 +1,24 @@ +{ lib, ... }: +let + inherit (lib) mkEnableOption mkOption types; +in +{ + options = { + valhalla = { + linux.programs.systemd-networkd = { + enable = mkEnableOption "systemd-networkd"; + + networks = mkOption { + type = types.attrsOf types.attrs; + description = "The networks to configure."; + }; + + networkFiles = mkOption { + type = types.attrsOf types.str; + description = "The files for configuring the networks."; + default = builtins.mapAttrs (name: network: lib.generators.toINI { listsAsDuplicateKeys = true; } network); + }; + }; + }; + }; +}