Skip to content

Commit

Permalink
Poetry2nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Azeirah committed Dec 25, 2024
1 parent 0f36e24 commit 19b2765
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 33 deletions.
2 changes: 1 addition & 1 deletion deployment/remarks-server/remarks_server/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Flask, request, jsonify
from flask import Flask, request
from remarks import remarks
import os, os.path

Expand Down
130 changes: 129 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 34 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
{
description = "Remarks - ReMarkabe notebook files to human readable formats";
description = "Remarks - ReMarkable notebook files to human readable formats";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
};
};

outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pythonEnv = pkgs.python310.withPackages (ps: with ps; []);
in
{
devShells.default = pkgs.mkShell {
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication mkPoetryEnv defaultPoetryOverrides;
pythonEnv = pkgs.python310.withPackages (ps: with ps; [ ]);

remarksBin = mkPoetryApplication {
projectDir = ./.;
python = pkgs.python310;
preferWheels = true;
overrides = defaultPoetryOverrides.extend
(final: prev: {
click = prev.click.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ prev.flit-scm ];
}
);
});
# Optional overrides if needed:
# overrides = poetry2nix.overrides.withDefaults (final: prev: { });
};

environment = pkgs.mkShell {
buildInputs = [
pythonEnv
pkgs.poetry
Expand All @@ -29,10 +48,7 @@
echo "🔍 Remarks Development Environment"
echo "• Run 'poetry install' to set up dependencies"
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [
pkgs.libgcc.lib
pkgs.zlib
]}:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.libgcc.lib pkgs.zlib ]}:$LD_LIBRARY_PATH"
if ! [[ -f .githooks/pre-commit ]]; then
git config core.hooksPath .githooks
Expand All @@ -49,6 +65,12 @@
poetry install
'';
};
}
);
in {
packages = {
default = remarksBin;
remarks = remarksBin;
};

devShells.default = environment;
});
}
Loading

0 comments on commit 19b2765

Please sign in to comment.