XMonad: enable configured recompile#155478
Conversation
Commit 9a5b5d9 added Haskell dependencies (GHC and packages) to the xmonad binary's environment even if xmonad had been preconfigured (via the "config" option). The intent was to enable one-off recompiling using a local config file (e.g. ~/.config/xmonad/xmonad.hs), so the user can get quick feedback while developing their config. While this works, it may not be a common use-case, and it requires some careful crafting in xmonad.hs itself. On top of that, it significantly increases the size of the closure. Given all that, commit b69d9d3 removed GHC and packages from the binary's environment. But there are still those among us who want to be able to recompile from a preconfigured xmonad, so let's provide a way to opt-into configured recompilation.
|
Would it be possible to test this in |
|
code looks good, old behavior seems to be still ok. an addition to the test would be nice thought |
|
@Synthetica9 @Lassulus Thanks, I'll take a look at adding tests. I haven't written nixos tests before, so I'm referencing |
|
I guess you can just extend https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/xmonad.nix to have the new option enabled and create a xmonad.hs in the correct location, recompile it and check if the new version was compiled/applied |
Update the example config to show a working example for xmonad 0.17.0, which added an argument to the `launch` function and adjusted the location of the recompiled binary.
Add test coverage for the enableConfiguredRecompile option, checking
that we can compile and exec a new xmonad from a user's local config, as
well as restart the originally configured xmonad.
As I needed a reliable way to wait for recompilation to finish before
proceeding with subsequent test steps, I adjusted the startup behavior
to write a file ("oldXMonad" or "newXMonad") to /etc upon startup, and
replaced some "sleep" calls with "wait_for_file".
90090b6 to
44af29e
Compare
|
alright, the test ran on my system, and instead of sleeping we wait for xmonad to touch files which seems more robust. |
|
I hope these |
@Synthetica9 Good point. I'll make a followup PR to clean these |
Motivation for this change
The NixOS xmonad module builds an
xmonadbinary that's not capable of recompiling xmonad with a local config (e.g. ~/.config/xmonad/xmonad.hs) if the module'sconfigoption was set. That capability is useful when trying out changes to your config, but since it increases the closure size, it should be opt-in.Add a new module option,
enableConfiguredRecompile, to opt into including the necessary Haskell dependencies in the binary's environment, even if theconfigoption was set (they're already included if it was not set, to allow xmonad to recompile using an xmonad config not managed by nixos).This behavior was previously added unconditionally (#107696), and later removed (#143886) due to its affect on closure size and the reasonable argument that it's not a common enough use-case.
Additionally, the example config will not work with XMonad 0.17.0. Provide an example of how to configure 0.17.0
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes