diff options
Diffstat (limited to 'snowfall')
| -rw-r--r-- | snowfall/modules/nixos/apps/i3/default.nix | 50 | ||||
| -rw-r--r-- | snowfall/modules/nixos/apps/playerctl/default.nix | 18 | ||||
| -rw-r--r-- | snowfall/modules/nixos/fonts/default.nix | 38 | ||||
| -rw-r--r-- | snowfall/modules/nixos/hardware/audio/default.nix | 25 | ||||
| -rw-r--r-- | snowfall/modules/nixos/hardware/keyboard/default.nix | 43 | ||||
| -rw-r--r-- | snowfall/modules/nixos/suites/common/default.nix | 4 | ||||
| -rw-r--r-- | snowfall/modules/nixos/suites/desktop/default.nix | 25 | ||||
| -rw-r--r-- | snowfall/systems/x86_64-linux/c-pc/default.nix | 7 |
8 files changed, 209 insertions, 1 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; + }; + }; +} diff --git a/snowfall/systems/x86_64-linux/c-pc/default.nix b/snowfall/systems/x86_64-linux/c-pc/default.nix index 201c999..05f6965 100644 --- a/snowfall/systems/x86_64-linux/c-pc/default.nix +++ b/snowfall/systems/x86_64-linux/c-pc/default.nix @@ -1,4 +1,4 @@ -{ lib, namespace, ... }: +{ lib, pkgs, namespace, ... }: with lib; with lib.${namespace}; { imports = [ @@ -14,7 +14,12 @@ with lib; with lib.${namespace}; { suites = { common.enable = true; + desktop.enable = true; }; + + fonts.extra = with pkgs; [ + minecraftia + ]; }; system.stateVersion = "23.11"; |