Skip to content

Instantly share code, notes, and snippets.

@jhilker98
Last active June 25, 2022 15:43
Show Gist options
  • Save jhilker98/05e4133b81750d46edf38d3933144874 to your computer and use it in GitHub Desktop.
Save jhilker98/05e4133b81750d46edf38d3933144874 to your computer and use it in GitHub Desktop.
broken qtile setup
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./qtile.nix
<home-manager/nixos>
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.utf8";
# Configure keymap in X11
services.xserver = {
enable = true;
windowManager.i3.enable = true;
layout = "us";
xkbVariant = "";
};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.alad = {
isNormalUser = true;
description = "alad";
extraGroups = [ "networkmanager" "wheel" ];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leavecatenate(variables, "bootdev", bootdev)
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.05"; # Did you read the comment?
}
{ lib
, fetchFromGitHub
, python3
, python3Packages
, mypy
, glib
, pango
, pkg-config
, libinput
, libxkbcommon
, wayland
, wlroots
, xcbutilcursor
, config
}:
let
qtile-extras = python3Packages.buildPythonPackage {
pname = "qtile-extras";
version = "unstable-2022-05-26";
src = fetchFromGitHub {
owner = "elParaguayo";
repo = "qtile-extras";
rev = "52c143da6917ac0f1e0b1aacc1af48e2bebc7289";
sha256 = "0rnc1mqmqccydk5bsgfzzj5q9s6syk6abc6n83wr62gd843ff6p7";
};
doCheck = false;
};
unwrapped = python3Packages.buildPythonPackage rec {
pname = "qtile";
version = "0.21.0";
src = fetchFromGitHub {
owner = "qtile";
repo = "qtile";
rev = "v${version}";
sha256 = "3QCI1TZIh1LcWuklVQkqgR1MQphi6CzZKc1UZcytV0k=";
};
patches = [
./fix-restart.patch # https://github.com/NixOS/nixpkgs/issues/139568
];
postPatch = ''
substituteInPlace libqtile/pangocffi.py \
--replace libgobject-2.0.so.0 ${glib.out}/lib/libgobject-2.0.so.0 \
--replace libpangocairo-1.0.so.0 ${pango.out}/lib/libpangocairo-1.0.so.0 \
--replace libpango-1.0.so.0 ${pango.out}/lib/libpango-1.0.so.0
substituteInPlace libqtile/backend/x11/xcursors.py \
--replace libxcb-cursor.so.0 ${xcbutilcursor.out}/lib/libxcb-cursor.so.0
'';
SETUPTOOLS_SCM_PRETEND_VERSION = version;
nativeBuildInputs = [
pkg-config
] ++ (with python3Packages; [
setuptools-scm
]);
propagatedBuildInputs = with python3Packages; [
xcffib
(cairocffi.override { withXcffib = true; })
setuptools
python-dateutil
dbus-python
mpd2
psutil
pyxdg
pygobject3
pywayland
pywlroots
xkbcommon
qtile-extras
];
buildInputs = [
libinput
wayland
wlroots
libxkbcommon
qtile-extras
];
# for `qtile check`, needs `stubtest` and `mypy` commands
makeWrapperArgs = [
"--suffix PATH : ${lib.makeBinPath [ mypy ]}"
];
doCheck = false; # Requires X server #TODO this can be worked out with the existing NixOS testing infrastructure.
meta = with lib; {
homepage = "http://www.qtile.org/";
license = licenses.mit;
description = "A small, flexible, scriptable tiling window manager written in Python";
platforms = platforms.linux;
maintainers = with maintainers; [ kamilchm ];
};
};
in
(python3.withPackages (_: [ unwrapped ])).overrideAttrs (_: {
# otherwise will be exported as "env", this restores `nix search` behavior
name = "${unwrapped.pname}-${unwrapped.version}";
# export underlying qtile package
passthru = { inherit unwrapped; };
# restore original qtile attrs
inherit (unwrapped) pname version meta;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment