Add wake online
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
lanIface = "enp5s0";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
#../ai.nix
|
||||
@@ -10,10 +13,12 @@
|
||||
../k8s.nix
|
||||
../libvirt.nix
|
||||
../openfortivpn.nix
|
||||
../options.nix
|
||||
../packages.nix
|
||||
../sops-desktop.nix
|
||||
../ssh.nix
|
||||
../sshd.nix
|
||||
../sudo-nopasswd.nix
|
||||
../wakeonlan.nix
|
||||
|
||||
### Import GUI modules
|
||||
../desktop/code.nix
|
||||
@@ -31,6 +36,8 @@
|
||||
../desktop/nvidia.nix
|
||||
];
|
||||
|
||||
my.lanInterface = "enp5s0";
|
||||
|
||||
sops = {
|
||||
secrets = {
|
||||
"wireguard_home/publickey" = { };
|
||||
@@ -44,7 +51,7 @@
|
||||
networking = {
|
||||
#useNetworkd = true;
|
||||
#useHostResolvConf = false;
|
||||
interfaces.enp5s0 = {
|
||||
interfaces.${config.my.lanInterface} = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.0.2";
|
||||
@@ -54,7 +61,7 @@
|
||||
};
|
||||
defaultGateway = {
|
||||
address = "192.168.0.254";
|
||||
interface = "enp5s0";
|
||||
interface = "${config.my.lanInterface}";
|
||||
};
|
||||
nameservers = [
|
||||
#"9.9.9.9"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
../openfortivpn.nix
|
||||
../packages.nix
|
||||
../sops-desktop.nix
|
||||
../ssh.nix
|
||||
../sshd.nix
|
||||
../sudo-nopasswd.nix
|
||||
|
||||
### Import GUI modules
|
||||
@@ -36,7 +36,7 @@
|
||||
carto-interavtive 172.18.20.134
|
||||
'';
|
||||
};
|
||||
users.users.${username} = {
|
||||
users.users.${username} = {
|
||||
extraGroups = [ "networkmanager" ];
|
||||
};
|
||||
programs.nm-applet.enable = true;
|
||||
|
||||
10
modules/optionnals/options.nix
Normal file
10
modules/optionnals/options.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.my.lanInterface = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "enp5s0";
|
||||
};
|
||||
}
|
||||
32
modules/optionnals/wakeonlan.nix
Normal file
32
modules/optionnals/wakeonlan.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
hostname,
|
||||
...
|
||||
}:
|
||||
{
|
||||
systemd.services."wol@$${config.my.lanInterface}" = {
|
||||
description = "Wake-on-LAN for ${config.my.lanInterface}";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.ethtool}/bin/ethtool -s ${config.my.lanInterface} wol g";
|
||||
RandomizedDelaySec = "30s";
|
||||
};
|
||||
};
|
||||
environment.systemPackages = [ pkgs.ethtool ];
|
||||
|
||||
boot.initrd.network = {
|
||||
enable = true;
|
||||
ssh = {
|
||||
enable = true;
|
||||
port = 2222;
|
||||
authorizedKeys = [ "ssh-ed25519 AAAA..." ]; # ta clé publique
|
||||
hostKeys = [ "/etc/secrets/initrd/ssh_host_ed25519_key" ];
|
||||
};
|
||||
};
|
||||
boot.kernelParams = [
|
||||
"ip=192.168.0.2::192.168.0.254:255.255.255.0:${hostname}:${config.my.lanInterface}:off"
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user