aboutsummaryrefslogtreecommitdiff
path: root/snowfall/modules/nixos
diff options
context:
space:
mode:
authorCaroline Larimore <caroline@larimo.re>2025-02-04 18:50:11 -0800
committerCaroline Larimore <caroline@larimo.re>2025-04-14 18:58:44 -0700
commit10f11ec042ab468821274636d438f84781cb2408 (patch)
treedde2244d5e9d76f7191e095a621bf23f9adcd9ab /snowfall/modules/nixos
parente45aca9d0cbda0559fb3c6a8075e029faa9c58ac (diff)
migration: desktop role
Diffstat (limited to 'snowfall/modules/nixos')
-rw-r--r--snowfall/modules/nixos/apps/i3/default.nix50
-rw-r--r--snowfall/modules/nixos/apps/playerctl/default.nix18
-rw-r--r--snowfall/modules/nixos/fonts/default.nix38
-rw-r--r--snowfall/modules/nixos/hardware/audio/default.nix25
-rw-r--r--snowfall/modules/nixos/hardware/keyboard/default.nix43
-rw-r--r--snowfall/modules/nixos/suites/common/default.nix4
-rw-r--r--snowfall/modules/nixos/suites/desktop/default.nix25
7 files changed, 203 insertions, 0 deletions
diff --git a/snowfall/modules/nixos/apps/i3/default.nix b/snowfall/modules/nixos/apps/i3/default.nix
new file mode 100644
index 0000000..e01c6c2
--- /dev/null
+++ b/snowfall/modules/nixos/apps/i3/default.nix
@@ -0,0 +1,50 @@
+{ options, config, lib, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.apps.i3;
+in {
+ options.${namespace}.apps.i3 = with types; {
+ enable = mkEnableOption "i3";
+
+ videoDrivers = mkOption {
+ type = types.listOf types.str;
+ default = [ "modesetting" "fbdev" ];
+ };
+
+ setupCommands = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Shell commands executed just after the X server has started.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ services = {
+ displayManager = {
+ enable = true;
+ defaultSession = "none+i3";
+ };
+
+ xserver = {
+ enable = true;
+ windowManager.i3.enable = true;
+
+ displayManager = {
+ lightdm.enable = true;
+ setupCommands = cfg.setupCommands;
+ };
+
+ videoDrivers = cfg.videoDrivers;
+ xkb.layout = "us";
+ };
+
+ libinput = {
+ enable = true;
+ mouse.accelProfile = "flat";
+ touchpad.naturalScrolling = true;
+ };
+ };
+ };
+}
diff --git a/snowfall/modules/nixos/apps/playerctl/default.nix b/snowfall/modules/nixos/apps/playerctl/default.nix
new file mode 100644
index 0000000..9bf95d7
--- /dev/null
+++ b/snowfall/modules/nixos/apps/playerctl/default.nix
@@ -0,0 +1,18 @@
+{ options, config, lib, pkgs, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.apps.playerctl;
+in {
+ options.${namespace}.apps.playerctl = with types; {
+ enable = mkEnableOption "playerctl";
+ };
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs; [
+ playerctl
+ ];
+
+ #TODO: enable, eventually
+ services.playerctld.enable = false;
+ };
+}
diff --git a/snowfall/modules/nixos/fonts/default.nix b/snowfall/modules/nixos/fonts/default.nix
new file mode 100644
index 0000000..8055925
--- /dev/null
+++ b/snowfall/modules/nixos/fonts/default.nix
@@ -0,0 +1,38 @@
+{ options, config, lib, pkgs, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.fonts;
+in {
+ options.${namespace}.fonts = with types; {
+ enable = mkEnableOption "fonts";
+ nerdfonts = mkEnableOption "nerdfonts";
+ extra = mkOption {
+ type = listOf package;
+ default = [];
+ description = ''
+ additional fonts to install
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ fonts = {
+ packages = with pkgs; [
+ noto-fonts
+ noto-fonts-cjk-sans
+ noto-fonts-cjk-serif
+ noto-fonts-emoji
+ ] ++ (
+ optionals cfg.nerdfonts (
+ cfg.nerdfonts builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts)
+ )
+ ) ++ cfg.extra;
+
+ fontconfig.defaultFonts = {
+ monospace = [ "CaskaydiaMono Nerd Font" ];
+ sansSerif = [ "DejaVu Sans" "Noto Sans CJK JP" "Noto Sans" ];
+ serif = [ "DejaVu Serif" "Noto Serif CJK JP" "Noto Serif" ];
+ };
+ };
+ };
+}
diff --git a/snowfall/modules/nixos/hardware/audio/default.nix b/snowfall/modules/nixos/hardware/audio/default.nix
new file mode 100644
index 0000000..d2bfa96
--- /dev/null
+++ b/snowfall/modules/nixos/hardware/audio/default.nix
@@ -0,0 +1,25 @@
+{ options, config, lib, pkgs, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.hardware.audio;
+in {
+ options.${namespace}.hardware.audio = with types; {
+ enable = mkEnableOption "audio support";
+ };
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs; [
+ pulseaudio
+ ];
+
+ security.rtkit.enable = true;
+ services.pipewire = {
+ enable = true;
+
+ pulse.enable = true;
+ alsa.enable = true;
+ alsa.support32Bit = true;
+ #jack.enable = true;
+ };
+ };
+}
diff --git a/snowfall/modules/nixos/hardware/keyboard/default.nix b/snowfall/modules/nixos/hardware/keyboard/default.nix
new file mode 100644
index 0000000..a8c478d
--- /dev/null
+++ b/snowfall/modules/nixos/hardware/keyboard/default.nix
@@ -0,0 +1,43 @@
+{ options, config, lib, pkgs, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.hardware.keyboard;
+in {
+ options.${namespace}.hardware.keyboard = with types; {
+ enable = mkEnableOption "keyboard hardware tweaks";
+ jp = mkEnableOption "japanese ime support";
+ };
+
+ config = mkIf cfg.enable {
+ services.keyd = {
+ enable = true;
+
+ keyboards."*".settings = {
+ main = {
+ # Swap alt and meta keys.
+ # I prefer (physical) alt as my WM modifier key because it
+ # is easier to reach. This can collide with some programs
+ # shortcuts if they inlcude alt. Swapping alt and meta fixes
+ # this by making my WM mod key (software) meta, freeing up alt.
+
+ leftalt = "leftmeta";
+ leftmeta = "leftalt";
+
+ rightalt = "rightmeta";
+ rightmeta = "rightalt";
+ };
+ };
+ };
+
+ i18n.inputMethod = mkIf cfg.jp {
+ enable = true;
+ type = "fcitx5";
+ fcitx5.addons = with pkgs; [ fcitx5-mozc ];
+ };
+
+ environment.variables = mkIf cfg.jp {
+ # Required for fcitx5 support in kitty
+ GLFW_IM_MODULE = "ibus";
+ };
+ };
+}
diff --git a/snowfall/modules/nixos/suites/common/default.nix b/snowfall/modules/nixos/suites/common/default.nix
index 0090ba3..e7656d1 100644
--- a/snowfall/modules/nixos/suites/common/default.nix
+++ b/snowfall/modules/nixos/suites/common/default.nix
@@ -9,6 +9,10 @@ in {
config = mkIf cfg.enable {
cxl = {
+ hardware = {
+ keyboard.enable = true;
+ };
+
apps = {
bash.enable = true;
};
diff --git a/snowfall/modules/nixos/suites/desktop/default.nix b/snowfall/modules/nixos/suites/desktop/default.nix
new file mode 100644
index 0000000..09dd4e3
--- /dev/null
+++ b/snowfall/modules/nixos/suites/desktop/default.nix
@@ -0,0 +1,25 @@
+{ options, config, lib, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.suites.desktop;
+in {
+ options.${namespace}.suites.desktop = with types; {
+ enable = mkEnableOption "desktop";
+ };
+
+ config = mkIf cfg.enable {
+ cxl = {
+ hardware = {
+ audio.enable = true;
+ keyboard.jp = true;
+ };
+
+ apps = {
+ i3.enable = true;
+ playerctl.enable = true;
+ };
+
+ fonts.enable = true;
+ };
+ };
+}