nix-bundle icon indicating copy to clipboard operation
nix-bundle copied to clipboard

Appimage function

Open tomberek opened this issue 7 years ago • 0 comments

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.

tomberek avatar Sep 23 '18 21:09 tomberek