flake: separate images to images attribute

This also allows for downstream users to import my flake now (if there's
any).
This commit is contained in:
Gabriel Arazas 2023-07-14 13:17:05 +08:00
parent d524444ae0
commit 06704f5ab6
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -365,29 +365,45 @@
# My custom packages, available in here as well. Though, I mainly support # My custom packages, available in here as well. Though, I mainly support
# "x86_64-linux". I just want to try out supporting other systems. # "x86_64-linux". I just want to try out supporting other systems.
packages = forAllSystems (system: packages = forAllSystems (system:
let inputs.flake-utils.lib.flattenTree (import ./pkgs {
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs {
in inherit system;
inputs.flake-utils.lib.flattenTree (import ./pkgs { inherit pkgs; }) overlays = [
// lib'.mapAttrs' (final: prev: {
inherit (inputs.firefox-addons.lib.${system}) buildFirefoxXpiAddon;
})
];
};
}));
# This contains images that are meant to be built and distributed
# somewhere else including those NixOS configurations that are built as
# an ISO.
images =
lib'.mapAttrs
(host: metadata: (host: metadata:
lib'.nameValuePair "nixos-image-${metadata.format or "iso"}-${host}" (mkImage { let
inherit system pkgs extraArgs; system = metadata.system or defaultSystem;
nixpkgs-channel = metadata.nixpkgs-channel or "nixpkgs";
pkgs = import inputs."${nixpkgs-channel}" { inherit system; };
format = metadata.format or "iso"; format = metadata.format or "iso";
in
mkImage {
inherit format system pkgs extraArgs;
extraModules = [ extraModules = [
({ lib, ... }: { ({ lib, ... }: {
config = lib.mkMerge [ config = lib.mkMerge [
{ networking.hostName = metadata.hostname or host; } { networking.hostName = lib.mkForce metadata.hostname or host; }
(lib.mkIf (metadata ? domain) (lib.mkIf (metadata ? domain)
{ networking.domain = metadata.domain; }) { networking.domain = lib.mkForce metadata.domain; })
]; ];
}) })
hostSharedConfig hostSharedConfig
./hosts/${host} ./hosts/${host}
]; ];
})) })
images); images;
# My several development shells for usual type of projects. This is much # My several development shells for usual type of projects. This is much
# more preferable than installing all of the packages at the system # more preferable than installing all of the packages at the system