commit 60311eb09fd52c5568e7bcc2c2cd6157467bd153 Author: Anish Lakhwara Date: Tue Mar 22 00:40:54 2022 +1000 working (sorta) hpi nix derivation diff --git a/hpi/flake.lock b/hpi/flake.lock new file mode 100644 index 0000000..73a45b9 --- /dev/null +++ b/hpi/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1647778089, + "narHash": "sha256-11oBXsWzZ6MFUaP8VveBO22ijFmM+vDOmFWb66IK+Rg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "016a19d13c5b4319228719244e3564cd82ce72e7", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/hpi/flake.nix b/hpi/flake.nix new file mode 100644 index 0000000..19c2769 --- /dev/null +++ b/hpi/flake.nix @@ -0,0 +1,62 @@ +{ + description = "Reproducible Environment for anish.lakhwara.com"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + hpi = pkgs.python39Packages.buildPythonPackage rec { + pname = "HPI"; + version = "v0.3.20220202"; + src = pkgs.fetchgit { + rev = "e750666e30e8987f3a4c46755857dc85dd64446c"; + url = "https://github.com/karlicoss/HPI"; + sha256 = "sha256-CHrlVG7H2Gzhc2gcAOwWNSivje9K3/tJYA7BQWvSyuQ="; + leaveDotGit = true; + }; + + nativeBuildInputs = [ python-with-my-packages pkgs.git ]; + propagatedBuildInputs = [ python-with-my-packages ]; + + doCheck = false; + pythonImportsCheck = [ "my.core" ]; + + meta = with pkgs.lib; { + description = ""; + homepage = "https://github.com/karlicoss/HPI"; + # license = with licenses; [ mit ]; + maintainers = with maintainers; [ chickensoupwithrice ]; + }; + }; + python-with-my-packages = pkgs.python39.withPackages (p: with p; [ + pytz # even though it's not needed by the core, it's so common anyway... + appdirs # very common, and makes it portable + more-itertools # it's just too useful and very common anyway + decorator # less pain in writing correct decorators. very mature and stable, so worth keeping in core + click + setuptools-scm + pytest + geopy + ]); + in + { + devShell = pkgs.mkShell { + buildInputs = [ + python-with-my-packages + hpi + ]; + shellHook = '' + PYTHONPATH=${python-with-my-packages}/${python-with-my-packages.sitePackages} + # This only works when you have ~/vimwiki locally, since I'm not putting my unfiltered kitaab online + alias build='python3 src/kitaab-public/main.py' + # maybe set more env-vars + ''; + }; + defaultPackage = hpi; + }); +} diff --git a/hpi/result b/hpi/result new file mode 120000 index 0000000..5d7b5b0 --- /dev/null +++ b/hpi/result @@ -0,0 +1 @@ +/nix/store/20rx33nyvzjk9nd1z8px4c7nrm901kjz-python3.9-HPI-v0.3.20220202 \ No newline at end of file