some refactoring and modularizing locale

This commit is contained in:
cnst
2024-10-23 20:11:01 +02:00
parent 86046c6414
commit b7784f9b15
58 changed files with 256 additions and 165 deletions

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.fwupd;
in {
options = {
nixos.services.system.fwupd.enable = mkEnableOption "Enables fwupd";
};
config = mkIf cfg.enable {
services.fwupd.enable = true;
};
}

View File

@@ -0,0 +1,58 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge mkOption types;
cfg = config.nixos.services.system.greetd;
in {
options = {
nixos.services.system.greetd = {
enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enables the greetd service.";
};
gnomeKeyring.enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enables GnomeKeyring PAM service for greetd.";
};
autologin.enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enables autologin for a specified user.";
};
autologin.user = mkOption {
type = types.str;
default = "cnst";
description = "The username to auto-login when autologin is enabled.";
};
};
};
config = mkIf cfg.enable {
services.greetd = {
enable = true;
settings = mkMerge [
# Conditionally include initial_session if autologin is enabled
(mkIf cfg.autologin.enable {
initial_session = {
command = "${pkgs.hyprland}/bin/Hyprland";
user = cfg.autologin.user;
};
})
{
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet -r --remember-session --asterisks";
user = "greeter";
};
}
];
};
# Apply GnomeKeyring PAM Service based on user configuration
security.pam.services.greetd.enableGnomeKeyring = cfg.gnomeKeyring.enable;
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.gvfs;
in {
options = {
nixos.services.system.gvfs.enable = mkEnableOption "Enables gvfs";
};
config = mkIf cfg.enable {
services.gvfs.enable = true;
};
}

View File

@@ -0,0 +1,23 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.kanata;
in {
options = {
nixos.services.system.kanata.enable = mkEnableOption "Enables kanata keyboard remapping";
};
config = mkIf cfg.enable {
services.kanata = {
enable = true;
package = pkgs.kanata-with-cmd;
keyboards.hhkbse = {
devices = ["/dev/input/by-id/usb-PFU_Limited_HHKB-Hybrid-event-kbd"];
config = builtins.readFile (./. + "/hhkbse.kbd");
};
};
};
}

View File

@@ -0,0 +1,52 @@
(deflocalkeys-linux
§ 41
+ 12
´ 13
å 26
¨ 27
ö 39
ä 40
' 43
< 86
> 100
, 51
. 52
- 53
)
(defsrc
esc 1 2 3 4 5 6 7 8 9 0 + ´ ' §
tab q w e r t y u i o p å ¨ bspc
lctl a s d f g h j k l ö ä ret
lsft z x c v b n m , . - rsft
lalt lmet spc rmet ralt
)
(deflayer default
esc 1 2 3 4 5 6 7 8 9 0 + pgdn pgup del
tab q w e r t y u i o p å ' bspc
lctl a s d f g h j k l ö ä ret
@shift z x c v b n m , . - rsft
lalt lmet spc @level3 ralt
)
(deflayer shift
esc S-1 S-2 S-3 RA-4 S-5 S-6 S-7 S-8 S-9 S-0 S-+ RA-7 RA-0 RA-<
tab S-q S-w S-e S-r S-t S-y S-u S-i S-o S-p S-å S-¨ bspc
lctl S-a S-s S-d S-f S-g S-h S-j S-k S-l S-ö S-ä S-ret
@shift S-z S-x S-c S-v S-b S-n S-m S-, S-. S-- rsft
lalt lmet spc @level3 ralt
)
(deflayer level3
esc 1 RA-2 RA-3 S-4 RA-5 RA-6 RA-7 RA-8 RA-9 RA-0 RA-+ ⇤ ⇥ S-'
tab q w RA-5 r t y u i o ▲ å RA-¨ bspc
lctl a s d f g h j k ◀ ▼ ▶ ret
@shift RA-S-z RA-S-x c v b n m , . - rsft
lalt lmet spc @level3 ralt
)
(defalias
shift (layer-toggle shift)
level3 (layer-toggle level3)
)

View File

@@ -0,0 +1,20 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.locate;
in {
options = {
nixos.services.system.locate.enable = mkEnableOption "Enables plocate";
};
config = mkIf cfg.enable {
services.locate = {
enable = true;
package = pkgs.plocate;
localuser = null;
};
};
}

View File

@@ -0,0 +1,103 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.nix-ld;
in {
options = {
nixos.services.system.nix-ld.enable = mkEnableOption "Enables nix-ld";
};
config = mkIf cfg.enable {
programs.nix-ld = {
enable = true;
# Sets up all the libraries to load
libraries = with pkgs; [
stdenv.cc.cc
openssl
xorg.libXcomposite
xorg.libXtst
xorg.libXrandr
xorg.libXext
xorg.libX11
xorg.libXfixes
libGL
libva
xorg.libxcb
xorg.libXdamage
xorg.libxshmfence
xorg.libXxf86vm
libelf
glib
gtk3
bzip2
xorg.libXinerama
xorg.libXcursor
xorg.libXrender
xorg.libXScrnSaver
xorg.libXi
xorg.libSM
xorg.libICE
gnome2.GConf
nspr
nss
cups
libcap
SDL2
libusb1
dbus-glib
ffmpeg
libudev0-shim
xorg.libXt
xorg.libXmu
libogg
libvorbis
SDL
SDL2_image
glew110
libidn
tbb
flac
freeglut
libjpeg
libpng
libpng12
libsamplerate
libmikmod
libtheora
libtiff
pixman
speex
SDL_image
SDL_ttf
SDL_mixer
SDL2_ttf
SDL2_mixer
libappindicator-gtk2
libdbusmenu-gtk2
libindicator-gtk2
libcaca
libcanberra
libgcrypt
libvpx
librsvg
xorg.libXft
libvdpau
gnome2.pango
cairo
atk
gdk-pixbuf
fontconfig
freetype
dbus
alsaLib
expat
libdrm
mesa
libxkbcommon
];
};
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.pcscd;
in {
options = {
nixos.services.system.pcscd.enable = mkEnableOption "Enables pcscd";
};
config = mkIf cfg.enable {
services.pcscd.enable = true;
};
}

View File

@@ -0,0 +1,24 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.pipewire;
in {
options = {
nixos.services.system.pipewire.enable = mkEnableOption "Enables pipewire";
};
config = mkIf cfg.enable {
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
};
};
}

View File

@@ -0,0 +1,18 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.powerd;
in {
options = {
nixos.services.system.powerd.enable = mkEnableOption "Enables power-profiles-daemon";
};
config = mkIf cfg.enable {
services = {
power-profiles-daemon.enable = true;
upower.enable = true;
};
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.udisks;
in {
options = {
nixos.services.system.udisks.enable = mkEnableOption "Enables udisks";
};
config = mkIf cfg.enable {
services.udisks2.enable = true;
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.zram;
in {
options = {
nixos.services.system.zram.enable = mkEnableOption "Enables zram";
};
config = mkIf cfg.enable {
zramSwap.enable = true;
};
}