Created
February 11, 2017 04:42
-
-
Save sheenobu/809a9b8bbabe67c77dddfc8d96c20fda to your computer and use it in GitHub Desktop.
Create a desktop entry for a webapp using Chromium --app and Nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nix-env -i litewrite |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment