Skip to content

Commit 5dc7d88

Browse files
authored
Merge pull request #78 from ngi-nix/flake
Add Nix flake as a build system
2 parents 7a4e715 + 0ce080e commit 5dc7d88

File tree

6 files changed

+103
-0
lines changed

6 files changed

+103
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,6 @@ tcl
7171

7272
# Ignore Jupyter Notebook related temp files
7373
.ipynb_checkpoints/
74+
75+
# Nix
76+
/result*

default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/b4a34015c698c7793d592d66adbab377907a2be8.tar.gz) {
2+
src = builtins.fetchGit ./.;
3+
}).defaultNix

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
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.";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6+
};
7+
8+
outputs = { self, nixpkgs }: ({
9+
overlays.default = import ./overlay.nix;
10+
}) // (
11+
let
12+
supportedSystems = [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ];
13+
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
14+
nixpkgsFor = forAllSystems (system: self.overlays.default null nixpkgs.legacyPackages.${system});
15+
in
16+
{
17+
packages = forAllSystems (system: rec {
18+
python3Packages = {
19+
inherit (nixpkgsFor.${system}.python3Packages) univers;
20+
};
21+
default = python3Packages.univers;
22+
});
23+
}
24+
);
25+
}

overlay.nix

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
final: prev: rec {
2+
python3 = prev.python3.override {
3+
packageOverrides = final: prev:
4+
{
5+
univers = python3Packages.callPackage
6+
({ lib
7+
, buildPythonPackage
8+
, git
9+
, setuptools-scm
10+
, attrs
11+
, packaging
12+
, pyparsing
13+
, semantic-version
14+
, semver
15+
, black
16+
, commoncode
17+
, pytestCheckHook
18+
, saneyaml
19+
}: buildPythonPackage rec {
20+
name = "univers";
21+
22+
src = ./.;
23+
24+
nativeBuildInputs = [ git setuptools-scm ];
25+
propagatedBuildInputs = [ attrs packaging pyparsing semantic-version semver ];
26+
checkInputs = [ black commoncode pytestCheckHook saneyaml ];
27+
28+
dontConfigure = true; # ./configure tries to setup virtualenv and downloads dependencies
29+
30+
pythonImportsCheck = [ "univers" ];
31+
32+
meta = with lib; {
33+
description = "Library for parsing version ranges and expressions";
34+
homepage = "https://github.com/nexB/univers";
35+
license = with licenses; [ asl20 bsd3 mit ];
36+
};
37+
})
38+
{ };
39+
};
40+
};
41+
python3Packages = prev.recurseIntoAttrs python3.pkgs;
42+
}

shell.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/b4a34015c698c7793d592d66adbab377907a2be8.tar.gz) {
2+
src = builtins.fetchGit ./.;
3+
}).shellNix

0 commit comments

Comments
 (0)