Skip to content

Commit

Permalink
[meta] flakify batou_ext
Browse files Browse the repository at this point in the history
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
PhilTaken committed Jun 16, 2023
1 parent eceec73 commit 92931d2
Show file tree
Hide file tree
Showing 4 changed files with 259 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/nix.yml
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
115 changes: 115 additions & 0 deletions flake.lock

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

68 changes: 68 additions & 0 deletions flake.nix
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
'';
};
};
};
}
56 changes: 56 additions & 0 deletions nix/batou_ext.nix
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;
}

0 comments on commit 92931d2

Please sign in to comment.