Compare commits

...

7 commits

Author SHA1 Message Date
Schrottkatze 2a5e635c0d
make terminal module default module thingy 2024-03-05 18:51:30 +01:00
Schrottkatze 7bacabf0d3
biiiiig refactor (part 1) 2024-03-05 17:10:35 +01:00
Schrottkatze 9a7768ff5b
move git and mprocs configs to shell module 2024-03-05 13:53:39 +01:00
Schrottkatze ede1765ee8
move hardware key configs into one file 2024-03-05 13:49:22 +01:00
Schrottkatze 7829fcd0ce
merge kmscon and tty configs 2024-03-05 13:38:05 +01:00
Schrottkatze 193b006557
add aliases for toggling caps lock 2024-03-05 13:10:25 +01:00
Schrottkatze 991cc8fc88
add input remapping module with easier configuration 2024-03-05 13:10:08 +01:00
35 changed files with 340 additions and 336 deletions

View file

@ -29,9 +29,6 @@ with builtins; {
environment = {
systemPackages = with pkgs; [
# pynitrokey
# nitrokey-app2
veracrypt
htmlq
@ -90,29 +87,6 @@ with builtins; {
};
};
console.colors = [
"282828"
"cc241d"
"98971a"
"d79921"
"458588"
"b16286"
"689d6a"
"a89984"
"928374"
"fb4934"
"b8bb26"
"fabd2f"
"83a598"
"d3869b"
"8ec07c"
"ebdbb2"
];
# nitrokey
services.udev.packages = [pkgs.nitrokey-udev-rules];
services.pcscd.enable = true;
programs = {
ssh.startAgent = false;
gnupg.agent = {
@ -157,9 +131,6 @@ with builtins; {
users.users.jade = {
isNormalUser = true;
extraGroups = ["wheel" "input" "uinput" "libvirtd" "adbusers" "dialout" "plugdev" "wireshark"];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOaE8TFsIazpn4OnHvHcRpOFr9FfvMaWOiEjmHsmnAoE cardno:000F_70CD7D05"
];
};
zramSwap = {

View file

@ -17,18 +17,30 @@
../../modules
];
jade = {
flatpak.enable = true;
desktop = {
compositing.enable = true;
syncthing.enable = true;
kdeconnect.enable = true;
cloud.enable = true;
social.enable = true;
mail.enable = true;
gaming.enable = true;
evremap.enable = true;
};
terminal.enable = true;
input.remapping = {
enable = true;
devices."AT Translated Set 2 keyboard" = {
swapKeys = [
["KEY_Y" "KEY_Z"]
["KEY_LEFTALT" "KEY_LEFTMETA"]
];
dual_role = [
{
input = "KEY_CAPSLOCK";
hold = ["KEY_LEFTCTRL"];
tap = ["KEY_ESC"];
}
];
};
};
};
hardware.trackpoint = {
@ -88,55 +100,15 @@
"/crypto_keyfile.bin" = null;
};
# nixpkgs = {
# overlays = [
# (self: super: {
# linux_zen_xeniafied = pkgs.linuxPackagesFor (pkgs.linuxKernel.kernels.linux_zen.override {
# structuredExtraConfig = with lib.kernel; {
# "FB" = yes;
# "FRAMEBUFFER_CONSOLE" = yes;
# "VGA_CONSOLE" = yes;
# "VIDEO_SELECT" = yes;
# LOGO = lib.mkForce yes;
# LOGO_LINUX_CLUT224 = yes;
# };
# ignoreConfigErrors = true;
# });
# })
# ];
# };
boot.kernelPackages = pkgs.linuxPackages_zen;
# boot.kernelPatches = [
# {
# name = "fomx";
# patch = ../../other/0001-fomx.patch;
# }
# ];
services.xserver.displayManager.autoLogin = {
enable = true;
user = "jade";
};
networking.hostName = "catbook-j"; # 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
networking.networkmanager.enable = true;
security.pam.services.jade.u2fAuth = true;
programs.i3lock.u2fSupport = true;
security.pam.u2f = {
enable = true;
cue = true;
control = "sufficient";
authFile = "/home/jade/.ssh/u2f_keys";
};
networking.hostName = "catbook-j";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";

View file

@ -8,24 +8,6 @@
../../modules
];
# nixpkgs = {
# overlays = [
# (self: super: {
# linux_zen_xeniafied = pkgs.linuxPackagesFor (pkgs.linuxKernel.kernels.linux_zen.override {
# structuredExtraConfig = with lib.kernel; {
# "FB" = yes;
# "FRAMEBUFFER_CONSOLE" = yes;
# "VGA_CONSOLE" = yes;
# "VIDEO_SELECT" = yes;
# LOGO = lib.mkForce yes;
# LOGO_LINUX_CLUT224 = yes;
# };
# ignoreConfigErrors = true;
# });
# })
# ];
# };
jade = {
flatpak.enable = true;
desktop = {
@ -46,16 +28,8 @@
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
# latest linux kernel
#boot.kernelPackages = pkgs.linuxPackages_latest;
#boot.kernelPackages = pkgs.linux_zen_xeniafied;
kernelPackages = pkgs.linuxPackages_zen;
# boot.kernelPatches = [
# {
# name = "fomx";
# patch = ../other/0001-fomx.patch;
# }
# ];
binfmt.emulatedSystems = ["aarch64-linux"];
};
@ -82,16 +56,6 @@
enableRedistributableFirmware = true;
};
security.pam.services.jade.u2fAuth = true;
programs.i3lock.u2fSupport = true;
security.pam.u2f = {
enable = true;
cue = true;
control = "sufficient";
authFile = "/home/jade/.ssh/u2f_keys";
};
# missing: menu-qalc picom-jonaburg
environment.systemPackages = with pkgs; [
# TODO: clean up.

View file

@ -116,17 +116,8 @@
services.gnome.gnome-keyring.enable = true;
programs.seahorse.enable = true;
security.pam.services.jade.enableGnomeKeyring = true;
security.pam.services.jade.u2fAuth = true;
systemd.services."NetworkManager-wait-online".enable = false;
programs.i3lock.u2fSupport = true;
security.pam.u2f = {
enable = true;
cue = true;
control = "sufficient";
authFile = "/home/jade/.ssh/u2f_keys";
};
# services.pixiecore =
# let

View file

@ -2,11 +2,9 @@
imports = [
./shell
./desktop
./terminal.nix
./flatpak.nix
./hardware
./firewall.nix
./git.nix
./kmscon.nix
./mprocs.nix
./desktop-environment
./input
];
}

View file

@ -0,0 +1,11 @@
{...}: {
imports = [
./audio.nix
./compositing.nix
./dunst.nix
./panels
./xmonad
./terminal.nix
./flatpak.nix
];
}

View file

@ -0,0 +1,16 @@
{
config,
lib,
pkgs,
...
}: {
services.flatpak.enable = true;
xdg.portal = {
enable = true;
# TODO
config.common.default = "*";
extraPortals = [
pkgs.xdg-desktop-portal-gtk
];
};
}

View file

@ -0,0 +1,6 @@
{...}: {
imports = [
./xmobar
./polybar.nix
];
}

View file

@ -0,0 +1,33 @@
{
lib,
pkgs,
...
}: {
home-manager.users.jade = {
config,
pkgs,
...
}: let
xmobarGhc = pkgs.haskellPackages.ghcWithPackages (pkgs:
with pkgs; [
xmobar
statgrab
]);
in {
home = {
packages = [xmobarGhc];
file."xmobar.hs" = rec {
source = ./xmobar.hs;
target = ".config/xmobar/xmobar.hs";
onChange = ''
${xmobarGhc}/bin/ghc -threaded ${target}
${pkgs.busybox}/bin/pkill xmobar
${pkgs.haskellPackages.xmonad}/bin/xmonad --restart
'';
};
};
programs.xmobar = {
enable = true;
};
};
}

View file

@ -0,0 +1,36 @@
{...}: {
environment.sessionVariables = {
TERMINAL = "kitty";
};
home-manager.users.jade = {pkgs, ...}: {
programs.kitty = {
enable = true;
font = {
name = "FiraCode Nerd Font";
size = 11;
};
settings = {
#adjust_column_width = "70%";
color0 = "#282828";
color8 = "#928374";
color1 = "#cc241d";
color9 = "#fb4934";
color2 = "#98971a";
color10 = "#b8bb26";
color3 = "#d79921";
color11 = "#fabd2f";
color4 = "#458588";
color12 = "#83a598";
color5 = "#b16286";
color13 = "#d3869b";
color6 = "#689d6a";
color14 = "#8ec07c";
color7 = "#a89984";
color15 = "#ebdbb2";
foreground = "#ebdbb2";
background = "#282828";
confirm_os_window_close = 0;
};
};
};
}

View file

@ -0,0 +1,25 @@
{
lib,
pkgs,
...
}: {
home-manager.users.jade = {
config,
pkgs,
...
}: {
home.packages = [pkgs.xmonadctl];
xsession.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
config = ./xmonad.hs;
};
home.file.wallpaper = {
target = "Pictures/wallpaper.jpg";
source = ../../../other/wallpaper.jpg;
onChange = ''
feh --bg-fill ~/Pictures/wallpaper.jpg;
'';
};
};
}

View file

@ -15,25 +15,19 @@
in
with lib; {
imports = [
./audio.nix
./gaming.nix
./creative.nix # TODO: more fine grained choices, not every setup needs fspy or rawtherapee
./dunst.nix
./compositing.nix
./ios-compat.nix
./syncthing.nix
./kdeconnect.nix
./themeing.nix
./cloud.nix
./networking.nix
./polybar.nix
./social.nix
./mail.nix
./specific-hardware
./evremap.nix
./xmonad.nix
./fonts.nix
./firefox.nix
./x.nix
];
i18n.inputMethod = {
@ -52,32 +46,6 @@ in
services = {
printing.enable = true;
gnome.gnome-keyring.enable = true;
xserver = {
enable = true;
xkb = {
layout = "us";
variant = "altgr-intl";
};
libinput = {
enable = true;
};
desktopManager = {
xterm.enable = false;
};
displayManager = {
defaultSession = "none+xmonad";
gdm.enable = true;
};
windowManager.xmonad = {
enable = true;
};
};
};
programs.xss-lock = {

View file

@ -1,39 +0,0 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.jade.desktop.evremap;
evremap = pkgs.rustPlatform.buildRustPackage {
pname = "evremap";
version = "0.1.0";
src = pkgs.fetchFromGitHub {
owner = "wez";
repo = "evremap";
rev = "4480c4eda223b98899b0fbd926bc34f7bd0e1a18";
sha256 = "sha256-BxSrphgW1n465FX6bKVkq6O0XE2JqanfSYlsGwWUWkQ=";
};
cargoHash = "";
cargoLock.lockFile = ../../other/evremap.Cargo.lock;
postPatch = ''
cp ${../../other/evremap.Cargo.lock} Cargo.lock
'';
nativeBuildInputs = [pkgs.pkg-config];
buildInputs = [pkgs.libevdev];
};
in
with lib; {
options.jade.desktop.evremap = {
enable = mkEnableOption "Enable evremap";
};
config = mkIf cfg.enable {
systemd.services.evremap = {
script = "${evremap}/bin/evremap remap ${../../other/remaps-${config.networking.hostName}.toml}";
wantedBy = ["multi-user.target"];
unitConfig = {
Restart = "on-failure";
};
};
};
}

18
modules/desktop/x.nix Normal file
View file

@ -0,0 +1,18 @@
{...}: {
services.xserver = {
enable = true;
desktopManager = {
xterm.enable = false;
};
displayManager = {
defaultSession = "none+xmonad";
gdm.enable = true;
};
windowManager.xmonad = {
enable = true;
};
};
}

View file

@ -1,43 +0,0 @@
{
lib,
pkgs,
...
}: {
home-manager.users.jade = {
config,
pkgs,
...
}: let
xmobarGhc = pkgs.haskellPackages.ghcWithPackages (pkgs:
with pkgs; [
xmobar
statgrab
]);
in {
home.packages = [xmobarGhc pkgs.xmonadctl];
programs.xmobar = {
enable = true;
};
home.file."xmobar.hs" = rec {
source = ../../haskell/xmobar/xmobar.hs;
target = ".config/xmobar/xmobar.hs";
onChange = ''
${xmobarGhc}/bin/ghc -threaded ${target}
${pkgs.busybox}/bin/pkill xmobar
${pkgs.haskellPackages.xmonad}/bin/xmonad --restart
'';
};
xsession.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
config = ../../haskell/xmonad/xmonad.hs;
};
home.file.wallpaper = {
target = "Pictures/wallpaper.jpg";
source = ../../other/wallpaper.jpg;
onChange = ''
feh --bg-fill ~/Pictures/wallpaper.jpg;
'';
};
};
}

View file

@ -1,24 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.jade.flatpak;
in
with lib; {
options.jade.flatpak = {
enable = mkEnableOption "Enable flatpak";
};
config = mkIf cfg.enable {
services.flatpak.enable = true;
xdg.portal = {
enable = true;
# TODO
config.common.default = "*";
extraPortals = [
pkgs.xdg-desktop-portal-gtk
];
};
};
}

View file

@ -7,5 +7,6 @@
imports = [
./spacenav.nix
./wacom.nix
./hardware_key.nix
];
}

View file

@ -0,0 +1,20 @@
{pkgs, ...}: {
# nitrokey
services.udev.packages = [pkgs.nitrokey-udev-rules];
# smartcard daemon
services.pcscd.enable = true;
# authenticate using hw key
security.pam = {
services.jade.u2fAuth = true;
u2f = {
enable = true;
cue = true;
control = "sufficient";
authFile = "/home/jade/.ssh/u2f_keys";
};
};
programs.i3lock.u2fSupport = true;
}

15
modules/input/default.nix Normal file
View file

@ -0,0 +1,15 @@
{...}: {
imports = [
./evremap.nix
];
services.xserver = {
xkb = {
layout = "us";
variant = "altgr-intl";
};
libinput = {
enable = true;
};
};
}

110
modules/input/evremap.nix Normal file
View file

@ -0,0 +1,110 @@
{
pkgs,
config,
lib,
utils,
...
}: let
cfg = config.jade.input.remapping;
evremap = pkgs.rustPlatform.buildRustPackage {
pname = "evremap";
version = "0.1.0";
src = pkgs.fetchFromGitHub {
owner = "wez";
repo = "evremap";
rev = "4480c4eda223b98899b0fbd926bc34f7bd0e1a18";
sha256 = "sha256-BxSrphgW1n465FX6bKVkq6O0XE2JqanfSYlsGwWUWkQ=";
};
cargoHash = "";
cargoLock.lockFile = ../../other/evremap.Cargo.lock;
postPatch = ''
cp ${../../other/evremap.Cargo.lock} Cargo.lock
'';
nativeBuildInputs = [pkgs.pkg-config];
buildInputs = [pkgs.libevdev];
};
toml = pkgs.formats.toml {};
in
with lib; {
options.jade.input.remapping = {
enable = mkEnableOption "Enable evremap";
devices = mkOption {
type = types.attrsOf (types.submodule ({name, ...}: {
options = {
device_name = mkOption {
type = types.str;
description = "The device name";
default = name;
};
remap = mkOption {
type = types.listOf (types.submodule ({...}: {
options.input = mkOption {type = types.listOf types.str;};
options.output = mkOption {type = types.listOf types.str;};
}));
default = [];
};
swapKeys = mkOption {
description = "Lists with two keys to be swapped on the keyboard layout.";
type = types.listOf (
# verify that each key swapping list contains two elements
types.addCheck (types.listOf types.str) (v: builtins.length v == 2)
);
default = [];
};
dual_role = mkOption {
type = types.listOf (types.submodule ({...}: {
options.input = mkOption {type = types.str;};
options.hold = mkOption {type = types.listOf types.str;};
options.tap = mkOption {type = types.listOf types.str;};
}));
default = [];
};
};
}));
};
};
config = mkIf cfg.enable (
with builtins; let
devs = map ({
device_name,
remap,
swapKeys,
dual_role,
}: {
inherit device_name dual_role;
# expand swapKeys to normal remaps
remap = concatLists [
remap
(lib.lists.flatten (map (keys: [
{
input = [(head keys)];
output = [(lib.lists.last keys)];
}
{
input = [(lib.lists.last keys)];
output = [(head keys)];
}
])
swapKeys))
];
}) (attrValues cfg.devices);
in {
# generate numbered systemd services for each device to be remapped
# https://github.com/wez/evremap/issues/17
systemd.services = listToAttrs (genList (i: {
name = "evremap${toString i}";
value = let
cfgFile = toml.generate "remaps-${toString i}.toml" (elemAt devs i);
in {
script = "${evremap}/bin/evremap remap ${cfgFile}";
wantedBy = ["multi-user.target"];
unitConfig = {
Restart = "on-failure";
};
};
}) (length devs));
environment.systemPackages = [evremap];
}
);
}

View file

@ -6,6 +6,9 @@
./zellij.nix
./carapace.nix
./direnv.nix
./tty.nix
./git.nix
./mprocs.nix
];
programs.mosh.enable = true;
}

View file

@ -34,6 +34,26 @@
(getAttr (substring 5 2 (toUpper color)) hexLookupTable)
]);
in {
# TODO: global colorscheme vars for everything
console.colors = [
"282828"
"cc241d"
"98971a"
"d79921"
"458588"
"b16286"
"689d6a"
"a89984"
"928374"
"fb4934"
"b8bb26"
"fabd2f"
"83a598"
"d3869b"
"8ec07c"
"ebdbb2"
];
services.kmscon = {
enable = true;
fonts = [

View file

@ -1,49 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.jade.terminal;
in
with lib; {
options.jade.terminal = {
enable = mkEnableOption "Enable Kitty";
};
config = mkIf cfg.enable {
environment.sessionVariables = rec {
TERMINAL = "kitty";
};
home-manager.users.jade = {pkgs, ...}: {
programs.kitty = {
enable = true;
font = {
name = "FiraCode Nerd Font";
size = 11;
};
settings = {
#adjust_column_width = "70%";
color0 = "#282828";
color8 = "#928374";
color1 = "#cc241d";
color9 = "#fb4934";
color2 = "#98971a";
color10 = "#b8bb26";
color3 = "#d79921";
color11 = "#fabd2f";
color4 = "#458588";
color12 = "#83a598";
color5 = "#b16286";
color13 = "#d3869b";
color6 = "#689d6a";
color14 = "#8ec07c";
color7 = "#a89984";
color15 = "#ebdbb2";
foreground = "#ebdbb2";
background = "#282828";
confirm_os_window_close = 0;
};
};
};
};
}

View file

@ -831,3 +831,6 @@ alias cr = cargo run;
alias cl = cargo clippy;
alias cb = cargo build;
alias cch = cargo check;
alias togglecaps = xdotool key Caps_Lock;
alias TOGGLECAPS = togglecaps;

View file

@ -1,22 +0,0 @@
device_name = "AT Translated Set 2 keyboard"
[[remap]]
input = [ "KEY_Y" ]
output = [ "KEY_Z" ]
[[remap]]
input = [ "KEY_Z" ]
output = [ "KEY_Y" ]
[[remap]]
input = [ "KEY_LEFTALT" ]
output = [ "KEY_LEFTMETA" ]
[[remap]]
input = [ "KEY_LEFTMETA" ]
output = [ "KEY_LEFTALT" ]
[[dual_role]]
input = "KEY_CAPSLOCK"
hold = ["KEY_LEFTCTRL"]
tap = ["KEY_ESC"]