-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
70 lines (63 loc) · 1.96 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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;
};
});
});
};
}