about summary refs log tree commit diff
path: root/users/flokli
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-03-07T14·20+0200
committerclbot <clbot@tvl.fyi>2024-03-07T14·43+0000
commitc499e424d835052ecce2f92f198238602ad40193 (patch)
treee0c63fef560b26387cd293e726e4ba554ccf27b4 /users/flokli
parent525388fde79e1eeffd256f31d6a6a183165d55bf (diff)
feat(users/flokli/ipu6-softisp): provide example closure r/7654
This introduces a NixOS configuration using config.nix as a NixOS
module, and also checks the firmware is present in the location it's
expected to.

Change-Id: I3ec4333d73fe1b28e10c589c1cf351c59372bb99
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11099
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/flokli')
-rw-r--r--users/flokli/ipu6-softisp/default.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/users/flokli/ipu6-softisp/default.nix b/users/flokli/ipu6-softisp/default.nix
new file mode 100644
index 000000000000..b420a88bdd90
--- /dev/null
+++ b/users/flokli/ipu6-softisp/default.nix
@@ -0,0 +1,50 @@
+# This file ensures the fixes from ./config.nix build with the version of
+# nixpkgs from depot.
+# If you're an outside user of this, import config.nix as a NixOS module (and
+# check the README.md file).
+
+{ depot
+, pkgs
+, ...
+}:
+
+let
+  systemFor = sys: (depot.ops.nixos.nixosFor sys).system;
+in
+depot.nix.readTree.drvTargets rec {
+  testSystem = systemFor ({ modulesPath, pkgs, ... }: {
+    imports = [
+      # Import the module, this is something a user would do in their config.
+      ./config.nix
+    ];
+
+    # Make sure we use the linuxPackages_latest.
+    boot.kernelPackages = pkgs.linuxPackages_latest;
+
+    # Enable firmware.
+    hardware.enableAllFirmware = true;
+
+    # Set some options necessary to evaluate.
+    boot.loader.systemd-boot.enable = true;
+    fileSystems."/" = {
+      device = "/dev/disk/by-partlabel/root";
+      fsType = "xfs";
+    };
+    # Shut off the warning.
+    system.stateVersion = "24.05";
+  });
+
+  # Make sure the firmware requested by the driver is present in our firmware.
+  # We do have a .xz suffix here, but that's fine, since request_firmware does
+  # check ${name}.xz too in case CONFIG_FW_LOADER_COMPRESS is set.
+  # The path needs to be kept in sync with the ones used in the kernel patch.
+  checkFirmware = pkgs.runCommand "check-firmware" { } ''
+    stat ${testSystem}/firmware/intel/ipu/ipu6se_fw.bin.xz
+    stat ${testSystem}/firmware/intel/ipu/ipu6ep_fw.bin.xz
+    stat ${testSystem}/firmware/intel/ipu/ipu6_fw.bin.xz
+    stat ${testSystem}/firmware/intel/ipu/ipu6epmtl_fw.bin.xz
+
+    # all good, succeed build
+    touch $out
+  '';
+}