nix-conf/upstream/modules/appimage/default.nix

34 lines
976 B
Nix
Raw Normal View History

2024-04-03 21:39:20 +02:00
{ lib, config, pkgs, ... }:
2024-02-17 23:33:17 +01:00
2024-04-03 21:39:20 +02:00
let
cfg = config.programs.appimage;
in
{
2024-02-17 23:33:17 +01:00
options.programs.appimage = {
2024-04-03 21:39:20 +02:00
enable = lib.mkEnableOption "appimage-run wrapper script for executing appimages on NixOS";
binfmt = lib.mkEnableOption "binfmt registration to run appimages via appimage-run seamlessly";
package = lib.mkPackageOption pkgs "appimage-run" {
example = ''
pkgs.appimage-run.override {
extraPkgs = pkgs: [ pkgs.ffmpeg pkgs.imagemagick ];
}
'';
};
2024-02-17 23:33:17 +01:00
};
config = lib.mkIf cfg.enable {
2024-04-03 21:39:20 +02:00
boot.binfmt.registrations.appimage = lib.mkIf cfg.binfmt {
2024-02-17 23:33:17 +01:00
wrapInterpreterInShell = false;
2024-04-03 21:39:20 +02:00
interpreter = lib.getExe cfg.package;
2024-02-17 23:33:17 +01:00
recognitionType = "magic";
offset = 0;
mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
magicOrExtension = ''\x7fELF....AI\x02'';
};
2024-04-03 21:39:20 +02:00
environment.systemPackages = [ cfg.package ];
2024-02-17 23:33:17 +01:00
};
2024-04-03 21:39:20 +02:00
meta.maintainers = with lib.maintainers; [ jopejoe1 atemu ];
2024-02-17 23:33:17 +01:00
}