Unverified Commit 6044a811 authored by h7x4's avatar h7x4 Committed by GitHub
Browse files

iio-niri: init at 1.2.1 (#454551)

parents de79463a 207f23bf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -28965,6 +28965,11 @@
    githubId = 1329212;
    name = "Andy Zhang";
  };
  zhaithizaliel = {
    name = "Zhaith Izaliel";
    github = "Zhaith-Izaliel";
    githubId = 39216756;
  };
  zhaofengli = {
    email = "hello@zhaofeng.li";
    matrix = "@zhaofeng:zhaofeng.li";
+2 −0
Original line number Diff line number Diff line
@@ -166,6 +166,8 @@ In addition to numerous new and upgraded packages, this release has the followin

- [twingate](https://docs.twingate.com/docs/linux), a high performance, easy to use zero trust solution that enables access to private resources from any device with better security than a VPN.

- [iio-niri](https://github.com/Zhaith-Izaliel/iio-niri), a utils that listens to `iio-sensor-proxy` and updates Niri output orientation depending on the accelerometer orientation.

## Backward Incompatibilities {#sec-release-21.11-incompatibilities}

- The NixOS VM test framework, `pkgs.nixosTest`/`make-test-python.nix` (`pkgs.testers.nixosTest` since 22.05), now requires detaching commands such as `succeed("foo &")` and `succeed("foo | xclip -i")` to close stdout.
+1 −0
Original line number Diff line number Diff line
@@ -240,6 +240,7 @@
  ./programs/iay.nix
  ./programs/iftop.nix
  ./programs/iio-hyprland.nix
  ./programs/iio-niri.nix
  ./programs/immersed.nix
  ./programs/iotop.nix
  ./programs/java.nix
+59 −0
Original line number Diff line number Diff line
{
  config,
  lib,
  pkgs,
  ...
}:
let
  inherit (lib)
    mkEnableOption
    mkPackageOption
    mkOption
    types
    mkIf
    getExe
    escapeShellArgs
    mkDefault
    ;
  cfg = config.services.iio-niri;
in
{
  options.services.iio-niri = {
    enable = mkEnableOption "IIO-Niri";

    package = mkPackageOption pkgs "iio-niri" { };

    niriUnit = mkOption {
      type = types.nonEmptyStr;
      default = "niri.service";
      description = "The Niri **user** service unit to bind IIO-Niri's **user** service unit to.";
    };

    extraArgs = mkOption {
      type = types.listOf types.str;
      default = [ ];
      description = "Extra arguments to pass to IIO-Niri.";
    };
  };

  config = mkIf cfg.enable {
    hardware.sensor.iio.enable = mkDefault true;

    environment.systemPackages = [ cfg.package ];

    systemd.user.services.iio-niri = {
      description = "IIO-Niri";
      wantedBy = [ cfg.niriUnit ];
      bindsTo = [ cfg.niriUnit ];
      partOf = [ cfg.niriUnit ];
      after = [ cfg.niriUnit ];
      serviceConfig = {
        Type = "simple";
        ExecStart = "${getExe cfg.package} ${escapeShellArgs cfg.extraArgs}";
        Restart = "on-failure";
      };
    };
  };

  meta.maintainers = with lib.maintainers; [ zhaithizaliel ];
}
+37 −0
Original line number Diff line number Diff line
{
  rustPlatform,
  lib,
  fetchFromGitHub,
  dbus,
  pkg-config,
}:
rustPlatform.buildRustPackage rec {
  pname = "iio-niri";
  version = "1.2.1";

  src = fetchFromGitHub {
    owner = "Zhaith-Izaliel";
    repo = "iio-niri";
    tag = "v${version}";
    hash = "sha256-IOMJ1xtjUkUoUgFZ9pxBf5XKdaUHu3WbUH5TlEiNRc4=";
  };

  cargoHash = "sha256-b05Jy+EKFAUcHR9+SdjHZUcIZG0Ta+ar/qc0GdRlJik=";

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = [
    dbus
  ];

  meta = {
    description = "Listen to iio-sensor-proxy and updates Niri output orientation depending on the accelerometer orientation";
    homepage = "https://github.com/Zhaith-Izaliel/iio-niri";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ zhaithizaliel ];
    mainProgram = "iio-niri";
    platforms = lib.platforms.linux;
  };
}