Chore/nixfiles review fixes #14
@@ -98,16 +98,34 @@
|
||||
fullName,
|
||||
modules,
|
||||
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 {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs username fullName; };
|
||||
specialArgs = {
|
||||
inherit
|
||||
inputs
|
||||
username
|
||||
fullName
|
||||
portable
|
||||
;
|
||||
};
|
||||
modules =
|
||||
baseModules
|
||||
++ modules
|
||||
++ [
|
||||
{
|
||||
home-manager.extraSpecialArgs = { inherit inputs username fullName; };
|
||||
home-manager.extraSpecialArgs = {
|
||||
inherit
|
||||
inputs
|
||||
username
|
||||
fullName
|
||||
portable
|
||||
;
|
||||
};
|
||||
home-manager.users.${username}.imports = homeModules;
|
||||
}
|
||||
];
|
||||
|
||||
@@ -6,7 +6,14 @@
|
||||
# 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
|
||||
# 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 = {
|
||||
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";
|
||||
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+";
|
||||
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 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%-";
|
||||
"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";
|
||||
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";
|
||||
interval = 5;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user