diff --git a/.gitignore b/.gitignore index 73d73ac..fc37d40 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ __pycache__ *.egg-info /build .coverage -htmlcov \ No newline at end of file +htmlcov +.DS_Store diff --git a/default.nix b/default.nix index 477b928..8ee3bf3 100644 --- a/default.nix +++ b/default.nix @@ -1,9 +1,12 @@ { - pkgs? import {}, - 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; @@ -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"; @@ -36,10 +39,10 @@ in buildPythonPackage rec { ]; preBuild = '' - make antlr + make antlr ''; propagatedBuildInputs = [ antlr4_10-python3-runtime ]; -} \ No newline at end of file +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..af6d1a7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "narHash": "sha256-C36QmoJd5tdQ5R9MC1jM7fBkZW9zBUqbUCsgwS6j4QU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c1be43e8e837b8dbee2b3665a007e761680f0c3d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..79218f0 --- /dev/null +++ b/flake.nix @@ -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; + } + ); + }; +}