No description
| checks | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| module.nix | ||
| package.nix | ||
| README.md | ||
IfState.nix
Nix Module for IfState.
Usage
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
ifstate = {
url = "git+https://codeberg.org/m4rc3l/ifstate.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, ifstate, ... }: {
nixosConfigurations = {
hostname = nixpkgs.lib.nixosSystem {
modules = [
ifstate.nixosModules.default
];
};
};
};
}
Example interface configuration. See the Json Schema for deails.
networking.ifstate = {
enable = true;
settings = {
interfaces = [{
name = "eth0";
addresses = [ "10.44.1.2/24" "fd44:1::2/64" ];
link = {
state = "up";
kind = "physical";
address = "2e:28:00:60:c2:1b";
};
}];
routing.routes = [
{ to = "0.0.0.0/0"; via = "10.44.1.1"; }
{ to = "fd44::/16"; via = "fd44:1::1"; }
];
};
};
initrd
- Don't forget to configure the necessary networking kernel modules.
- IfState in initrd has colored output and WireGuard support disabled by default. Use
networking.ifstate.initrd.packageto modify this behavior.
networking.ifstate = {
# ifstate automatly reuses the configuration declared above
initrd.enable = true;
# use different configuration in initrd
# initrd.settings = { ... };
};
boot.initrd.network = {
# needed, otherwiese ssh.enable gets ignored
enable = true;
# configure ssh daemon for initrd
ssh = {
enable = true;
hostKeys = [ /etc/ssh/ssh_host_ed25519_key ];
authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK255EY8KUx5cMXSuoERXJSzVnkDUM+y8sMAVrRoDBnn marcel" ];
};
# example for zfs remote decryption
postCommands = ''
zpool import -a
echo "zfs load-key -a; killall zfs" >> /root/.profile
'';
};