Hi everyone,
I am trying to run Xorg installed via nix
on Ubuntu. Before I dive
into details, maybe someone has experience in running Xorg on Ubuntu?
A link to working environment configuration would be great! I have
seen various configurations for NixOS, but hard to translate them on
non-NixOS.
The machine I am working on is ThinkPad T14s, I have already installed
Xorg with Xinit and managed to fix all obvious errors in Xorg logs
(mostly related to OpenGL issues). But whenever I startx
, keyboard
and mouse stops working, so it’s pretty much unusable.
I have installed multi-user nix on a fresh installation Ubuntu Server
21.04. Then I’ve installed nixUnstable
(because I manage my
environment with home-manager
and flakes).
My flakes.nix
is straight-forward:
{
description = "d12frosted systems configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home.url = "github:nix-community/home-manager";
emacs-overlay.url = "github:nix-community/emacs-overlay";
# Follows
home.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, home, emacs-overlay }:
let
overlays = [
emacs-overlay.overlay
(import ./nix/overlays)
];
in {
homeConfigurations = {
d12frosted = home.lib.homeManagerConfiguration {
configuration = { pkgs, lib, config, ... }: {
imports = [ ./nix/home.nix ];
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = overlays;
};
system = "x86_64-linux";
homeDirectory = "/home/d12frosted";
username = "d12frosted";
};
};
};
}
And nix/home.nix
:
let
# some irrelevant constants
in {
home = {
packages = pkgs.callPackage ./packages.nix {};
# ... many irrelevant configurations (xdg, git, gpg, etc.)
xsession = {
enable = true;
windowManager = {
xmonad = {
enable = true;
enableContribAndExtras = true;
};
};
};
};
}
My packages look like this:
{ pkgs, lib, stdenv, ... }:
with pkgs;
let exe = haskell.lib.justStaticExecutables;
in [
# common utilities
] ++ lib.optionals stdenv.isDarwin [
# mac-only packages
] ++ lib.optionals stdenv.isLinux [
xorg.xauth
xorg.xclock
# it feels like many of them are not needed, tried selecting only one of them
xorg.xf86inputevdev
# xorg.xf86inputlibinput # tried enabling
xorg.xf86inputsynaptics
# xorg.xf86videoati # tried enabling
# xorg.xf86videofbdev # tried enablig
xorg.xf86videointel
# xorg.xf86videonouveau # tried enabling
# xorg.xf86videovesa # tried enabling
xorg.xinit
xorg.xkill
xorg.xorgserver
xorg.xrandr
xorg.xrdb
xorg.xsetroot
xterm
]
Now, I build/assemble it using the following steps:
$ cd $XDG_CONFIG_HOME
$ nix build \
--experimental-features 'nix-command flakes' \
./#homeConfigurations.d12frosted.activationPackage
$ ./result/activate switch
All good. I tried calling startx
without any custom xinitrc
and I
saw 3 (I suspect) xterm
windows and could not select any of them nor
type anywhere, my mouse cursor was frozen. Had to restart. By checking
Xorg
logs at ~/.local/share/xorg/Xorg.0.log
I figured that it
struggles to load some OpenGL libraries, so I found
GitHub - guibou/nixGL: A wrapper tool for nix OpenGL application. After I installed nixGLDefault
, I
tried to start my x-es like this:
nixGL startx
I’ve got the same state, 3 xterm
windows and locked input. I checked
logs again, and the only errors I see now are:
(EE) Failed to load module "intel" (module does not exist, 0)
...
(EE) Failed to load module "fbdev" (module does not exist, 0)
...
(EE) Failed to load module "vesa" (module does not exist, 0)
...
(EE) modset(0): eglGetDisplay() failed
(EE) modset(0): glamor initialization failed
Now I think that I simply missing something obvious. I am new to all
this stuff, so apologies if I missed something, just let me know if
you need more information. And thank you in for reading this long
post.
Any help would be appreciated!