devos/lib/mkFlake/default.nix
2021-04-18 20:31:49 -05:00

55 lines
1.2 KiB
Nix

{ lib, deploy, ... }:
let
inherit (dev) os;
in
_: { self, ... } @ args:
let
userFlakeSelf = self;
cfg = (lib.mkFlake.evalOldArgs { inherit args; }).config;
multiPkgs = os.mkPkgs { inherit (cfg) extern overrides; };
outputs = {
nixosConfigurations = os.mkHosts {
inherit userFlakeSelf multiPkgs;
inherit (cfg) extern suites overrides;
dir = cfg.hosts;
};
homeConfigurations = os.mkHomeConfigurations;
nixosModules = cfg.modules;
homeModules = cfg.userModules;
overlay = cfg.packages;
inherit (cfg) overlays;
deploy.nodes = os.mkNodes deploy userFlakeSelf.nixosConfigurations;
};
systemOutputs = lib.eachDefaultSystem (system:
let
pkgs = multiPkgs.${system};
pkgs-lib = lib.pkgs-lib.${system};
# all packages that are defined in ./pkgs
legacyPackages = os.mkPackages { inherit pkgs; };
in
{
checks = pkgs-lib.tests.mkChecks {
inherit (userFlakeSelf.deploy) nodes;
hosts = userFlakeSelf.nixosConfigurations;
homes = userFlakeSelf.homeConfigurations;
};
inherit legacyPackages;
packages = lib.filterPackages system legacyPackages;
devShell = pkgs-lib.shell;
});
in
outputs // systemOutputs