diff options
author | Tad Fisher <tadfisher@gmail.com> | 2022-01-22 20:10:44 -0800 |
---|---|---|
committer | Tad Fisher <129148+tadfisher@users.noreply.github.com> | 2022-02-12 17:19:39 -0800 |
commit | de580749e2852b5e6e2c3e3eba6613a48c40adbb (patch) | |
tree | af117b3cc639d696f501ed0a08ca8833f777a4ce | |
parent | 869828656788bd3d6f0b2fea02760d8489f4f7c1 (diff) | |
download | pass-otp-de580749e2852b5e6e2c3e3eba6613a48c40adbb.tar.gz pass-otp-de580749e2852b5e6e2c3e3eba6613a48c40adbb.zip |
Add Nix flake
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | flake.lock | 40 | ||||
-rw-r--r-- | flake.nix | 58 |
4 files changed, 105 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4e1c8a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.envrc +/result +/.direnv/ @@ -35,6 +35,8 @@ lint: $(MAKE) -C test lint test: - $(MAKE) -C test + $(MAKE) -C test all -.PHONY: install uninstall lint test +check: lint test + +.PHONY: install uninstall lint test check diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..18ef0a5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,40 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1642700792, + "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1642281915, + "narHash": "sha256-jcMsXmmO1knyf99o242A+2cy1A0eKa9afly0cwBknPA=", + "path": "/nix/store/1q3bx2vjp4afq1wglhxgva9rhs69k8ri-source", + "rev": "d5dae6569ea9952f1ae4e727946d93a71c507821", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} 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}; + } + ); +} |