nix/lib/create.nix

46 lines
1.5 KiB
Nix

let
inputs = import ./inputs.nix;
inherit (inputs) nixpkgs;
inherit (nixpkgs) lib;
recursivelyImport = import ./recursively-import.nix { inherit lib; };
in
{
systems =
definitions:
lib.mapAttrs (
name: info:
lib.nixosSystem {
specialArgs = {
inherit inputs;
inherit (info) system;
# annoyingly, this is the only dependency on `system` from the entrypoint
localPkgs = lib.packagesFromDirectoryRecursive {
inherit (inputs.nixpkgs.legacyPackages.${info.system}) callPackage;
directory = ../pkgs;
};
scope = import ./scope.nix { inherit lib; };
mainUser = info.username;
getPkgs = builtins.attrValues;
};
modules = [
inputs.arbys.nixosModules.arbys
inputs.hjem.nixosModules.hjem
({ scope, ... }: scope "hjem" {
users.${info.username}.enable = true;
extraModules = [
inputs.hjem-rum.hjemModules.hjem-rum
]
# alias base hjem options to `rum` so we can alias them all together after
++ (map (f: lib.mkAliasOptionModule [ "rum" f ] [ f ]) [
"packages"
"files"
"xdg"
]);
})
# alias hjem-rum options to `user`
(lib.mkAliasOptionModule [ "user" ] [ "hjem" "users" info.username "rum" ])
]
++ (recursivelyImport info.imports);
}
) definitions;
}