aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..3fb9ad2
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,58 @@
+{
+ description = "A pass extension for managing one-time-password (OTP) tokens";
+
+ inputs = {
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let pkgs = nixpkgs.legacyPackages.${system}; in
+ {
+ defaultPackage = with pkgs; stdenv.mkDerivation {
+ pname = "pass-otp";
+ version = "unstable";
+ src = ./.;
+
+ buildInputs = [ oathToolkit ];
+
+ checkInputs = [
+ bash
+ expect
+ git
+ gnumake
+ gnupg
+ pass
+ shellcheck
+ which
+ ];
+
+ dontBuild = true;
+ doCheck = true;
+
+ patchPhase = ''
+ sed -i -e 's|OATH=\$(which oathtool)|OATH=${oathToolkit}/bin/oathtool|' otp.bash
+ '';
+
+ checkPhase = ''
+ make SHELL=$SHELL check
+ '';
+
+ installFlags = [
+ "PREFIX=$(out)"
+ "BASHCOMPDIR=$(out)/share/bash-completions/completions"
+ ];
+
+ meta = with lib; {
+ description = "A pass extension for managing one-time-password (OTP) tokens";
+ homepage = "https://github.com/tadfisher/pass-otp";
+ license = licenses.gpl3;
+ maintainers = with maintainers; [ tadfisher ];
+ platforms = platforms.unix;
+ };
+ };
+
+ checks.pass-otp = self.defaultPackage.${system};
+ }
+ );
+}