nix: Some system options, like keyboard

This commit is contained in:
Geoffrey Frogeye 2023-10-24 23:52:45 +02:00
parent e0b9bbcfba
commit 6ad06cb349
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
8 changed files with 103 additions and 136 deletions

View file

@ -1,10 +0,0 @@
***************
*** 6,11 ****
--- 6,12 ----
{
include "us(basic)"
include "level3(ralt_switch)"
+ include "keypad(oss)"
name[Group1]= "US keyboard with french symbols - AltGr combination";

View file

@ -1,7 +0,0 @@
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "us_qwerty-fr"
#Option "XkbModel" "pc105+inet"
Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

View file

@ -2,125 +2,8 @@
# Package are installed with --asdeps because they are needed
# Etckeeper
- name: Check if etckeeper is initialized
stat:
path: /etc/.git
register: etckeeper
become: yes
- name: Initialize etckeeper
command: "etckeeper init"
become: yes
when: not etckeeper.stat.exists
changed_when: yes
- name: Configure git user.name for etckeeper
git_config:
scope: local
repo: /etc
name: "{{ item.name }}"
value: "{{ item.value }}"
loop:
- name: "user.name"
value: "etckeeper on {{ inventory_hostname_short }}"
- name: "user.email"
value: "etckeeper@{{ inventory_hostname }}"
become: yes
# Manjaro configuration
- name: Remove Manjaro's pamac
pacman:
name: pamac
state: absent
become: yes
when: arch_based and False # I'm trying to remember why I usually delete this thing
# Verbose logging during boot
- name: Check if using Uboot
stat:
path: /boot/extlinux/extlinux.conf
register: extlinux
# This (and the following) was made with the Pinebook in mind,
# not sure about compatibility
- name: Remove non-tty1 console (Uboot)
replace:
path: /boot/extlinux/extlinux.conf
regexp: '^APPEND(.*) console=(?!tty1)\S+(.*)$'
replace: 'APPEND\1\2'
become: yes
when: extlinux.stat.exists
# Only one console= will be removed because regular expression are either hard
# or somewhat limited. It's just what I need anyway
- name: Remove bootsplash.bootfile (Uboot)
replace:
path: /boot/extlinux/extlinux.conf
regexp: '^APPEND(.*) bootsplash.bootfile=\S+(.*)$'
replace: 'APPEND\1\2'
become: yes
when: extlinux.stat.exists
- name: Remove bootsplash packages (Arch based)
pacman:
name:
- bootsplash-systemd
- bootsplash-theme-manjaro
state: absent
become: yes
when: arch_based
# Display Manager
- name: Remove display manager packages (Arch based)
pacman:
name:
- sddm
- sddm-breath2-theme
state: absent
become: yes
when: arch_based
# Xorg configuration
- name: Check if there is nvidia-xrun is installed
stat:
path: /etc/X11/nvidia-xorg.conf
register: nvidia_xrun
when: display_server == 'x11'
- name: Add nvidia-xrun xorg config directory
set_fact:
xorg_common_config_dirs: "{{ xorg_default_config_dirs + xorg_nvidia_config_dirs }}"
vars:
xorg_default_config_dirs:
- /etc/X11/xorg.conf.d
xorg_nvidia_config_dirs: "{{ ['/etc/X11/nvidia-xorg.conf.d'] if nvidia_xrun.stat.exists else [] }}"
when: display_server == 'x11'
- name: Configure Xorg keyboard layout
copy:
src: xorg/keyboard.conf
dest: "{{ item }}/00-keyboard.conf"
become: yes
when: display_server == 'x11'
notify: etc changed
loop: "{{ xorg_common_config_dirs }}"
- name: Use Alt keys for numpad
patch:
src: us_qwert_alt_numpad.patch
dest: /usr/share/X11/xkb/symbols/us_qwerty-fr
become: yes
when: display_server == 'x11'
# This is not very nice but it's updated so infrequently that it's not worth
# the trouble
- name: Check if there is Intel backlight
stat:
path: /sys/class/backlight/intel_backlight

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
imports = [
<nixos-hardware/dell/g3/3779>
# <nixos-hardware/pine64/pinebook-pro>
./modules/common.nix
./modules/desktop.nix
./modules/battery.nix

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [ tlp powertop ];
environment.systemPackages = with pkgs; [ powertop ];
}

View file

@ -3,7 +3,30 @@
# Enable the X11 windowing system
services.xserver.enable = true;
# FIXME qwerty-fr for X11
services.xserver = {
extraLayouts.qwerty-fr = {
description = "QWERTY-fr";
languages = [ "fr" ];
symbolsFile = "${pkgs.stdenv.mkDerivation {
name = "qwerty-fr-keypad";
src = builtins.fetchGit {
url = "https://github.com/qwerty-fr/qwerty-fr.git";
rev = "3a4d13089e8ef016aa20baf6b2bf3ea53de674b8";
};
patches = [ ./qwerty-fr-keypad.diff ];
# TODO This doesn't seem to be applied... it's the whole point of the derivation :(
installPhase = ''
runHook preInstall
mkdir -p $out/linux
cp $src/linux/us_qwerty-fr $out/linux
runHook postInstall
'';
}}/linux/us_qwerty-fr";
};
layout = "qwerty-fr";
# TODO home.keyboard = null; in home-manager... or something
};
# Enable sound
sound.enable = true;
@ -79,4 +102,5 @@
];
environment.systemPackages = with pkgs; [ pavucontrol ];
}

View file

@ -0,0 +1,10 @@
--- ./linux/us_qwerty-fr
+++ ./linux/us_qwerty-fr
@@ -4,6 +4,7 @@
{
include "us(basic)"
include "level3(ralt_switch)"
+ include "keypad(oss)"
name[Group1]= "US keyboard with french symbols - AltGr combination";

65
config/nix/us_qwerty-fr Normal file
View file

@ -0,0 +1,65 @@
partial alphanumeric_keys
xkb_symbols "qwerty-fr"
{
include "us(basic)"
include "level3(ralt_switch)"
include "keypad(oss)"
name[Group1]= "US keyboard with french symbols - AltGr combination";
key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] };
key <AE01> { [ 1, exclam, onesuperior, exclamdown ] };
key <AE02> { [ 2, at, twosuperior, dead_doubleacute ] };
key <AE03> { [ 3, numbersign, ecircumflex, Ecircumflex ] };
key <AE04> { [ 4, dollar, EuroSign, dead_currency ] }; // FIXME: dead_currency has a different mapping than the one we want for qwerty-fr. Need to define a custom dead key instead. See Windows layout for dead key definition.
key <AE05> { [ 5, percent, dead_macron, dead_abovedot ] };
key <AE06> { [ 6, asciicircum, dead_circumflex, dead_caron ] };
key <AE07> { [ 7, ampersand, ucircumflex, Ucircumflex ] };
key <AE08> { [ 8, asterisk, icircumflex, Icircumflex ] };
key <AE09> { [ 9, parenleft, ocircumflex, Ocircumflex ] };
key <AE10> { [ 0, parenright, oslash, Oslash ] };
key <AE11> { [ minus, underscore, endash, emdash ] };
key <AE12> { [ equal, plus, notequal, approxeq ] };
key <AD01> { [ q, Q, acircumflex, Acircumflex ] };
key <AD02> { [ w, W, eacute, Eacute ] };
key <AD03> { [ e, E, egrave, Egrave ] };
key <AD04> { [ r, R, registered, copyright ] };
key <AD05> { [ t, T, thorn, THORN ] };
key <AD06> { [ y, Y, dead_invertedbreve, dead_breve ] };
key <AD07> { [ u, U, ugrave, Ugrave ] };
key <AD08> { [ i, I, igrave, Igrave ] };
key <AD09> { [ o, O, ograve, Ograve ] };
key <AD10> { [ p, P, oe, OE ] };
key <AD11> { [ bracketleft, braceleft, guillemotleft, leftdoublequotemark ] };
key <AD12> { [ bracketright, braceright, guillemotright, rightdoublequotemark ] };
key <AC01> { [ a, A, agrave, Agrave ] };
key <AC02> { [ s, S, ae, AE ] };
key <AC03> { [ d, D, ediaeresis, Ediaeresis ] };
key <AC04> { [ f, F, VoidSymbol, VoidSymbol ] };
key <AC05> { [ g, G, dead_greek, VoidSymbol ] }; // FIXME: dead_greek has a different mapping than the one we want for qwerty-fr. Need to define a custom dead key instead. See Windows layout for dead key definition.
key <AC06> { [ h, H, ydiaeresis, Ydiaeresis ] };
key <AC07> { [ j, J, udiaeresis, Udiaeresis ] };
key <AC08> { [ k, K, idiaeresis, Idiaeresis ] };
key <AC09> { [ l, L, odiaeresis, Odiaeresis ] };
key <AC10> { [ semicolon, colon, dead_acute, dead_abovering ] };
key <AC11> { [ apostrophe, quotedbl, dead_grave, dead_diaeresis ] };
key <BKSL> { [ backslash, bar, VoidSymbol, doublelowquotemark ] }; // „
key <LSGT> { [ less, greater, lessthanequal, greaterthanequal ] };
key <AB01> { [ z, Z, adiaeresis, Adiaeresis ] };
key <AB02> { [ x, X, multiply, division ] };
key <AB03> { [ c, C, ccedilla, Ccedilla ] };
key <AB04> { [ v, V, VoidSymbol, VoidSymbol ] };
key <AB05> { [ b, B, ssharp, U1E9E ] }; // ß, ẞ (capital)
key <AB06> { [ n, N, ntilde, Ntilde ] };
key <AB07> { [ m, M, VoidSymbol, VoidSymbol ] };
key <AB08> { [ comma, less, dead_cedilla, dead_ogonek ] };
key <AB09> { [ period, greater, periodcentered, ellipsis ] }; // ., >, ·, …
key <AB10> { [ slash, question, rightsinglequotemark, questiondown ] }; // /, ?, , ¿
key <SPCE> { [ space, space, nobreakspace, 0x100202F ] }; // espace insécable fine
};