From d15842324a8e95a3a32b7783bacf36354b295fc9 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 10 Jun 2024 18:53:04 +0200 Subject: [PATCH] Add runners config --- system/roles/workstation/default.nix | 1 + system/roles/workstation/runners.nix | 52 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 system/roles/workstation/runners.nix diff --git a/system/roles/workstation/default.nix b/system/roles/workstation/default.nix index 54b31e5..1c83f82 100644 --- a/system/roles/workstation/default.nix +++ b/system/roles/workstation/default.nix @@ -3,5 +3,6 @@ ./services ./programs ./fonts.nix + ./runners.nix ]; } diff --git a/system/roles/workstation/runners.nix b/system/roles/workstation/runners.nix new file mode 100644 index 0000000..6b6fae4 --- /dev/null +++ b/system/roles/workstation/runners.nix @@ -0,0 +1,52 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (lib) mkIf; + + deviceType = config.myOptions.device.roles.type; + acceptedTypes = ["laptop" "desktop"]; +in { + config = mkIf (builtins.elem deviceType acceptedTypes) { + environment.systemPackages = [pkgs.appimage-run]; + + # run appimages with appimage-run + boot.binfmt.registrations = lib.genAttrs ["appimage" "AppImage"] (_: { + wrapInterpreterInShell = false; + interpreter = "${pkgs.appimage-run}/bin/appimage-run"; + recognitionType = "magic"; + offset = 0; + mask = "\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\xff\\xff\\xff"; + magicOrExtension = "\\x7fELF....AI\\x02"; + }); + + # run unpatched linux binaries with nix-ld + programs.nix-ld = { + enable = true; + libraries = with pkgs; [ + stdenv.cc.cc + openssl + curl + glib + util-linux + glibc + icu + libunwind + libuuid + zlib + libsecret + # graphical + freetype + libglvnd + libnotify + SDL2 + vulkan-loader + gdk-pixbuf + xorg.libX11 + ]; + }; + }; +} +