My Nix Configuration

[flake] add nix-search and topology

Changed files
+303 -11
+191 -1
flake.lock
···
"type": "github"
}
},
+
"devshell": {
+
"inputs": {
+
"flake-utils": "flake-utils_4",
+
"nixpkgs": [
+
"topology",
+
"nixpkgs"
+
]
+
},
+
"locked": {
+
"lastModified": 1713532798,
+
"narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=",
+
"owner": "numtide",
+
"repo": "devshell",
+
"rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40",
+
"type": "github"
+
},
+
"original": {
+
"owner": "numtide",
+
"repo": "devshell",
+
"type": "github"
+
}
+
},
"dns": {
"inputs": {
"flake-utils": [
···
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
+
"type": "github"
+
},
+
"original": {
+
"owner": "edolstra",
+
"repo": "flake-compat",
+
"type": "github"
+
}
+
},
+
"flake-compat_5": {
+
"flake": false,
+
"locked": {
+
"lastModified": 1696426674,
+
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+
"owner": "edolstra",
+
"repo": "flake-compat",
+
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
···
"systems": "systems_4"
},
"locked": {
+
"lastModified": 1701680307,
+
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
+
"owner": "numtide",
+
"repo": "flake-utils",
+
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
+
"type": "github"
+
},
+
"original": {
+
"owner": "numtide",
+
"repo": "flake-utils",
+
"type": "github"
+
}
+
},
+
"flake-utils_5": {
+
"inputs": {
+
"systems": "systems_5"
+
},
+
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
···
"inputs": {
"nixpkgs": [
"prismlauncher",
+
"pre-commit-hooks",
+
"nixpkgs"
+
]
+
},
+
"locked": {
+
"lastModified": 1709087332,
+
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
+
"owner": "hercules-ci",
+
"repo": "gitignore.nix",
+
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
+
"type": "github"
+
},
+
"original": {
+
"owner": "hercules-ci",
+
"repo": "gitignore.nix",
+
"type": "github"
+
}
+
},
+
"gitignore_3": {
+
"inputs": {
+
"nixpkgs": [
+
"topology",
"pre-commit-hooks",
"nixpkgs"
]
···
},
"lib-aggregate": {
"inputs": {
-
"flake-utils": "flake-utils_4",
+
"flake-utils": "flake-utils_5",
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
···
"type": "github"
},
+
"nix-search": {
+
"inputs": {
+
"flake-compat": [
+
"flake-compat"
+
],
+
"flake-utils": [
+
"flake-utils"
+
],
+
"nixpkgs": [
+
"nixpkgs"
+
]
+
},
+
"locked": {
+
"lastModified": 1720284519,
+
"narHash": "sha256-GAGgfUXXgXdxZOtoJ9kE9Kby/7mthcSA/1Oh7nR3o0U=",
+
"owner": "diamondburned",
+
"repo": "nix-search",
+
"rev": "b075a39227150cce4af9452621c0eb5ce92790f0",
+
"type": "github"
+
},
+
"original": {
+
"owner": "diamondburned",
+
"repo": "nix-search",
+
"type": "github"
+
}
+
},
"nixd": {
"inputs": {
"flake-parts": [
···
"type": "github"
},
+
"nixpkgs-stable_2": {
+
"locked": {
+
"lastModified": 1710695816,
+
"narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=",
+
"owner": "NixOS",
+
"repo": "nixpkgs",
+
"rev": "614b4613980a522ba49f0d194531beddbb7220d3",
+
"type": "github"
+
},
+
"original": {
+
"owner": "NixOS",
+
"ref": "nixos-23.11",
+
"repo": "nixpkgs",
+
"type": "github"
+
}
+
},
"nixpkgs_2": {
"locked": {
"lastModified": 1719285171,
···
"type": "github"
},
+
"pre-commit-hooks_2": {
+
"inputs": {
+
"flake-compat": "flake-compat_5",
+
"flake-utils": [
+
"topology",
+
"flake-utils"
+
],
+
"gitignore": "gitignore_3",
+
"nixpkgs": [
+
"topology",
+
"nixpkgs"
+
],
+
"nixpkgs-stable": "nixpkgs-stable_2"
+
},
+
"locked": {
+
"lastModified": 1714478972,
+
"narHash": "sha256-q//cgb52vv81uOuwz1LaXElp3XAe1TqrABXODAEF6Sk=",
+
"owner": "cachix",
+
"repo": "pre-commit-hooks.nix",
+
"rev": "2849da033884f54822af194400f8dff435ada242",
+
"type": "github"
+
},
+
"original": {
+
"owner": "cachix",
+
"repo": "pre-commit-hooks.nix",
+
"type": "github"
+
}
+
},
"prismlauncher": {
"inputs": {
"flake-compat": [
···
"nh": "nh",
"nix-index": "nix-index",
"nix-index-database": "nix-index-database",
+
"nix-search": "nix-search",
"nixd": "nixd",
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs_2",
···
"snowfall-lib": "snowfall-lib",
"stable": "stable",
"systems": "systems_3",
+
"topology": "topology",
"wayland": "wayland"
},
···
"original": {
"owner": "nix-systems",
"repo": "default",
+
"type": "github"
+
}
+
},
+
"systems_5": {
+
"locked": {
+
"lastModified": 1681028828,
+
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+
"owner": "nix-systems",
+
"repo": "default",
+
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+
"type": "github"
+
},
+
"original": {
+
"owner": "nix-systems",
+
"repo": "default",
+
"type": "github"
+
}
+
},
+
"topology": {
+
"inputs": {
+
"devshell": "devshell",
+
"flake-utils": [
+
"flake-utils"
+
],
+
"nixpkgs": [
+
"nixpkgs"
+
],
+
"pre-commit-hooks": "pre-commit-hooks_2"
+
},
+
"locked": {
+
"lastModified": 1715634843,
+
"narHash": "sha256-YrECYhEXY7g8Ji5luq8mdRaLRGiwTPCSDEeVP91DyDY=",
+
"owner": "oddlama",
+
"repo": "nix-topology",
+
"rev": "9ed5c7b5c5cd5bed9e204e8b9d69f4be1954abd3",
+
"type": "github"
+
},
+
"original": {
+
"owner": "oddlama",
+
"repo": "nix-topology",
"type": "github"
},
+34 -10
flake.nix
···
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
+
nix-search = {
+
url = "github:diamondburned/nix-search";
+
inputs.nixpkgs.follows = "nixpkgs";
+
inputs.flake-utils.follows = "flake-utils";
+
inputs.flake-compat.follows = "flake-compat";
+
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
···
my-pkgs = {
url = "git+https://git.pyrox.dev/pyrox/pkgs";
inputs.nixpkgs.follows = "nixpkgs";
+
};
+
topology = {
+
url = "github:oddlama/nix-topology";
+
inputs.nixpkgs.follows = "nixpkgs";
+
inputs.flake-utils.follows = "flake-utils";
};
wayland = {
url = "github:nix-community/nixpkgs-wayland";
···
namespace = "py";
};
};
-
in
-
lib.mkFlake {
-
# Nixpkgs configuration
-
channels-config = {
-
allowUnfree = true;
-
};
-
-
# Overlays for Nixpkgs.
overlays = [
self.overlays.pyronet-packages
self.overlays.nix-index
···
inputs.nixd.overlays.default
inputs.nur.overlay
inputs.prismlauncher.overlays.default
+
inputs.topology.overlays.default
inputs.wayland.overlays.default
];
+
in
+
lib.mkFlake {
+
# Nixpkgs configuration
+
channels-config = {
+
allowUnfree = true;
+
};
+
+
# Overlays for Nixpkgs.
+
inherit overlays;
# Home-manager configurations
homes = {
···
buildbot-nix.nixosModules.buildbot-worker
ctp.nixosModules.catppuccin
lix-module.nixosModules.default
+
topology.nixosModules.default
];
hosts = {
# Zaphod, my personal Framework 16 laptop
···
# Export packages and systems as checks for buildbot-nix
checks =
let
-
pkgs = channels.nixpkgs;
-
inherit (pkgs) system;
+
inherit (channels.nixpkgs) system;
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self.packages.${system};
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self.devShells.${system};
in
packages // devShells;
};
deploy = lib.mkDeploy { inherit (inputs) self; };
+
topology = import inputs.topology {
+
pkgs = import inputs.nixpkgs {
+
inherit overlays;
+
system = "x86_64-linux";
+
};
+
modules = [
+
./topology.nix
+
{ nixosConfigurations = self.nixosConfigurations; }
+
];
+
};
+
};
}
+78
topology.nix
···
+
{ config, ... }:
+
let
+
inherit (config.lib.topology) mkInternet mkConnection;
+
mkTS = addresses: {
+
inherit addresses;
+
network = "tailscale";
+
virtual = true;
+
};
+
in
+
{
+
topology = {
+
+
};
+
nodes.internet = mkInternet {
+
connections = [
+
(mkConnection "marvin" "wlp41s0")
+
(mkConnection "prefect" "enp1s0")
+
(mkConnection "thought" "enp1s0")
+
(mkConnection "zaphod" "wlp1s0")
+
];
+
};
+
networks.tailscale = {
+
name = "Tailscale";
+
cidrv4 = "100.64.0.0/10";
+
cidrv6 = "fd7a:115c:a1e0::/96";
+
};
+
nodes = {
+
marvin = {
+
interfaces.enp42s0 = {
+
renderer.hidePhysicalConnections = true;
+
};
+
interfaces.tailscale0 =
+
mkTS [
+
"100.123.15.72"
+
"\n"
+
"fd7a:115c:a1e0:ab12:4843:cd96:627b:f48"
+
]
+
// {
+
physicalConnections = [
+
(mkConnection "prefect" "tailscale0")
+
(mkConnection "marvin" "tailscale0")
+
];
+
};
+
};
+
zaphod = {
+
interfaces = {
+
vboxnet0.virtual = true;
+
tailscale0 =
+
mkTS [
+
"100.125.9.36"
+
""
+
"fd7a:115c:a1e0:ab12:4843:cd96:627d:924"
+
]
+
// {
+
physicalConnections = [
+
(mkConnection "prefect" "tailscale0")
+
(mkConnection "marvin" "tailscale0")
+
];
+
};
+
};
+
};
+
prefect = {
+
interfaces.tailscale0 =
+
mkTS [
+
"100.93.63.54"
+
"\n"
+
"fd7a:115c:a1e0:ab12:4843:cd96:625d:3f36"
+
]
+
// {
+
physicalConnections = [
+
(mkConnection "marvin" "tailscale0")
+
(mkConnection "zaphod" "tailscale0")
+
];
+
};
+
};
+
thought = { };
+
};
+
}