Skip to content

Commit

Permalink
Switch to Antlr 4.9 for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Nov 4, 2024
1 parent 570fd3e commit 003772e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 49 deletions.
31 changes: 8 additions & 23 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,46 +1,31 @@
{
antlr4_10,
black,
lib,
black,
nix-gitignore,
buildPythonPackage,
poetry-core,
setuptools,
pytest,
coverage,
antlr4_9,
antlr4_9-runtime,
}:

let
antlr4_10-python3-runtime = buildPythonPackage rec {
pname = "antlr4-python3-runtime";
inherit (antlr4_10.runtime.cpp) version src;

sourceRoot = "source/runtime/Python3";

doCheck = false;

meta = with lib; {
description = "Runtime for ANTLR";
homepage = "https://www.antlr.org/";
license = licenses.bsd3;
};
};
in buildPythonPackage {
buildPythonPackage {
name = "ioplace_parser";
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).tool.poetry.version;
format = "pyproject";

src = nix-gitignore.gitignoreSourcePure ./.gitignore ./.;

nativeBuildInputs = [
poetry-core
antlr4_10
antlr4_9
];

propagatedBuildInputs = [
antlr4_10-python3-runtime
antlr4_9-runtime
];

nativeCheckInputs = [
pytest
black
Expand Down
20 changes: 19 additions & 1 deletion flake.lock

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

52 changes: 27 additions & 25 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,39 @@
# limitations under the License.
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-24.05;
nix-eda.url = github:efabless/nix-eda;
};

outputs = {
self,
nixpkgs,
nix-eda,
...
}: {
# Helper functions
forAllSystems = function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (
system:
function (import nixpkgs {
inherit system;
})
);
}: let
nixpkgs = nix-eda.inputs.nixpkgs;
lib = nixpkgs.lib;
in {
overlays = {
default = lib.composeManyExtensions [
(nix-eda.composePythonOverlay (pkgs': pkgs: pypkgs': pypkgs: let
callPythonPackage = lib.callPackageWith (pkgs' // pkgs'.python3.pkgs);
in {
ioplace-parser = callPythonPackage ./default.nix {};
}))
];
};

# Outputs
packages = self.forAllSystems (pkgs: let
callPackage = pkgs.lib.callPackageWith (pkgs // self.packages.${pkgs.system});
callPythonPackage = pkgs.lib.callPackageWith (pkgs // pkgs.python3.pkgs // self.packages.${pkgs.system});
in
rec {
ioplace-parser = callPythonPackage ./default.nix {};
default = ioplace-parser;
}
legacyPackages = nix-eda.forAllSystems (
system:
import nixpkgs {
inherit system;
overlays = [nix-eda.overlays.default self.overlays.default];
}
);

# Outputs
packages = nix-eda.forAllSystems (system: {
inherit (self.legacyPackages.${system}.python3.pkgs) ioplace-parser;
default = self.packages.${system}.ioplace-parser;
});
};
}

0 comments on commit 003772e

Please sign in to comment.