mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 14:50:40 +02:00
feat: move modules/interface-naming.nix -> nixos-extra-modules
This commit is contained in:
parent
61375199e5
commit
aa9ba64bff
5 changed files with 200 additions and 96 deletions
229
flake.lock
generated
229
flake.lock
generated
|
@ -27,11 +27,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701216516,
|
||||
"narHash": "sha256-jKSeJn+7hZ1dZdiH1L+NWUGT2i/BGomKAJ54B9kT06Q=",
|
||||
"lastModified": 1703107199,
|
||||
"narHash": "sha256-Xx9Kkoqye520mkEWTZx/sKQRJsIeWOuwoh568uwHpNg=",
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"rev": "13ac9ac6d68b9a0896e3d43a082947233189e247",
|
||||
"rev": "17090d105af1b9f941109c1e12d6e3a596657f97",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -327,6 +327,28 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"devshell_3": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"extra-modules",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems_5"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701787589,
|
||||
"narHash": "sha256-ce+oQR4Zq9VOsLoh9bZT8Ip9PaMLcjjBUHVPzW5d7Cw=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "44ddedcbcfc2d52a76b64fb6122f209881bd3e1e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"disko": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -334,11 +356,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703063214,
|
||||
"narHash": "sha256-OgrRZKb7IkSSlIshUDaD7plxe0xIQauMA1y+OirtEWo=",
|
||||
"lastModified": 1703162528,
|
||||
"narHash": "sha256-pQ41wN6JlStkZOhRTIHEpuwVywLdh+xzZQW1+FzdjVs=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "b4104fcaea42037b04c199a5d6784682a15be254",
|
||||
"rev": "a050895e4eb06e0738680021a701ea05dc8dbfc9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -371,6 +393,31 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"extra-modules": {
|
||||
"inputs": {
|
||||
"devshell": "devshell_3",
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"pre-commit-hooks": "pre-commit-hooks_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703205251,
|
||||
"narHash": "sha256-V8Uxy/g6WRn+ISgBHjs0IY9ZGqjovguNp2FZ2aL+Oqg=",
|
||||
"owner": "oddlama",
|
||||
"repo": "nixos-extra-modules",
|
||||
"rev": "42374eff1f3ca895d631789e38c04f3f10318abb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oddlama",
|
||||
"repo": "nixos-extra-modules",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -420,21 +467,6 @@
|
|||
}
|
||||
},
|
||||
"flake-compat_4": {
|
||||
"locked": {
|
||||
"lastModified": 1688025799,
|
||||
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "flake-compat",
|
||||
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_5": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
|
@ -450,6 +482,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_5": {
|
||||
"locked": {
|
||||
"lastModified": 1688025799,
|
||||
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "flake-compat",
|
||||
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_6": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -466,6 +513,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_7": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
|
@ -526,7 +589,7 @@
|
|||
},
|
||||
"flake-utils_3": {
|
||||
"inputs": {
|
||||
"systems": "systems_5"
|
||||
"systems": "systems_6"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701680307,
|
||||
|
@ -544,7 +607,7 @@
|
|||
},
|
||||
"flake-utils_4": {
|
||||
"inputs": {
|
||||
"systems": "systems_6"
|
||||
"systems": "systems_7"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701680307,
|
||||
|
@ -637,6 +700,28 @@
|
|||
}
|
||||
},
|
||||
"gitignore_3": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"extra-modules",
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore_4": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"pre-commit-hooks",
|
||||
|
@ -664,11 +749,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703026685,
|
||||
"narHash": "sha256-AkualfMbc40HkDR2AZc6u71pcap50wDQOXFCY1ULDUA=",
|
||||
"lastModified": 1703178811,
|
||||
"narHash": "sha256-Orbqa8DvszYZ38XGWAs43hVs++czt2N6/Y0sFRLhJms=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "efc177c15f2a8bb063aeb250fe3c7c21e1de265e",
|
||||
"rev": "fb5ac0c870a1b3ffea70e02ab1720d991ce812ae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -734,11 +819,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703033270,
|
||||
"narHash": "sha256-W4vAVJgQVglR2WdXB4ZVN9qn0kgl9iNvy8HSZ68cV0s=",
|
||||
"lastModified": 1703095240,
|
||||
"narHash": "sha256-n/oeDYcJmmrC5F13qHZHGoFr2LfGIgcGz+bmApSApF0=",
|
||||
"owner": "astro",
|
||||
"repo": "microvm.nix",
|
||||
"rev": "736d43ae8552653ea8ad51fc8c79288668c866a5",
|
||||
"rev": "7bd9255e535c8cbada7f574ddd3bcf3bfa5e1eae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -961,9 +1046,25 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable_4": {
|
||||
"locked": {
|
||||
"lastModified": 1685801374,
|
||||
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-wayland": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_4",
|
||||
"flake-compat": "flake-compat_5",
|
||||
"lib-aggregate": "lib-aggregate",
|
||||
"nix-eval-jobs": "nix-eval-jobs",
|
||||
"nixpkgs": [
|
||||
|
@ -971,11 +1072,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703076155,
|
||||
"narHash": "sha256-SqoimzG67m97Izasi/PTEOjHIWavrZ307e4an15eh3o=",
|
||||
"lastModified": 1703193381,
|
||||
"narHash": "sha256-ene7BogLot9jn/xTAP2W1hm8HxPAmW1j0LsSbsraTdI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs-wayland",
|
||||
"rev": "17e912d76aa7bed31778f6ee7bd8baf98e1f6008",
|
||||
"rev": "8e05204779246147cdcf501ac97e63ee19d6eba7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1010,11 +1111,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701000000,
|
||||
"narHash": "sha256-YclZV0n36KnkEZNcHxWqmuhdBa6eB8Wdmwcf5EMYEp4=",
|
||||
"lastModified": 1703073600,
|
||||
"narHash": "sha256-XSEHNoc3h21foVeR28KgfiBTRHyUh+GJ52LMD2xFHfA=",
|
||||
"owner": "symphorien",
|
||||
"repo": "nixseparatedebuginfod",
|
||||
"rev": "c8e79d5b228b71686172ff6626394bed2ad7b7a3",
|
||||
"rev": "c64424332b6198ed1411917232a2b0e3794dd09b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1036,11 +1137,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1702895385,
|
||||
"narHash": "sha256-xCfbHlBEPbjpecbhd9zJ79xyI9pURW9/BsY75DNIfs4=",
|
||||
"lastModified": 1703185304,
|
||||
"narHash": "sha256-CKsV786NBB8fuls4vyKGTfOz9bkpAn2lh8PKL8YLZ+M=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "309e5644fc72ce82b31da5290638019f60a0a84b",
|
||||
"rev": "43d20e833267ffd026af692060fb344960930fe1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1107,12 +1208,14 @@
|
|||
},
|
||||
"pre-commit-hooks_3": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_5",
|
||||
"flake-compat": "flake-compat_4",
|
||||
"flake-utils": [
|
||||
"extra-modules",
|
||||
"flake-utils"
|
||||
],
|
||||
"gitignore": "gitignore_3",
|
||||
"nixpkgs": [
|
||||
"extra-modules",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable_3"
|
||||
|
@ -1131,6 +1234,32 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks_4": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_6",
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"gitignore": "gitignore_4",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1702456155,
|
||||
"narHash": "sha256-I2XhXGAecdGlqi6hPWYT83AQtMgL+aa3ulA85RAEgOk=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "007a45d064c1c32d04e1b8a0de5ef00984c419bc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
|
@ -1138,6 +1267,7 @@
|
|||
"devshell": "devshell_2",
|
||||
"disko": "disko",
|
||||
"elewrap": "elewrap",
|
||||
"extra-modules": "extra-modules",
|
||||
"flake-utils": "flake-utils_3",
|
||||
"home-manager": "home-manager",
|
||||
"impermanence": "impermanence",
|
||||
|
@ -1151,7 +1281,7 @@
|
|||
"nixpkgs-wayland": "nixpkgs-wayland",
|
||||
"nixseparatedebuginfod": "nixseparatedebuginfod",
|
||||
"nixvim": "nixvim",
|
||||
"pre-commit-hooks": "pre-commit-hooks_3",
|
||||
"pre-commit-hooks": "pre-commit-hooks_4",
|
||||
"stylix": "stylix",
|
||||
"templates": "templates",
|
||||
"wired-notify": "wired-notify"
|
||||
|
@ -1194,7 +1324,7 @@
|
|||
"base16-kitty": "base16-kitty",
|
||||
"base16-tmux": "base16-tmux",
|
||||
"base16-vim": "base16-vim",
|
||||
"flake-compat": "flake-compat_6",
|
||||
"flake-compat": "flake-compat_7",
|
||||
"home-manager": [
|
||||
"home-manager"
|
||||
],
|
||||
|
@ -1306,6 +1436,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_7": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"templates": {
|
||||
"locked": {
|
||||
"lastModified": 1697364028,
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
extra-modules = {
|
||||
url = "github:oddlama/nixos-extra-modules";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
home-manager = {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
inputs.agenix.nixosModules.default
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.elewrap.nixosModules.default
|
||||
inputs.extra-modules.nixosModules.default
|
||||
inputs.home-manager.nixosModules.default
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
inputs.nixos-nftables-firewall.nixosModules.default
|
||||
|
@ -30,7 +31,6 @@
|
|||
./acme-wildcard.nix
|
||||
./deterministic-ids.nix
|
||||
./distributed-config.nix
|
||||
./interface-naming.nix
|
||||
./kanidm.nix
|
||||
./meta.nix
|
||||
./nginx.nix
|
||||
|
|
|
@ -32,7 +32,12 @@ in {
|
|||
hypervisor = mkDefault "qemu";
|
||||
|
||||
# Give them some juice by default
|
||||
mem = mkDefault (2 * 1024);
|
||||
# TODO
|
||||
mem = mkDefault 1024;
|
||||
|
||||
# Add a writable store overlay, but since this is always ephemeral
|
||||
# disable any store optimization from nix.
|
||||
writableStoreOverlay = "/nix/.rw-store";
|
||||
|
||||
# MACVTAP bridge to the host's network
|
||||
interfaces = [
|
||||
|
@ -67,10 +72,6 @@ in {
|
|||
);
|
||||
};
|
||||
|
||||
# Add a writable store overlay, but since this is always ephemeral
|
||||
# disable any store optimization from nix.
|
||||
microvm.writableStoreOverlay = "/nix/.rw-store";
|
||||
|
||||
networking.renameInterfacesByMac.${guestCfg.networking.mainLinkName} = guestCfg.microvm.mac;
|
||||
systemd.network.networks."10-${guestCfg.networking.mainLinkName}".matchConfig.MACAddress = guestCfg.microvm.mac;
|
||||
};
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
# Provides an option to easily rename interfaces by their mac addresses.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit
|
||||
(lib)
|
||||
attrValues
|
||||
concatStringsSep
|
||||
duplicates
|
||||
mapAttrsToList
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.networking.renameInterfacesByMac;
|
||||
|
||||
interfaceNamesUdevRules = pkgs.writeTextFile {
|
||||
name = "interface-names-udev-rules";
|
||||
text = concatStringsSep "\n" (mapAttrsToList
|
||||
(name: mac: ''SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="${mac}", NAME:="${name}"'')
|
||||
cfg);
|
||||
destination = "/etc/udev/rules.d/01-interface-names.rules";
|
||||
};
|
||||
in {
|
||||
options.networking.renameInterfacesByMac = mkOption {
|
||||
default = {};
|
||||
example = {lan = "11:22:33:44:55:66";};
|
||||
description = "Allows naming of network interfaces based on their physical address";
|
||||
type = types.attrsOf types.str;
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg != {}) {
|
||||
assertions = let
|
||||
duplicateMacs = duplicates (attrValues cfg);
|
||||
in [
|
||||
{
|
||||
assertion = duplicateMacs == [];
|
||||
message = "Duplicate mac addresses found in network interface name assignment: ${concatStringsSep ", " duplicateMacs}";
|
||||
}
|
||||
];
|
||||
|
||||
services.udev.packages = [interfaceNamesUdevRules];
|
||||
boot.initrd.services.udev.packages = [interfaceNamesUdevRules];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue