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..110a605 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,12 +40,7 @@ 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 + ./devShells/flake-module.nix ./flake-parts/job-flake-update-clan-core ./flake-parts/job-flake-update-clan-homepage ./flake-parts/job-flake-update-clan-infra @@ -54,7 +49,7 @@ ./pkgs/flake-module.nix ./pkgs/clan-merge/flake-module.nix ]; - 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..77db107 100644 --- a/pkgs/flake-module.nix +++ b/pkgs/flake-module.nix @@ -1,9 +1,25 @@ -{ 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; + inherit (config.packages) action-checkout action-ensure-tea-login action-create-pr action-flake-update; + }; }; }; }