1{ lib, config, pkgs, ... }:
2
3let
4 cfg = config.programs.appimage;
5in
6
7{
8 options.programs.appimage = {
9 enable = lib.mkEnableOption "appimage-run wrapper script for executing appimages on NixOS";
10 binfmt = lib.mkEnableOption "binfmt registration to run appimages via appimage-run seamlessly";
11 package = lib.mkPackageOption pkgs "appimage-run" {
12 example = ''
13 pkgs.appimage-run.override {
14 extraPkgs = pkgs: [ pkgs.ffmpeg pkgs.imagemagick ];
15 }
16 '';
17 };
18 };
19
20 config = lib.mkIf cfg.enable {
21 boot.binfmt.registrations.appimage = lib.mkIf cfg.binfmt {
22 wrapInterpreterInShell = false;
23 interpreter = lib.getExe cfg.package;
24 recognitionType = "magic";
25 offset = 0;
26 mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
27 magicOrExtension = ''\x7fELF....AI\x02'';
28 };
29 environment.systemPackages = [ cfg.package ];
30 };
31
32 meta.maintainers = with lib.maintainers; [ jopejoe1 atemu ];
33}