45 lines
1.3 KiB
Nix
45 lines
1.3 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, utils }:
|
|
let supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
|
|
in (utils.lib.eachSystem supportedSystems (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 {
|
|
formatter = pkgs.nixfmt;
|
|
packages = lib.mapAttrs'
|
|
(name: value: lib.nameValuePair "${name}-sdimage" (makeImage value))
|
|
self.nixosConfigurations;
|
|
})) // {
|
|
nixosModules.minify = { ... }: {
|
|
disabledModules = [ "profiles/base.nix" ];
|
|
config = {
|
|
nix.enable = false;
|
|
programs.nano.enable = true;
|
|
};
|
|
};
|
|
|
|
nixosConfigurations.aarch64-rpi = nixpkgs.lib.nixosSystem {
|
|
system = "aarch64-linux";
|
|
modules = [
|
|
self.nixosModules.minify
|
|
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
|
|
];
|
|
};
|
|
};
|
|
}
|