Nix-Templates/DevEnv/Python/flake.nix

55 lines
2.0 KiB
Nix

{
inputs = {
nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling";
nixpkgs-python.url = "github:cachix/nixpkgs-python";
nixpkgs-python.inputs = { nixpkgs.follows = "nixpkgs"; };
systems.url = "github:nix-systems/default";
devenv.url = "github:cachix/devenv";
devenv.inputs.nixpkgs.follows = "nixpkgs";
};
nixConfig = {
extra-trusted-public-keys = [
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
"nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU="
];
extra-substituters = [
"https://devenv.cachix.org"
"https://nixpkgs-python.cachix.org"
];
};
outputs = { self, nixpkgs, devenv, systems, ... } @ inputs:
let
forEachSystem = nixpkgs.lib.genAttrs (import systems);
in
{
packages = forEachSystem (system: {
devenv-up = self.devShells.${system}.default.config.procfileScript;
});
devShells = forEachSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
languages.python = {
enable = true;
version = "3.11.3";
venv.enable = true;
venv.requirements = ./requirements.txt;
};
packages = [ pkgs.zsh pkgs.python311Packages.tkinter ];
processes.run.exec = "python main.py";
}
];
};
});
};
}