Skip to content

Commit

Permalink
Add flake
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruder committed Jul 22, 2022
1 parent b74229c commit d1378d7
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ tcl

# Ignore Jupyter Notebook related temp files
.ipynb_checkpoints/

# Nix
/result*
3 changes: 3 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).defaultNix
27 changes: 27 additions & 0 deletions flake.lock

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

25 changes: 25 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
description = "Parse and compare all the package versions and all the ranges. From debian, npm, pypi, ruby and more. Process all the version range specs and expressions.";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};

outputs = { self, nixpkgs }: ({
overlays.default = import ./overlay.nix;
}) // (
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
nixpkgsFor = forAllSystems (system: self.overlays.default null nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (system: rec {
python3Packages = {
inherit (nixpkgsFor.${system}.python3Packages) univers;
};
default = python3Packages.univers;
});
}
);
}
43 changes: 43 additions & 0 deletions overlay.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
final: prev: rec {
python3 = prev.python3.override {
packageOverrides = final: prev:
{
univers = python3Packages.callPackage
({ lib
, buildPythonPackage
, git
, setuptools-scm
, attrs
, packaging
, pyparsing
, semantic-version
, semver
, black
, commoncode
, pytestCheckHook
, saneyaml
}: buildPythonPackage rec {
name = "univers";

src = ./.;

nativeBuildInputs = [ git setuptools-scm ];
propagatedBuildInputs = [ attrs packaging pyparsing semantic-version semver ];
checkInputs = [ black commoncode pytestCheckHook saneyaml ];

dontConfigure = true; # ./configure tries to setup virtualenv and downloads dependencies

pythonImportsCheck = [ "univers" ];

meta = with lib; {
description = "Library for parsing version ranges and expressions";
homepage = "https://github.com/nexB/univers";
license = with licenses; [ asl20 bsd3 mit ];
platforms = platforms.linux;
};
})
{ };
};
};
python3Packages = prev.recurseIntoAttrs python3.pkgs;
}
3 changes: 3 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).shellNix

0 comments on commit d1378d7

Please sign in to comment.