Add Nix flake

This commit is contained in:
Tad Fisher 2022-01-22 20:10:44 -08:00 committed by Tad Fisher
parent 8698286567
commit de580749e2
4 changed files with 105 additions and 2 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/.envrc
/result
/.direnv/

View File

@ -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

40
flake.lock Normal file
View File

@ -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
}

58
flake.nix Normal file
View File

@ -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};
}
);
}