pub-solar-os/lib/mkFlake/default.nix

69 lines
1.6 KiB
Nix
Raw Normal View History

{ lib, deploy }:
let
inherit (lib) os;
in
_: { self, inputs, nixos, ... } @ args:
let
2021-04-19 00:35:11 +00:00
userFlakeSelf = self;
userFlakeInputs = inputs;
userFlakeNixOS = nixos;
2021-04-18 23:30:07 +00:00
cfg = (
lib.mkFlake.evalOldArgs
{ inherit userFlakeSelf userFlakeInputs; }
{ inherit args; }
).config;
multiPkgs = os.mkPkgs
{ inherit userFlakeSelf userFlakeInputs userFlakeNixOS; }
{ inherit (cfg) extern overrides; };
outputs = {
nixosConfigurations = os.mkHosts
{ inherit userFlakeSelf userFlakeInputs userFlakeNixOS; }
{
inherit multiPkgs;
inherit (cfg) extern suites overrides;
dir = cfg.hosts;
};
homeConfigurations = os.mkHomeConfigurations
{ inherit userFlakeSelf; };
nixosModules = cfg.modules;
homeModules = cfg.userModules;
overlay = cfg.packages;
inherit (cfg) overlays;
2021-04-19 00:35:11 +00:00
deploy.nodes = os.mkNodes deploy userFlakeSelf.nixosConfigurations;
};
2021-04-18 01:56:24 +00:00
systemOutputs = lib.eachDefaultSystem (system:
let
pkgs = multiPkgs.${system};
2021-04-18 01:35:05 +00:00
pkgs-lib = lib.pkgs-lib.${system};
# all packages that are defined in ./pkgs
legacyPackages = os.mkPackages
{ inherit userFlakeSelf; }
{ inherit pkgs; };
in
{
checks = pkgs-lib.tests.mkChecks {
2021-04-19 00:35:11 +00:00
inherit (userFlakeSelf.deploy) nodes;
hosts = userFlakeSelf.nixosConfigurations;
homes = userFlakeSelf.homeConfigurations;
};
inherit legacyPackages;
2021-04-18 01:35:05 +00:00
packages = lib.filterPackages system legacyPackages;
devShell = pkgs-lib.shell;
});
in
2021-04-10 01:22:08 +00:00
outputs // systemOutputs