Fix htop for darwin
A shim for programs.htop
This commit is contained in:
@@ -1,30 +1,12 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
git
|
||||
jq
|
||||
lib,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
# Nix
|
||||
nix-output-monitor # nix build -> nom build
|
||||
|
||||
# Software debug
|
||||
tcpdump
|
||||
lsof
|
||||
ncdu
|
||||
nmap
|
||||
lnav
|
||||
wakeonlan
|
||||
|
||||
# Hardware info and tunables
|
||||
smartmontools # smartctl
|
||||
usbutils # lsusb
|
||||
pciutils # lspci
|
||||
];
|
||||
|
||||
programs.htop = {
|
||||
enable = true;
|
||||
settings = {
|
||||
let
|
||||
htopSettings = {
|
||||
# Header
|
||||
header_margin = false;
|
||||
detailed_cpu_time = true;
|
||||
@@ -47,5 +29,53 @@
|
||||
highlight_base_name = true;
|
||||
tree_view = true;
|
||||
};
|
||||
hasHtopOption = options ? programs.htop;
|
||||
in
|
||||
lib.mkMerge [
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
git
|
||||
jq
|
||||
|
||||
# Nix
|
||||
nix-output-monitor # nix build -> nom build
|
||||
|
||||
# Software debug
|
||||
tcpdump
|
||||
lsof
|
||||
ncdu
|
||||
nmap
|
||||
lnav
|
||||
wakeonlan
|
||||
|
||||
# Hardware info and tunables
|
||||
smartmontools # smartctl
|
||||
usbutils # lsusb
|
||||
pciutils # lspci
|
||||
];
|
||||
}
|
||||
|
||||
(lib.optionalAttrs hasHtopOption {
|
||||
programs.htop = {
|
||||
enable = true;
|
||||
settings = htopSettings;
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
(lib.optionalAttrs (!hasHtopOption) {
|
||||
environment.systemPackages = [ pkgs.htop ];
|
||||
environment.etc."htoprc".text =
|
||||
let
|
||||
serialize =
|
||||
val:
|
||||
if lib.isBool val then
|
||||
(if val then "1" else "0")
|
||||
else if lib.isList val then
|
||||
lib.concatStringsSep " " val
|
||||
else
|
||||
toString val;
|
||||
in
|
||||
lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "${k}=${serialize v}") htopSettings) + "\n";
|
||||
})
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user