Skip to content

Commit

Permalink
WIP minimize overlay use
Browse files Browse the repository at this point in the history
  • Loading branch information
573 committed Sep 13, 2024
1 parent e28ae3e commit 640c632
Show file tree
Hide file tree
Showing 43 changed files with 1,692 additions and 1,141 deletions.
11 changes: 5 additions & 6 deletions files/nix/raspi-hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# source: https://github.com/n8henrie/nixos-btrfs-pi/blob/856722b/nixos/hardware-configuration.nix
# see https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/uboot/default.nix as well
{
lib,
modulesPath,
...
{ lib
, modulesPath
, ...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
Expand Down Expand Up @@ -42,7 +41,7 @@
"/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
options = ["nofail" "noauto"];
options = [ "nofail" "noauto" ];
};
};

Expand All @@ -56,6 +55,6 @@

powerManagement.cpuFreqGovernor =
lib.mkDefault
"ondemand";
"ondemand";
}

40 changes: 20 additions & 20 deletions files/nix/run-in-vm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ let
# = configuration
(
{ lib, pkgs, ... }:
{
systemd.network.enable = true;
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
{
systemd.network.enable = true;
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];

}
}
)
];
};
in
# https://github.com/NixOS/nixpkgs/blob/5061fe0c2c7743370e1d379d6fa60eed26ff1470/pkgs/misc/uboot/default.nix#L230
# https://github.com/n8henrie/nixos-btrfs-pi/blob/master/flake.nix#L44
# https://github.com/n8henrie/nixos-btrfs-pi/blob/master/flake.nix#L44
nixpkgs.writeScript "run-nixos-vm" ''
#!${nixpkgs.runtimeShell}
#!${nixpkgs.runtimeShell}
img=${evaluatedConfig.config.system.build.sdImage}/aarch64-qemu.img
img=${evaluatedConfig.config.system.build.sdImage}/aarch64-qemu.img
# https://wiki.qemu.org/Documentation/Platforms/ARM#Supported_Machines
# https://www.qemu.org/docs/master/system/arm/raspi.html
qemu-system-aarch64 \
-M raspi2 \
-m 1G \
-smp 4 \
-drive file="$img",format=raw \
-kernel "${nixpkgs.ubootRaspberryPi2}/u-boot-rpi3.bin" \
-device usb-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-append "console=ttyAMA0 root=/dev/mmcblk0p2 rw rootwait" \
-nographic
''
# https://wiki.qemu.org/Documentation/Platforms/ARM#Supported_Machines
# https://www.qemu.org/docs/master/system/arm/raspi.html
qemu-system-aarch64 \
-M raspi2 \
-m 1G \
-smp 4 \
-drive file="$img",format=raw \
-kernel "${nixpkgs.ubootRaspberryPi2}/u-boot-rpi3.bin" \
-device usb-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-append "console=ttyAMA0 root=/dev/mmcblk0p2 rw rootwait" \
-nographic
''
22 changes: 12 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 640c632

Please sign in to comment.