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 16, 2024
1 parent e28ae3e commit f128748
Show file tree
Hide file tree
Showing 44 changed files with 1,748 additions and 1,194 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 f128748

Please sign in to comment.