From 59dc3627a0d32744a6bd08246bda90ec6c5e4b62 Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 6 Dec 2020 19:09:59 +0100 Subject: [PATCH] Use host config lib from pbb --- lib/hosts.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/hosts.nix diff --git a/lib/hosts.nix b/lib/hosts.nix new file mode 100644 index 0000000..b0e26d3 --- /dev/null +++ b/lib/hosts.nix @@ -0,0 +1,26 @@ +{ pkgs ? import ../pkgs {} }: + +with pkgs.lib; + +rec { + hostsDir = ../hosts; + + hostNames = attrNames ( + filterAttrs ( + name: type: type == "directory" + ) ( + builtins.readDir hostsDir + ) + ); + + hosts = listToAttrs ( + map ( + hostName: nameValuePair hostName ( + import (pkgs.path + "/nixos") { + configuration = import (hostsDir + "/${hostName}/configuration.nix"); + system = "x86_64-linux"; + } + ) + ) hostNames + ); +}