cinnamon.nemo-with-extensions: init

This commit is contained in:
Bobby Rong 2022-12-19 17:39:42 +08:00
parent 5cc5f394d7
commit f60da05d0b
No known key found for this signature in database
4 changed files with 90 additions and 2 deletions

View file

@ -12,6 +12,10 @@ lib.makeScope pkgs.newScope (self: with self; {
installPhase = "mv svg $out/share/iso-flags-svg";
});
# Extensions added here will be shipped by default
nemoExtensions = [
];
# blueberry -> pkgs/tools/bluetooth/blueberry/default.nix
bulky = callPackage ./bulky { };
cinnamon-common = callPackage ./cinnamon-common { };
@ -25,6 +29,7 @@ lib.makeScope pkgs.newScope (self: with self; {
cinnamon-settings-daemon = callPackage ./cinnamon-settings-daemon { };
cjs = callPackage ./cjs { };
nemo = callPackage ./nemo { };
nemo-with-extensions = callPackage ./nemo/wrapper.nix { };
mint-artwork = callPackage ./mint-artwork { };
mint-cursor-themes = callPackage ./mint-cursor-themes { };
mint-themes = callPackage ./mint-themes { };

View file

@ -25,8 +25,6 @@ stdenv.mkDerivation rec {
pname = "nemo";
version = "5.6.1";
# TODO: add plugins support (see https://github.com/NixOS/nixpkgs/issues/78327)
src = fetchFromGitHub {
owner = "linuxmint";
repo = pname;
@ -35,6 +33,10 @@ stdenv.mkDerivation rec {
};
patches = [
# Load extensions from NEMO_EXTENSION_DIR environment variable
# https://github.com/NixOS/nixpkgs/issues/78327
./load-extensions-from-env.patch
# Don't populate nemo actions from /run/current-system/sw/share
# They should only be loaded exactly once from $out/share
# https://github.com/NixOS/nixpkgs/issues/190781
@ -70,12 +72,16 @@ stdenv.mkDerivation rec {
"--localedir=${cinnamon-translations}/share/locale"
];
# Taken from libnemo-extension.pc.
passthru.extensiondir = "lib/nemo/extensions-3.0";
meta = with lib; {
homepage = "https://github.com/linuxmint/nemo";
description = "File browser for Cinnamon";
license = [ licenses.gpl2 licenses.lgpl2 ];
platforms = platforms.linux;
maintainers = teams.cinnamon.members;
mainProgram = "nemo";
};
}

View file

@ -0,0 +1,40 @@
diff --git a/libnemo-private/nemo-module.c b/libnemo-private/nemo-module.c
index 92bcff5..ecadcd8 100644
--- a/libnemo-private/nemo-module.c
+++ b/libnemo-private/nemo-module.c
@@ -209,11 +209,16 @@ void
nemo_module_setup (void)
{
static gboolean initialized = FALSE;
+ const gchar *extensiondir = NULL;
if (!initialized) {
initialized = TRUE;
- load_module_dir (NEMO_EXTENSIONDIR);
+ extensiondir = g_getenv ("NEMO_EXTENSION_DIR");
+ if (extensiondir == NULL) {
+ extensiondir = NEMO_EXTENSIONDIR;
+ }
+ load_module_dir (extensiondir);
eel_debug_call_at_shutdown (free_module_objects);
}
diff --git a/src/nemo-extensions-list.c b/src/nemo-extensions-list.c
index 944fc5f..983c396 100644
--- a/src/nemo-extensions-list.c
+++ b/src/nemo-extensions-list.c
@@ -129,7 +129,12 @@ module_get_extensions_for_type (GType type)
int
main (int argc, char *argv[])
{
- populate_from_directory (NEMO_EXTENSIONDIR);
+ const gchar *extensiondir = NULL;
+ extensiondir = g_getenv ("NEMO_EXTENSION_DIR");
+ if (extensiondir == NULL) {
+ extensiondir = NEMO_EXTENSIONDIR;
+ }
+ populate_from_directory (extensiondir);
GList *nd_providers;
GList *l;

View file

@ -0,0 +1,37 @@
{ symlinkJoin
, lib
, makeWrapper
, nemo
, nemoExtensions
, extensions ? [ ]
, useDefaultExtensions ? true
}:
let
selectedExtensions = extensions ++ (lib.optionals useDefaultExtensions nemoExtensions);
in
symlinkJoin {
name = "nemo-with-extensions-${nemo.version}";
paths = [ nemo ] ++ selectedExtensions;
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
for f in $(find $out/bin/ $out/libexec/ -type l -not -path "*/.*"); do
wrapProgram "$f" \
--set "NEMO_EXTENSION_DIR" "$out/${nemo.extensiondir}"
done
# Point to wrapped binary in all service files
for file in "share/dbus-1/services/nemo.FileManager1.service" \
"share/dbus-1/services/nemo.service"
do
rm "$out/$file"
substitute "${nemo}/$file" "$out/$file" \
--replace "${nemo}" "$out"
done
'';
inherit (nemo) meta;
}