2019-06-16 20:59:06 +01:00
|
|
|
{ lib, runCommand, writeScriptBin, buildEnv
|
2019-09-04 17:13:50 +01:00
|
|
|
, python3Packages, perlPackages, runtimeShell
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 17:36:41 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
weechat:
|
|
|
|
|
|
|
|
let
|
|
|
|
wrapper = {
|
2019-04-14 15:44:56 +01:00
|
|
|
installManPages ? true
|
|
|
|
, configure ? { availablePlugins, ... }: { plugins = builtins.attrValues availablePlugins; }
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 17:36:41 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2018-12-15 03:50:31 +00:00
|
|
|
perlInterpreter = perlPackages.perl;
|
2018-12-05 15:18:27 +00:00
|
|
|
availablePlugins = let
|
|
|
|
simplePlugin = name: {pluginFile = "${weechat.${name}}/lib/weechat/plugins/${name}.so";};
|
|
|
|
in rec {
|
2019-08-08 16:34:44 +01:00
|
|
|
python = (simplePlugin "python") // {
|
|
|
|
extraEnv = ''
|
2019-09-04 17:13:50 +01:00
|
|
|
export PATH="${python3Packages.python}/bin:$PATH"
|
2019-08-08 16:34:44 +01:00
|
|
|
'';
|
2018-12-05 15:18:27 +00:00
|
|
|
withPackages = pkgsFun: (python // {
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 17:36:41 +01:00
|
|
|
extraEnv = ''
|
2019-09-04 17:13:50 +01:00
|
|
|
export PYTHONHOME="${python3Packages.python.withPackages pkgsFun}"
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 17:36:41 +01:00
|
|
|
'';
|
2018-12-05 15:18:27 +00:00
|
|
|
});
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 17:36:41 +01:00
|
|
|
};
|
2018-12-05 15:18:27 +00:00
|
|
|
perl = (simplePlugin "perl") // {
|
|
|
|
extraEnv = ''
|
|
|
|
export PATH="${perlInterpreter}/bin:$PATH"
|
|
|
|
'';
|
|
|
|
withPackages = pkgsFun: (perl // {
|
|
|
|
extraEnv = ''
|
|
|
|
${perl.extraEnv}
|
2018-12-15 03:50:31 +00:00
|
|
|
export PERL5LIB=${perlPackages.makeFullPerlPath (pkgsFun perlPackages)}
|
2018-12-05 15:18:27 +00:00
|
|
|
'';
|
|
|
|
});
|
|
|
|
};
|
|
|
|
tcl = simplePlugin "tcl";
|
|
|
|
ruby = simplePlugin "ruby";
|
|
|
|
guile = simplePlugin "guile";
|
|
|
|
lua = simplePlugin "lua";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = configure { inherit availablePlugins; };
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 17:36:41 +01:00
|
|
|
|
2018-12-05 15:18:27 +00:00
|
|
|
plugins = config.plugins or (builtins.attrValues availablePlugins);
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 17:36:41 +01:00
|
|
|
|
|
|
|
pluginsDir = runCommand "weechat-plugins" {} ''
|
|
|
|
mkdir -p $out/plugins
|
|
|
|
for plugin in ${lib.concatMapStringsSep " " (p: p.pluginFile) plugins} ; do
|
|
|
|
ln -s $plugin $out/plugins
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2018-12-05 15:18:27 +00:00
|
|
|
init = let
|
|
|
|
init = builtins.replaceStrings [ "\n" ] [ ";" ] (config.init or "");
|
|
|
|
|
2019-08-05 12:03:38 +01:00
|
|
|
mkScript = drv: lib.forEach drv.scripts (script: "/script load ${drv}/share/${script}");
|
2018-12-05 15:18:27 +00:00
|
|
|
|
|
|
|
scripts = builtins.concatStringsSep ";" (lib.foldl (scripts: drv: scripts ++ mkScript drv)
|
|
|
|
[ ] (config.scripts or []));
|
|
|
|
in "${scripts};${init}";
|
|
|
|
|
|
|
|
mkWeechat = bin: (writeScriptBin bin ''
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2018-12-05 15:18:27 +00:00
|
|
|
export WEECHAT_EXTRA_LIBDIR=${pluginsDir}
|
|
|
|
${lib.concatMapStringsSep "\n" (p: lib.optionalString (p ? extraEnv) p.extraEnv) plugins}
|
|
|
|
exec ${weechat}/bin/${bin} "$@" --run-command ${lib.escapeShellArg init}
|
|
|
|
'') // {
|
2019-04-14 15:44:56 +01:00
|
|
|
inherit (weechat) name man;
|
2018-12-05 15:18:27 +00:00
|
|
|
unwrapped = weechat;
|
2019-04-14 15:44:56 +01:00
|
|
|
outputs = [ "out" "man" ];
|
2018-12-05 15:18:27 +00:00
|
|
|
};
|
|
|
|
in buildEnv {
|
|
|
|
name = "weechat-bin-env-${weechat.version}";
|
2019-04-14 15:44:56 +01:00
|
|
|
extraOutputsToInstall = lib.optionals installManPages [ "man" ];
|
2018-12-05 15:18:27 +00:00
|
|
|
paths = [
|
|
|
|
(mkWeechat "weechat")
|
|
|
|
(mkWeechat "weechat-headless")
|
2019-04-14 15:44:56 +01:00
|
|
|
(runCommand "weechat-out-except-bin" { } ''
|
|
|
|
mkdir $out
|
|
|
|
ln -sf ${weechat}/include $out/include
|
|
|
|
ln -sf ${weechat}/lib $out/lib
|
|
|
|
ln -sf ${weechat}/share $out/share
|
|
|
|
'')
|
2018-12-05 15:18:27 +00:00
|
|
|
];
|
2019-01-31 19:23:17 +00:00
|
|
|
meta = builtins.removeAttrs weechat.meta [ "outputsToInstall" ];
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 17:36:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in lib.makeOverridable wrapper
|