-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from pub-solar/flake/add-requirements
flake: improve devshell, add watson package, add github action
- Loading branch information
Showing
4 changed files
with
116 additions
and
65 deletions.
There are no files selected for viewing
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,21 @@ | ||
name: Nix Flake Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
nix-flake-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: nixbuild/nix-quick-install-action@v29 | ||
|
||
- name: build watson | ||
run: nix build '.#watson-td' | ||
|
||
- name: run watson | ||
run: ./result/bin/watson |
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 |
---|---|---|
|
@@ -40,3 +40,7 @@ pip-log.txt | |
*.sublime-workspace | ||
*.swp | ||
*.sw[po] | ||
|
||
# nix related files | ||
|
||
/result |
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 |
---|---|---|
@@ -1,51 +1,82 @@ | ||
{ | ||
description = "Watson devenv"; | ||
|
||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
|
||
inputs.devshell.url = "github:numtide/devshell"; | ||
inputs.devshell.inputs.nixpkgs.follows = "nixpkgs"; | ||
|
||
outputs = {self, nixpkgs, systems, devshell }: | ||
let | ||
eachSystem = nixpkgs.lib.genAttrs (import systems); | ||
# Nixpkgs instantiated for system types in nix-systems | ||
nixpkgsFor = eachSystem (system: | ||
import nixpkgs { | ||
inherit system; | ||
overlays = [ | ||
devshell.overlays.default | ||
]; | ||
} | ||
); | ||
in | ||
{ | ||
devShells = eachSystem (system: | ||
let | ||
pkgs = nixpkgsFor.${system}; | ||
in | ||
{ | ||
default = pkgs.devshell.mkShell { | ||
# Add additional packages you'd like to be available in your devshell | ||
# PATH here | ||
devshell.packages = with pkgs; [ | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
|
||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
}; | ||
|
||
outputs = inputs@{ self, ... }: | ||
inputs.flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = [ | ||
"x86_64-linux" | ||
"aarch64-linux" | ||
"x86_64-darwin" | ||
"aarch64-darwin" | ||
]; | ||
|
||
perSystem = | ||
args@{ pkgs, config, system, ... }: { | ||
packages = { | ||
watson-td = pkgs.python3Packages.buildPythonPackage { | ||
name = "watson-td"; | ||
src = ./.; | ||
propagatedBuildInputs = with pkgs.python3Packages; [ | ||
# requirements | ||
click | ||
click-didyoumean | ||
requests | ||
arrow | ||
|
||
# requirements-dev | ||
flake8 | ||
py | ||
pytest | ||
pytest-datafiles | ||
pytest-mock | ||
pytest-runner | ||
]; | ||
postInstall = '' | ||
installShellCompletion --bash --name watson watson.completion | ||
installShellCompletion --zsh --name _watson watson.zsh-completion | ||
installShellCompletion --fish watson.fish | ||
''; | ||
nativeCheckInputs = with pkgs.python3Packages; [ pytestCheckHook pytest-mock mock pytest-datafiles ]; | ||
nativeBuildInputs = [ pkgs.installShellFiles ]; | ||
}; | ||
}; | ||
|
||
devShells.default = pkgs.mkShell { | ||
buildInputs = with pkgs; [ | ||
gnumake | ||
virtualenv | ||
(pkgs.python3.withPackages (p: [ | ||
# select Python packages here | ||
yaml-language-server | ||
(python3.withPackages (p: [ | ||
# LSP support | ||
p.python-lsp-ruff | ||
p.python-lsp-server | ||
p.python-lsp-server.optional-dependencies | ||
|
||
# pip | ||
p.pip | ||
|
||
# requirements | ||
p.click | ||
p.click-didyoumean | ||
p.requests | ||
p.arrow | ||
|
||
# requirements-dev | ||
p.flake8 | ||
p.py | ||
p.pytest | ||
p.pytest-datafiles | ||
p.pytest-mock | ||
p.pytest-runner | ||
])) | ||
]; | ||
}; | ||
}); | ||
|
||
packages = eachSystem (system: | ||
let | ||
pkgs = nixpkgsFor.${system}; | ||
in | ||
{ | ||
}); | ||
}; | ||
}; | ||
} |