-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathflake.nix
More file actions
103 lines (84 loc) · 2.72 KB
/
flake.nix
File metadata and controls
103 lines (84 loc) · 2.72 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
description = "TerraVision - AI-Powered Terraform to Architecture Diagram Generator";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
python = pkgs.python312;
pythonPackages = python.pkgs;
# Wrapper that provides 'terraform' command using opentofu
terraformWrapper = pkgs.writeShellScriptBin "terraform" ''
exec ${pkgs.opentofu}/bin/tofu "$@"
'';
# Override python-hcl2 to use version 4.3.0 as required by terravision
python-hcl2 = pythonPackages.buildPythonPackage rec {
pname = "python-hcl2";
version = "4.3.0";
pyproject = true;
src = pkgs.fetchPypi {
inherit pname version;
hash = "sha256-QeN+Kps9Ij2l6OvJnnK0DSMVCH6Wb0WPfqwTx4Mdm54=";
};
build-system = with pythonPackages; [ setuptools setuptools-scm ];
dependencies = with pythonPackages; [
lark
];
doCheck = false;
};
terravision = pythonPackages.buildPythonApplication {
pname = "terravision";
version = "0.10.2";
pyproject = true;
src = ./.;
build-system = [ pythonPackages.poetry-core ];
dependencies = with pythonPackages; [
click
gitpython
graphviz
tqdm
python-hcl2
pyyaml
debugpy
ipaddr
ollama
requests
typing-extensions
tomli
];
# Graphviz binary and terraform wrapper are needed at runtime
makeWrapperArgs = [
"--prefix" "PATH" ":" "${pkgs.lib.makeBinPath [ pkgs.graphviz terraformWrapper ]}"
];
# Skip tests during build
doCheck = false;
meta = with pkgs.lib; {
description = "Terraform Architecture Visualizer";
homepage = "https://github.com/patrickchugh/terravision";
license = licenses.agpl3Only;
mainProgram = "terravision";
};
};
in {
packages = {
default = terravision;
terravision = terravision;
};
devShells.default = pkgs.mkShell {
packages = [
terravision
pkgs.graphviz
terraformWrapper
pkgs.git
];
shellHook = ''
echo "TerraVision development environment"
echo "Run 'terravision --help' to get started"
'';
};
}
);
}