Skip to content

Commit 14db90f

Browse files
authored
Merge pull request #472 from staticdev/feature/keyboard-conf
Feature/keyboard conf
2 parents 5c38813 + 6a0847f commit 14db90f

File tree

9 files changed

+59
-101
lines changed

9 files changed

+59
-101
lines changed

README.md

+1-24
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,7 @@ Note: this is an opinionated setup I personally use for software development on
5252

5353
### Included Applications / Configuration (Default)
5454

55-
Packages (installed with apt):
56-
57-
```yaml
58-
- apache2-utils
59-
- cmake
60-
- dconf-editor # visual gnome configs
61-
- gir1.2-clutter-1.0 # dep gnome extension system monitor
62-
- gir1.2-clutter-gst-3.0 # dep gnome extension system monitor
63-
- gir1.2-gtkclutter-1.0 # dep gnome extension system monitor
64-
- git
65-
- locales-all
66-
- openssl
67-
- podman
68-
- poedit
69-
```
70-
71-
It also installs with [Nix] package manager:
55+
It installs packages with [Nix] package manager:
7256

7357
```yaml
7458
- kubectl
@@ -93,13 +77,6 @@ Not everyone's workstation and preferred software configuration is the same.
9377
9478
You can override any of the defaults configured in **default.config.yml** by creating a **config.yml** file and setting the overrides in that file.
9579
96-
The first thing one can customize is the list of installed packages with apt (Debian's package manager):
97-
98-
```yaml
99-
installed_packages:
100-
- go
101-
```
102-
10380
To have you own dotfiles, just fork the [dotfiles eg. repo] and change the url of `dotfiles_repo` or just change `configure_dotfiles` to false if you do not want it.
10481

10582
For [Nix] packages, update your [Home Manager] config on your dotfiles repo.

default.config.yml

+1-44
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,12 @@
11
---
2-
# Install packages
3-
install_packages: true
4-
installed_packages:
5-
- apache2-utils
6-
- cmake
7-
- dconf-editor # visual gnome configs
8-
- gir1.2-clutter-1.0 # dep gnome extension system monitor
9-
- gir1.2-clutter-gst-3.0 # dep gnome extension system monitor
10-
- gir1.2-gtkclutter-1.0 # dep gnome extension system monitor
11-
- git
12-
- locales-all
13-
- openssl
14-
- podman # see https://github.com/NixOS/nixpkgs/issues/138423
15-
- poedit
16-
17-
nix_packages:
18-
- name: kubectl
19-
check_cmd: kubectl version --client
20-
- name: helm
21-
check_cmd: helm --version
22-
- name: k9s
23-
check_cmd: k9s version
24-
- name: htop
25-
check_cmd: htop --version
26-
- name: nmap
27-
check_cmd: nmap --version
28-
- name: thefuck
29-
check_cmd: thefuck --version
30-
- name: tmux
31-
check_cmd: tmux -V
32-
- name: vagrant
33-
check_cmd: vagrant --version
34-
- name: wget
35-
check_cmd: wget --version
36-
- name: xclip
37-
check_cmd: xclip -version
38-
39-
# Dotfiles (requires git on installed_packages)
2+
# Dotfiles (requires git enabled on nixpkgs)
403
configure_dotfiles: true
414
dotfiles_repo: "https://github.com/staticdev/dotfiles-eg.git"
425
dotfiles_repo_version: main
436
dotfiles_files:
447
- .tmux.conf
458
- .zshrc
469

47-
# Keyboard config
48-
configure_keyboard: false
49-
keyboard_layout: us
50-
keyboard_variant: intl
51-
keyboard_c_cedilla: false
52-
5310
# SSH config
5411
configure_ssh: true
5512
ssh_key_type: ed25519 # you can also choose between: dsa, ecdsa and ed25519

eg/local.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@
9696
autosuggestions.enable = true;
9797
syntaxHighlighting.enable = true;
9898
shellAliases = {
99+
editflake = "sudo nvim /etc/nixos/flake.nix";
100+
editlocal = "sudo nvim /etc/nixos/local.nix";
99101
gc = "nix store gc";
100-
localedit = "sudo vim /etc/nixos/local.nix";
101102
nixup = "sudo nix flake update --flake /etc/nixos && sudo nixos-rebuild switch";
102103
};
103104
shellInit = ''

flake.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.yml

-4
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@
7878
ansible.builtin.import_tasks: tasks/gnome-setup.yml
7979
when: gnome_setup
8080

81-
- name: Configure keyboard
82-
ansible.builtin.import_tasks: tasks/keyboard.yml
83-
when: configure_keyboard
84-
8581
- name: Configure terminal
8682
ansible.builtin.include_tasks: tasks/terminal.yml
8783
when: configure_terminal

modules/sysconf.nix

+30
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,36 @@
1010
description = "The git configs for commits: userName and email";
1111
};
1212

13+
keyboardCCedilla = lib.mkOption {
14+
type = lib.types.bool;
15+
default = false;
16+
description = "Whether to enable cedilla support via GTK/QT IM modules.";
17+
};
18+
keyboardLayout = lib.mkOption {
19+
type = with lib.types; listOf (submodule {
20+
options = {
21+
layout = lib.mkOption {
22+
type = str;
23+
description = "Keyboard layout, e.g. 'us'";
24+
example = "us";
25+
};
26+
27+
variant = lib.mkOption {
28+
type = nullOr str;
29+
default = null;
30+
description = "Optional keyboard variant, e.g. 'intl'";
31+
example = "intl";
32+
};
33+
};
34+
});
35+
default = [];
36+
description = "List of keyboard layout and optional variant tuples.";
37+
example = [
38+
{ layout = "us"; variant = "intl"; }
39+
{ layout = "de"; variant = null; }
40+
];
41+
};
42+
1343
mainUser = lib.mkOption {
1444
type = with lib.types; attrsOf (oneOf [str (listOf package)]);
1545
default = {

src/base.nix

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
# your system. Help is available in the configuration.nix(5) man page, on
33
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
44

5-
{ stateVersion, config, pkgs, ... }:
5+
{ lib, stateVersion, config, pkgs, ... }:
66

7+
let
8+
sysConf = config.environment.sysConf;
9+
in
710
{
811
imports = [ (import ./users.nix) ];
912

@@ -79,14 +82,20 @@
7982
enableDefaultPackages = true;
8083
};
8184

85+
# Add variables for C-Cedilha if on sysConf
86+
environment.variables = lib.mkIf sysConf.keyboardCCedilla {
87+
GTK_IM_MODULE = "cedilla";
88+
QT_IM_MODULE = "cedilla";
89+
};
8290
# List packages installed in system profile. To search, run:
8391
# $ nix search wget
84-
environment.systemPackages = config.environment.sysConf.systemWidePkgs;
92+
environment.systemPackages = sysConf.systemWidePkgs;
8593

8694
home-manager = {
8795
sharedModules = [ (import ./home.nix) ];
8896
extraSpecialArgs = {
8997
inherit stateVersion;
98+
inherit sysConf;
9099
};
91100
};
92101

src/home.nix

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
{ stateVersion, ... }:
1+
{ lib, sysConf, stateVersion, ... }:
22

33
# here we have system-wide configuration - for user configurations see: src/users.nix
44
{
5+
dconf.settings."org/gnome/desktop/input-sources".sources =
6+
map (k:
7+
lib.hm.gvariant.mkTuple [
8+
"xkb" (k.layout + (if k.variant != null then "+" + k.variant else ""))
9+
]
10+
) sysConf.keyboardLayout;
11+
512
home = {
613
stateVersion = stateVersion;
714
};

tasks/keyboard.yml

-19
This file was deleted.

0 commit comments

Comments
 (0)