got AppImage build working on my desktop

On my desktop the AppImage build kept picking up the `Htop.desktop`
file, whereas on my laptop it would pick up the
`medicore-loadout.desktop` file as expected. I'm not sure of why the
discrepancy, maybe some difference in the directory listing order. In
any case, I fixed it by deleting all desktop files, except the
loadout's, from the AppDir.
This commit is contained in:
mediocregopher 2021-10-05 21:57:22 -06:00
parent 07ab3a77b4
commit 0cd135b57d
2 changed files with 41 additions and 46 deletions

View File

@ -73,31 +73,33 @@ binary:
./Mediocre_Loadout-x86_64.AppImage nvim ./Mediocre_Loadout-x86_64.AppImage nvim
``` ```
NOTE that the AppImage doesn't like working with files within `/tmp`. I don't
know of a workaround for this at the moment.
# Available Components # Available Components
Components of the loadout can be run separate from the others, depending on what Components of the loadout can be run separate from the others, depending on what
you're trying to do. The following components are available to be run: you're trying to do. The following components are available to be run:
* `zsh` (`shell` in the AppImage): My terminal shell. There's some customization * `zsh`: My terminal shell. There's some customization
to it but it should be pretty self-explanatory to "just use". to it but it should be pretty self-explanatory to "just use".
* `nvim` (`editor` in the AppImage): My neovim development environment, plus all * `nvim`: My neovim development environment, plus all plugins I use. I mostly
plugins I use. I mostly work in golang, so it's most tuned for that, but it work in golang, so it's most tuned for that, but it does fine for general dev
does fine for general dev work. `Ctrl-N` will open NerdTree, `<backslash>tn` work. `Ctrl-N` will open NerdTree, `<backslash>tn` will open a terminal tab,
will open a terminal tab, and `<backslash>th`/`<backslash>tl` can be used to and `<backslash>th`/`<backslash>tl` can be used to navigate tabs. There's a
navigate tabs. There's a lot more customization that's been done, see the lot more customization that's been done, see the `nvim/init.vim` file.
`nvim/init.vim` file.
* `alacritty` (`gui` in the AppImage, might be broken): Terminal which I use. * `alacritty`: Terminal GUI which I use. Yes, I always use a light-mode theme,
Yes, I always use a light-mode theme, because I work in well lit spaces because I work in well lit spaces generally. There's not much else to this.
generally. There's not much else to this.
* `awesome` (`wm` in the AppImage, almost definitely broken): My window manager. * `awesome`: My window manager. There's so much customization I couldn't begin
There's so much customization I couldn't begin to start. `Meta+Enter` should to start. `Meta+Enter` should open a terminal, where `Meta` is probably the
open a terminal, where `Meta` is probably the windows key on your keyboard. windows key on your keyboard.
# Status # Status
This configuration is still fairly new, and so expect it to be fairly broken. This configuration is still fairly new, and so expect it to be fairly broken.
I'll be updating it as I go though, so it should stabalize into something I'll be updating it as I go though, so it should stabalize into something
functional. functional. I don't test the AppImage build very much, it's more of a gimick,
but the shell and dev environment should work well from it at least.

View File

@ -69,62 +69,55 @@
]; ];
}; };
appimageEntrypoint = pkgs.writeScriptBin "mediocre-loadout" '' appimageEntrypoint = pkgs.writeScript "mediocre-loadout" ''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
cmd="$1"; shift; cmd="$1"; shift;
if [ "$cmd" = "editor" ]; then exec nvim "$@"; fi if [ "$cmd" = "nvim" ]; then exec nvim "$@"; fi
if [ "$cmd" = "shell" ]; then exec zsh "$@"; fi if [ "$cmd" = "zsh" ]; then exec zsh "$@"; fi
if [ "$cmd" = "gui" ]; then exec alacritty "$@"; fi if [ "$cmd" = "alacritty" ]; then exec alacritty "$@"; fi
if [ "$cmd" = "wm" ]; then exec awesome "$@"; fi if [ "$cmd" = "awesome" ]; then exec awesome "$@"; fi
echo "USAGE: $0 [editor|shell|gui|wm] [passthrough args...]" echo "USAGE: $0 [nvim|zsh|alacritty|awesome] [passthrough args...]"
exit 1 exit 1
''; '';
appimageIcon = pkgs.stdenv.mkDerivation { appimageDesktopFile = builtins.toFile "mediocre-loadout.desktop" ''
name = "mediocre-loadout-icon";
src = ./bonzi.png;
builder = builtins.toFile "builder.sh" ''
source $stdenv/setup
dir=share/icons/hicolor/256x256/apps
mkdir -p "$out"/$dir
cp $src "$out"/$dir/mediocre-loadout.png
'';
};
appimageDesktopFile = pkgs.writeTextDir "share/applications/mediocre-loadout.desktop" ''
[Desktop Entry] [Desktop Entry]
Name=Mediocre Loadout Name=Mediocre Loadout
Exec=mediocre-loadout gui Exec=mediocre-loadout alacritty
Icon=mediocre-loadout Icon=mediocre-loadout
Type=Application Type=Application
Categories=Utility; Categories=Utility;
''; '';
appimageTarget = pkgs.buildEnv { appdir = pkgs.stdenv.mkDerivation {
name = "mediocre-loadout-target";
paths = [
loadout
appimageEntrypoint
appimageIcon
appimageDesktopFile
];
};
appimageTargetFlat = pkgs.stdenv.mkDerivation {
name = "mediocre-loadout-target-flat"; name = "mediocre-loadout-target-flat";
src = appimageTarget;
inherit appimageEntrypoint appimageDesktopFile;
appimageIcon = ./bonzi.png;
src = loadout;
builder = builtins.toFile "builder.sh" '' builder = builtins.toFile "builder.sh" ''
source $stdenv/setup source $stdenv/setup
cp -rL "$src" "$out" cp -rL "$src" "$out"
chmod -R +w "$out"
rm -rf "$out"/share/applications/*
cp "$appimageDesktopFile" "$out"/share/applications/mediocre-loadout.desktop
cp "$appimageEntrypoint" "$out"/bin/mediocre-loadout
icondir=share/icons/hicolor/256x256/apps
mkdir -p "$out"/$icondir
cp "$appimageIcon" "$out"/$icondir/mediocre-loadout.png
''; '';
}; };
appimage = ((import ./appimage.nix) { pkgsSrc = pkgsSrc; }) { appimage = ((import ./appimage.nix) { pkgsSrc = pkgsSrc; }) {
name = "mediocre-loadout"; name = "mediocre-loadout";
target = appimageTargetFlat; target = appdir;
}; };
} }