This commit is contained in:
commit
95a533c876
451 changed files with 18255 additions and 0 deletions
77
templates/dev/flask-hello/flake.nix
Normal file
77
templates/dev/flask-hello/flake.nix
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
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;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue