flake: use mkFlake

this is where we create devos's template structure
This commit is contained in:
Pacman99 2021-03-26 11:59:10 -07:00
parent 340784df6d
commit d068d79bfd

View File

@ -28,79 +28,26 @@
pkgs.inputs.nixpkgs.follows = "nixos"; pkgs.inputs.nixpkgs.follows = "nixos";
}; };
outputs = inputs@{ deploy, nixos, nur, self, utils, ... }: outputs = inputs@{ deploy, nixos, nur, self, utils, ... }:
let let
inherit (self) lib; lib = import ./lib { inherit self nixos inputs; };
inherit (lib) os; in
lib.mkFlake {
extern = import ./extern { inherit inputs; }; inherit self;
overrides = import ./overrides; hosts = ./hosts;
packages = import ./pkgs;
multiPkgs = os.mkPkgs { suites = import ./suites;
inherit extern overrides; extern = import ./extern;
};
suites = os.mkSuites {
suites = import ./suites;
users = os.mkProfileAttrs "${self}/users";
profiles = os.mkProfileAttrs "${self}/profiles";
userProfiles = os.mkProfileAttrs "${self}/users/profiles";
};
outputs = {
nixosConfigurations = os.mkHosts {
dir = "${self}/hosts";
overrides = import ./overrides; overrides = import ./overrides;
inherit multiPkgs suites extern; overlays = ./overlays;
profiles = ./profiles;
userProfiles = ./users/profiles;
modules = import ./modules/module-list.nix;
userModules = import ./users/modules/module-list.nix;
} // {
inherit lib;
defaultTemplate = self.templates.flk;
templates.flk.path = ./.;
templates.flk.description = "flk template";
}; };
homeConfigurations = os.mkHomeConfigurations;
nixosModules =
let moduleList = import ./modules/module-list.nix;
in lib.pathsToImportedAttrs moduleList;
homeModules =
let moduleList = import ./users/modules/module-list.nix;
in lib.pathsToImportedAttrs moduleList;
overlay = import ./pkgs;
overlays = lib.pathsToImportedAttrs (lib.pathsIn ./overlays);
lib = import ./lib { inherit nixos self inputs; };
templates.flk.path = ./.;
templates.flk.description = "flk template";
defaultTemplate = self.templates.flk;
deploy.nodes = os.mkNodes deploy self.nixosConfigurations;
};
systemOutputs = utils.lib.eachDefaultSystem (system:
let
pkgs = multiPkgs.${system};
# all packages that are defined in ./pkgs
legacyPackages = os.mkPackages { inherit pkgs; };
in
{
checks =
let
tests = nixos.lib.optionalAttrs (system == "x86_64-linux")
(import ./tests { inherit self pkgs; });
deployHosts = nixos.lib.filterAttrs
(n: _: self.nixosConfigurations.${n}.config.nixpkgs.system == system) self.deploy.nodes;
deployChecks = deploy.lib.${system}.deployChecks { nodes = deployHosts; };
in
nixos.lib.recursiveUpdate tests deployChecks;
inherit legacyPackages;
packages = lib.filterPackages system legacyPackages;
devShell = import ./shell {
inherit self system extern overrides;
};
}
);
in
nixos.lib.recursiveUpdate outputs systemOutputs;
} }