rework lib and some general changes

This commit is contained in:
Reid 2024-02-27 23:10:03 -08:00
parent 48b7ab9fab
commit af804c63f8
11 changed files with 152 additions and 121 deletions

View file

@ -1,21 +1,35 @@
{ inputs, lib, pkgs, ... }:
with lib;
{
mkHost = path: attrs@{ system, ... }:
inputs,
lib,
pkgs,
self,
...
}: let
inherit (inputs.nixpkgs.lib) nixosSystem;
inherit (builtins) baseNameOf elem;
inherit (lib.attrsets) filterAttrs;
inherit (lib.modules) mkDefault;
inherit (lib.strings) removeSuffix;
inherit (self.modules) mapModules;
in rec {
mkHost = path: attrs @ {system ? "aarch64-linux", ...}:
nixosSystem {
inherit system;
specialArgs = { inherit lib inputs system; };
specialArgs = {inherit lib inputs system;};
modules = [
{
nixpkgs.pkgs = pkgs;
networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf path));
networking.hostName =
mkDefault (removeSuffix ".nix" (baseNameOf path));
}
(filterAttrs (n: v: !elem n [ "system" ]) attrs)
../.
(filterAttrs (n: v: !elem n ["system"]) attrs)
../. # /default.nix
(import path)
];
};
mapHosts = dir: attrs @ {system ? system, ...}:
mapModules dir (hostPath: mkHost hostPath attrs);
}