Skip to content

Commit 4400ec6

Browse files
committed
[meta] flakify batou_ext
add a nix flake to batou_ext to build the batou_ext python package as well as a devshell for development purposes
1 parent 1df9b67 commit 4400ec6

File tree

4 files changed

+259
-0
lines changed

4 files changed

+259
-0
lines changed

.github/workflows/nix.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Nix Test"
2+
3+
# Controls when the workflow will run
4+
on:
5+
# Trigger the workflow on push or pull request events:
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
10+
# Allow to run this workflow manually from the Actions tab:
11+
workflow_dispatch:
12+
13+
jobs:
14+
tests:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: cachix/install-nix-action@v20
19+
- run: nix build
20+
- run: nix flake check

flake.lock

Lines changed: 115 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: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
description = "A flake for the flyingcircus batou_ext library";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-parts.url = "github:hercules-ci/flake-parts";
7+
8+
treefmt-nix.url = "github:numtide/treefmt-nix";
9+
nix-filter.url = "github:numtide/nix-filter";
10+
};
11+
12+
outputs = inputs @ {flake-parts, ...}:
13+
flake-parts.lib.mkFlake {inherit inputs;} {
14+
imports = [
15+
inputs.treefmt-nix.flakeModule
16+
];
17+
18+
systems = [
19+
"x86_64-linux"
20+
"aarch64-darwin"
21+
];
22+
23+
perSystem = {
24+
config,
25+
pkgs,
26+
...
27+
}: let
28+
src = inputs.nix-filter.lib {
29+
root = inputs.self;
30+
exclude = [
31+
(inputs.nix-filter.lib.matchExt "nix")
32+
"flake.lock"
33+
];
34+
};
35+
batou_ext = pkgs.python3Packages.callPackage ./nix/batou_ext.nix {inherit src;};
36+
in {
37+
treefmt = {
38+
projectRootFile = "flake.nix";
39+
programs.alejandra.enable = true;
40+
settings.formatter.alejandra.excludes = [
41+
"src/batou_ext/*"
42+
];
43+
flakeCheck = false;
44+
};
45+
46+
formatter = config.treefmt.build.wrapper;
47+
48+
packages = rec {
49+
default = batou_ext;
50+
inherit batou_ext;
51+
};
52+
53+
checks = {
54+
inherit batou_ext;
55+
};
56+
57+
devShells.default = pkgs.mkShell {
58+
packages = [
59+
(pkgs.python3.withPackages (ps: [batou_ext ps.tox]))
60+
];
61+
62+
shellHook = ''
63+
export APPENV_BASEDIR=$PWD
64+
'';
65+
};
66+
};
67+
};
68+
}

nix/batou_ext.nix

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
buildPythonPackage,
3+
pyyaml,
4+
pyaml,
5+
six,
6+
fetchPypi,
7+
src,
8+
markupsafe,
9+
requests,
10+
execnet,
11+
importlib-metadata,
12+
remote-pdb,
13+
py,
14+
configupdater,
15+
mock,
16+
pytest,
17+
setuptools,
18+
inquirerpy,
19+
}: let
20+
jinja2 = buildPythonPackage rec {
21+
pname = "Jinja2";
22+
version = "3.0.1";
23+
propagatedBuildInputs = [markupsafe];
24+
src = fetchPypi {
25+
inherit pname version;
26+
sha256 = "sha256-cD9IS0emr1AudDyRIllcyBKwJx9mFyJAMRT3GnnQ9aQ=";
27+
};
28+
};
29+
batou = buildPythonPackage rec {
30+
pname = "batou";
31+
version = "2.3.1";
32+
propagatedBuildInputs = [
33+
requests
34+
pyyaml
35+
execnet
36+
importlib-metadata
37+
remote-pdb
38+
py
39+
configupdater
40+
mock
41+
pytest
42+
setuptools
43+
jinja2
44+
];
45+
src = fetchPypi {
46+
inherit pname version;
47+
sha256 = "sha256-fPLYvmsNubKfsYWR039CoF7/767EDtXLFNAWhDAg9m4=";
48+
};
49+
};
50+
in
51+
buildPythonPackage {
52+
pname = "batou_ext";
53+
version = "latest";
54+
propagatedBuildInputs = [pyyaml pyaml six batou inquirerpy];
55+
inherit src;
56+
}

0 commit comments

Comments
 (0)