indigo-dc / oidc-agent

oidc-agent for managing OpenID Connect tokens on the command line
MIT License
110 stars 30 forks source link

Package for the nix packaging system #574

Closed v1kko closed 1 month ago

v1kko commented 5 months ago

I created a package such that I can work with oidc-agent on my system. please see the derivation below. I hope it is useful for others that wish to install it on a nix system.

{ lib, stdenv, fetchFromGitHub, curl, webkitgtk, libmicrohttpd, libsecret, qrencode, libsodium, pkg-config, help2man }:

stdenv.mkDerivation rec {
  pname = "oidc-agent";
  version = "5.1.0";

  src = fetchFromGitHub {
    owner = "indigo-dc";
    repo = "${pname}";
    rev = "v${version}";
    sha256 = "sha256-cOK/rZ/jnyALLuhDM3+qvwwe4Fjkv8diQBkw7NfVo0c="
    ;
  };

  buildInputs = [
    pkg-config
    help2man
  ];
  nativeBuildInputs = [
    curl
    webkitgtk
    libmicrohttpd
    libsecret
    qrencode
    libsodium
  ];

  installPhase = ''
    make install_bin PREFIX=$out BIN_PATH=$out
    make install_lib PREFIX=$out LIB_PATH=$out/lib
    make install_conf install_bash install_scheme_handler install_xsession_script PREFIX=$out
  '';
  postFixup = ''
    cp -r $out/bin/* bin
    make install_man PREFIX=$out
  '';

  meta = with lib; {
    description = "oidc-agent for managing OpenID Connect tokens on the command line";
    homepage = "https://github.com/indigo-dc/oidc-agent";
    maintainers = [ ];
    license = licenses.mit;
  };
}
marcvs commented 5 months ago

Cool, thanks; I'll keep this open until I get to packaging again.

Could you recommend me a docker image to use with building nix packages?

v1kko commented 5 months ago

I will look into setting up a pipeline for this (also out of my own interest).

xinyangli commented 2 months ago

Would it be possible to consider adding this to nixpkgs? I noticed that there are users requesting oidc-agent on the forum (https://discourse.nixos.org/t/managing-openid-connect-tokens/24743). Additionally, we could include a NixOS module to make usage easier.

zachmann commented 1 month ago

It seems that this has been added to nixpkgs, so I guess we can close this. Thanks to @xinyangli and @v1kko