diff options
author | worldofpeace <worldofpeace@protonmail.ch> | 2019-12-22 18:56:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-22 18:56:13 -0500 |
commit | 144973a7e0869681a767488176cf59c0a0223051 (patch) | |
tree | 4e825ee72d503d63ef3c32d159650cd62afd94b8 | |
parent | 6b10e48548d8affe989975451dffe0ce40b730a5 (diff) | |
parent | 2dd7d4dd4458bc79e566979c2fa299f22770efcb (diff) | |
download | nixpkgs-144973a7e0869681a767488176cf59c0a0223051.tar nixpkgs-144973a7e0869681a767488176cf59c0a0223051.tar.gz nixpkgs-144973a7e0869681a767488176cf59c0a0223051.tar.bz2 nixpkgs-144973a7e0869681a767488176cf59c0a0223051.tar.lz nixpkgs-144973a7e0869681a767488176cf59c0a0223051.tar.xz nixpkgs-144973a7e0869681a767488176cf59c0a0223051.tar.zst nixpkgs-144973a7e0869681a767488176cf59c0a0223051.zip |
Merge pull request #76192 from worldofpeace/pantheon-update-script
Pantheon update script
29 files changed, 241 insertions, 18 deletions
diff --git a/pkgs/applications/audio/vocal/default.nix b/pkgs/applications/audio/vocal/default.nix index c26d8b6d360..c928962c983 100644 --- a/pkgs/applications/audio/vocal/default.nix +++ b/pkgs/applications/audio/vocal/default.nix @@ -58,6 +58,13 @@ stdenv.mkDerivation rec { webkitgtk ]; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + + meta = with stdenv.lib; { description = "The podcast client for the modern free desktop"; longDescription = '' diff --git a/pkgs/applications/editors/quilter/default.nix b/pkgs/applications/editors/quilter/default.nix index d9c3bd0825d..61145e33cb1 100644 --- a/pkgs/applications/editors/quilter/default.nix +++ b/pkgs/applications/editors/quilter/default.nix @@ -39,6 +39,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Focus on your writing - designed for elementary OS"; homepage = https://github.com/lainsce/quilter; diff --git a/pkgs/applications/graphics/fondo/default.nix b/pkgs/applications/graphics/fondo/default.nix index e4dff59670a..3df7ba493c0 100644 --- a/pkgs/applications/graphics/fondo/default.nix +++ b/pkgs/applications/graphics/fondo/default.nix @@ -63,6 +63,13 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + + meta = with stdenv.lib; { description = "Find the most beautiful wallpapers for your desktop"; homepage = https://github.com/calo001/fondo; diff --git a/pkgs/applications/graphics/ideogram/default.nix b/pkgs/applications/graphics/ideogram/default.nix index 36afe8dd3e0..ba5ee230ce4 100644 --- a/pkgs/applications/graphics/ideogram/default.nix +++ b/pkgs/applications/graphics/ideogram/default.nix @@ -50,6 +50,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Insert emoji anywhere, even in non-native apps - designed for elementary OS"; homepage = https://github.com/cassidyjames/ideogram; diff --git a/pkgs/applications/misc/appeditor/default.nix b/pkgs/applications/misc/appeditor/default.nix index 68cd91c1676..cda75ac4c05 100644 --- a/pkgs/applications/misc/appeditor/default.nix +++ b/pkgs/applications/misc/appeditor/default.nix @@ -50,6 +50,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Edit the Pantheon desktop application menu"; homepage = https://github.com/donadigo/appeditor; diff --git a/pkgs/applications/misc/cipher/default.nix b/pkgs/applications/misc/cipher/default.nix index ef47e3e0358..9265724c7d1 100644 --- a/pkgs/applications/misc/cipher/default.nix +++ b/pkgs/applications/misc/cipher/default.nix @@ -48,6 +48,12 @@ stdenv.mkDerivation rec { patchShebangs post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "A simple application for encoding and decoding text, designed for elementary OS"; homepage = "https://github.com/arshubham/cipher"; diff --git a/pkgs/applications/misc/formatter/default.nix b/pkgs/applications/misc/formatter/default.nix index 26478c7f2ed..7cb1e7dfebb 100644 --- a/pkgs/applications/misc/formatter/default.nix +++ b/pkgs/applications/misc/formatter/default.nix @@ -61,6 +61,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "A simple formatter designed for elementary OS"; homepage = "https://github.com/Djaler/Formatter"; diff --git a/pkgs/applications/misc/notejot/default.nix b/pkgs/applications/misc/notejot/default.nix index da7775769d4..b91f8018c57 100644 --- a/pkgs/applications/misc/notejot/default.nix +++ b/pkgs/applications/misc/notejot/default.nix @@ -34,6 +34,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Stupidly-simple sticky notes applet"; homepage = https://github.com/lainsce/notejot; diff --git a/pkgs/applications/misc/sequeler/default.nix b/pkgs/applications/misc/sequeler/default.nix index 4f8315f060a..4199e198c53 100644 --- a/pkgs/applications/misc/sequeler/default.nix +++ b/pkgs/applications/misc/sequeler/default.nix @@ -29,6 +29,12 @@ in stdenv.mkDerivation rec { patchShebangs build-aux/meson_post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Friendly SQL Client"; longDescription = '' diff --git a/pkgs/applications/misc/tootle/default.nix b/pkgs/applications/misc/tootle/default.nix index 15c675c902f..e619ab053e7 100644 --- a/pkgs/applications/misc/tootle/default.nix +++ b/pkgs/applications/misc/tootle/default.nix @@ -62,6 +62,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Simple Mastodon client designed for elementary OS"; homepage = https://github.com/bleakgrey/tootle; diff --git a/pkgs/applications/networking/browsers/ephemeral/default.nix b/pkgs/applications/networking/browsers/ephemeral/default.nix index d5a1063a688..ce0617b8d3f 100644 --- a/pkgs/applications/networking/browsers/ephemeral/default.nix +++ b/pkgs/applications/networking/browsers/ephemeral/default.nix @@ -54,6 +54,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "The always-incognito web browser"; homepage = https://github.com/cassidyjames/ephemeral; diff --git a/pkgs/applications/networking/feedreaders/feedreader/default.nix b/pkgs/applications/networking/feedreaders/feedreader/default.nix index 350e96a94a7..c336d2d0bba 100644 --- a/pkgs/applications/networking/feedreaders/feedreader/default.nix +++ b/pkgs/applications/networking/feedreaders/feedreader/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchFromGitHub, meson, ninja, pkgconfig, vala, gettext, python3 , appstream-glib, desktop-file-utils, wrapGAppsHook, gnome-online-accounts, fetchpatch -, gtk3, libgee, libpeas, librest, webkitgtk, gsettings-desktop-schemas +, gtk3, libgee, libpeas, librest, webkitgtk, gsettings-desktop-schemas, pantheon , curl, glib, gnome3, gst_all_1, json-glib, libnotify, libsecret, sqlite, gumbo, libxml2 }: @@ -40,6 +40,12 @@ stdenv.mkDerivation rec { }) ]; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "A modern desktop application designed to complement existing web-based RSS accounts"; homepage = https://jangernert.github.io/FeedReader/; diff --git a/pkgs/applications/networking/ftp/taxi/default.nix b/pkgs/applications/networking/ftp/taxi/default.nix index b18809f21be..cb40c347e1c 100644 --- a/pkgs/applications/networking/ftp/taxi/default.nix +++ b/pkgs/applications/networking/ftp/taxi/default.nix @@ -35,6 +35,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "The FTP Client that drives you anywhere"; homepage = https://github.com/Alecaddd/taxi; diff --git a/pkgs/applications/networking/p2p/torrential/default.nix b/pkgs/applications/networking/p2p/torrential/default.nix index 0ca5402d6da..01da8a63374 100644 --- a/pkgs/applications/networking/p2p/torrential/default.nix +++ b/pkgs/applications/networking/p2p/torrential/default.nix @@ -50,6 +50,12 @@ stdenv.mkDerivation rec { pantheon.granite ]; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Download torrents in style with this speedy, minimalist torrent client for elementary OS"; homepage = https://github.com/davidmhewitt/torrential; diff --git a/pkgs/applications/networking/ping/default.nix b/pkgs/applications/networking/ping/default.nix index 4d1d39a05c2..925618bbe99 100644 --- a/pkgs/applications/networking/ping/default.nix +++ b/pkgs/applications/networking/ping/default.nix @@ -49,6 +49,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "A helpful tool that lets you debug what part of your API is causing you issues"; homepage = https://github.com/jeremyvaartjes/ping; diff --git a/pkgs/applications/office/aesop/default.nix b/pkgs/applications/office/aesop/default.nix index 5bb66245328..5b166711693 100644 --- a/pkgs/applications/office/aesop/default.nix +++ b/pkgs/applications/office/aesop/default.nix @@ -46,6 +46,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "The simplest PDF viewer around"; homepage = https://github.com/lainsce/aesop; diff --git a/pkgs/applications/office/envelope/default.nix b/pkgs/applications/office/envelope/default.nix index 9142fff9a2c..bb85ae2e12b 100644 --- a/pkgs/applications/office/envelope/default.nix +++ b/pkgs/applications/office/envelope/default.nix @@ -64,6 +64,12 @@ stdenv.mkDerivation rec { patchShebangs data/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Personal finance manager for elementary OS"; homepage = "https://github.com/cjfloss/envelope"; diff --git a/pkgs/applications/office/notes-up/default.nix b/pkgs/applications/office/notes-up/default.nix index e7db27bdedc..6b8694a91d4 100644 --- a/pkgs/applications/office/notes-up/default.nix +++ b/pkgs/applications/office/notes-up/default.nix @@ -50,6 +50,12 @@ stdenv.mkDerivation rec { # Whether to build with contractor support (Pantheon specific) cmakeFlags = if withPantheon then null else [ "-Dnoele=yes" ]; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Markdown notes editor and manager designed for elementary OS" + stdenv.lib.optionalString withPantheon " - built with Contractor support"; diff --git a/pkgs/applications/office/spice-up/default.nix b/pkgs/applications/office/spice-up/default.nix index 6c09cc1de47..07a3b26a1a8 100644 --- a/pkgs/applications/office/spice-up/default.nix +++ b/pkgs/applications/office/spice-up/default.nix @@ -60,6 +60,12 @@ stdenv.mkDerivation rec { }) ]; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Create simple and beautiful presentations"; homepage = https://github.com/Philip-Scott/Spice-up; diff --git a/pkgs/applications/office/timetable/default.nix b/pkgs/applications/office/timetable/default.nix index bb13cae08f2..c652f765687 100644 --- a/pkgs/applications/office/timetable/default.nix +++ b/pkgs/applications/office/timetable/default.nix @@ -47,6 +47,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Plot out your own timetable for the week and organize it"; homepage = "https://github.com/lainsce/timetable"; diff --git a/pkgs/data/themes/adwaita-qt/default.nix b/pkgs/data/themes/adwaita-qt/default.nix index 16ccee8540b..7428b5fab2f 100644 --- a/pkgs/data/themes/adwaita-qt/default.nix +++ b/pkgs/data/themes/adwaita-qt/default.nix @@ -1,4 +1,4 @@ -{ mkDerivation, lib, fetchFromGitHub, cmake, ninja, qtbase }: +{ mkDerivation, lib, fetchFromGitHub, cmake, ninja, qtbase, pantheon }: mkDerivation rec { pname = "adwaita-qt"; @@ -26,6 +26,12 @@ mkDerivation rec { --replace "DESTINATION \"\''${QT_PLUGINS_DIR}/styles" "DESTINATION \"$qtPluginPrefix/styles" ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with lib; { description = "A style to bend Qt applications to look like they belong into GNOME Shell"; homepage = https://github.com/FedoraQt/adwaita-qt; diff --git a/pkgs/desktops/pantheon/nixpkgs_github_update/lib/nixpkgs_github_update/github_latest_version.ex b/pkgs/desktops/pantheon/nixpkgs_github_update/lib/nixpkgs_github_update/github_latest_version.ex index 76dcc2d6997..bd4bb8100ba 100644 --- a/pkgs/desktops/pantheon/nixpkgs_github_update/lib/nixpkgs_github_update/github_latest_version.ex +++ b/pkgs/desktops/pantheon/nixpkgs_github_update/lib/nixpkgs_github_update/github_latest_version.ex @@ -3,15 +3,9 @@ defmodule NixpkgsGitHubUpdate.GitHubLatestVersion do def fetch({owner, repo}) do endpoint = releases_endpoint(owner, repo) + headers = construct_headers() - oauth_token = String.to_charlist("#{System.get_env("OAUTH_TOKEN")}") - - headers = %{ - 'User-Agent' => @user_agent, - 'Authorization' => 'token #{oauth_token}' - } - - :httpc.request(:get, {endpoint, Map.to_list(headers)}, [], []) + :httpc.request(:get, {endpoint, headers}, [], []) |> handle_response end @@ -19,6 +13,23 @@ defmodule NixpkgsGitHubUpdate.GitHubLatestVersion do 'https://api.github.com/repos/#{owner}/#{repo}/releases/latest' end + def construct_headers do + headers = %{'User-Agent' => @user_agent} + + put_token(headers, get_token()) + |> Map.to_list + end + + defp get_token do + String.to_charlist("#{System.get_env("OAUTH_TOKEN")}") + end + + defp put_token(headers, token) when is_binary(token) do + Map.put_new(headers, 'Authorization', 'token #{token}') + end + + defp put_token(headers, _), do: headers + def handle_response({_, {{_httpv, status_code, _}, _headers, response}}) do { status_code |> check_for_error(), diff --git a/pkgs/desktops/pantheon/nixpkgs_github_update/lib/nixpkgs_github_update/nix.ex b/pkgs/desktops/pantheon/nixpkgs_github_update/lib/nixpkgs_github_update/nix.ex index 713badf770b..d5d9af84a6b 100644 --- a/pkgs/desktops/pantheon/nixpkgs_github_update/lib/nixpkgs_github_update/nix.ex +++ b/pkgs/desktops/pantheon/nixpkgs_github_update/lib/nixpkgs_github_update/nix.ex @@ -2,7 +2,7 @@ defmodule NixpkgsGitHubUpdate.Nix do def executable do nix = System.find_executable("nix") - if nil === nix do + if nix == nil do raise RuntimeError, message: "missing executable for 'nix'" end @@ -22,19 +22,29 @@ defmodule NixpkgsGitHubUpdate.Nix do |> handle_eval end - def handle_eval({eval_result, 0}) do + defp handle_eval({eval_result, 0}) do case eval_result do "" -> eval_result _ -> Poison.Parser.parse!(eval_result, %{}) end end - def handle_eval({eval_result, _}) do - IO.puts("Error running nix eval: #{eval_result}") + defp handle_eval({eval_result, _}) do + raise RuntimeError, message: "Error running nix eval: #{eval_result}" end def attribute_exists?(attribute) do - eval!("(with import <nixpkgs> {}; lib.isDerivation #{attribute})") + attr_exist_expression = """ + with import <nixpkgs> {}; + + let + attrSet = pkgs.lib.attrByPath (pkgs.lib.splitString "." "#{attribute}") null pkgs; + in + if attrSet == null then false + else true + """ + + eval!("(#{attr_exist_expression})") end def update_source_version(attribute, version) do @@ -45,9 +55,9 @@ defmodule NixpkgsGitHubUpdate.Nix do end def get_url_attr(attribute) do - case eval!("nixpkgs.#{attribute}.src.fetchSubmodules") do + case attribute_exists?("#{attribute}.src.fetchSubmodules") do true -> "url" - _ -> "urls" + false -> "urls" end end diff --git a/pkgs/desktops/pantheon/nixpkgs_github_update/test/nix_test.exs b/pkgs/desktops/pantheon/nixpkgs_github_update/test/nix_test.exs new file mode 100644 index 00000000000..c5a57698fed --- /dev/null +++ b/pkgs/desktops/pantheon/nixpkgs_github_update/test/nix_test.exs @@ -0,0 +1,49 @@ +defmodule NixTest do + @fake_package "asanotehhhuh" + @fetchgit_package "polybar" + @fetchgithub_package "notes-up" + + use ExUnit.Case + + import NixpkgsGitHubUpdate.Nix + + def check_for_nix(_context) do + try do + executable() + rescue + RuntimeError -> + IO.puts("You need Nix installed to run these tests.") + System.halt(127) + end + + :ok + end + + setup_all :check_for_nix + + describe "evaluation tests" do + test "evaluation handling" do + exists_attr = "nixpkgs.#{@fetchgithub_package}" + + assert is_binary(eval!(exists_attr)) == true + catch_error(eval!(@fake_package) == 1) + end + + # This should always be true or false + test "package exists?" do + assert attribute_exists?(@fetchgithub_package) == true + assert attribute_exists?(@fake_package) == false + end + end + + test "owner repo" do + assert get_url_attr(@fetchgit_package) == "url" + assert get_url_attr(@fetchgithub_package) == "urls" + + assert get_owner_repo(@fetchgit_package) == + {@fetchgit_package, @fetchgit_package} + + assert get_owner_repo(@fetchgithub_package) == + {"Philip-Scott", String.capitalize(@fetchgithub_package)} + end +end diff --git a/pkgs/desktops/pantheon/nixpkgs_github_update/test/test_helper.exs b/pkgs/desktops/pantheon/nixpkgs_github_update/test/test_helper.exs new file mode 100644 index 00000000000..869559e709e --- /dev/null +++ b/pkgs/desktops/pantheon/nixpkgs_github_update/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start() diff --git a/pkgs/development/libraries/qgnomeplatform/default.nix b/pkgs/development/libraries/qgnomeplatform/default.nix index 564fc70f2b9..3626e15cfc7 100644 --- a/pkgs/development/libraries/qgnomeplatform/default.nix +++ b/pkgs/development/libraries/qgnomeplatform/default.nix @@ -1,4 +1,4 @@ -{ mkDerivation, lib, fetchFromGitHub, pkgconfig, gtk3, qtbase, qmake, qtx11extras }: +{ mkDerivation, lib, fetchFromGitHub, pkgconfig, gtk3, qtbase, qmake, qtx11extras, pantheon }: mkDerivation rec { pname = "qgnomeplatform"; @@ -30,6 +30,12 @@ mkDerivation rec { --replace "\$\$[QT_INSTALL_PLUGINS]" "$out/$qtPluginPrefix" ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with lib; { description = "QPlatformTheme for a better Qt application inclusion in GNOME"; homepage = https://github.com/FedoraQt/QGnomePlatform; diff --git a/pkgs/misc/screensavers/light-locker/default.nix b/pkgs/misc/screensavers/light-locker/default.nix index e3d3b109d1a..9763949cf98 100644 --- a/pkgs/misc/screensavers/light-locker/default.nix +++ b/pkgs/misc/screensavers/light-locker/default.nix @@ -64,6 +64,12 @@ stdenv.mkDerivation rec { ${glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { homepage = https://github.com/the-cavalry/light-locker; description = "A simple session-locker for LightDM"; diff --git a/pkgs/tools/misc/hashit/default.nix b/pkgs/tools/misc/hashit/default.nix index 0315750c250..9a3ffe93510 100644 --- a/pkgs/tools/misc/hashit/default.nix +++ b/pkgs/tools/misc/hashit/default.nix @@ -33,6 +33,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "A simple app for checking usual checksums - Designed for elementary OS"; homepage = https://github.com/artemanufrij/hashit; diff --git a/pkgs/tools/text/snippetpixie/default.nix b/pkgs/tools/text/snippetpixie/default.nix index 276fb639205..585c183a81c 100644 --- a/pkgs/tools/text/snippetpixie/default.nix +++ b/pkgs/tools/text/snippetpixie/default.nix @@ -64,6 +64,12 @@ stdenv.mkDerivation rec { patchShebangs meson/post_install.py ''; + passthru = { + updateScript = pantheon.updateScript { + attrPath = pname; + }; + }; + meta = with stdenv.lib; { description = "Your little expandable text snippet helper"; longDescription = '' |