Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/weechat: backport to 18.09 #46861

Closed
wants to merge 7 commits into from
Closed

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Sep 18, 2018

Motivation for this change

This backports my weechat enhancements to 18.09. It allows users to declaratively specify scripts and configuration in weechat.override. Additionally adds a module which runs weechat in a screen session which is useful when running weechat on a different server for IRC persistence.

I'm using these changes on top of release-18.09 since original the PR was merged. This PR adds a new module and doesn't break current weechat package configurations. Please refer to #45728 for the initial discussion regarding the changes and the backport.

/cc @samueldr

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

lukateras and others added 6 commits September 18, 2018 21:59
This aims to make the `weechat` package even more configurable. It
allows to specify scripts and commands using the `configure` function
inside a `weechat.override` expression.

The package can be configured like this:

```
with import <nixpkgs> { };
weechat.override {
  plugins = { availablePlugins, ... }: {
    plugins = builtins.attrValues availablePlugins;

    init = ''
      /set foo bar
      /server add freenode chat.freenode.org
    '';

    scripts = [ "/path/to/script.py" ];
  };
}
```

All commands are passed to `weechat --run-command "/set foo bar;/server ..."`.

The `plugins' attribute is not necessarily required anymore, if it's
sufficient to add `init' commands, the `plugins' will be
`builtins.attrValues availablePlugins' by default.

Additionally the result contains `weechat` and `weechat-headless`
(introduced in WeeChat 2.1) now.
This adds several improvements the previously introduced
`services.weechat` module:

* Dropped `services.weechat.init` as the initialization script can now
  be done on package-level since 2af41719bc using the `configure`
  function.

* Added `sessionName` option to explicitly configure a name for the
  `screen` session (by default: weechat-screen).

* Added `binary` option to configure the binary name (e.g.
  `weechat-headless`).

* Added docs regarding `screen` session and `weechat.service`.
In my previous PR I missed that ${sec.foobar} (syntax to retrieve
secrets in a weechat runtime) breaks the shell evaluation.

Furthermore `;` shall be used rather than `\n` to concat scripts and the
init config.
Loading olm.lua as weechat script with `/script load olm.lua' causes
errors like this:

```
/nix/store/43jbh7yxh8j4gjfzbvpd9clncah5dip1-weechat-matrix-bridge-2018-05-29/lib/ffi.so: undefined symbol: lua_tointeger
```

As `olm.lua' is loaded by `matrix.lua' it doesn't need to be included
manually by the weechat configuration.
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: weechat

Partial log (click to expand)

strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/zw82zjjl1xfbamv040q9i5hhn26zs8fa-weechat-2.2-python/lib
patching script interpreter paths in /nix/store/zw82zjjl1xfbamv040q9i5hhn26zs8fa-weechat-2.2-python
checking for references to /build in /nix/store/zw82zjjl1xfbamv040q9i5hhn26zs8fa-weechat-2.2-python...
building '/nix/store/kb2298jb2r6gl85h0jscc1bzgnp06l8n-weechat-plugins.drv'...
building '/nix/store/ylnbn0aj0p7vj15jgymr3yp00zpsms95-weechat-headless.drv'...
building '/nix/store/iapskl5lrj5d48nv1piz2lr5ynm93kx1-weechat.drv'...
building '/nix/store/mfb91i5ga1x3956d12aqavcfryanfrhn-weechat-bin-env.drv'...
created 2 symlinks in user environment
/nix/store/0xbk1fsfw16msjscrpsrfsfix23gxs2b-weechat-bin-env

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: weechat

Partial log (click to expand)

strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/bmdyrm4l8hadkb0syyg5139s02qiaph6-weechat-2.2-python/lib
patching script interpreter paths in /nix/store/bmdyrm4l8hadkb0syyg5139s02qiaph6-weechat-2.2-python
checking for references to /build in /nix/store/bmdyrm4l8hadkb0syyg5139s02qiaph6-weechat-2.2-python...
building '/nix/store/l1mmzvrc6kjsn0bd42847m17hnpxpcgc-weechat-plugins.drv'...
building '/nix/store/rdr5am8p6v25gssc3h04vq5n8fqvf4xy-weechat-headless.drv'...
building '/nix/store/4l1gvr1l714l5k1y11m2hs19hc7i165p-weechat.drv'...
building '/nix/store/c9gc0lfq4qhl2kdk85369c6cbbf6ibd7-weechat-bin-env.drv'...
created 2 symlinks in user environment
/nix/store/8i8yr0lvrvwdjwd91dgp4clzq9ilmlmy-weechat-bin-env

@srhb
Copy link
Contributor

srhb commented Sep 22, 2018

If this gets into 18.09, #47164 is also needed in order to fix package metadata.

Currently the output from `nix search` and similar tools are lacking
important meta data
@Ma27
Copy link
Member Author

Ma27 commented Sep 22, 2018

@srhb thanks, fixed:)

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: weechat

Partial log (click to expand)

strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/gh4ia2xsy4i630skvk5byn3hwh1wfjpi-weechat-2.2-python/lib
patching script interpreter paths in /nix/store/gh4ia2xsy4i630skvk5byn3hwh1wfjpi-weechat-2.2-python
checking for references to /build in /nix/store/gh4ia2xsy4i630skvk5byn3hwh1wfjpi-weechat-2.2-python...
building '/nix/store/4pffml3a9s16qvyfnnddhpxqz6zdy699-weechat-plugins.drv'...
building '/nix/store/6b7a734mw7bp4wai898hp4rkfg79jlrm-weechat-headless.drv'...
building '/nix/store/c7ck2d36vm1li8z0llshy30h6d9gm4k9-weechat.drv'...
building '/nix/store/c2f3lfp8hpdv0dhnn5icziw0qs5chm4i-weechat-bin-env-2.2.drv'...
created 2 symlinks in user environment
/nix/store/3nasyjv4gd3mqzzga5pvif9x17zckzb1-weechat-bin-env-2.2

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: weechat

Partial log (click to expand)

strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/vlfqrprj8nz9zw1m71hb2pllhh1fcx9q-weechat-2.2-python/lib
patching script interpreter paths in /nix/store/vlfqrprj8nz9zw1m71hb2pllhh1fcx9q-weechat-2.2-python
checking for references to /build in /nix/store/vlfqrprj8nz9zw1m71hb2pllhh1fcx9q-weechat-2.2-python...
building '/nix/store/wfqvzyjqcv9prxnlclyw1zprrb0x7qb5-weechat-plugins.drv'...
building '/nix/store/xj7w4z9ldg4p5b211249na0231100wh4-weechat-headless.drv'...
building '/nix/store/f3z77mwrsdscywfrxwhsyc18w4qhxvqg-weechat.drv'...
building '/nix/store/hpvlny1q8hd3br6df0kl9rywhzzkg4pf-weechat-bin-env-2.2.drv'...
created 2 symlinks in user environment
/nix/store/6cfp0kmxpfb7qv4dqxwxscy5h50gr1k4-weechat-bin-env-2.2

@samueldr
Copy link
Member

Hmm, sorry to ask so much, but could you cherry-pick -x the commits?

No need to add an additional reason to the messages, here it's just for bookkeeping.

@vcunat vcunat self-assigned this Sep 23, 2018
vcunat added a commit that referenced this pull request Sep 23, 2018
Close #46861 - it's exactly the same commits, just with -x annotations.
@vcunat
Copy link
Member

vcunat commented Sep 23, 2018

Done as 317ce1b.

@vcunat vcunat closed this Sep 23, 2018
@Ma27 Ma27 deleted the backport-weechat branch September 23, 2018 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants