Skip to content

Commit

Permalink
Flake
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Apr 16, 2024
1 parent 41092c7 commit ba207d5
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ __pycache__
*.egg-info
/build
.coverage
htmlcov
htmlcov
.DS_Store
15 changes: 9 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
pkgs? import <nixpkgs> {},
gitignore-src ? import ./nix/gitignore.nix { inherit pkgs; },
antlr4_10,
black,
lib,
nix-gitignore,
buildPythonPackage,
}:

with pkgs; with python3.pkgs; let
let
antlr4_10-python3-runtime = buildPythonPackage rec {
pname = "antlr4-python3-runtime";
inherit (antlr4_10.runtime.cpp) version src;
Expand All @@ -25,7 +28,7 @@ in buildPythonPackage rec {
version_list = builtins.match ''.+''\n__version__ = "([^"]+)"''\n.+''$'' version_file;
version = builtins.head version_list;

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

doCheck = false;
PIP_DISABLE_PIP_VERSION_CHECK = "1";
Expand All @@ -36,10 +39,10 @@ in buildPythonPackage rec {
];

preBuild = ''
make antlr
make antlr
'';

propagatedBuildInputs = [
antlr4_10-python3-runtime
];
}
}
26 changes: 26 additions & 0 deletions flake.lock

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

49 changes: 49 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2024 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-23.11;
};

outputs = {
self,
nixpkgs,
...
}: {
# Helper functions
forAllSystems = function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (
system:
function (import nixpkgs {
inherit system;
})
);

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

0 comments on commit ba207d5

Please sign in to comment.