Skip to content

Commit

Permalink
flake: improve devshell, add watson package
Browse files Browse the repository at this point in the history
  • Loading branch information
b12f committed Nov 25, 2024
1 parent 9e03f54 commit 73e7c0c
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 63 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ pip-log.txt
*.sublime-workspace
*.swp
*.sw[po]

# nix related files

/result
49 changes: 22 additions & 27 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 68 additions & 36 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,51 +1,83 @@
{
description = "Watson devenv";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};

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
outputs = inputs@{ self, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
];
imports = [
inputs.flake-parts.flakeModules.easyOverlay
];
perSystem =
args@{
system,
pkgs,
config,
lib,
...
}:
{
default = pkgs.devshell.mkShell {
# Add additional packages you'd like to be available in your devshell
# PATH here
devshell.packages = with pkgs; [
packages = {
watson-td = pkgs.python3Packages.buildPythonPackage rec {
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
pytest-runner
];
};
};
overlayAttrs = config.packages;

devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
gnumake
virtualenv
(pkgs.python3.withPackages (p: [
# select Python packages here
(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
p.pytest-runner
]))
];
};
});

packages = eachSystem (system:
let
pkgs = nixpkgsFor.${system};
in
{
});
};
};
}

0 comments on commit 73e7c0c

Please sign in to comment.