init minipc
This commit is contained in:
@@ -34,6 +34,12 @@
|
||||
custom = {
|
||||
cli-tools.enable = true;
|
||||
tmpfs.enable = true;
|
||||
static-ip = {
|
||||
enable = true;
|
||||
interface = "enp0s31f6";
|
||||
ip = "192.168.0.6";
|
||||
dns = "127.0.0.1";
|
||||
};
|
||||
nix = {
|
||||
settings.enable = true;
|
||||
};
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
./nftables.nix
|
||||
./cli-tools.nix
|
||||
./tmpfs.nix
|
||||
./static-ip.nix
|
||||
];
|
||||
}
|
||||
|
||||
41
modules/misc/static-ip.nix
Normal file
41
modules/misc/static-ip.nix
Normal file
@@ -0,0 +1,41 @@
|
||||
{config, lib, ...}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.custom.static-ip;
|
||||
in
|
||||
{
|
||||
options.custom.static-ip = {
|
||||
enable = mkEnableOption "Enables static-ip";
|
||||
ip = lib.mkOption {
|
||||
type = types.str;
|
||||
description = "ipv4 address";
|
||||
};
|
||||
dns = lib.mkOption {
|
||||
default = types.str;
|
||||
description = "ip of the dns server";
|
||||
};
|
||||
interface = lib.mkOption {
|
||||
default = types.str;
|
||||
description = "interface to apply the change to";
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
networking = {
|
||||
defaultGateway = "192.168.0.1";
|
||||
useDHCP = false;
|
||||
nameservers = [
|
||||
cfg.dns
|
||||
"1.1.1.1"
|
||||
];
|
||||
interfaces = {
|
||||
${cfg.interface} = {
|
||||
name = "eth0";
|
||||
ipv4.addresses = [{
|
||||
address = cfg.ip;
|
||||
prefixLength = 24;
|
||||
}];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
{ config, vars, ...}:
|
||||
let
|
||||
ip = vars.ipv4;
|
||||
dns = vars.dns;
|
||||
interface = vars.interface;
|
||||
in
|
||||
{
|
||||
networking = {
|
||||
defaultGateway = "192.168.0.1";
|
||||
useDHCP = false;
|
||||
nameservers = [
|
||||
dns
|
||||
"1.1.1.1"
|
||||
];
|
||||
interfaces = {
|
||||
${interface} = {
|
||||
name = "eth0";
|
||||
ipv4.addresses = [{
|
||||
address = ip;
|
||||
prefixLength = 24;
|
||||
}];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user