From 9c15267ba6d3a40178344132f4afed0c30c1f958 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 2 Dec 2021 21:44:37 +0800 Subject: [PATCH] init: pop-launcher at 1.1.0 --- pkgs/default.nix | 1 + pkgs/pop-launcher.nix | 52 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 pkgs/pop-launcher.nix diff --git a/pkgs/default.nix b/pkgs/default.nix index d036c7a0..5f96a62b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -4,5 +4,6 @@ doggo = pkgs.callPackage ./doggo.nix { }; gnome-shell-extension-pop-shell = pkgs.callPackage ./gnome-shell-extension-pop-shell.nix { }; libcs50 = pkgs.callPackage ./libcs50.nix { }; + pop-launcher = pkgs.callPackage ./pop-launcher.nix { }; tic-80 = pkgs.callPackage ./tic-80.nix { }; } diff --git a/pkgs/pop-launcher.nix b/pkgs/pop-launcher.nix new file mode 100644 index 00000000..08e1d2bf --- /dev/null +++ b/pkgs/pop-launcher.nix @@ -0,0 +1,52 @@ +{ lib, fetchFromGitHub, rustPlatform, pkg-config, openssl, gtk3 }: + +let + distributionPluginPath = "$out/lib/pop-launcher"; +in +rustPlatform.buildRustPackage rec { + pname = "pop-launcher"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "pop-os"; + repo = "launcher"; + rev = version; + sha256 = "sha256-I713Er96ONt7L0LLzemNtc/qpy+RBaAuNF7SU+FG8LA="; + }; + + cargoBuildFlags = [ "-p" "pop-launcher-bin" ]; + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ openssl gtk3 ]; + + # Replace the distribution plugins path since it is only usable with traditional Linux distros. + prePatchPhase = '' + substituteInPlace src/lib.rs --replace "/usr/lib/pop-launcher" "${distributionPluginPath}" + substituteInPlace plugins/src/scripts/mod.rs --replace "/usr/lib/pop-launcher/scripts" "${distributionPluginPath}/scripts" + ''; + + # Installing and configuring the built-in plugins. + postInstall = '' + # Clean up the name. + mv $out/bin/pop-launcher{-bin,} + + # Configure the built-in plugins properly. + for plugin in plugins/src/*; do + plugin_name=$(basename "$plugin") + plugin_path="${distributionPluginPath}/plugins/$plugin_name" + + # We are only after the plugins which are stored inside subdirectories. + [ -d $plugin ] || continue + + # Configure each built-in plugin with the plugin metadata file and the binary (which is also `pop-launcher`). + mkdir -p "$plugin_path" && cp "$plugin/plugin.ron" "$plugin_path" + ln -sf "$out/bin/pop-launcher" "$plugin_path/$plugin_name" + done + ''; + + cargoSha256 = "sha256-swkQAja+t/yz5TFq5omskP7e/OVaHK7/a6TFuP+T/VY="; + meta = with lib; { + description = "Modular IPC-based desktop launcher service"; + homepage = "https://github.com/pop-os/launcher"; + license = licenses.gpl3; + }; +}