From 188a7e5bf50f73e4c37b68375f151298bf82658c Mon Sep 17 00:00:00 2001 From: anirudhb Date: Fri, 22 Oct 2021 21:26:54 -0700 Subject: [PATCH] flake: init --- flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4840015 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1634851050, + "narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c91f3de5adaf1de973b797ef7485e441a65b8935", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1634919341, + "narHash": "sha256-iYTckx+vxrGskDsI7US/3N1CDGYjnFl2Wh6gkLBmAKI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1cab3e231b41f38f2d2cbf5617eb7b88e433428a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "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..5d68da9 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "Warp across directories"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + pname = "wd"; + in rec { + packages.wd = pkgs.stdenv.mkDerivation { + name = pname; + src = ./.; + + nativeBuildInputs = [ pkgs.jdk pkgs.makeWrapper ]; + + buildPhase = '' + mkdir -p $out/share/${pname} + javac -d $out/share/${pname} $src/src/WarpDrive.java + ''; + + installPhase = '' + mkdir -p $out/bin + makeWrapper ${pkgs.jre}/bin/java $out/bin/wd \ + --add-flags "-cp $out/share/${pname} WarpDrive" + cp -a $src/man $out/man + ''; + + meta = with pkgs.lib; { + description = "Warp across directories"; + homepage = "https://github.com/quackduck/WarpDrive"; + license = licenses.mit; + platforms = platforms.linux ++ platforms.darwin; + }; + }; + defaultPackage = packages.wd; + }); +}