summaryrefslogtreecommitdiff
path: root/users/kassouni/palette/default.nix
blob: 08c68b1c2bebe773354b3dc9b358f85b1530d24e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ 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;
  palette = pkgs.symlinkJoin {
    name = "palette";
    paths = commands;
  };
in
{
  home.packages = [
    (pkgs.writers.writeBashBin "open-palette" ''
      set -eu
      choice=$(${pkgs.coreutils}/bin/ls ${palette}/bin | ${pkgs.rofi}/bin/rofi -dmenu -i -p palette)
      exec "${palette}/bin/$choice"
    '')
  ];
}