initial commit
Some checks failed
Nix CI / build (push) Failing after 31s

This commit is contained in:
Rustam Efimov 2026-04-01 08:50:01 +03:00
commit 30ce0dafc2
No known key found for this signature in database
195 changed files with 8902 additions and 0 deletions

View file

@ -0,0 +1,6 @@
{
imports = [
./options.nix
./service.nix
];
}

View file

@ -0,0 +1,17 @@
{ lib, ... }:
with lib;
{
options.machine = {
gateway = mkOption {
type = types.nullOr types.str;
default = null;
description = "Default network gateway";
};
ipv4 = mkOption {
type = types.nullOr types.str;
default = null;
description = "Main IPv4 address";
};
};
}

View file

@ -0,0 +1,32 @@
{ config, lib, hostname, ... }:
let
inherit (config.machine) ipv4 gateway;
in
with lib; {
networking = {
hostName = hostname;
networkmanager.enable = mkDefault true;
firewall = {
enable = true;
allowPing = true;
};
nameservers = [
"1.1.1.1"
"1.0.0.1"
"9.9.9.9"
"8.8.8.8"
];
interfaces.ens3 = mkIf (ipv4 != null) {
ipv4.addresses = [
{
address = ipv4;
prefixLength = 32;
}
];
};
defaultGateway = mkIf (gateway != null) {
address = gateway;
interface = "ens3";
};
};
}