Commit graph

130 commits

Author SHA1 Message Date
volth f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
volth ac6875d294 nixos/desktop-managers: let them work when 'services.xserver.enable = false'
they can be used by remote desktop software, without X11 running locally
2019-05-13 04:23:56 +00:00
Vladimír Čunát 11d204a9c4
nixos docs: improve GPU driver documentation
I'm not 100% sure about the incompatibility lines,
but I believe it's better to discourage these anyway.
If you find better information, feel free to amend...

The 32-bit thing is completely GPU-agnostic, so I can't see why we had
it separately for proprietary drivers and missing for the rest.
2019-03-22 14:31:17 +01:00
Silvan Mosberger 94411a4c08
nixos/xserver: Point to man page for options available in monitorConfig 2019-03-01 00:44:19 +01:00
Silvan Mosberger c0318efe9a
Merge pull request #50504 from symphorien/local-closureInfo
nixos: add preferLocalBuild=true; on derivations for config files and closureInfo
2019-02-22 20:53:17 +01:00
Symphorien Gibol a915b33315 nixos: add preferLocalBuild=true; on derivations for config files 2019-02-22 20:11:27 +01:00
Michael Raskin 95039d0668
nixos/xserver: drop intel from videoDrivers (#55583)
* nixos/xserver: drop intel from videoDrivers

* Some more notes about possible regressions
2019-02-21 09:42:11 +00:00
Vladimír Čunát 9108b24253
xorg: init xf86-video-vboxvideo at 1.0.0
... and switch to it by default in virtualbox guests
2018-11-12 20:29:14 +01:00
Maximilian Bosch e8fb77a944
Merge pull request #46152 from Ma27/fix-setxkbmap-completion
zsh: patch `_setxkbmap` completion script
2018-10-19 14:33:04 +02:00
Matthew Bauer 1ffe83caa7
Merge pull request #42846 from ambrop72/optimus-prime-config-master
nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME
2018-10-03 22:56:53 -05:00
Maximilian Bosch 18d461533b
zsh: patch _setxkbmap completion script
Instead of searching `/usr` it should search for the `xkb`,
$XDG_DATA_DIRS will be searched. With this approach we allow compliance
on NixOS and non-NixOS systems to find `symbols` in the `xkb` directory.

The patch has been accepted by upstream, but isn't released yet, so this
is mainly a temporary fix until we can bump ZSH to the next stable version.

The `xserver` module links `/share/X11/xkb` to `/run/current-system` to
make this possible.

The fix can be tested inside the following VM:

```
{
  zshtest = {
    programs.zsh.enable = true;
    users.extraUsers.vm = {
      password = "vm";
      isNormalUser = true;
    };
    services.xserver.enable = true;
  };
}
```

Fixes #46025
2018-09-20 12:54:34 +02:00
lassulus fc035da4a4 xserver.displayManager: change default
Switch from slim to lightdm as the display-manager.
    If plasma5 is used as desktop-manager use sdddm.
    If gnome3 is used as desktop-manager use gdm.

    Based on #12516
2018-08-31 17:57:39 +02:00
Michael Peyton Jones 13e2e19158
xdg: add modules for supporting various XDG specs 2018-08-16 21:23:34 +01:00
volth 2e979e8ceb [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
Ambroz Bizjak f26153754a nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME
This adds configuration options which automate the configuration of NVIDIA Optimus using PRIME. This allows using the NVIDIA proprietary driver on Optimus laptops, in order to render using the NVIDIA GPU while outputting to displays connected only to the integrated Intel GPU. It also adds an option for enabling kernel modesetting for the NVIDIA driver (via a kernel command line flag); this is particularly useful together with Optimus/PRIME because it fixes tearing on PRIME-connected screens.

The user still needs to enable the Optimus/PRIME feature and specify the bus IDs of the Intel and NVIDIA GPUs, but this is still much easier for users and more reliable. The implementation handles both the X configuration file as well as getting display managers to run certain necessary `xrandr` commands just after X has started.

Configuration of commands run after X startup is done using a new configuration option `services.xserver.displayManager.setupCommands`. Support for this option is implemented for LightDM, GDM and SDDM; all of these have been tested with this feature including logging into a Plasma session.

Note: support of `setupCommands` for GDM is implemented by making GDM run the session executable via a wrapper; the wrapper will run the `setupCommands` before execing. This seemed like the simplest and most reliable approach, and solves running these commands both for GDM's X server and user X servers (GDM starts separate X servers for itself and user sessions). An alternative approach would be with autostart files but that seems harder to set up and less reliable.

Note that some simple features for X configuration file generation (in `xserver.nix`) are added which are used in the implementation:
- `services.xserver.extraConfig`: Allows adding arbitrary new sections. This is used to add the Device section for the Intel GPU.
- `deviceSection` and `screenSection` within `services.xserver.drivers`. This allows the nvidia configuration module to add additional contents into the `Device` and `Screen` sections of the "nvidia" driver, and not into such sections for other drivers that may be enabled.
2018-07-09 18:46:13 +02:00
Jan Malakhovski b01ccbb899 nixos: xserver: add related packages 2018-06-13 16:25:10 +00:00
Jörg Thalheim 468f3ce0ed nixos/xserver: remove nvidiaLegacy173 from videoDrivers.examples
see 92265e807e (commitcomment-28773179)
2018-04-27 23:02:09 +01:00
Jan Malakhovski 92265e807e nixos: xserver: add related packages 2018-04-27 18:10:04 +01:00
Frederik Rietdijk 9d2ff98571 Merge remote-tracking branch 'upstream/master' into HEAD 2018-03-30 08:14:35 +02:00
Maximilian Bosch 5caa22fe0a Revert restrictive validation behavior for DM/WM defaults in the X module
The original idea behind this change (described in ticket #11064) was to
improve the assertions to avoid that users of the X server accidentally
forget to configure a DM or WM.

However this caused several issues with setups that require X, but no DM
or WM. The keymap testcases became instable as well as now disabling DMs
needs to be done explicitly.
(see https://github.com/NixOS/nixpkgs/pull/31268#issuecomment-347080036)

In the end the idea behind the change and #11064 was obviously a
mistake, so reverting it completely for now should be fine.
2018-03-28 20:34:05 +02:00
Nikolay Amiantov 4f0b59de9a xserver service: cleanup LD_LIBRARY_PATH
X libraries in LD_LIBRARY_PATH seem to not be needed anymore.
I've tracked this addition as far as I could
(02cef04c81) and they seem to be added for unfree
NVIDIA and ATI drivers but at least for NVIDIA they are not needed anymore. We
can add them with patchelf instead if it turns out to be the case with ATI.
2018-03-26 14:01:49 +03:00
Eelco Dolstra dddcd10ecc
Don't set 'config.xorg = {}'
This makes memoization of Nixpkgs evaluation less effective, since
some Nixpkgs invocations may have 'config = {}' while others may have
'config = { xorg = {}; }'.

Instead set 'config = {}'.
2018-01-11 19:31:05 +01:00
Jan Tojnar 1d868aa8de
nixos/xserver: Move the keyboard configuration to 00-keyboard.conf
localectl looks for keyboard settings in /X11/xorg.conf.d/00-keyboard.conf

Closes: #29959, #14318
2017-11-30 14:10:34 +01:00
Jan Tojnar c177b838df nixos/xserver: let X choose the xkb rules
With libinput used for keyboard, base rules produce incorrect keyboard
layouts. We are removing the option as recommended in the XKB configuration
guide [1] to let X server choose the ruleset. It looks like it chooses
evdev rules which seem to work for some reason

[1]: https://www.x.org/releases/X11R7.6/doc/xorg-docs/input/XKB-Config.html#id2521360
2017-11-25 10:27:31 +00:00
Maximilian Bosch 410f0f0db2
services.xserver: fix apply of default DM/WM
This is needed to pick the first enabled DM/WM
if the default is `none`
2017-11-07 12:18:24 +01:00
Maximilian Bosch 5b70c1855b
Revert "Revert "services.xserver: assert that either desktop- or window manager is not "none"""
This reverts commit e64dc25434.
2017-11-05 07:32:56 +01:00
Herwig Hochleitner e64dc25434 Revert "services.xserver: assert that either desktop- or window manager is not "none""
This reverts commit 93c54acf97.
This reopens #30517 @nbp @Ma27

Breaking people's config for this is hardly reasonable as is. If it
absolutely cannot be avoided, at the very least, we need to provide
clear instructions on what people need to upgrade in their config. I
actually had to bisect to the commit, to even find out what property I
should change or define, as the error message was useless. It didn't
even mention a property name.

Discussion on the PR seems to be ongoing, so I'm reverting this, so we
don't break people's systems on unstable.
2017-11-05 01:51:13 +01:00
Maximilian Bosch 93c54acf97 services.xserver: assert that either desktop- or window manager is not "none"
resolves #11064
2017-11-04 15:30:20 +01:00
Peter Hoeg 2cd4ebfe93 Revert "display-manager: systemd-udev-settle serves no purpose"
This reverts commit 3571163858.
2017-10-14 14:42:49 +08:00
Peter Hoeg 3571163858 display-manager: systemd-udev-settle serves no purpose 2017-10-14 14:38:04 +08:00
Rostislav Beneš 0cad98dde1
nixos/xserver,gdm: let GDM handle X server verbosity. 2017-09-28 00:18:57 +02:00
aszlig 6e5d2f8963
nixos/xserver: Properly validate XKB options
Checking the keyboard layout has been a long set of hurdles so far, with
several attempts. Originally, the checking was introduced by @lheckemann
in #23709.

The initial implementation just was trying to check whether the symbols/
directory contained the layout name.

Unfortunately, that wasn't enough and keyboard variants weren't
recognized, so if you set layout to eg. "dvorak" it will fail with an
error (#25526).

So my improvement on that was to use sed to filter rules/base.lst and
match the layout against that. I fucked up twice with this, first
because layout can be a comma-separated list which I didn't account for
and second because I ran into a Nix issue (NixOS/nix#1426).

After fixing this, it still wasn't enough (and this is btw. what
localectl also does), because we were *only* matching rules but not
symbols, so using "eu" as a layout won't work either.

I decided now it's the time to actually use libxkbcommon to try
compiling the keyboard options and see whether it succeeds. This comes
in the form of a helper tool called xkbvalidate.

IMHO this approach is a lot less error-prone and we can be sure that we
don't forget about anything because that's what the X server itself uses
to compile the keymap.

Another advantage of this is that we now validate the full set of XKB
options rather than just the layout.

Tested this against a variety of wrong and correct keyboard
configurations and against the "keymap" NixOS VM tests.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @lheckemann, @peti, @7c6f434c, @tohl, @vcunat, @lluchs
Fixes: #27597
2017-07-28 12:39:55 +02:00
zimbatm 4d545297d8 lib: introduce imap0, imap1 (#25543)
* lib: introduce imap0, imap1

For historical reasons, imap starts counting at 1 and it's not
consistent with the rest of the lib.

So for now we split imap into imap0 that starts counting at zero and
imap1 that starts counting at 1. And imap is marked as deprecated.

See c71e2d4235 (commitcomment-21873221)

* replace uses of lib.imap

* lib: move imap to deprecated.nix
2017-07-04 23:29:23 +01:00
aszlig 69da1807f0
nixos/xserver: Allow more than one keyboard layout
Regression introduced by 44c64fef16.

The services.xserver.layout option allows to specify more than one
layout separated by comma, which the commit above didn't take into
account.

This is very similar to @lheckemann's pull request (#26984) but differs
in the following ways:

  * Print out the full list available layouts (as suggested by @0xABAB
    in [1]).
  * Loop over $layout using the default IFS (and thus no need for
    escaping ${cfg.layout}), because the layouts won't contain white
    spaces.
  * Re-do the error message, which now uses multiple echos instead of a
    heredoc, so the line is wrapped according to the viewers terminal
    width.

I've tested this with several good and bad layouts and also against the
keymap NixOS VM subtests.

[1]: https://github.com/NixOS/nixpkgs/pull/26984#discussion_r125146700

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Fixes: #26961
Closes: #26984
2017-07-03 08:29:20 +02:00
aszlig d97cdfc591
nixos/xserver: Document the layouts sed expression
This was brought up by @0xABAB in #26984 by the following comment:

https://github.com/NixOS/nixpkgs/pull/26984#discussion_r125146405

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2017-07-03 08:29:16 +02:00
aszlig e82d126212
nixos/xserver: Don't use exec in xkb-layouts-exist
First of all, thanks to @pbogdan for getting this problem reproduced:

https://github.com/NixOS/nixpkgs/commit/2014db3efcd2a#commitcomment-22815396

Also thanks to @vcunat for bringing this to my attention:

https://github.com/NixOS/nixpkgs/commit/44c64fef16ed5#commitcomment-22813503

Although it is not entirely clear why Nix has killed the build prior to
finishing, it seems to be related to the process substition I was using.

So instead of using "exec touch", let's wrap this inside an if so we
don't exit too early.

Tested this against all sub-tests in nixos/tests/keymap.nix and also a
few configurations with wrong keyboard layout definitions.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2017-06-28 21:39:19 +02:00
Vladimír Čunát 2014db3efc
nixos xkb-layouts-exist: try to debug on Hydra
I hate having to do this.  We're unable to reproduce the problem locally.
2017-06-28 19:47:51 +02:00
aszlig 44c64fef16
nixos/xserver: Improve checking keyboard layout
Enumerating the symbols directory doesn't include variants, so we're now
basically doing what "localectl list-x11-keymap-layouts" does but we use
sed instead.

The reason I'm not using localectl directly is because the path to
rules/base.lst is hardcoded in the systemd source.

Of course, the XKB specification allows for much more complicated rules,
but at least this should cover the most basic ones including variants.

So the sed expression itself is just for listing the available layouts
and variants and we use a grep with -xF to match only full lines without
interpreting regular expressions.

This should again allow to set "dvorak" as the layout option.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @lheckemann
Fixes: #25526
2017-06-22 03:24:28 +02:00
aszlig 9dca737d62
Merge pull request #15353 (improve xrandrHeads)
When you have a setup consisting of multiple monitors, the default is
that the first monitor detected by xrandr is set to the primary monitor.

However this may not be the monitor you need to be set as primary. In
fact this monitor set to primary may in fact be disconnected.

This has happened for the original submitter of the pull request and it
affected these programs:

 * XMonad: Gets confused with Super + {w,e,r}
 * SDDM: Puts the login screen on the wrong monitor, and does not
         currently duplicate the login screen on all monitors
 * XMobar: Puts the XMobar on the wrong monitor, as it only puts the
           taskbar on the primary monitor

These changes should fix that not only by setting a primary monitor in
xrandrHeads but also make it possible to make a different monitor the
primary one.

The changes are also backwards-compatible.
2017-05-02 23:14:26 +02:00
aszlig 79e712822f
nixos/xserver: Document xrandrHeads.apply
It was asked by @CMCDragonkai to elaborate on that, so let's just do
this by actually providing a code comment.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2017-04-24 12:02:10 +02:00
aszlig 8266c89b55
nixos/xserver: Fix up/refactor xrandrHeads option
Using invalid module options in the submodule isn't very nice, because
it doesn't give very useful errors in case of type mismatch, also we
don't get descriptions of these options as they're effecively
nonexistent to the module system. Another downside of this is that
merging of these options isn't done correctly as well (eg. for
types.lines).

So we now have proper submodules for each xrandrHead and we also use
corcedTo in the type of xrandrHeads so that we can populate the
submodule's "output" option in case a plain string is defined for a list
item.

Instead of silently skipping multiple primary heads, we now have an
assertion, which displays a message and aborts configuration evaluation
appropriately.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2017-04-24 11:22:55 +02:00
Roger Qiu bb6a5b079f nixos/xserver: Changed xrandrHeads to support corresponding monitor section configuration in Xorg 2017-04-21 22:01:29 +10:00
Linus Heckemann 79872b9e39 Document possibility of multiple keyboard layouts
In services.xserver.layout
2017-03-23 21:15:14 +00:00
Linus Heckemann c5c0459a60 xserver: check that selected layout exists
Fixes #5638
2017-03-23 21:02:38 +00:00
Jaka Hudoklin f5d81ed79b Merge pull request #20904 from offlinehacker/nixos/xserver/xpra
Add xpra display-manager
2017-03-05 01:32:23 +01:00
Vladimír Čunát 31eba21d1d
virtualbox: force xorg-server-1.18 for now
This is getting a little hacky, but hopefully it won't break anything.
2017-02-12 21:07:49 +01:00
Tristan Helmich 24f3abdafb
Revert "Make services.xserver.xkbDir conflict free when overriden."
This reverts commit 82bcfef109.

cc @nbp

Fixes #22290, #22352.

Signed-off-by: Franz Pletz <fpletz@fnordicwalking.de>
2017-02-01 22:37:04 +01:00
Nicolas B. Pierron 82bcfef109 Make services.xserver.xkbDir conflict free when overriden. 2017-01-29 12:24:31 +01:00
Jaka Hudoklin b72f8ccc5c xpra module: add xpra, as xserver display-manager 2016-12-04 22:38:10 +01:00
Joachim Fasting 6977b94e9b
Revert "xserverArgs fuckup"
This reverts commit c2922a9157.

See https://github.com/NixOS/nixpkgs/issues/19930

While the above commit is designed to allow GDM to work, it appears to
break other use cases.  In particular, it breaks tests involving X
usage (e.g., i3wm[1] and firefox[2]), which makes it difficult to assess
the impact of other changes and so hampers development of unrelated
features.

https://hydra.nixos.org/build/42852015
https://hydra.nixos.org/build/42851666
2016-10-28 19:30:12 +02:00