mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
chore: remove unused overlays
This commit is contained in:
parent
7da0924d91
commit
76893ae125
37 changed files with 47 additions and 1530 deletions
37
lib.nix
Normal file
37
lib.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
inputs,
|
||||
tree,
|
||||
}: let
|
||||
nixlib = inputs.nixpkgs.lib;
|
||||
inherit (nixlib.strings) splitString toLower;
|
||||
inherit (nixlib.lists) imap0 elemAt;
|
||||
inherit (nixlib.attrsets) listToAttrs nameValuePair;
|
||||
inherit (nixlib.strings) substring fixedWidthString;
|
||||
inherit (nixlib.trivial) flip toHexString bitOr;
|
||||
|
||||
toHexStringLower = v: toLower (toHexString v);
|
||||
|
||||
hexCharToInt = let
|
||||
hexChars = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f"];
|
||||
pairs = imap0 (flip nameValuePair) hexChars;
|
||||
idx = listToAttrs pairs;
|
||||
in
|
||||
char: idx.${char};
|
||||
|
||||
eui64 = mac: let
|
||||
parts = map toLower (splitString ":" mac);
|
||||
part = elemAt parts;
|
||||
part0 = part: let
|
||||
nibble1' = hexCharToInt (substring 1 1 part);
|
||||
nibble1 = bitOr 2 nibble1';
|
||||
nibble0 = substring 0 1 part;
|
||||
in
|
||||
nibble0 + (fixedWidthString 1 "0" (toHexStringLower nibble1));
|
||||
in "${part0 (part 0)}${part 1}:${part 2}ff:fe${part 3}:${part 4}${part 5}";
|
||||
in {
|
||||
inherit tree nixlib;
|
||||
std = import ./std.nix {inherit inputs;};
|
||||
lib = {
|
||||
inherit eui64 toHexStringLower hexCharToInt;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue