Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 fetchurl,
3 google-chrome,
4 lib,
5 makeDesktopItem,
6 runtimeShell,
7 symlinkJoin,
8 writeScriptBin,
9
10 # command line arguments which are always set e.g "--disable-gpu"
11 commandLineArgs ? [ ],
12}:
13
14let
15 name = "netflix-via-google-chrome";
16
17 meta = {
18 description = "Open Netflix in Google Chrome app mode";
19 longDescription = ''
20 Netflix is a video streaming service providing films, TV series and exclusive content. See https://www.netflix.com.
21
22 This package installs an application launcher item that opens Netflix in a dedicated Google Chrome window. If your preferred browser doesn't support Netflix's DRM, this package provides a quick and easy way to launch Netflix on a supported browser, without polluting your application list with a redundant, single-purpose browser.
23 '';
24 homepage = google-chrome.meta.homepage or null;
25 license = lib.licenses.unfree;
26 maintainers = [ lib.maintainers.roberth ];
27 platforms = google-chrome.meta.platforms or lib.platforms.all;
28 };
29
30 desktopItem = makeDesktopItem {
31 inherit name;
32 # Executing by name as opposed to store path is conventional and prevents
33 # copies of the desktop file from bitrotting too much.
34 # (e.g. a copy in ~/.config/autostart, you lazy lazy bastard ;) )
35 exec = name;
36 icon = fetchurl {
37 name = "netflix-icon-2016.png";
38 url = "https://assets.nflxext.com/us/ffe/siteui/common/icons/nficon2016.png";
39 sha256 = "sha256-c0H3uLCuPA2krqVZ78MfC1PZ253SkWZP3PfWGP2V7Yo=";
40 meta.license = lib.licenses.unfree;
41 };
42 desktopName = "Netflix via Google Chrome";
43 genericName = "A video streaming service providing films and exclusive TV series";
44 categories = [
45 "TV"
46 "AudioVideo"
47 "Network"
48 ];
49 startupNotify = true;
50 };
51
52 script = writeScriptBin name ''
53 #!${runtimeShell}
54 exec ${google-chrome}/bin/${google-chrome.meta.mainProgram} ${lib.escapeShellArgs commandLineArgs} \
55 --app=https://netflix.com \
56 --no-first-run \
57 --no-default-browser-check \
58 --no-crash-upload \
59 "$@"
60 '';
61
62in
63
64symlinkJoin {
65 inherit name meta;
66 paths = [
67 script
68 desktopItem
69 ];
70}