-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flake: dev env + build/test gcgen pkg
- Loading branch information
1 parent
8d16671
commit d40b3d2
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
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,70 @@ | ||
{ | ||
description = "bindings generation dev env"; | ||
|
||
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; }; | ||
|
||
outputs = { self, nixpkgs }: | ||
let | ||
allSystems = [ | ||
"x86_64-linux" # AMD/Intel Linux | ||
"x86_64-darwin" # AMD/Intel macOS | ||
"aarch64-linux" # ARM Linux | ||
"aarch64-darwin" # ARM macOS | ||
]; | ||
|
||
forAllSystems = fn: | ||
nixpkgs.lib.genAttrs allSystems | ||
(system: fn { pkgs = import nixpkgs { inherit system; }; }); | ||
|
||
rev = "${self.lastModifiedDate}"; | ||
|
||
in { | ||
# used when calling `nix fmt <path/to/flake.nix>` | ||
formatter = forAllSystems ({ pkgs }: pkgs.nixfmt); | ||
|
||
# nix develop <flake-ref>#<name> | ||
# -- | ||
# $ nix develop <flake-ref>#blue | ||
# $ nix develop <flake-ref>#yellow | ||
devShells = forAllSystems ({ pkgs }: | ||
let python = pkgs.python311Packages; | ||
in { | ||
default = pkgs.mkShell { | ||
name = "nixdev"; | ||
nativeBuildInputs = (with pkgs.python311Packages; [ | ||
python-lsp-server | ||
pyls-isort | ||
pylsp-mypy | ||
pytest | ||
black | ||
sphinx | ||
]); | ||
}; | ||
}); | ||
|
||
# nix run|build <flake-ref>#<pkg-name> | ||
# -- | ||
# $ nix run <flake-ref>#hello | ||
# $ nix run <flake-ref>#cowsay | ||
packages = forAllSystems ({ pkgs }: | ||
let python = pkgs.python311Packages; | ||
in rec { | ||
gcgen = (python.buildPythonPackage rec { | ||
pname = "gcgen"; | ||
version = rev; | ||
src = ./.; | ||
doCheck = true; | ||
propagatedBuildInputs = [ ]; | ||
checkInputs = (with python; [ pytest ]); | ||
checkPhase = '' | ||
TERM=unknown python -m pytest | ||
''; | ||
meta = with pkgs.lib; { | ||
description = "a general code generator"; | ||
homepage = "https://jwdevantier.github.io/gcgen/"; | ||
license = licenses.mit; | ||
}; | ||
}); | ||
}); | ||
}; | ||
} |
Empty file.