summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kreutz <mail@skreutz.com>2024-04-19 13:11:51 +0200
committerStefan Kreutz <mail@skreutz.com>2024-04-19 13:12:05 +0200
commit0a0f1a16134a74868e10fc2062996825b7cc41f3 (patch)
tree6d06b97e64f9747eaf4d82fb3cf5eedeb6d99c04
parent41134866c2646092c7baa9e0e545c50354aab934 (diff)
downloadjotpass-nix.tar
Add experimental Nix flakenix
-rw-r--r--README.md3
-rw-r--r--default.nix4
-rw-r--r--flake.lock61
-rw-r--r--flake.nix20
-rw-r--r--jotpass.nix29
-rw-r--r--overlay.nix4
6 files changed, 121 insertions, 0 deletions
diff --git a/README.md b/README.md
index 0eb149c..08de240 100644
--- a/README.md
+++ b/README.md
@@ -35,3 +35,6 @@ follows:
$ make
$ sudo make install
+There's also an experimental Nix flake:
+
+ $ nix run git+https://git.skreutz.com/jotpass.git/?ref=nix
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..869fc10
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,4 @@
+{ pkgs ? import <nixpkgs> {} }:
+{
+ jotpass = pkgs.callPackage ./jotpass.nix {};
+}
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..7bd5706
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1710146030,
+ "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1713297878,
+ "narHash": "sha256-hOkzkhLT59wR8VaMbh1ESjtZLbGi+XNaBN6h49SPqEc=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "66adc1e47f8784803f2deb6cacd5e07264ec2d5c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..dfe1752
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,20 @@
+{
+ description = "A BSD utility to generate random passwords suitable for handwriting";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let pkgs = nixpkgs.legacyPackages.${system};
+ in {
+ overlays.default = import ./overlay.nix;
+ packages = {
+ jotpass = pkgs.callPackage ./jotpass.nix {};
+ default = self.packages.${system}.jotpass;
+ };
+ }
+ );
+}
diff --git a/jotpass.nix b/jotpass.nix
new file mode 100644
index 0000000..2bce578
--- /dev/null
+++ b/jotpass.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, oksh, outils, bc, makeBinaryWrapper }:
+stdenv.mkDerivation rec {
+ name = "jotpass-${version}";
+ version = "0.2.0-snapshot"; # TODO: set or infer correct version
+
+ src = ./.;
+
+ postPatch = ''
+ substituteInPlace jotpass.ksh --replace "/bin/ksh" "${oksh}/bin/oksh"
+ '';
+
+ nativeBuildInputs = [
+ makeBinaryWrapper
+ ];
+
+ buildInputs = [
+ oksh
+ outils
+ bc
+ ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp jotpass.ksh $out/bin/jotpass
+ mkdir -p $out/man/man1
+ cp jotpass.1 $out/man/man1/jotpass.1
+ wrapProgram $out/bin/jotpass --prefix PATH : ${lib.makeBinPath [ oksh outils bc ]}
+ '';
+}
diff --git a/overlay.nix b/overlay.nix
new file mode 100644
index 0000000..7f03286
--- /dev/null
+++ b/overlay.nix
@@ -0,0 +1,4 @@
+final: prev:
+{
+ jotpass = pkgs.callPackage ./jotpass.nix {}
+}
Generated by cgit. See skreutz.com for my tech blog and contact information.