working (sorta) hpi nix derivation

This commit is contained in:
Anish Lakhwara 2022-03-22 00:40:54 +10:00
commit 60311eb09f
3 changed files with 105 additions and 0 deletions

42
hpi/flake.lock Normal file
View file

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

62
hpi/flake.nix Normal file
View file

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

1
hpi/result Symbolic link
View file

@ -0,0 +1 @@
/nix/store/20rx33nyvzjk9nd1z8px4c7nrm901kjz-python3.9-HPI-v0.3.20220202