about summary refs log tree commit diff
path: root/pkgs/larbs-scripts/displayselect/wrapper.nix
blob: bcc051b8845637d8de81c12a0d9266311492bde0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ stdenv, buildEnv, callPackage, lib, xrandr, libnotify, arandr }:

displayselect:

let

  mapCase = options:
  builtins.concatStringsSep "\n"
  (builtins.map
  (option: "\t\"${option}\") ${builtins.getAttr option options} ;;")
  (builtins.attrNames options));

  wrapper = { moreOptions ? {} }:
  let
    dmenu = callPackage ../../larbs/dmenu { };
  in
  buildEnv {
    name = "displayselect-env";

    paths = [
      xrandr
      arandr
      libnotify
      dmenu
    ];

    postBuild = ''
      mkdir -p $out/bin
      cp ${displayselect}/bin/displayselect $out/bin
      echo ${mapCase moreOptions} >> $out/bin/test
    '';


    meta = {
      description = "A fancy monitor configuration menu.";
      homepage = "https://github.com/LukeSmithXYZ/voidrice";
    };
  };
in
  lib.makeOverridable wrapper