Chore/nixfiles review fixes #14

Merged
lyrathorpe merged 8 commits from chore/nixfiles-review-fixes into main 2026-06-04 15:02:08 +01:00
3 changed files with 69 additions and 14 deletions
Showing only changes of commit 333cb21152 - Show all commits
+20 -2
View File
@@ -98,16 +98,34 @@
fullName, fullName,
modules, modules,
homeModules, homeModules,
# Host form factor. Laptops inherit the default; a desktop host sets
# `portable = false` to drop mobile components (battery block,
# brightness keys) from the home-manager Sway config.
portable ? true,
}: }:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { inherit inputs username fullName; }; specialArgs = {
inherit
inputs
username
fullName
portable
;
};
modules = modules =
baseModules baseModules
++ modules ++ modules
++ [ ++ [
{ {
home-manager.extraSpecialArgs = { inherit inputs username fullName; }; home-manager.extraSpecialArgs = {
inherit
inputs
username
fullName
portable
;
};
home-manager.users.${username}.imports = homeModules; home-manager.users.${username}.imports = homeModules;
} }
]; ];
+36 -12
View File
@@ -6,7 +6,14 @@
# pulling a second Sway. home-manager owns the user config (~/.config/sway) and # pulling a second Sway. home-manager owns the user config (~/.config/sway) and
# wires the systemd user session (sway-session.target), which is what lets the # wires the systemd user session (sway-session.target), which is what lets the
# swayidle/dunst user services start with the desktop. # swayidle/dunst user services start with the desktop.
{ pkgs, lib, ... }: {
pkgs,
lib,
# Threaded from mkHost (flake.nix). Desktop hosts set this false to drop
# mobile components (battery block, screen-brightness keys).
portable ? true,
...
}:
{ {
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
@@ -42,15 +49,20 @@
} }
]; ];
keybindings = lib.mkOptionDefault { keybindings = lib.mkOptionDefault (
"${modifier}+l" = "exec ${pkgs.swaylock}/bin/swaylock -f"; {
"Print" = "exec ${pkgs.grim}/bin/grim ~/screenshot-$(date +%F-%H%M%S).png"; "${modifier}+l" = "exec ${pkgs.swaylock}/bin/swaylock -f";
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+"; "Print" = "exec ${pkgs.grim}/bin/grim ~/screenshot-$(date +%F-%H%M%S).png";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; "XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+";
"XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"; "XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
"XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; "XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; }
}; # Screen backlight: laptops only (no internal backlight on a desktop).
// lib.optionalAttrs portable {
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
}
);
}; };
}; };
@@ -120,8 +132,20 @@
block = "cpu"; block = "cpu";
interval = 2; interval = 2;
} }
{ block = "sound"; } ]
{ block = "battery"; } # Desktop-only: CPU temperature and wired network throughput, in place
# of the laptop's battery readout.
++ lib.optionals (!portable) [
{
block = "temperature";
interval = 5;
format = " $icon $average avg, $max max ";
}
{ block = "net"; }
]
++ [ { block = "sound"; } ]
++ lib.optional portable { block = "battery"; }
++ [
{ {
block = "time"; block = "time";
interval = 5; interval = 5;
+13
View File
@@ -0,0 +1,13 @@
# Desktop (non-portable) NixOS hosts. Counterpart to ./laptop.nix: imports the
# shared ./workstation.nix base and swaps the mobile Wi-Fi backend for wired
# NetworkManager. A desktop host also sets `portable = false` in its host-table
# entry (flake.nix), which drops the battery block and brightness keybindings
# from the Sway bar -- see lyrathorpe/home/sway.nix.
{ ... }:
{
imports = [ ./workstation.nix ];
# Wired networking. NetworkManager handles DHCP/connections itself; do not
# combine with networking.wireless.* (laptop.nix) -- the two backends conflict.
networking.networkmanager.enable = true;
}