-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
64 lines (55 loc) · 1.77 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
{
description = "Cowboy Home Assistant Integration Development Environment";
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};
pythonEnv = pkgs.python311.withPackages (ps: with ps; [
pip
virtualenv
]);
in
{
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
pythonEnv
git
pre-commit
ruby
jekyll
bundler
];
shellHook = ''
# Create virtual environment if it doesn't exist
if [ ! -d .venv ]; then
echo "Creating virtual environment..."
python -m venv .venv
fi
# Activate virtual environment
source .venv/bin/activate
# Install dependencies if needed
if [ ! -f .venv/.installed ]; then
echo "Installing dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
touch .venv/.installed
fi
(cd docs && bundle install)
# Add .venv/bin to PATH
export PATH="$PWD/.venv/bin:$PATH"
echo "Development environment ready!"
echo ""
echo "Quick start:"
echo "1. Run 'hass -c config' to start Home Assistant"
echo "2. Visit http://localhost:8123 in your browser"
echo "3. Run 'pytest tests/' to run tests"
echo "4. Run 'cd docs && bundle exec jekyll serve' to preview docs"
'';
};
}
);
}