Compare commits

...

3 commits

View file

@ -14,28 +14,33 @@
makeImage = conf: makeImage = conf:
(conf.extendModules { (conf.extendModules {
modules = [{ config.nixpkgs.buildPlatform.system = system; }]; modules = [{ config.nixpkgs.buildPlatform.system = system; }];
}).config.system.build.sdImage; }).config.system.build;
in { in {
formatter = pkgs.nixfmt; formatter = pkgs.nixfmt;
packages = lib.mapAttrs' packages = lib.mapAttrs'
(name: value: lib.nameValuePair "${name}-sdimage" (makeImage value)) (name: value: lib.nameValuePair "${name}" (makeImage value))
self.nixosConfigurations; self.nixosConfigurations;
})) // { })) // {
nixosModules.minify = { ... }: { nixosModules.minify = { config, ... }: {
disabledModules = [ "profiles/base.nix" ]; disabledModules = [ "profiles/base.nix" "profiles/all-hardware.nix" ];
config = { config = {
boot.bcache.enable = false; boot.bcache.enable = false;
boot.initrd.includeDefaultModules = false; boot.initrd.includeDefaultModules = false;
environment.defaultPackages = [ ];
fonts.fontconfig.enable = false; fonts.fontconfig.enable = false;
networking.firewall.enable = false; networking.firewall.enable = false;
nix.enable = false;
programs.nano.enable = false; programs.nano.enable = false;
services.lvm.enable = false; services.lvm.enable = false;
# Disable nix daemon, but sdImage uses nix-env so it's in the closure anyway
# Link it in for convenience
nix.enable = false;
environment.systemPackages = [ config.nix.package.out ];
# Disable a few default packages, like rsync, but not core stuff, like coreutils
# We could theoretically disable system-path.nix so we don't have # We could theoretically disable system-path.nix so we don't have
# requiredPackages, but that seems like a lot of work. # requiredPackages, but that seems like a lot of work.
# At that point I should just use buildroot... # At that point I should just use buildroot...
environment.defaultPackages = [ ];
# Leave networking.useDHCP = true since we would reenable it anyway # Leave networking.useDHCP = true since we would reenable it anyway
@ -83,6 +88,9 @@
self.nixosModules.rpiSht3x self.nixosModules.rpiSht3x
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix" "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix"
({ pkgs, ... }: { ({ pkgs, ... }: {
boot.initrd.availableKernelModules = [ "mmc_block" ];
sdImage.compressImage = false;
nixpkgs.hostPlatform = lib.systems.examples.raspberryPi; nixpkgs.hostPlatform = lib.systems.examples.raspberryPi;
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {