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

@ -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;
};
};
}