From 94172cfb81e30511183f9b91c7833ec934078ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Thu, 31 Oct 2024 09:05:51 +0100 Subject: [PATCH] only add the device tree files if the loader directory exists --- machine/not522/hardware.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/machine/not522/hardware.nix b/machine/not522/hardware.nix index 300507ad..89346852 100644 --- a/machine/not522/hardware.nix +++ b/machine/not522/hardware.nix @@ -10,11 +10,13 @@ boot.loader.systemd-boot.extraInstallCommands = '' set -euo pipefail ${pkgs.coreutils}/bin/cp --no-preserve=mode -r ${config.hardware.deviceTree.package} ${config.boot.loader.efi.efiSysMountPoint}/ - for filename in ${config.boot.loader.efi.efiSysMountPoint}/loader/entries/nixos*-generation-[1-9]*.conf; do - if ! ${pkgs.gnugrep}/bin/grep -q 'devicetree' $filename; then - ${pkgs.coreutils}/bin/echo "devicetree /dtbs/${config.hardware.deviceTree.name}" >> $filename - fi - done + if [ -d ${config.boot.loader.efi.efiSysMountPoint} /loader/entries ]; then + for filename in ${config.boot.loader.efi.efiSysMountPoint}/loader/entries/nixos*-generation-[1-9]*.conf; do + if ! ${pkgs.gnugrep}/bin/grep -q 'devicetree' $filename; then + ${pkgs.coreutils}/bin/echo "devicetree /dtbs/${config.hardware.deviceTree.name}" >> $filename + fi + done + fi ''; hardware.deviceTree.name = "starfive/jh7110-starfive-visionfive-2-v1.3b.dtb"; boot.initrd.kernelModules = [