feat: more wsl tweaks

This commit is contained in:
Nickolaj Jepsen 2025-12-14 04:09:59 +01:00
parent 50289dcc0d
commit 72a3dc6c5a
10 changed files with 104 additions and 40 deletions

View file

@ -5,6 +5,11 @@
}: {
options.fireproof.desktop = {
enable = lib.mkEnableOption "Enable desktop environment with niri, greetd, and all desktop features";
windowManager.enable = lib.mkOption {
type = lib.types.bool;
default = config.fireproof.desktop.enable;
description = "Enable window manager (niri) and dank material shell (dms)";
};
};
imports = [
@ -18,9 +23,4 @@
./gtk/default.nix
./dms/default.nix
];
config = lib.mkIf config.fireproof.desktop.enable {
# All desktop-related configuration is handled by the individual modules
# which check for fireproof.desktop.enable
};
}

View file

@ -3,6 +3,8 @@
lib,
...
}: let
hasMonitors = config.monitors != [];
commonBarSettings = {
enabled = true;
position = 0;
@ -35,11 +37,17 @@
maximizeDetection = true;
};
primaryMonitor = builtins.head config.monitors;
primaryMonitor =
if hasMonitors
then builtins.head config.monitors
else {};
primaryX = primaryMonitor.position.x or 0;
# Partition secondary monitors into left and right based on their x position relative to primary
secondaryMonitors = builtins.tail config.monitors;
secondaryMonitors =
if hasMonitors
then builtins.tail config.monitors
else [];
leftMonitors = builtins.filter (m: (m.position.x or 0) <= primaryX) secondaryMonitors;
rightMonitors = builtins.filter (m: (m.position.x or 0) > primaryX) secondaryMonitors;

View file

@ -11,7 +11,7 @@
./bar.nix
];
config = lib.mkIf config.fireproof.desktop.enable {
config = lib.mkIf config.fireproof.desktop.windowManager.enable {
systemd.user.services.niri-flake-polkit.enable = false;
fireproof.home-manager = {

View file

@ -4,7 +4,13 @@
pkgs,
...
}: {
config = lib.mkIf config.fireproof.desktop.enable {
options.fireproof.desktop.greeter.enable =
lib.mkEnableOption "greeter"
// {
default = config.fireproof.desktop.enable;
};
config = lib.mkIf config.fireproof.desktop.greeter.enable {
services.greetd = {
enable = true;
settings = {

View file

@ -5,10 +5,13 @@
inputs,
...
}: let
primaryMonitorName = (builtins.head config.monitors).name or "";
hasMonitors = config.monitors != [];
primaryMonitorName =
if hasMonitors
then (builtins.head config.monitors).name or ""
else "";
in {
config = lib.mkIf config.fireproof.desktop.enable {
# TODO: Move these to a separate module
config = lib.mkIf config.fireproof.desktop.windowManager.enable {
programs.xwayland.enable = true;
xdg.portal = {

View file

@ -5,6 +5,7 @@ _: {
./boot.nix
./hosts.nix
./keyd.nix
./wsl.nix
./ld.nix
./networking.nix
./security.nix

View file

@ -1,15 +1,21 @@
{lib, ...}: {
services.keyd = {
enable = lib.mkDefault true;
keyboards.mouse = {
ids = [
"046d:c051:4ae65a29" # Work mouse
"046d:407f:ee6ee407" # Home mouse
];
settings = {
main = {
# Bind mouse-back to meta if held
mouse1 = "overload(meta, mouse1)";
{
lib,
config,
...
}: {
config = lib.mkIf config.fireproof.desktop.enable {
services.keyd = {
enable = lib.mkDefault true;
keyboards.mouse = {
ids = [
"046d:c051:4ae65a29" # Work mouse
"046d:407f:ee6ee407" # Home mouse
];
settings = {
main = {
# Bind mouse-back to meta if held
mouse1 = "overload(meta, mouse1)";
};
};
};
};

20
modules/system/wsl.nix Normal file
View file

@ -0,0 +1,20 @@
{
config,
lib,
...
}: {
options.fireproof.wsl.enable = lib.mkEnableOption "Enable WSL configuration";
config = lib.mkIf config.fireproof.wsl.enable {
wsl = {
enable = true;
defaultUser = config.fireproof.username;
startMenuLaunchers = true;
interop.includePath = false;
};
# WSL doesn't use a bootloader - disable systemd-boot
boot.loader.systemd-boot.enable = false;
boot.loader.efi.canTouchEfiVariables = false;
};
}