Skip to content

Appimage function #39

@tomberek

Description

@tomberek

I find myself doing this to wrap arbitrary packages (including GTK ones) with appimage.

let
  appimage_src = drv : exec : with self;
    self.stdenv.mkDerivation rec {
      name = drv.name + "-appdir";
      env = buildEnv {
        inherit name;
        paths = buildInputs;
      };
      src = env;
      inherit exec;
      buildInputs = [ drv ];
      usr_fonts = buildEnv {
        name = "fonts";
        paths = [noto-fonts];
      };
      buildCommand = ''
        source $stdenv/setup
        mkdir -p $out/bin
        cp -rL ${drv}/* $out/
        chmod +w -R $out/

        mkdir -p $out/share/fonts
        cp ${usr_fonts}/share/fonts/* $out/share/fonts -R

        mkdir -p $out/share/icons
        touch $out/share/icons/${drv.name}.png

        mkdir -p $out/share/applications
        cat <<EOF > $out/share/applications/${drv.name}.desktop
        [Desktop Entry]
        Type=Application
        Version=1.0
        Name=${drv.name}
        Path=${exec}
        Icon=$out/share/icons/${drv.name}
        Exec=$exec
        Terminal=true
        EOF
        chmod +w -R $out/
        '';
        system = builtins.currentSystem;
  };

in
  with (import (nix-bundle_src + "/appimage-top.nix"){nixpkgs' = nixpkgs_src_musl;});
    appimage (appdir {
      name ="gnuradio";
      target = appimage_src grc "/bin/hello";
    })

This needs some cleanup, but a function that does all this, and improving the CLI to do it too, would be a big jump in capability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions