-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a nix flake to batou_ext to build the batou_ext python package as well as a devshell for development purposes
- Loading branch information
Showing
4 changed files
with
259 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "Nix Test" | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Trigger the workflow on push or pull request events: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
|
||
# Allow to run this workflow manually from the Actions tab: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: cachix/install-nix-action@v20 | ||
- run: nix build | ||
- run: nix flake check |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
description = "A flake for the flyingcircus batou_ext library"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
|
||
treefmt-nix.url = "github:numtide/treefmt-nix"; | ||
nix-filter.url = "github:numtide/nix-filter"; | ||
}; | ||
|
||
outputs = inputs @ {flake-parts, ...}: | ||
flake-parts.lib.mkFlake {inherit inputs;} { | ||
imports = [ | ||
inputs.treefmt-nix.flakeModule | ||
]; | ||
|
||
systems = [ | ||
"x86_64-linux" | ||
"aarch64-darwin" | ||
]; | ||
|
||
perSystem = { | ||
config, | ||
pkgs, | ||
... | ||
}: let | ||
src = inputs.nix-filter.lib { | ||
root = inputs.self; | ||
exclude = [ | ||
(inputs.nix-filter.lib.matchExt "nix") | ||
"flake.lock" | ||
]; | ||
}; | ||
batou_ext = pkgs.python3Packages.callPackage ./nix/batou_ext.nix {inherit src;}; | ||
in { | ||
treefmt = { | ||
projectRootFile = "flake.nix"; | ||
programs.alejandra.enable = true; | ||
settings.formatter.alejandra.excludes = [ | ||
"src/batou_ext/*" | ||
]; | ||
flakeCheck = false; | ||
}; | ||
|
||
formatter = config.treefmt.build.wrapper; | ||
|
||
packages = rec { | ||
default = batou_ext; | ||
inherit batou_ext; | ||
}; | ||
|
||
checks = { | ||
inherit batou_ext; | ||
}; | ||
|
||
devShells.default = pkgs.mkShell { | ||
packages = [ | ||
(pkgs.python3.withPackages (ps: [batou_ext ps.tox])) | ||
]; | ||
|
||
shellHook = '' | ||
export APPENV_BASEDIR=$PWD | ||
''; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
buildPythonPackage, | ||
pyyaml, | ||
pyaml, | ||
six, | ||
fetchPypi, | ||
src, | ||
markupsafe, | ||
requests, | ||
execnet, | ||
importlib-metadata, | ||
remote-pdb, | ||
py, | ||
configupdater, | ||
mock, | ||
pytest, | ||
setuptools, | ||
inquirerpy, | ||
}: let | ||
jinja2 = buildPythonPackage rec { | ||
pname = "Jinja2"; | ||
version = "3.0.1"; | ||
propagatedBuildInputs = [markupsafe]; | ||
src = fetchPypi { | ||
inherit pname version; | ||
sha256 = "sha256-cD9IS0emr1AudDyRIllcyBKwJx9mFyJAMRT3GnnQ9aQ="; | ||
}; | ||
}; | ||
batou = buildPythonPackage rec { | ||
pname = "batou"; | ||
version = "2.3.1"; | ||
propagatedBuildInputs = [ | ||
requests | ||
pyyaml | ||
execnet | ||
importlib-metadata | ||
remote-pdb | ||
py | ||
configupdater | ||
mock | ||
pytest | ||
setuptools | ||
jinja2 | ||
]; | ||
src = fetchPypi { | ||
inherit pname version; | ||
sha256 = "sha256-fPLYvmsNubKfsYWR039CoF7/767EDtXLFNAWhDAg9m4="; | ||
}; | ||
}; | ||
in | ||
buildPythonPackage { | ||
pname = "batou_ext"; | ||
version = "latest"; | ||
propagatedBuildInputs = [pyyaml pyaml six batou inquirerpy]; | ||
inherit src; | ||
} |