synix/templates/dev/flask-hello/flake.nix
sid 95a533c876
All checks were successful
Deploy docs / build-and-deploy (push) Successful in 3s
initial commit
2026-02-23 20:34:35 +01:00

77 lines
1.9 KiB
Nix

{
description = "A hello world template for Python Flask";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
...
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (
system:
import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
}
);
in
{
overlays.default = final: _prev: {
flask_hello = self.packages.${final.system}.default;
};
packages = forAllSystems (system: {
default = nixpkgsFor.${system}.callPackage ./nix/package.nix { };
});
devShells = forAllSystems (system: {
default = import ./nix/shell.nix { pkgs = nixpkgsFor.${system}; };
});
nixosModules = {
flask_hello = import ./nix/module.nix;
};
formatter = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
config = self.checks.${system}.pre-commit-check.config;
inherit (config) package configFile;
script = ''
${pkgs.lib.getExe package} run --all-files --config ${configFile}
'';
in
pkgs.writeShellScriptBin "pre-commit-run" script
);
checks = forAllSystems (system: {
build-packages = nixpkgsFor."${system}".linkFarm "flake-packages-${system}" self.packages.${system};
pre-commit-check = self.inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixfmt.enable = true;
black.enable = true;
};
};
});
};
}