Skip to content

Commit

Permalink
Add flake.nix to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
firecat53 committed Apr 29, 2024
1 parent 9cd6110 commit 8143a0e
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ The follow actions are supported:
## Build/development

- pyproject.toml is configured for [hatch][2] for building and submitting to pypi.
- flake.nix is available for a development shell or building/testing the package
if desired. `nix develop`

[1]: http://urwid.org/manual/displayattributes.html#display-attributes "Urwid display attributes"
[2]: https://hatch.pypa.io/latest/ "Hatch"
26 changes: 26 additions & 0 deletions flake.lock

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

69 changes: 69 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
description = "View/select the URLs in an email message or file";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};

outputs = {
self,
nixpkgs,
}: let
systems = ["x86_64-linux" "i686-linux" "aarch64-linux"];
forAllSystems = f:
nixpkgs.lib.genAttrs systems (system:
f rec {
pkgs = nixpkgs.legacyPackages.${system};
commonPackages = builtins.attrValues {
inherit
(pkgs.python312Packages)
python
urwid
;
};
});
in {
devShells = forAllSystems ({
pkgs,
commonPackages,
}: {
default = pkgs.mkShell {
packages = commonPackages ++ [pkgs.pandoc];
shellHook = ''
alias urlscan="python -m urlscan"
export PYTHONPATH="$PYTHONPATH:$PWD"
'';
};
});
packages = forAllSystems ({
pkgs,
commonPackages,
}: {
default = pkgs.python3Packages.buildPythonApplication {
name = "urlscan";
pname = "urlscan";
format = "pyproject";
src = ./.;
nativeBuildInputs = builtins.attrValues {
inherit
(pkgs)
git
;
inherit
(pkgs.python312Packages)
hatchling
hatch-vcs
;
};
propagatedBuildInputs = commonPackages;
meta = {
description = "View/select the URLs in an email message or file";
homepage = "https://github.com/firecat53/urlscan";
license = pkgs.lib.licenses.gpl2Plus;
maintainers = ["firecat53"];
platforms = systems;
};
};
});
};
}

0 comments on commit 8143a0e

Please sign in to comment.