From 35b2e4a65730b8a7b2c2b789d5f1ca8f188eea4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 3 Aug 2023 16:13:22 +0200 Subject: [PATCH] move devShells out of flake-parts --- .../default.nix => devShells/flake-module.nix | 2 -- flake-parts/action-checkout/default.nix | 24 ----------------- flake-parts/action-create-pr/default.nix | 25 ----------------- .../action-ensure-tea-login/default.nix | 23 ---------------- .../action-flake-update-pr-clan/default.nix | 27 ------------------- flake-parts/action-flake-update/default.nix | 24 ----------------- flake.nix | 14 +++++----- pkgs/action-checkout/default.nix | 9 +++++++ .../action-checkout/script.sh | 0 pkgs/action-create-pr/default.nix | 10 +++++++ .../action-create-pr/script.sh | 0 pkgs/action-ensure-tea-login/default.nix | 8 ++++++ .../action-ensure-tea-login/script.sh | 0 pkgs/action-flake-update-pr-clan/default.nix | 18 +++++++++++++ .../action-flake-update-pr-clan/script.sh | 0 pkgs/action-flake-update/default.nix | 9 +++++++ .../action-flake-update/script.sh | 0 pkgs/flake-module.nix | 21 ++++++++++++--- 18 files changed, 79 insertions(+), 135 deletions(-) rename flake-parts/devShells/default.nix => devShells/flake-module.nix (95%) delete mode 100644 flake-parts/action-checkout/default.nix delete mode 100644 flake-parts/action-create-pr/default.nix delete mode 100644 flake-parts/action-ensure-tea-login/default.nix delete mode 100644 flake-parts/action-flake-update-pr-clan/default.nix delete mode 100644 flake-parts/action-flake-update/default.nix create mode 100644 pkgs/action-checkout/default.nix rename {flake-parts => pkgs}/action-checkout/script.sh (100%) create mode 100644 pkgs/action-create-pr/default.nix rename {flake-parts => pkgs}/action-create-pr/script.sh (100%) create mode 100644 pkgs/action-ensure-tea-login/default.nix rename {flake-parts => pkgs}/action-ensure-tea-login/script.sh (100%) create mode 100644 pkgs/action-flake-update-pr-clan/default.nix rename {flake-parts => pkgs}/action-flake-update-pr-clan/script.sh (100%) create mode 100644 pkgs/action-flake-update/default.nix rename {flake-parts => pkgs}/action-flake-update/script.sh (100%) diff --git a/flake-parts/devShells/default.nix b/devShells/flake-module.nix similarity index 95% rename from flake-parts/devShells/default.nix rename to devShells/flake-module.nix index 5f3c959..c06d709 100644 --- a/flake-parts/devShells/default.nix +++ b/devShells/flake-module.nix @@ -1,9 +1,7 @@ { perSystem = { inputs' - , lib , pkgs - , self' , ... }: { devShells.default = pkgs.mkShell { diff --git a/flake-parts/action-checkout/default.nix b/flake-parts/action-checkout/default.nix deleted file mode 100644 index 6b7c397..0000000 --- a/flake-parts/action-checkout/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - perSystem = - { config - , pkgs - , ... - }: - let - name = builtins.baseNameOf ./.; - script = config.writers.writePureShellScriptBin - name - [ - pkgs.bash - pkgs.coreutils - pkgs.git - pkgs.openssh - ] - '' - bash ${./script.sh} - ''; - in - { - packages.${name} = script; - }; -} diff --git a/flake-parts/action-create-pr/default.nix b/flake-parts/action-create-pr/default.nix deleted file mode 100644 index 622ee2c..0000000 --- a/flake-parts/action-create-pr/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - perSystem = - { config - , pkgs - , ... - }: - let - name = builtins.baseNameOf ./.; - script = config.writers.writePureShellScriptBin - name - [ - pkgs.bash - pkgs.coreutils - pkgs.git - pkgs.tea - pkgs.openssh - ] - '' - bash ${./script.sh} "$@" - ''; - in - { - packages.${name} = script; - }; -} diff --git a/flake-parts/action-ensure-tea-login/default.nix b/flake-parts/action-ensure-tea-login/default.nix deleted file mode 100644 index d137837..0000000 --- a/flake-parts/action-ensure-tea-login/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - perSystem = - { config - , pkgs - , ... - }: - let - name = builtins.baseNameOf ./.; - script = config.writers.writePureShellScriptBin - name - [ - pkgs.bash - pkgs.coreutils - pkgs.tea - ] - '' - bash ${./script.sh} - ''; - in - { - packages.${name} = script; - }; -} diff --git a/flake-parts/action-flake-update-pr-clan/default.nix b/flake-parts/action-flake-update-pr-clan/default.nix deleted file mode 100644 index 4e0717e..0000000 --- a/flake-parts/action-flake-update-pr-clan/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - perSystem = - { config - , pkgs - , self' - , ... - }: - let - name = builtins.baseNameOf ./.; - script = config.writers.writePureShellScriptBin - name - [ - pkgs.bash - pkgs.coreutils - self'.packages.action-checkout - self'.packages.action-ensure-tea-login - self'.packages.action-create-pr - self'.packages.action-flake-update - ] - '' - bash ${./script.sh} - ''; - in - { - packages.${name} = script; - }; -} diff --git a/flake-parts/action-flake-update/default.nix b/flake-parts/action-flake-update/default.nix deleted file mode 100644 index 3b18ba3..0000000 --- a/flake-parts/action-flake-update/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - perSystem = - { config - , pkgs - , ... - }: - let - name = builtins.baseNameOf ./.; - script = config.writers.writePureShellScriptBin - name - [ - pkgs.bash - pkgs.coreutils - pkgs.git - pkgs.nix - ] - '' - bash ${./script.sh} - ''; - in - { - packages.${name} = script; - }; -} diff --git a/flake.nix b/flake.nix index 4924854..4d94d45 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ }; outputs = inputs@{ flake-parts, ... }: - flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }: { + flake-parts.lib.mkFlake { inherit inputs; } ({ ... }: { systems = [ "x86_64-linux" "aarch64-linux" @@ -40,11 +40,6 @@ imports = [ inputs.treefmt-nix.flakeModule inputs.clan-core.modules.flake-parts.writers - ./flake-parts/action-checkout - ./flake-parts/action-create-pr - ./flake-parts/action-ensure-tea-login - ./flake-parts/action-flake-update - ./flake-parts/action-flake-update-pr-clan ./flake-parts/devShells ./flake-parts/job-flake-update-clan-core ./flake-parts/job-flake-update-clan-homepage @@ -53,8 +48,13 @@ ./modules/flake-module.nix ./pkgs/flake-module.nix ./pkgs/clan-merge/flake-module.nix + ./pkgs/action-checkout + ./pkgs/action-create-pr + ./pkgs/action-ensure-tea-login + ./pkgs/action-flake-update + ./pkgs/action-flake-update-pr-clan ]; - perSystem = { pkgs, inputs', ... }: { + perSystem = { ... }: { treefmt = { projectRootFile = "flake.nix"; programs.terraform.enable = true; diff --git a/pkgs/action-checkout/default.nix b/pkgs/action-checkout/default.nix new file mode 100644 index 0000000..df68dbb --- /dev/null +++ b/pkgs/action-checkout/default.nix @@ -0,0 +1,9 @@ +{ bash +, coreutils +, git +, openssh +, writePureShellScriptBin +}: +writePureShellScriptBin "action-checkout" [ bash coreutils git openssh ] '' + bash ${./script.sh} +'' diff --git a/flake-parts/action-checkout/script.sh b/pkgs/action-checkout/script.sh similarity index 100% rename from flake-parts/action-checkout/script.sh rename to pkgs/action-checkout/script.sh diff --git a/pkgs/action-create-pr/default.nix b/pkgs/action-create-pr/default.nix new file mode 100644 index 0000000..456c857 --- /dev/null +++ b/pkgs/action-create-pr/default.nix @@ -0,0 +1,10 @@ +{ bash +, coreutils +, git +, tea +, openssh +, writePureShellScriptBin +}: +writePureShellScriptBin "action-create-pr" [ bash coreutils git tea openssh ] '' + bash ${./script.sh} +'' diff --git a/flake-parts/action-create-pr/script.sh b/pkgs/action-create-pr/script.sh similarity index 100% rename from flake-parts/action-create-pr/script.sh rename to pkgs/action-create-pr/script.sh diff --git a/pkgs/action-ensure-tea-login/default.nix b/pkgs/action-ensure-tea-login/default.nix new file mode 100644 index 0000000..0857ef1 --- /dev/null +++ b/pkgs/action-ensure-tea-login/default.nix @@ -0,0 +1,8 @@ +{ bash +, coreutils +, tea +, writePureShellScriptBin +}: +writePureShellScriptBin "action-ensure-tea-login" [ bash coreutils tea ] '' + bash ${./script.sh} +'' diff --git a/flake-parts/action-ensure-tea-login/script.sh b/pkgs/action-ensure-tea-login/script.sh similarity index 100% rename from flake-parts/action-ensure-tea-login/script.sh rename to pkgs/action-ensure-tea-login/script.sh diff --git a/pkgs/action-flake-update-pr-clan/default.nix b/pkgs/action-flake-update-pr-clan/default.nix new file mode 100644 index 0000000..4f28a40 --- /dev/null +++ b/pkgs/action-flake-update-pr-clan/default.nix @@ -0,0 +1,18 @@ +{ bash +, coreutils +, action-checkout +, action-ensure-tea-login +, action-create-pr +, action-flake-update +, writePureShellScriptBin +}: +writePureShellScriptBin "action-flake-update-pr-clan" [ + bash + coreutils + action-checkout + action-ensure-tea-login + action-create-pr + action-flake-update +] '' + bash ${./script.sh} +'' diff --git a/flake-parts/action-flake-update-pr-clan/script.sh b/pkgs/action-flake-update-pr-clan/script.sh similarity index 100% rename from flake-parts/action-flake-update-pr-clan/script.sh rename to pkgs/action-flake-update-pr-clan/script.sh diff --git a/pkgs/action-flake-update/default.nix b/pkgs/action-flake-update/default.nix new file mode 100644 index 0000000..7d2560f --- /dev/null +++ b/pkgs/action-flake-update/default.nix @@ -0,0 +1,9 @@ +{ bash +, coreutils +, git +, nix +, writePureShellScriptBin +}: +writePureShellScriptBin "action-flake-update" [ bash coreutils git nix ] '' + bash ${./script.sh} +'' diff --git a/flake-parts/action-flake-update/script.sh b/pkgs/action-flake-update/script.sh similarity index 100% rename from flake-parts/action-flake-update/script.sh rename to pkgs/action-flake-update/script.sh diff --git a/pkgs/flake-module.nix b/pkgs/flake-module.nix index facaffa..b4727d3 100644 --- a/pkgs/flake-module.nix +++ b/pkgs/flake-module.nix @@ -1,9 +1,24 @@ -{ lib, ... }: { - perSystem = { pkgs, inputs', ... }: { +{ ... }: { + perSystem = { pkgs, config, ... }: { packages = { inherit (pkgs.callPackage ./renovate { }) renovate; - } // lib.optionalAttrs (!pkgs.stdenv.isDarwin) { gitea = pkgs.callPackage ./gitea { }; + + action-checkout = pkgs.callPackage ./action-checkout { + inherit (config.writers) writePureShellScriptBin; + }; + action-create-pr = pkgs.callPackage ./action-create-pr { + inherit (config.writers) writePureShellScriptBin; + }; + action-ensure-tea-login = pkgs.callPackage ./action-ensure-tea-login { + inherit (config.writers) writePureShellScriptBin; + }; + action-flake-update = pkgs.callPackage ./action-flake-update { + inherit (config.writers) writePureShellScriptBin; + }; + action-flake-update-pr-clan = pkgs.callPackage ./action-flake-update-pr-clan { + inherit (config.writers) writePureShellScriptBin; + }; }; }; }