2023-12-09 02:12:40 +00:00
|
|
|
{
|
|
|
|
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:
|
2023-12-09 03:23:19 +00:00
|
|
|
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;
|
2023-12-09 02:12:40 +00:00
|
|
|
in {
|
|
|
|
formatter = pkgs.nixfmt;
|
2023-12-09 03:23:19 +00:00
|
|
|
packages = lib.mapAttrs'
|
|
|
|
(name: value: lib.nameValuePair "${name}-sdimage" (makeImage value))
|
|
|
|
self.nixosConfigurations;
|
2023-12-09 02:12:40 +00:00
|
|
|
})) // {
|
|
|
|
nixosModules.minify = { ... }: {
|
|
|
|
disabledModules = [ "profiles/base.nix" ];
|
|
|
|
config = {
|
2023-12-09 03:54:26 +00:00
|
|
|
boot.bcache.enable = false;
|
|
|
|
environment.defaultPackages = [ ];
|
|
|
|
fonts.fontconfig.enable = false;
|
|
|
|
networking.firewall.enable = false;
|
2023-12-09 02:12:40 +00:00
|
|
|
nix.enable = false;
|
2023-12-09 03:54:26 +00:00
|
|
|
programs.nano.enable = false;
|
|
|
|
services.lvm.enable = false;
|
|
|
|
|
|
|
|
# We could theoretically disable system-path.nix so we don't have
|
|
|
|
# requiredPackages, but that seems like a lot of work.
|
|
|
|
|
|
|
|
# Leave networking.useDHCP = true since we would reenable it anyway
|
|
|
|
|
|
|
|
# Just set this to something, we probably don't care
|
|
|
|
system.stateVersion = "23.11";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
nixosModules.insecureRemote = { ... }: {
|
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
settings.PermitRootLogin = "yes";
|
2023-12-09 02:12:40 +00:00
|
|
|
};
|
2023-12-09 03:54:26 +00:00
|
|
|
users.users.root.initialPassword = "ohnowo";
|
2023-12-09 02:12:40 +00:00
|
|
|
};
|
|
|
|
|
2023-12-09 03:23:19 +00:00
|
|
|
nixosConfigurations.aarch64-rpi = nixpkgs.lib.nixosSystem {
|
2023-12-09 02:12:40 +00:00
|
|
|
system = "aarch64-linux";
|
|
|
|
modules = [
|
|
|
|
self.nixosModules.minify
|
2023-12-09 03:54:26 +00:00
|
|
|
self.nixosModules.insecureRemote
|
2023-12-09 02:12:40 +00:00
|
|
|
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|