Skip to content

Commit

Permalink
feat: Add sppl (#5)
Browse files Browse the repository at this point in the history
* feat: add sppl package
* fix: use nixpkgs-compatible versions of numpy etc

The GitHub (rather than PyPi) pinned source can be
removed once it is released as 2.0.5 or greater on Pypi.
  • Loading branch information
ships authored May 6, 2024
1 parent d99bfec commit 051fd3e
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 22 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,26 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-23.11
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: |
- name: build sppl
run: |
nix build \
-L \
-o ./sppl \
'.#sppl'
- name: build base image (not pushed)
run: |
nix build \
-L \
-o ./imgBase \
'.#ociImgBase'
- run: |
- name: build Gensql Query image
run: |
nix build \
-L \
-o ./imgGensqlQuery \
'.#ociImgGensqlQuery'
- run: |
- name: build Loom image
run: |
nix build \
-L \
-o ./imgLoom \
Expand Down
30 changes: 12 additions & 18 deletions flake.lock

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

14 changes: 13 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
# apps, and devshells are per system.
perSystem = { config, self', inputs', pkgs, system, ... }:
let
sppl = pkgs.callPackage ./pkgs/sppl {};

ociImgBase = pkgs.callPackage ./pkgs/oci/base {
inherit nixpkgs;
basicTools = self.lib.basicTools;
Expand All @@ -46,14 +48,24 @@
packages = loom.more_packages // {
inherit
loom
sppl

ociImgBase
ociImgGensqlQuery
ociImgLoom
;
};
in {
devShells.default = pkgs.mkShell {
buildInputs = [] ++ toolkit;
packages = [] ++ toolkit;
};

devShells.sppl = pkgs.mkShell {
packages
= [sppl]
++ sppl.checkInputs
++ toolkit
;
};

inherit packages;
Expand Down
50 changes: 50 additions & 0 deletions pkgs/sppl/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ pkgs,
system,
...
}: let

# relies on specific versions of deps that are no longer present in
# nixpkgs stable; we must checkout a specific SHA
nixpkgs-sppl = import (pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
rev = "994df04c3c700fe9edb1b69b82ba3c627e5e04ff";
sha256 = "sha256-60hLkFqLRI+5XEeacXaVPHdl6m/P8rN2L4luLGxklqs=";
}) {inherit system;};
pypkgs = nixpkgs-sppl.python39Packages;

sppl = pypkgs.buildPythonPackage rec { # not in nixpkgs
pname = "sppl";
version = "2.0.4";

# Use a version of sppl that has Nixpkgs-compatible versions of some packages
src = pkgs.fetchFromGitHub {
owner = "probsys";
repo = "sppl";
rev = "ab6435648e56df1603c4d8d27029605c247cb9f5";
sha256 = "sha256-hFIR073wDRXyt8EqFkLZNDdGUjPTyWYOfDg5eGTjvz0=";
};

propagatedBuildInputs = with pypkgs; [
astunparse
numpy
scipy
sympy
];

checkInputs = with pypkgs; [
coverage
pytest
pytestCheckHook
pytest-timeout
];

pytestFlagsArray = [ "--pyargs" "sppl" ];

pipInstallFlags = [ "--no-deps" ];

passthru.runtimePython = nixpkgs-sppl.python39.withPackages (p: [ sppl ]);
passthru.checkInputs = checkInputs;
};

in sppl

0 comments on commit 051fd3e

Please sign in to comment.