Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generator #2

Merged
merged 1 commit into from
Mar 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ./.