From e3f3b47602ad0d133c883f6d3e1ab2f0042c96db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vili=20Sinerv=C3=A4?= Date: Sun, 1 Jun 2025 13:34:34 +0300 Subject: [PATCH] Create flake config for all hosts --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 24 +++++++++++++++++++----- 2 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..cd3f169 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1748437600, + "narHash": "sha256-hYKMs3ilp09anGO7xzfGs3JqEgUqFMnZ8GMAqI6/k04=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7282cb574e0607e65224d33be8241eae7cfe0979", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 9fb0636..4562ea6 100644 --- a/flake.nix +++ b/flake.nix @@ -6,11 +6,25 @@ }; outputs = - { nixpkgs }: + { nixpkgs, ... }: { - nixosConfigurations.lithium = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ ./hosts/lithium.nix ]; - }; + nixosConfigurations = ( + let + hosts = map (name: (nixpkgs.lib.removeSuffix ".nix" name)) ( + builtins.attrNames (builtins.readDir ./hosts) + ); + in + builtins.listToAttrs ( + map ( + host: + nixpkgs.lib.nameValuePair host ( + nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./hosts/${host}.nix ]; + } + ) + ) hosts + ) + ); }; }