biiiiig refactor (part 1)

This commit is contained in:
Schrottkatze 2024-03-05 17:10:35 +01:00
parent 9a7768ff5b
commit 7bacabf0d3
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
23 changed files with 96 additions and 81 deletions

View file

@ -1,39 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
config = {
programs = {
noisetorch.enable = true;
};
services = {
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
jack.enable = true;
};
};
hardware.pulseaudio.enable = pkgs.lib.mkForce false;
sound.mediaKeys.enable = true;
home-manager.users.jade = {pkgs, ...}: {
home.packages = with pkgs; [
pavucontrol
pulseaudioFull
easyeffects
cava
volumeicon
playerctl
helvum
];
xsession.windowManager.i3.config.startup = [
{
command = "pkill volumeicon; volumeicon";
always = true;
}
];
};
};
}

View file

@ -1,42 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.jade.desktop.compositing;
in
with lib; {
options.jade.desktop.compositing = {
enable = mkEnableOption "Enable compositing with picom";
};
config = mkIf cfg.enable {
services.picom = {
enable = true;
backend = "glx";
shadow = true;
shadowOffsets = [(-40) (-30)];
shadowOpacity = 0.2;
shadowExclude = [
"class_g ?= 'Notify-osd'"
"_GTK_FRAME_EXTENTS@:c"
"!(class_g = 'Rofi' || class_g = 'Dunst')"
];
vSync = true;
settings = {
"shadow-radius" = 40;
# fading rofi
"fading" = true;
"fade-in-step" = 0.25;
"fade-out-step" = 0.2;
"fade-delta" = 20;
"fade-exclude" = ["class_g != 'Rofi'"];
# use damage information
"use-damage" = true;
};
};
# }}}
};
}

View file

@ -15,26 +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
./xmonad.nix
./fonts.nix
./firefox.nix
./x.nix
./input
];
i18n.inputMethod = {

View file

@ -1,19 +0,0 @@
{...}: {
home-manager.users.jade = {pkgs, ...}: {
services.dunst = {
enable = true;
settings = {
global = {
dmenu = "${pkgs.rofi}/bin/rofi -theme gruvbox-dark -dmenu -p dunst";
browser = "${pkgs.librewolf}/bin/librewolf";
mouse_left_click = "context";
mouse_middle_click = "close_current";
background = "#282828";
foreground = "#ebdbb2";
frame_color = "#504945";
frame_width = 2;
};
};
};
};
}

View file

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

View file

@ -1,110 +0,0 @@
{
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

@ -1,150 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
config = {
home-manager.users.jade = {pkgs, ...}: {
services.polybar = {
enable = true;
package = pkgs.polybarFull;
script = "";
settings = {
colors = {
background = "#282828";
background-alt = "#3c3836";
foreground = "#ebdbb2";
primary = "#d65d0e";
secondary = "#fe8019";
alert = "#cc241d";
disabled = "#504945";
};
"bar/status" = {
# Style
bottom = true;
width = "100%";
height = "24px";
radius = 0;
tray-position = "center";
background = "\${colors.background}";
foreground = "\${colors.foreground}";
line-size = "4px";
border-color = "#00000000";
padding-left = 0;
padding-right = 1;
module-margin = 1;
separator = "|";
separator-foreground = "\${colors.disabled}";
font-0 = "FiraCode Nerd Font";
modules-left = "xworkspaces xwindow";
modules-right = "memory cpu wlan bat0 bat1";
cursor-click = "pointer";
cursor-scroll = "ns-resize";
enable-ipc = true;
wm-restack = "generic";
override-redirect = false;
};
"module/xworkspaces" = {
type = "internal/xworkspaces";
label-active = "";
label-active-padding = 1;
label-occupied = "";
label-occupied-padding = 1;
label-urgent = "";
label-urgent-foreground = "\${colors.alert}";
label-urgent-padding = 1;
label-empty = "";
label-empty-foreground = "\${colors.disabled}";
label-empty-padding = 1;
};
"module/xwindow" = {
type = "internal/xwindow";
label = "%title:0:60:...%";
};
"module/memory" = {
type = "internal/memory";
interval = 2;
format-prefix = "󰍛 ";
format-prefix-foreground = "\${colors.primary}";
label = "%percentage_used:2%%";
};
"module/cpu" = {
type = "internal/cpu";
interval = "2";
format-prefix = "󰻠 ";
format-prefix-foreground = "\${colors.primary}";
label = "%percentage:2%%";
};
"network-base" = {
type = "internal/network";
interval = 5;
format-connected = "<ramp-signal> <label-connected>";
format-disconnected = "<label-disconnected>";
label-disconnected = "󰣼";
label-disconnected-foreground = "#d65d0e";
ramp.signal = [
"%{F#cc241d}󰣾"
"%{F#d79921}󰣴"
"%{F#98971a}󰣶"
"%{F#98971a}󰣸"
"%{F#98971a}󰣺"
];
};
"module/wlan" = {
"inherit" = "network-base";
interface-type = "wireless";
label-connected = "%{F#F0C674}%{F-} %local_ip%";
};
"battery-base" = {
type = "internal/battery";
poll-interval = 1;
time-format = "%H%{F#7c6f64}:%{F#d5c4a1}%M";
label-charging = "%{F#98971a}󰚥 %{F#ebdbb2}%percentage%%%{F#d5c4a1} %time%";
format-charging = "<ramp-capacity> <label-charging>";
label-discharging = "%{F#ebdbb2}%percentage%%%{F#bdae93} %time%";
format-discharging = "<ramp-capacity> <label-discharging>";
label-full = "%{F#98971a}󰁹%{F#ebdbb2} %percentage%%";
format-full = "<label-full>";
label-low = "%{F#cc241d}󰂎%{F#ebdbb2} %percentage%%";
format-low = "<label-low>";
ramp.capacity = [
"%{F#cc241d}󰁺"
"%{F#d79921}󰁻"
"%{F#98971a}󰁼"
"%{F#98971a}󰁽"
"%{F#98971a}󰁾"
"%{F#98971a}󰁿"
"%{F#98971a}󰂀"
"%{F#98971a}󰂁"
"%{F#98971a}󰂂"
"%{F#98971a}󰁹"
];
};
"module/bat0" = {
"inherit" = "battery-base";
battery = "BAT0";
adapter = "ADP1";
};
"module/bat1" = {
"inherit" = "battery-base";
battery = "BAT1";
adapter = "ADP1";
};
"settings" = {
screenchange-reload = true;
pseudo-transparency = true;
};
};
};
};
};
}

View file

@ -1,12 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
imports = [
./spacenav.nix
./wacom.nix
./hardware_key.nix
];
}

View file

@ -1,20 +0,0 @@
{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;
}

View file

@ -1,10 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
spacenavd
libspnav
];
systemd.services.spacenavd = {
wantedBy = ["graphical.target"];
script = "${pkgs.spacenavd}/bin/spacenavd -d";
};
}

View file

@ -1,10 +0,0 @@
{...}: {
services.xserver.wacom.enable = true;
home-manager.users.jade = {pkgs, ...}: {
home.packages = [
# TODO: figure out if the previous enabled option depends on these anyway
pkgs.libwacom
pkgs.wacomtablet
];
};
}

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;
'';
};
};
}