Automatically generate packages from configurations
This commit is contained in:
parent
1e56b9fbcb
commit
79ca4f1a1a
26
flake.nix
26
flake.nix
|
@ -7,17 +7,23 @@
|
||||||
outputs = { self, nixpkgs, utils }:
|
outputs = { self, nixpkgs, utils }:
|
||||||
let supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
|
let supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
|
||||||
in (utils.lib.eachSystem supportedSystems (system:
|
in (utils.lib.eachSystem supportedSystems (system:
|
||||||
let pkgs = import nixpkgs { inherit system; };
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
makeImage = conf:
|
||||||
|
(conf.extendModules {
|
||||||
|
modules = [{
|
||||||
|
config.nixpkgs = {
|
||||||
|
hostPlatform.system = conf.config.nixpkgs.system;
|
||||||
|
buildPlatform.system = system;
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
}).config.system.build.sdImage;
|
||||||
in {
|
in {
|
||||||
formatter = pkgs.nixfmt;
|
formatter = pkgs.nixfmt;
|
||||||
packages.pi4-sdimage = (self.nixosConfigurations.pi4.extendModules {
|
packages = lib.mapAttrs'
|
||||||
modules = [{
|
(name: value: lib.nameValuePair "${name}-sdimage" (makeImage value))
|
||||||
config.nixpkgs = {
|
self.nixosConfigurations;
|
||||||
hostPlatform.system = "aarch64-linux";
|
|
||||||
buildPlatform.system = system;
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
}).config.system.build.sdImage;
|
|
||||||
})) // {
|
})) // {
|
||||||
nixosModules.minify = { ... }: {
|
nixosModules.minify = { ... }: {
|
||||||
disabledModules = [ "profiles/base.nix" ];
|
disabledModules = [ "profiles/base.nix" ];
|
||||||
|
@ -27,7 +33,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosConfigurations.pi4 = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.aarch64-rpi = nixpkgs.lib.nixosSystem {
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
self.nixosModules.minify
|
self.nixosModules.minify
|
||||||
|
|
Reference in a new issue