-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this is a really experimental project that's getting a ton of changes every day, so I'll have to keep an eye on things. Should work for now though :-)
- Loading branch information
1 parent
077c28a
commit 59421f2
Showing
2 changed files
with
95 additions
and
94 deletions.
There are no files selected for viewing
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,46 +1,58 @@ | ||
{ | ||
description = "Python program to show your google calendar next meeting"; | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
inputs.flake-utils.url = "github:numtide/flake-utils"; | ||
inputs.poetry2nix = { | ||
url = "github:nix-community/poetry2nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
inputs.flake-utils.follows = "flake-utils"; | ||
pyproject-nix = { | ||
url = "github:nix-community/pyproject.nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
pyproject-build-systems = { | ||
url = "github:pyproject-nix/build-system-pkgs"; | ||
inputs.pyproject-nix.follows = "pyproject-nix"; | ||
inputs.uv2nix.follows = "uv2nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
uv2nix = { | ||
url = "github:adisbladis/uv2nix"; | ||
inputs.pyproject-nix.follows = "pyproject-nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = { | ||
self, | ||
nixpkgs, | ||
flake-utils, | ||
poetry2nix, | ||
uv2nix, | ||
pyproject-nix, | ||
pyproject-build-systems, | ||
... | ||
}: | ||
flake-utils.lib.eachDefaultSystem (system: let | ||
p2n = import poetry2nix {inherit pkgs;}; | ||
python = pkgs.python3; | ||
projectDir = ../.; | ||
overrides = p2n.overrides.withDefaults (final: prev: { | ||
# use wheels to build ruff & mypy | ||
ruff = prev.ruff.override { | ||
preferWheel = true; | ||
}; | ||
mypy = prev.mypy.override { | ||
preferWheel = true; | ||
}; | ||
}); | ||
poetry_env = p2n.mkPoetryEnv { | ||
inherit python projectDir overrides; | ||
}; | ||
poetry_app = p2n.mkPoetryApplication { | ||
inherit python projectDir overrides; | ||
}; | ||
inherit (nixpkgs) lib; | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
python = pkgs.python312; | ||
# setup uv2nix workspace & overlay | ||
workspace = uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ../.;}; | ||
overlay = workspace.mkPyprojectOverlay { | ||
# Prefer prebuilt binary wheels as a package source. | ||
sourcePreference = "wheel"; # or sourcePreference = "sdist"; | ||
}; | ||
pythonSet = | ||
# Use base package set from pyproject.nix builders | ||
(pkgs.callPackage pyproject-nix.build.packages { | ||
inherit python; | ||
}) | ||
.overrideScope | ||
( | ||
lib.composeManyExtensions [ | ||
pyproject-build-systems.overlays.default | ||
overlay | ||
] | ||
); | ||
in { | ||
packages = { | ||
nextmeeting = poetry_app; | ||
default = self.packages.${system}.nextmeeting; | ||
${system}.default = pythonSet.mkVirtualEnv "nextmeeting" workspace.deps.default; | ||
}; | ||
devShells.default = | ||
pkgs.mkShell {packages = [pkgs.poetry poetry_env];}; | ||
}); | ||
} |