yep, more dotfiles

add nix net parsing library

wiro.world 6d6b2739 118b1435

verified
+66 -13
+21
flake.lock
··· 662 662 "url": "https://github.com/lucide-icons/lucide/releases/download/0.536.0/lucide-icons-0.536.0.zip" 663 663 } 664 664 }, 665 + "net": { 666 + "inputs": { 667 + "nixpkgs": [ 668 + "unixpkgs" 669 + ] 670 + }, 671 + "locked": { 672 + "lastModified": 1769341404, 673 + "narHash": "sha256-DRe4hoL880v6SSprIQIXeXjAUvpSqPmxFkEVWU0zdGE=", 674 + "owner": "0xCCF4", 675 + "repo": "nix-net-lib", 676 + "rev": "f7a02760eb2864e525da462f3e366ad6e8b5f7f0", 677 + "type": "github" 678 + }, 679 + "original": { 680 + "owner": "0xCCF4", 681 + "repo": "nix-net-lib", 682 + "type": "github" 683 + } 684 + }, 665 685 "nix-alien": { 666 686 "inputs": { 667 687 "flake-compat": "flake-compat_2", ··· 830 850 "home-manager": "home-manager", 831 851 "hypixel-bank-tracker": "hypixel-bank-tracker", 832 852 "lanzaboote": "lanzaboote", 853 + "net": "net", 833 854 "nix-alien": "nix-alien", 834 855 "nix-darwin": "nix-darwin", 835 856 "nixos-hardware": "nixos-hardware",
+13 -3
flake.nix
··· 31 31 srvos.url = "github:nix-community/srvos"; 32 32 srvos.inputs.nixpkgs.follows = "nixpkgs"; 33 33 34 + ## Libraries 35 + 36 + net.url = "github:0xCCF4/nix-net-lib"; 37 + net.inputs.nixpkgs.follows = "unixpkgs"; 38 + 34 39 ## Packages 35 40 36 41 git-leave.url = "github:mrnossiom/git-leave"; ··· 65 70 inherit (self) outputs; 66 71 inherit (flake-lib) forAllSystems; 67 72 68 - flake-lib = import ./lib/flake (nixpkgs // { inherit self; }); 73 + flake-lib = import ./lib/flake ({ 74 + inherit self; 75 + inherit (nixpkgs) lib; 76 + }); 69 77 70 - # This should be the only constructed nixpkgs instances in this flake 71 78 allPkgs = forAllSystems ( 72 79 system: 80 + # This should be the only constructed nixpkgs instance in this flake 81 + # (along with the derived unixpkgs instance in specialModuleArgs) 73 82 import nixpkgs { 74 83 inherit system; 75 - config.allowUnfreePredicate = import ./lib/unfree.nix { lib = nixpkgs.lib; }; 84 + config.allowUnfreePredicate = import ./lib/unfree.nix { inherit (nixpkgs) lib; }; 76 85 overlays = [ outputs.overlays.all ]; 77 86 } 78 87 ); ··· 84 93 85 94 inherit flake-lib; # Nonstandard 86 95 lib = forAllPkgs (import ./lib); 96 + globals = forAllPkgs (import ./globals.nix); 87 97 templates = import ./templates; 88 98 89 99 apps = forAllPkgs (import ./apps { pkgs-per-system = allPkgs; });
+20 -8
globals.nix
··· 1 + { 2 + lib, 3 + llib, 4 + ... 5 + }: 6 + 1 7 { 2 8 domains = rec { 3 9 # wiro.world ··· 32 38 hbt-banana = "banana.${hypixel-bank-tracker}"; 33 39 }; 34 40 35 - hosts = { 36 - weird-row-server = { 37 - ip = "91.99.55.74"; 38 - ip-prefix-length = 32; 39 - ip6 = "2a01:4f8:c2c:76d2::1"; 40 - ip6-prefix-length = 64; 41 - ip6-agnos = "2a01:4f8:c2c:76d2::2"; 41 + network = 42 + let 43 + pipeNoMask = [ 44 + llib.net.decompose 45 + (addr: addr.addressNoMask) 46 + ]; 47 + in 48 + rec { 49 + primary4 = llib.net.decompose "91.99.55.74"; 50 + primary6-subnet = llib.net.decompose "2a01:4f8:c2c:76d2::/64"; 51 + 52 + weird-row-server = lib.pipe primary4.address pipeNoMask; 53 + weird-row-server6 = lib.pipe (llib.net.assignAddress primary6-subnet.address 1) pipeNoMask; 54 + weird-row-server6-agnos = lib.pipe (llib.net.assignAddress primary6-subnet.address 2) pipeNoMask; 42 55 }; 43 - }; 44 56 }
+1 -1
hosts/weird-row-server/default.nix
··· 53 53 "2001:4860:4860::8888" 54 54 "2001:4860:4860::8844" 55 55 ]; 56 - 56 + 57 57 # Single network card is `eth0` 58 58 networking.usePredictableInterfaceNames = false; 59 59
+11 -1
lib/default.nix
··· 1 1 # This flake library is available to modules via the `llib` arg 2 - pkgs: { } 2 + { 3 + self, 4 + ... 5 + }: 6 + 7 + let 8 + inherit (self.inputs) net; 9 + in 10 + { 11 + net = net.lib; 12 + }