Compare commits

...

6 commits

8 changed files with 91 additions and 2 deletions

View file

@ -57,6 +57,7 @@ let
[ "logo-ls" "logo-ls" ]
[ "lutris" "Lutris" ]
[ "minegrub-theme" "Minegrub Theme" ]
[ "networkmanager" "NetworkManager" ]
[ "nginx" "nginx" ]
[ "nodejs-n" "n" ]
[ "nuke-usb" "nuke-usb" ]
@ -97,6 +98,7 @@ in
./programs/nextcloud.nix
./programs/oh-my-posh.nix
./programs/rclone.nix
./programs/systemd-networkd.nix
];
options = {

View file

@ -0,0 +1,26 @@
{ lib, config, ... }:
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)
config.valhalla.linux.programs.systemd-networkd.networks;
};
};
};
};
}

View file

@ -114,6 +114,7 @@ in {
"vim"
])) // (optionalAttrs desktopExperience (mkPrograms [
"icedtea"
"networkmanager"
"plasma"
"sddm"
"waydroid"

View file

@ -70,6 +70,33 @@ in {
linux.programs = {
grub.enable = true;
systemd-networkd = {
enable = true;
networks =
let device = "enp0s31f6";
in {
${device} = {
Match = {
Name = device;
};
Network = {
Address = "2a01:4f8:10b:2644::2/64";
Gateway = [
"94.130.48.193"
"fe80::1"
];
};
Address = {
Address = "94.130.48.251";
Peer = "94.130.48.193/32";
};
};
};
};
docker = {
services = {
anki-sync.enable = true;

View file

@ -36,7 +36,6 @@ begin
base \
linux \
linux-firmware \
networkmanager \
man-db \
man-pages \
texinfo
@ -63,7 +62,11 @@ begin
end
and genfstab -U "$mountDir" >>"$mountDir/etc/fstab"
and arch-chroot "$mountDir" systemctl enable NetworkManager
and if isProgramEnabled "networkmanager"
and pacstrap -K "$mountDir" networkmanager
arch-chroot "$mountDir" systemctl enable NetworkManager
end
and if set -q timezone
arch-chroot "$mountDir" ln -sf "/usr/share/zoneinfo/$timezone" /etc/localtime

View file

@ -0,0 +1,13 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../../lib/software.fish"
inherit "$dir/../../../Common/Software/systemd-networkd/main.fish"
function configureSW -V dir
systemctl enable systemd-networkd
configureSWBase $argv
end
runInstaller $argv
end

View file

@ -71,6 +71,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action
end
and source "$dir/../../Common/Software/bash/main.fish" $argv
and source "$dir/../Software/systemd-networkd/main.fish" $argv
and source "$dir/../Software/btrfs/main.fish" $argv
and source "$dir/../../Common/Software/nuke-usb/main.fish" $argv
and source "$dir/../Software/sudo/main.fish" $argv

View file

@ -0,0 +1,16 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../../lib/software.fish"
function configureSW -V dir
source "$dir/../../../lib/settings.fish"
set config (getProgramConfig $argv --json)
for name in (echo "$config" | jq '.networkFiles | keys[]' --raw-output0 | string split0 || true)
echo "$config" | NAME=$name jq '.networkFiles[env.NAME]' | sudo tee "/etc/systemd/network/10-$name.network" >/dev/null
end
end
runInstaller $argv
end