q: highlight risky users

feature/hass
Ingolf Wagner 2020-01-02 11:49:44 +13:00
parent 6bf95c6948
commit 702d85b329
Signed by: palo
GPG Key ID: 76BF5F1928B9618B
3 changed files with 15 additions and 3 deletions

View File

@ -23,6 +23,10 @@ in {
default = true;
type = with types; bool;
};
userHighlight = mkOption {
default = [ config.users.users.mainUser.name ];
type = with types; listOf str;
};
};
config = mkIf cfg.enable {
@ -31,6 +35,7 @@ in {
timeZones = cfg.timeZones;
enableIntelBacklight = cfg.enableIntelBacklight;
enableBattery = cfg.enableBattery;
userHighlight = cfg.userHighlight;
})
];
};

View File

@ -2,7 +2,7 @@
# tzselect is your frind do find timezones
, timeZones ? [ ], timeColor ? 9, timeZoneColor ? 10, calBackgroundColor ? 10
, calWeekColor ? 13, calDayColor ? 9, enableIntelBacklight ? true
, enableBattery ? true, ... }:
, userHighlight ? [ "palo" ], enableBattery ? true, ... }:
let
@ -296,11 +296,13 @@ let
'';
q-show-users = ''
${pkgs.procps}/bin/ps aux \
| ${pkgs.gawk}/bin/awk '{ print $1 }' \
${pkgs.procps}/bin/ps -eo user \
| ${pkgs.gnused}/bin/sed '1 d' \
| ${pkgs.coreutils}/bin/sort \
| ${pkgs.coreutils}/bin/uniq \
| ${pkgs.gnugrep}/bin/egrep --color=always '(${
lib.concatStringsSep "|" userHighlight
})|$' \
| ${pkgs.utillinux}/bin/column
'';

View File

@ -57,4 +57,9 @@ in {
};
};
# highlight browser users in q command
programs.custom.q.userHighlight = map ({ user, ... }: user)
(builtins.attrValues config.programs.custom.browser.configList);
}