summaryrefslogtreecommitdiff
path: root/lib/hosts.nix
diff options
context:
space:
mode:
authorstuebinm2022-01-09 08:09:39 +0100
committerstuebinm2022-01-09 08:12:16 +0100
commite88fed18f499a3e8ac98c772bbb62f00d1f8d1d7 (patch)
tree2acb627ac0bf070d42f3b214015fdf1b4e920c44 /lib/hosts.nix
parenteb97c76228dd9675ccfe4662ca551f07327ca9b4 (diff)
use flakes instead of niv & stuff
Diffstat (limited to 'lib/hosts.nix')
-rw-r--r--lib/hosts.nix80
1 files changed, 0 insertions, 80 deletions
diff --git a/lib/hosts.nix b/lib/hosts.nix
deleted file mode 100644
index 91b6b40..0000000
--- a/lib/hosts.nix
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- pkgs,
- hostsDir ? ../hosts,
- commonImports ? [],
- pkgsPath ? ../pkgs,
- modules ? {},
- overlays ? {},
- profiles ? {},
- users ? {},
- sources ? {}
-}:
-
-with pkgs.lib;
-
-rec {
- hostNames = attrNames (
- filterAttrs (
- name: type: type == "directory"
- ) (
- builtins.readDir hostsDir
- )
- );
-
- hostConfig = hostName: { config, ... }: {
- _module.args = {
- inherit hosts groups;
- };
- imports = [
- (import (hostsDir + "/${hostName}/configuration.nix"))
- # urgh, yes, we still need to manually import the deploy module for now
- # at least if i want to keep my thing reusable.
- ../modules/deploy
- ] ++ commonImports;
- networking = {
- inherit hostName;
- };
- nixpkgs.pkgs =
- let pkgs = import pkgsPath {
- inherit (config.nixpkgs) config system;
- };
- in if pkgs ? nixpkgs then pkgs.nixpkgs else pkgs;
- };
-
- hosts = listToAttrs (
- map (
- hostName: nameValuePair hostName (
- import (pkgs.path + "/nixos/lib/eval-config.nix") {
- modules = [
- (hostConfig hostName)
- (if sources ? home-manager then sources.home-manager + "/nixos" else {})
- ];
- specialArgs = { inherit modules overlays profiles users sources; };
- }
- )
- ) hostNames
- );
-
- groupNames = unique (
- concatLists (
- mapAttrsToList (
- name: host: host.config.hexchen.deploy.groups
- ) hosts
- )
- );
-
- groups = listToAttrs (
- map (
- groupName: nameValuePair groupName (
- filter (
- host: elem groupName host.config.hexchen.deploy.groups
- ) (
- attrValues (
- filterAttrs (_: h: h.config.hexchen.deploy.enable) hosts
- )
- )
- )
- ) groupNames
- );
-}
-