Unverified Commit 818ef4d7 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

yabar: drop (#415550)

parents dd80d0b7 26b29edc
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -355,7 +355,6 @@
  ./programs/xonsh.nix
  ./programs/xss-lock.nix
  ./programs/xwayland.nix
  ./programs/yabar.nix
  ./programs/yazi.nix
  ./programs/ydotool.nix
  ./programs/yubikey-touch-detector.nix

nixos/modules/programs/yabar.nix

deleted100644 → 0
+0 −187
Original line number Diff line number Diff line
{
  lib,
  pkgs,
  config,
  ...
}:

let
  cfg = config.programs.yabar;

  mapExtra =
    v:
    lib.concatStringsSep "\n" (
      lib.mapAttrsToList (
        key: val:
        "${key} = ${if (builtins.isString val) then "\"${val}\"" else "${builtins.toString val}"};"
      ) v
    );

  listKeys = r: builtins.concatStringsSep "," (builtins.map (n: "\"${n}\"") (builtins.attrNames r));

  configFile =
    let
      bars = lib.mapAttrsToList (name: cfg: ''
        ${name}: {
          font: "${cfg.font}";
          position: "${cfg.position}";

          ${mapExtra cfg.extra}

          block-list: [${listKeys cfg.indicators}]

          ${builtins.concatStringsSep "\n" (
            lib.mapAttrsToList (name: cfg: ''
              ${name}: {
                exec: "${cfg.exec}";
                align: "${cfg.align}";
                ${mapExtra cfg.extra}
              };
            '') cfg.indicators
          )}
        };
      '') cfg.bars;
    in
    pkgs.writeText "yabar.conf" ''
      bar-list = [${listKeys cfg.bars}];
      ${builtins.concatStringsSep "\n" bars}
    '';
in
{
  options.programs.yabar = {
    enable = lib.mkEnableOption "yabar, a status bar for X window managers";

    package = lib.mkOption {
      default = pkgs.yabar-unstable;
      defaultText = lib.literalExpression "pkgs.yabar-unstable";
      example = lib.literalExpression "pkgs.yabar";
      type = lib.types.package;

      # `yabar-stable` segfaults under certain conditions.
      # remember to update yabar.passthru.tests if nixos switches back to it!
      apply =
        x:
        if x == pkgs.yabar-unstable then
          x
        else
          lib.flip lib.warn x ''
            It's not recommended to use `yabar' with `programs.yabar', the (old) stable release
            tends to segfault under certain circumstances:

            * https://github.com/geommer/yabar/issues/86
            * https://github.com/geommer/yabar/issues/68
            * https://github.com/geommer/yabar/issues/143

            Most of them don't occur on master anymore, until a new release is published, it's recommended
            to use `yabar-unstable'.
          '';

      description = ''
        The package which contains the `yabar` binary.

        Nixpkgs offers both a stable (`yabar`) and unstable (`yabar-unstable`) version of Yabar.
      '';
    };

    bars = lib.mkOption {
      default = { };
      type = lib.types.attrsOf (
        lib.types.submodule {
          options = {
            font = lib.mkOption {
              default = "sans bold 9";
              example = "Droid Sans, FontAwesome Bold 9";
              type = lib.types.str;

              description = ''
                The font that will be used to draw the status bar.
              '';
            };

            position = lib.mkOption {
              default = "top";
              example = "bottom";
              type = lib.types.enum [
                "top"
                "bottom"
              ];

              description = ''
                The position where the bar will be rendered.
              '';
            };

            extra = lib.mkOption {
              default = { };
              type = lib.types.attrsOf lib.types.str;

              description = ''
                An attribute set which contains further attributes of a bar.
              '';
            };

            indicators = lib.mkOption {
              default = { };
              type = lib.types.attrsOf (
                lib.types.submodule {
                  options.exec = lib.mkOption {
                    example = "YABAR_DATE";
                    type = lib.types.str;
                    description = ''
                      The type of the indicator to be executed.
                    '';
                  };

                  options.align = lib.mkOption {
                    default = "left";
                    example = "right";
                    type = lib.types.enum [
                      "left"
                      "center"
                      "right"
                    ];

                    description = ''
                      Whether to align the indicator at the left or right of the bar.
                    '';
                  };

                  options.extra = lib.mkOption {
                    default = { };
                    type = lib.types.attrsOf (lib.types.either lib.types.str lib.types.int);

                    description = ''
                      An attribute set which contains further attributes of a indicator.
                    '';
                  };
                }
              );

              description = ''
                Indicators that should be rendered by yabar.
              '';
            };
          };
        }
      );

      description = ''
        List of bars that should be rendered by yabar.
      '';
    };
  };

  config = lib.mkIf cfg.enable {
    systemd.user.services.yabar = {
      description = "yabar service";
      wantedBy = [ "graphical-session.target" ];
      partOf = [ "graphical-session.target" ];

      script = ''
        ${cfg.package}/bin/yabar -c ${configFile}
      '';

      serviceConfig.Restart = "always";
    };
  };
}
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@ in
      "way-cooler is abandoned by its author: "
      + "https://way-cooler.org/blog/2020/01/09/way-cooler-post-mortem.html"
    ))
    (mkRemovedOptionModule [ "programs" "yabar" ]
      "programs.yabar has been removed from NixOS. This is because the yabar repository has been archived upstream."
    )
    (mkRemovedOptionModule [ "security" "hideProcessInformation" ] ''
      The hidepid module was removed, since the underlying machinery
      is broken when using cgroups-v2.
+0 −1
Original line number Diff line number Diff line
@@ -1508,7 +1508,6 @@ in
  xss-lock = runTest ./xss-lock.nix;
  xterm = runTest ./xterm.nix;
  xxh = runTest ./xxh.nix;
  yabar = runTest ./yabar.nix;
  yarr = runTest ./yarr.nix;
  ydotool = handleTest ./ydotool.nix { };
  yggdrasil = runTest ./yggdrasil.nix;

nixos/tests/yabar.nix

deleted100644 → 0
+0 −30
Original line number Diff line number Diff line
{
  name = "yabar";
  meta.maintainers = [ ];

  nodes.machine = {
    imports = [
      ./common/x11.nix
      ./common/user-account.nix
    ];

    test-support.displayManager.auto.user = "bob";

    programs.yabar.enable = true;
    programs.yabar.bars = {
      top.indicators.date.exec = "YABAR_DATE";
    };
  };

  testScript = ''
    machine.start()
    machine.wait_for_x()

    # confirm proper startup
    machine.wait_for_unit("yabar.service", "bob")
    machine.sleep(10)
    machine.wait_for_unit("yabar.service", "bob")

    machine.screenshot("top_bar")
  '';
}
Loading