-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
76 additions
and
84 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 |
---|---|---|
@@ -1,104 +1,31 @@ | ||
{ | ||
description = "Flake for Dooit"; | ||
description = "Flake for Dooit with default.nix integration"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
}; | ||
|
||
outputs = inputs: let | ||
# Define function to generate attributes for each system | ||
forEachSystem = inputs.nixpkgs.lib.genAttrs inputs.nixpkgs.lib.platforms.all; | ||
outputs = { | ||
self, | ||
nixpkgs, | ||
... | ||
}: let | ||
forEachSystem = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.all; | ||
|
||
# Import nixpkgs for each system | ||
pkgsFor = forEachSystem ( | ||
system: | ||
import inputs.nixpkgs { | ||
import nixpkgs { | ||
inherit system; | ||
} | ||
); | ||
|
||
# Common Python packages used in both main package and devShell | ||
mainPkgs = python3: | ||
with python3; [ | ||
poetry-core | ||
pyperclip | ||
textual | ||
pyyaml | ||
dateutil | ||
sqlalchemy | ||
platformdirs | ||
tzlocal | ||
click | ||
]; | ||
|
||
# Additional packages for the devShell | ||
devShellPkgs = python3: | ||
with python3; [ | ||
textual-dev | ||
pre-commit-hooks | ||
pytest | ||
pytest-aio | ||
faker | ||
]; | ||
|
||
# Native build inputs | ||
nativeBuildInputs = pkgs: | ||
with pkgs; [ | ||
poetry | ||
]; | ||
|
||
# Define devShell for each system | ||
devShellFor = system: | ||
inputs.nixpkgs.lib.genAttrs ["default"] ( | ||
_: | ||
pkgsFor.${system}.mkShell { | ||
buildInputs = | ||
(mainPkgs pkgsFor.${system}.python312Packages) | ||
++ (devShellPkgs pkgsFor.${system}.python312Packages) | ||
++ [pkgsFor.${system}.bun]; | ||
|
||
shellHook = '' | ||
cd site/ | ||
${pkgsFor.${system}.bun}/bin/bun install | ||
cd .. | ||
''; | ||
} | ||
); | ||
|
||
# Define default package for each system | ||
defaultPackageFor = system: | ||
pkgsFor.${system}.python312Packages.buildPythonPackage { | ||
pname = "dooit"; | ||
version = "3.0.0"; | ||
src = ./.; | ||
format = "pyproject"; | ||
|
||
nativeBuildInputs = nativeBuildInputs pkgsFor.${system}; | ||
|
||
pythonRelaxDeps = [ | ||
"textual" | ||
"tzlocal" | ||
"platformdirs" | ||
"sqlalchemy" | ||
]; | ||
|
||
buildInputs = mainPkgs pkgsFor.${system}.python312Packages; | ||
propagatedBuildInputs = mainPkgs pkgsFor.${system}.python312Packages; | ||
|
||
doCheck = false; | ||
}; | ||
packageFor = system: | ||
pkgsFor.${system}.callPackage ./nix {}; | ||
in { | ||
# Define the devShells for each system | ||
devShells = forEachSystem devShellFor; | ||
|
||
# Define the default package for each system | ||
packages = forEachSystem ( | ||
system: { | ||
default = defaultPackageFor system; | ||
default = packageFor system; | ||
} | ||
); | ||
|
||
# Expose a top-level `defaultPackage` that detects the current system | ||
defaultPackage = defaultPackageFor inputs.nixpkgs.lib.systems.defaultSystem; | ||
}; | ||
} |
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,65 @@ | ||
{ | ||
lib, | ||
fetchFromGitHub, | ||
dooit, | ||
python311, | ||
testers, | ||
nix-update-script, | ||
}: let | ||
python3 = python311; | ||
in | ||
python3.pkgs.buildPythonApplication rec { | ||
pname = "dooit"; | ||
version = "3.0.0"; | ||
pyproject = true; | ||
|
||
src = fetchFromGitHub { | ||
owner = "kraanzu"; | ||
repo = "dooit"; | ||
rev = "develop"; # TODO: Change to version | ||
hash = "sha256-N0r37iEj0P/qLBFG9bGPUPjw31Wk9kA+rrZd59Yrxd4="; | ||
}; | ||
|
||
build-system = with python3.pkgs; [poetry-core]; | ||
|
||
pythonRelaxDeps = [ | ||
"tzlocal" | ||
"textual" | ||
]; | ||
|
||
propagatedBuildInputs = with python3.pkgs; [ | ||
pyperclip | ||
textual | ||
pyyaml | ||
dateutil | ||
sqlalchemy | ||
platformdirs | ||
tzlocal | ||
click | ||
]; | ||
|
||
# No tests available | ||
doCheck = true; | ||
|
||
passthru = { | ||
tests.version = testers.testVersion { | ||
package = dooit; | ||
command = "HOME=$(mktemp -d) dooit --version"; | ||
}; | ||
|
||
updateScript = nix-update-script {}; | ||
}; | ||
|
||
meta = with lib; { | ||
description = "TUI todo manager"; | ||
homepage = "https://github.com/kraanzu/dooit"; | ||
changelog = "https://github.com/kraanzu/dooit/blob/develop/CHANGELOG.md"; # TODO: change to version | ||
license = licenses.mit; | ||
maintainers = with maintainers; [ | ||
khaneliman | ||
wesleyjrz | ||
kraanzu | ||
]; | ||
mainProgram = "dooit"; | ||
}; | ||
} |