helm/lib/nixos.nix

26 lines
615 B
Nix
Raw Normal View History

2020-10-26 02:48:12 -07:00
{ inputs, lib, pkgs, ... }:
with lib;
with lib.my;
2021-01-19 22:28:30 -08:00
let sys = "x86_64-linux";
2020-10-26 02:48:12 -07:00
in {
2021-01-19 22:28:30 -08:00
mkHost = path: attrs @ { system ? sys, ... }:
2020-10-26 02:48:12 -07:00
nixosSystem {
inherit system;
2021-01-19 22:28:30 -08:00
specialArgs = { inherit lib inputs system; };
2020-10-26 02:48:12 -07:00
modules = [
{
nixpkgs.pkgs = pkgs;
networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf path));
}
(filterAttrs (n: v: !elem n [ "system" ]) attrs)
2021-01-01 21:26:00 -08:00
../. # /default.nix
2020-10-26 02:48:12 -07:00
(import path)
];
};
mapHosts = dir: attrs @ { system ? system, ... }:
mapModules dir
(hostPath: mkHost hostPath attrs);
}