From 211ac3d5a50ce4457807dfe4e0a951a7294192f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Szamszur?= Date: Sun, 26 Mar 2023 16:28:45 +0200 Subject: [PATCH] Run update --- .generator.yml | 3 +- .github/dependabot.yml | 6 ++ .github/workflows/update-flake.yml | 28 +++++++++ README.md | 13 ++++ flake.lock | 97 +++++++++++++++++++++--------- flake.nix | 52 ++++++++++------ update.sh | 1 + 7 files changed, 151 insertions(+), 49 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/update-flake.yml diff --git a/.generator.yml b/.generator.yml index 28ae44c..5524c43 100644 --- a/.generator.yml +++ b/.generator.yml @@ -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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..adee0ed --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" \ No newline at end of file diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml new file mode 100644 index 0000000..d404fcc --- /dev/null +++ b/.github/workflows/update-flake.yml @@ -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 }} + ``` \ No newline at end of file diff --git a/README.md b/README.md index 6ee9882..b8a47e0 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/flake.lock b/flake.lock index 71db29b..01b7b31 100644 --- a/flake.lock +++ b/flake.lock @@ -2,56 +2,61 @@ "nodes": { "fastapi-mvc": { "inputs": { - "flake-utils": "flake-utils", + "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", "poetry2nix": "poetry2nix" }, "locked": { - "lastModified": 1675770712, - "narHash": "sha256-apqcijQek/Gfz1M7qnB5zKnl9ICox+CiiVjESBvyyxA=", + "lastModified": 1679837385, + "narHash": "sha256-gb3Qh82G02wx86r/l7xHjONnJVKPTEugcbReTTqXrVI=", "owner": "fastapi-mvc", "repo": "fastapi-mvc", - "rev": "84a5224334aa37b8ca042e9fd0d179f63f58882c", + "rev": "499d2b0f9029452130635a76f6fb1ac87ff5ee05", "type": "github" }, "original": { "owner": "fastapi-mvc", - "ref": "0.25.0", "repo": "fastapi-mvc", "type": "github" } }, - "flake-utils": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "lastModified": 1679737941, + "narHash": "sha256-srSD9CwsVPnUMsIZ7Kt/UegkKUEBcTyU1Rev7mO45S0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3502ee99d6dade045bdeaf7b0cd8ec703484c25c", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, - "flake-utils_2": { + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "lastModified": 1679737941, + "narHash": "sha256-srSD9CwsVPnUMsIZ7Kt/UegkKUEBcTyU1Rev7mO45S0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3502ee99d6dade045bdeaf7b0cd8ec703484c25c", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, - "flake-utils_3": { + "flake-utils": { "locked": { "lastModified": 1667395993, "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", @@ -82,25 +87,61 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1678375444, + "narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1678375444, + "narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "poetry2nix": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs": [ "fastapi-mvc", "nixpkgs" ] }, "locked": { - "lastModified": 1670681815, - "narHash": "sha256-znag7V2HRi9w78hSoTx2snIrPmVJy7O5h6Klqz8aZ00=", + "lastModified": 1679621603, + "narHash": "sha256-4e6cny6AHzQcyXH3fqSHIXC5wx8mv6hdP4lP7EtnbnQ=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "bb7f4e1d046c5f19fda8bebb638d5d5bc07573d9", + "rev": "3313ab3740fb795f577c3c0598faaa4efb6c1597", "type": "github" }, "original": { "owner": "nix-community", - "ref": "1.39.1", + "ref": "1.40.1", "repo": "poetry2nix", "type": "github" } @@ -108,7 +149,7 @@ "root": { "inputs": { "fastapi-mvc": "fastapi-mvc", - "flake-utils": "flake-utils_3", + "flake-parts": "flake-parts_2", "nixpkgs": [ "fastapi-mvc", "nixpkgs" diff --git a/flake.nix b/flake.nix index 0bb5bd0..de867e3 100644 --- a/flake.nix +++ b/flake.nix @@ -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 ]}" @@ -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 ]}" @@ -49,6 +59,7 @@ -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 ./. ''); @@ -56,7 +67,7 @@ }; 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 @@ -64,5 +75,6 @@ ]; }); }; - })); + }; + }; } diff --git a/update.sh b/update.sh index cdc4e54..2b5e6cc 100755 --- a/update.sh +++ b/update.sh @@ -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 ./.