blob: 235f774a1509903b8959a55586d74ab7456b334c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
{ pkgs, lib, ... }:
let
commandFiles = lib.attrNames (
lib.filterAttrs (name: type: type == "regular" && name != "default.nix" && lib.hasSuffix ".nix" name)
(builtins.readDir ./.)
);
commands = map (file: pkgs.callPackage (./. + "/${file}") { }) commandFiles;
in
{
home.packages = [
(pkgs.writers.writeBashBin "open-palette" ''
set -eu
exes=(${lib.concatMapStringsSep " " (c: c.exe) commands})
idx=$(${pkgs.rofi}/bin/rofi -dmenu -i -format i -p palette <<EOF
${lib.concatMapStrings (c: "${c.icon} ${c.name}\n") commands}EOF
)
exec "''${exes[$idx]}"
'')
];
}
|