nix: improve plugin installation

This commit is contained in:
DashieTM 2024-06-03 14:30:54 +02:00
parent 93131a185a
commit f1ee049e17
12 changed files with 52 additions and 87 deletions

View file

@ -1 +1 @@
flake-profile-4-link
flake-profile-10-link

71
Cargo.lock generated
View file

@ -204,27 +204,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "directories-next"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc"
dependencies = [
"cfg-if",
"dirs-sys-next",
]
[[package]]
name = "dirs-sys-next"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [
"libc",
"redox_users",
"winapi",
]
[[package]]
name = "equivalent"
version = "1.0.1"
@ -396,17 +375,6 @@ dependencies = [
"system-deps",
]
[[package]]
name = "getrandom"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "gimli"
version = "0.28.1"
@ -744,16 +712,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags 2.5.0",
"libc",
]
[[package]]
name = "lock_api"
version = "0.4.11"
@ -968,19 +926,19 @@ dependencies = [
[[package]]
name = "re_set-lib"
version = "4.0.1"
version = "5.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06cb3803fff21953f1c17a685ae01e92b6b4d3231b99726d389520c48fbc1310"
checksum = "01fb110dc5087cdb0d8df799c3855c13e4ecb41f987e9691bf3d101c2dad1b3a"
dependencies = [
"dbus",
"dbus-crossroads",
"directories-next",
"gtk4",
"libloading",
"libpulse-binding",
"once_cell",
"serial_test",
"toml",
"xdg",
]
[[package]]
@ -992,20 +950,9 @@ dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_users"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891"
dependencies = [
"getrandom",
"libredox",
"thiserror",
]
[[package]]
name = "reset"
version = "1.2.0"
version = "1.2.1"
dependencies = [
"dbus",
"fork",
@ -1021,9 +968,9 @@ dependencies = [
[[package]]
name = "reset_daemon"
version = "1.4.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c9858fdb8b54d8d81a2e0c16f5f2f16837c627da54ea9f3e7a27a888c0ef1fa"
checksum = "e555b347b8b0b67081aeb570096338eae68a8db4b877661254ce17c59e5134dd"
dependencies = [
"crossbeam",
"dbus",
@ -1479,3 +1426,9 @@ checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352"
dependencies = [
"memchr",
]
[[package]]
name = "xdg"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546"

View file

@ -8,8 +8,8 @@ license = "GPL-3.0-or-later"
[dependencies]
reset_daemon = "1.5.0"
#re_set-lib = "5.0.0"
re_set-lib = { git = "https://github.com/Xetibo/ReSet-Lib" }
re_set-lib = "5.2.1"
# re_set-lib = { git = "https://github.com/Xetibo/ReSet-Lib" }
adw = { version = "0.6.0", package = "libadwaita", features = ["v1_4"] }
dbus = "0.9.7"
gtk = { version = "0.8.1", package = "gtk4", features = ["v4_12"] }

View file

@ -35,7 +35,7 @@
inputsFrom = builtins.attrValues self'.packages;
packages = with pkgs; [
# (rust-bin.selectLatestNightlyWith
# (toolchain: toolchain.default))
# (toolchain: toolchain.default))
rust-bin.nightly."2024-05-10".default
];
};

View file

@ -44,10 +44,9 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [
pkg-config
wrapGAppsHook4
# (rust-bin.selectLatestNightlyWith
# (toolchain: toolchain.default))
rust-bin.nightly."2024-05-10".default
];
copyLibs = true;
postInstall = ''
@ -55,6 +54,10 @@ rustPlatform.buildRustPackage rec {
install -D --mode=444 $src/src/resources/icons/ReSet.svg $out/share/pixmaps/ReSet.svg
'';
# test is broken in nix for some reason
doInstallCheck = false;
doCheck = false;
meta = with lib; {
description = "A wip universal Linux settings application.";
homepage = "https://github.com/Xetibo/ReSet";

View file

@ -26,7 +26,7 @@ in
config = {
plugins = mkOption {
type = with types; nullOr (listOf package);
type = with types; listOf package;
default = null;
description = mdDoc ''
List of plugins to use, represented as a list of packages.
@ -46,7 +46,7 @@ in
config =
let
fetchedPlugins =
if cfg.config.plugins == null
if cfg.config.plugins == [ ]
then [ ]
else
builtins.map
@ -55,19 +55,23 @@ in
then "lib${lib.replaceStrings ["-"] ["_"] entry.pname}.so"
else "")
cfg.config.plugins;
path =
if cfg.config.plugins == null
then ""
else
"${lib.lists.last cfg.config.plugins}/lib";
in
lib.mkIf cfg.enable {
home.packages = lib.optional (cfg.package != null) cfg.package;
lib.mkIf
cfg.enable
{
home.packages = lib.optional (cfg.package != null) cfg.package ++ cfg.config.plugins;
home.file = builtins.listToAttrs (builtins.map
(pkg: {
name = ".config/reset/plugins/lib${lib.replaceStrings ["-"] ["_"] pkg.pname}.so";
value = {
source = "${pkg}/lib/lib${lib.replaceStrings ["-"] ["_"] pkg.pname}.so";
};
})
cfg.config.plugins);
xdg.configFile."reset/ReSet.toml".source = (pkgs.formats.toml cfg.config.plugin_config).generate "reset"
{
plugins = fetchedPlugins;
plugin_path = path;
};
};
xdg.configFile."reset/ReSet.toml".source = (pkgs.formats.toml cfg.config.plugin_config).generate "reset"
{
plugins = fetchedPlugins;
};
};
}

View file

@ -21,6 +21,7 @@ use crate::components::utils::get_capabilities;
use crate::components::window::handle_sidebar_click::*;
use crate::components::window::reset_window_impl;
use crate::components::window::sidebar_entry::SidebarEntry;
use crate::VERSION;
use super::consts::{
AUDIO_SIDEBAR, BLUETOOTH_SIDEBAR, CONNECTIVITY_SIDEBAR, SINK_SIDEBAR, SOURCE_SIDEBAR,
@ -316,7 +317,7 @@ impl ReSetWindow {
.license_type(gtk::License::Gpl30)
.website("https://github.com/Xetibo/ReSet")
.issue_url("https://github.com/Xetibo/ReSet/issues")
.version("1.0.0")
.version(VERSION)
.transient_for(window)
.modal(true)
.copyright("© 2022-2023 Xetibo")

View file

@ -15,6 +15,10 @@ mod tests;
const APP_ID: &str = "org.Xetibo.ReSet";
/// Version of the current package.
/// Use this to avoid version mismatch conflicts.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[tokio::main]
async fn main() {
tokio::task::spawn(daemon_check());

View file

@ -39,6 +39,7 @@
<property name="hexpand">True</property>
<property name="hexpand-set">True</property>
<property name="icon-name">open-menu-symbolic</property>
<property name="menu-model">main_menu</property>
<property name="valign">end</property>
<property name="vexpand">True</property>
</object>

View file

@ -347,7 +347,7 @@
(3,33,"GtkMenuButton","can-shrink","True",None,None,None,None,None,None,None,None,None),
(3,33,"GtkMenuButton","has-frame","False",None,None,None,None,None,None,None,None,None),
(3,33,"GtkMenuButton","icon-name","open-menu-symbolic",None,None,None,None,None,None,None,None,None),
(3,33,"GtkMenuButton","menu-model",None,None,None,None,None,None,None,None,None,None),
(3,33,"GtkMenuButton","menu-model","54",None,None,None,None,None,None,None,None,None),
(3,33,"GtkWidget","halign","end",None,None,None,None,None,None,None,None,None),
(3,33,"GtkWidget","hexpand","True",None,None,None,None,None,None,None,None,None),
(3,33,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None),

View file

@ -1,12 +1,11 @@
use std::thread;
use std::time::Duration;
use re_set_lib::utils::plugin_setup::FRONTEND_PLUGINS;
use crate::daemon_check;
#[tokio::test]
#[cfg(test)]
async fn test_plugins() {
use crate::daemon_check;
use re_set_lib::utils::plugin::plugin_tests;
use re_set_lib::utils::plugin_setup::FRONTEND_PLUGINS;
use std::thread;
use std::time::Duration;
tokio::task::spawn(daemon_check());
thread::sleep(Duration::from_millis(2000));
unsafe {