Skip to content

Commit

Permalink
add flake
Browse files Browse the repository at this point in the history
  • Loading branch information
pschmitt committed Oct 31, 2024
1 parent bde0709 commit 6cc8eab
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
*.egg-info
build/
dist/
_version.py
result
61 changes: 61 additions & 0 deletions flake.lock

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

104 changes: 104 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
description = "Email autoconfig library";

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};

mylDiscovery = pkgs.python3Packages.buildPythonApplication {
pname = "myl-discovery";
version = builtins.readFile ./version.txt;
pyproject = true;

src = ./.;

buildInputs = [
pkgs.python3Packages.setuptools
pkgs.python3Packages.setuptools-scm
];

propagatedBuildInputs = with pkgs.python3Packages; [
dnspython
exchangelib
requests
rich
xmltodict
];

pythonImportsCheck = [ "myldiscovery" ];

meta = {
description = "Email autodiscovery";
homepage = "https://github.com/pschmitt/myl-discovery";
license = pkgs.lib.licenses.gpl3Only;
maintainers = with pkgs.lib.maintainers; [ pschmitt ];
platforms = pkgs.lib.platforms.all;
};
};

devShell = pkgs.mkShell {
name = "myl-discovery-devshell";

buildInputs = [
pkgs.python3
pkgs.python3Packages.dnspython
pkgs.python3Packages.exchangelib
pkgs.python3Packages.requests
pkgs.python3Packages.rich
pkgs.python3Packages.setuptools
pkgs.python3Packages.setuptools-scm
pkgs.python3Packages.xmltodict
];

# Additional development tools
nativeBuildInputs = [
pkgs.gh # GitHub CLI
pkgs.git
pkgs.python3Packages.ipython
pkgs.neovim
];

# Environment variables and shell hooks
shellHook = ''
export PYTHONPATH=${self.packages.${system}.default}/lib/python3.x/site-packages
echo -e "\e[34mWelcome to the myl-discovery development shell!\e[0m"
# Activate a virtual environment if desired
# source .venv/bin/activate
'';

# Optional: Set up a Python virtual environment
# if you prefer using virtualenv or similar tools
# you can uncomment and configure the following lines
# shellHook = ''
# if [ ! -d .venv ]; then
# python3 -m venv .venv
# source .venv/bin/activate
# pip install --upgrade pip
# else
# source .venv/bin/activate
# fi
# '';
};
in
{
# pkgs
packages."myl-discovery" = mylDiscovery;
defaultPackage = mylDiscovery;

devShells.default = devShell;
}
);
}
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ dependencies = [
"rich >= 13.0.0, < 14.0.0",
"xmltodict >= 0.13.0, < 1.0.0"
]
version = "0.6.1"
dynamic = ["version"]

[tool.setuptools_scm]
write_to = "version.txt"
version_file = "_version.py"

[project.urls]
homepage = "https://github.com/pschmitt/myl-discovery"
Expand Down
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.6.2.dev0+gbde0709.d20241031

0 comments on commit 6cc8eab

Please sign in to comment.