From b4e7901780ef6819a34535373b682e4759764fc9 Mon Sep 17 00:00:00 2001 From: reo101 Date: Fri, 19 Jul 2024 02:24:20 +0300 Subject: [PATCH] feat(topology): add support Using `flake-parts` flake module Import `nix-topology` `NixOS` module by default --- flake.lock | 224 ++++++++++++++++++++++++++++++++++++++--- flake.nix | 30 ++++-- nix/configurations.nix | 1 + 3 files changed, 233 insertions(+), 22 deletions(-) diff --git a/flake.lock b/flake.lock index b9bef07..19bf6b5 100644 --- a/flake.lock +++ b/flake.lock @@ -146,6 +146,28 @@ "type": "github" } }, + "devshell_2": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nix-topology", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1713532798, + "narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=", + "owner": "numtide", + "repo": "devshell", + "rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -279,6 +301,22 @@ "type": "github" } }, + "flake-compat_8": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -399,11 +437,11 @@ "systems": "systems_6" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -417,11 +455,11 @@ "systems": "systems_7" }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -452,6 +490,24 @@ "inputs": { "systems": "systems_9" }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_7": { + "inputs": { + "systems": "systems_10" + }, "locked": { "lastModified": 1705309234, "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", @@ -466,9 +522,27 @@ "type": "github" } }, - "flake-utils_7": { + "flake-utils_8": { "inputs": { - "systems": "systems_10" + "systems": "systems_11" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_9": { + "inputs": { + "systems": "systems_12" }, "locked": { "lastModified": 1710146030, @@ -556,6 +630,28 @@ } }, "gitignore_3": { + "inputs": { + "nixpkgs": [ + "nix-topology", + "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_4": { "inputs": { "nixpkgs": [ "zls-overlay", @@ -891,6 +987,29 @@ "type": "github" } }, + "nix-topology": { + "inputs": { + "devshell": "devshell_2", + "flake-utils": "flake-utils_4", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks_2" + }, + "locked": { + "lastModified": 1721160643, + "narHash": "sha256-ZkjJnwgDUkjzgySZv9GjKnDsDmNJVkU2u2pLD4a1QKA=", + "owner": "oddlama", + "repo": "nix-topology", + "rev": "fe9ace7f40a63e3eb9b39a20a1032834e090d806", + "type": "github" + }, + "original": { + "owner": "oddlama", + "repo": "nix-topology", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1717868076, @@ -982,6 +1101,22 @@ "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": 1721138476, @@ -1127,13 +1262,41 @@ "type": "github" } }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": "flake-compat_7", + "flake-utils": [ + "nix-topology", + "flake-utils" + ], + "gitignore": "gitignore_3", + "nixpkgs": [ + "nix-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" + } + }, "ragenix": { "inputs": { "agenix": [ "agenix" ], "crane": "crane", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_5", "nixpkgs": "nixpkgs_3", "rust-overlay": "rust-overlay" }, @@ -1170,6 +1333,7 @@ "nix-darwin": "nix-darwin", "nix-monitored": "nix-monitored", "nix-on-droid": "nix-on-droid", + "nix-topology": "nix-topology", "nixpkgs": "nixpkgs_2", "nur": "nur", "ragenix": "ragenix", @@ -1206,7 +1370,7 @@ }, "rust-overlay_2": { "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_7", "nixpkgs": "nixpkgs_5" }, "locked": { @@ -1241,7 +1405,7 @@ }, "spicetify-nix": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_6", "nixpkgs": "nixpkgs_4" }, "locked": { @@ -1288,6 +1452,36 @@ "type": "github" } }, + "systems_11": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_12": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "systems_2": { "locked": { "lastModified": 1681028828, @@ -1450,8 +1644,8 @@ }, "zig-overlay": { "inputs": { - "flake-compat": "flake-compat_7", - "flake-utils": "flake-utils_6", + "flake-compat": "flake-compat_8", + "flake-utils": "flake-utils_8", "nixpkgs": [ "nixpkgs" ] @@ -1472,8 +1666,8 @@ }, "zls-overlay": { "inputs": { - "flake-utils": "flake-utils_7", - "gitignore": "gitignore_3", + "flake-utils": "flake-utils_9", + "gitignore": "gitignore_4", "langref": "langref", "nixpkgs": [ "nixpkgs" diff --git a/flake.nix b/flake.nix index 56b2b5c..ad8d707 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,11 @@ url = "github:nix-community/impermanence"; }; + nix-topology = { + url = "github:oddlama/nix-topology"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + lib-net = { url = "https://gist.github.com/duairc/5c9bb3c922e5d501a1edb9e7b3b845ba/archive/3885f7cd9ed0a746a9d675da6f265d41e9fd6704.tar.gz"; flake = false; @@ -128,12 +133,10 @@ }; }; - outputs = - inputs: - let - inherit (inputs) self; - inherit (self) outputs; - in + outputs = inputs: let + inherit (inputs) self; + inherit (self) outputs; + in inputs.flake-parts.lib.mkFlake { inherit inputs; } ({ withSystem, flake-parts-lib, ... }: { systems = [ "aarch64-linux" @@ -145,6 +148,8 @@ imports = [ inputs.agenix-rekey.flakeModule + inputs.nix-topology.flakeModule + ] ++ [ ./nix/machines.nix ./nix/modules.nix ./nix/configurations.nix @@ -154,7 +159,9 @@ perSystem = { lib, pkgs, system, ... }: { _module.args.pkgs = import inputs.nixpkgs { inherit system; - overlays = lib.attrValues outputs.overlays; + overlays = lib.attrValues outputs.overlays ++ [ + inputs.nix-topology.overlays.default + ]; config = { }; }; @@ -170,6 +177,15 @@ # Formatter (`nix fmt`) formatter = pkgs.nixpkgs-fmt; + topology = { + modules = [ + ]; + nixosConfigurations = { + inherit (self.nixosConfigurations) + jeeves; + }; + }; + agenix-rekey = { nodes = { inherit (self.nixosConfigurations) jeeves; diff --git a/nix/configurations.nix b/nix/configurations.nix index 5501284..4565b18 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -18,6 +18,7 @@ let modules = [ (lib.path.append root "configuration.nix") inputs.home-manager.nixosModules.home-manager + inputs.nix-topology.nixosModules.default { nixpkgs.overlays = builtins.attrValues self.overlays; }