Skip to content

Instantly share code, notes, and snippets.

@sheenobu
Created February 11, 2017 04:42
Show Gist options
  • Save sheenobu/809a9b8bbabe67c77dddfc8d96c20fda to your computer and use it in GitHub Desktop.
Save sheenobu/809a9b8bbabe67c77dddfc8d96c20fda to your computer and use it in GitHub Desktop.
Create a desktop entry for a webapp using Chromium --app and Nix
with import <nixpkgs> {};
let
webApp = { name, title, url }: stdenv.mkDerivation rec {
inherit name;
src = pkgs.writeText "src" ''
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=${title}
Exec=chromium --app=${url}
NoDisplay=false
StartupWMClass=${name}
'';
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/share/applications/
cat $src >> $out/share/applications/${name}.desktop
'';
};
in
{
packageOverrides = pkgs: {
litewrite = webApp {
name = "litewrite";
url = "https://litewrite.net";
title = "LiteWrite";
};
}
$ nix-env -i litewrite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment