Skip to content

Commit

Permalink
Merge pull request #2 from fastapi-mvc/update_generator
Browse files Browse the repository at this point in the history
Update generator
  • Loading branch information
rszamszur authored Mar 26, 2023
2 parents 30d979a + 211ac3d commit 8874e0e
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 49 deletions.
3 changes: 2 additions & 1 deletion .generator.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changes here will be overwritten by Copier
_commit: 0.2.0
_commit: 0.4.1
_src_path: https://github.com/fastapi-mvc/copier-generator.git
copyright_date: 2022
generator: script
generator_name: script
github_actions: true
license: MIT
nix: true
repo_url: https://github.com/fastapi-mvc/copier-script
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
28 changes: 28 additions & 0 deletions .github/workflows/update-flake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Update flake
on:
workflow_dispatch:
# # runs weekly on Sunday at 00:00
# schedule:
# - cron: '0 0 * * 0'

jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v17
with:
pr-title: "Update flake.lock"
# https://github.com/DeterminateSystems/update-flake-lock#with-a-personal-authentication-token
token: ${{ secrets.API_TOKEN_GITHUB }}
pr-labels: |
dependencies
pr-body: |
Automated changes by the [update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) GitHub Action.
```
{{ env.GIT_COMMIT_MESSAGE }}
```
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ Copier template for scaffolding new script upon [fastapi-mvc](https://github.com

## Quickstart

### Using fastapi-mvc

Prerequisites:
* fastapi-mvc
* Git 2.27 or newer

```shell
git clone "https://github.com/fastapi-mvc/copier-script.git"
FMVC_PATH="$PWD:$FMVC_PATH" fastapi-mvc generate script /path/to/your/new/script
```

### Using copier

To use this template outside `fastapi-mvc`:

Prerequisites:
Expand Down
97 changes: 69 additions & 28 deletions flake.lock

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

52 changes: 32 additions & 20 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
{
description = "Fastapi-mvc generator flake";
nixConfig.bash-prompt = ''\n\[\033[1;32m\][nix-develop:\w]\$\[\033[0m\] '';
nixConfig = {
bash-prompt = ''\n\[\033[1;32m\][nix-develop:\w]\$\[\033[0m\] '';
extra-trusted-public-keys = [
"fastapi-mvc.cachix.org-1:knQ8Qo41bnhBmOB6Sp0UH10EV76AXW5o69SbAS668Fg="
];
extra-substituters = [
"https://fastapi-mvc.cachix.org"
];
};

inputs = {
flake-utils.url = "github:numtide/flake-utils";
fastapi-mvc.url = "github:fastapi-mvc/fastapi-mvc?ref=0.25.0";
flake-parts.url = "github:hercules-ci/flake-parts";
fastapi-mvc.url = "github:fastapi-mvc/fastapi-mvc";
nixpkgs.follows = "fastapi-mvc/nixpkgs";
};

outputs = { self, nixpkgs, flake-utils, fastapi-mvc }:
{
overlays.default = nixpkgs.lib.composeManyExtensions [
fastapi-mvc.overlays.default
];
} // (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
outputs = { self, nixpkgs, flake-parts, fastapi-mvc }@inputs:
let
mkApp =
{ drv
, name ? drv.pname or drv.name
, exePath ? drv.passthru.exePath or "/bin/${name}"
}:
{
type = "app";
program = "${drv}${exePath}";
};
in
rec {
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
apps = {
fastapi-mvc = flake-utils.lib.mkApp { drv = pkgs.fastapi-mvc; };
fastapi-mvc = mkApp { drv = fastapi-mvc.packages.${system}.default; };
copier = {
type = "app";
program = toString (pkgs.writeScript "copier" ''
export PATH="${pkgs.lib.makeBinPath [
pkgs.fastapi-mvc.dependencyEnv
fastapi-mvc.packages.${system}.default.dependencyEnv
pkgs.git
pkgs.coreutils
]}"
Expand All @@ -38,7 +48,7 @@
type = "app";
program = toString (pkgs.writeScript "update" ''
export PATH="${pkgs.lib.makeBinPath [
pkgs.fastapi-mvc.dependencyEnv
fastapi-mvc.packages.${system}.default.dependencyEnv
pkgs.git
pkgs.coreutils
]}"
Expand All @@ -49,20 +59,22 @@
-d license=MIT \
-d repo_url=https://github.com/fastapi-mvc/copier-script \
-d copyright_date=2022 \
-d github_actions=True \
-a .generator.yml \
update ./.
'');
};
};

devShells = {
default = pkgs.fastapi-mvc-dev.env.overrideAttrs (oldAttrs: {
default = fastapi-mvc.packages.${system}.fastapi-mvc-dev.env.overrideAttrs (oldAttrs: {
buildInputs = [
pkgs.git
pkgs.coreutils
pkgs.poetry
];
});
};
}));
};
};
}
1 change: 1 addition & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ copier -x template/** -x copier.yml -x *.py -x CHANGELOG.md \
-d license=MIT \
-d repo_url=https://github.com/fastapi-mvc/copier-script \
-d copyright_date=2022 \
-d github_actions=True \
-a .generator.yml \
update ./.

0 comments on commit 8874e0e

Please sign in to comment.