Expose pythonEnv from flake

This commit is contained in:
Tim Van Baak 2024-11-06 19:03:19 -08:00
parent e72f9aa349
commit c903947f00
3 changed files with 27 additions and 24 deletions

4
.gitignore vendored
View File

@ -159,6 +159,8 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
venv
# nixos-shell # nixos-shell
nixos.qcow2 nixos.qcow2
@ -166,4 +168,4 @@ nixos.qcow2
result result
# test sources # test sources
tests/**/*.item tests/**/*.item

View File

@ -3,6 +3,9 @@
help: ## display this help help: ## display this help
@awk 'BEGIN{FS = ":.*##"; printf "\033[1m\nUsage\n \033[1;92m make\033[0;36m <target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST) @awk 'BEGIN{FS = ":.*##"; printf "\033[1m\nUsage\n \033[1;92m make\033[0;36m <target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST)
venv: ## link the python dev environment to ./venv
nix build .#pythonEnv -o venv
lint: ## run linters lint: ## run linters
nix fmt nix fmt
black **/*.py black **/*.py

View File

@ -23,6 +23,14 @@
let let
inherit (nixpkgs.lib) makeOverridable nixosSystem; inherit (nixpkgs.lib) makeOverridable nixosSystem;
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
pythonEnv = pkgs.python3.withPackages (
pypkgs: with pypkgs; [
flask
black
pytest
]
);
in in
{ {
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style; formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
@ -39,32 +47,22 @@
{ {
default = self.packages.${system}.intake; default = self.packages.${system}.intake;
inherit (pkgs) intake; inherit (pkgs) intake;
inherit pythonEnv;
}; };
devShells.${system} = { devShells.${system} = {
default = default = pkgs.mkShell {
let packages = [
pkgs = nixpkgs.legacyPackages.${system}; pythonEnv
pythonEnv = pkgs.python3.withPackages ( pkgs.gnumake
pypkgs: with pypkgs; [ pkgs.nixos-shell
flask # We only take this dependency for htpasswd, which is a little unfortunate
black pkgs.apacheHttpd
pytest ];
] shellHook = ''
); PS1="(develop) $PS1"
in '';
pkgs.mkShell { };
packages = [
pythonEnv
pkgs.gnumake
pkgs.nixos-shell
# We only take this dependency for htpasswd, which is a little unfortunate
pkgs.apacheHttpd
];
shellHook = ''
PS1="(develop) $PS1"
'';
};
}; };
overlays.default = final: prev: { overlays.default = final: prev: {