summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorยท๐‘‘๐‘ด๐‘•๐‘‘๐‘ฉ๐‘ค2025-12-23 06:22:23 +0000
committerยท๐‘‘๐‘ด๐‘•๐‘‘๐‘ฉ๐‘ค2025-12-23 06:22:23 +0000
commit88e1e2f3c22fd24f5b3a47033526c627c8667464 (patch)
treee9b17868c2ae4e0e868485075aa409e52ab0ba50
parent8095f07850ecba1265b7a77154b2d316a88a4e99 (diff)
downloadnixtaml-88e1e2f3c22fd24f5b3a47033526c627c8667464.tar
nixtaml-88e1e2f3c22fd24f5b3a47033526c627c8667464.tar.gz
nixtaml-88e1e2f3c22fd24f5b3a47033526c627c8667464.tar.bz2
nixtaml-88e1e2f3c22fd24f5b3a47033526c627c8667464.tar.lz
nixtaml-88e1e2f3c22fd24f5b3a47033526c627c8667464.tar.xz
nixtaml-88e1e2f3c22fd24f5b3a47033526c627c8667464.tar.zst
nixtaml-88e1e2f3c22fd24f5b3a47033526c627c8667464.zip
nix/check: onset
-rw-r--r--nix/check/editorconfig.nix38
-rw-r--r--nix/check/nixfmt.nix43
-rw-r--r--nix/overlay/check.nix27
-rw-r--r--release.nix13
4 files changed, 99 insertions, 22 deletions
diff --git a/nix/check/editorconfig.nix b/nix/check/editorconfig.nix
new file mode 100644
index 0000000..526ed5b
--- /dev/null
+++ b/nix/check/editorconfig.nix
@@ -0,0 +1,38 @@
+#โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+# SPDX-FileCopyrightText: 2025 toastal <https://toast.al/contact/> โ”‚
+# SPDX-License-Identifier: LGPL-2.1-or-later โ”‚
+#โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+{
+ lib,
+ runDashCommand,
+ editorconfig-checker,
+ nixtamal,
+}:
+
+runDashCommand
+ {
+ name = "check-EditorConfig";
+ runtimeInputs = [
+ editorconfig-checker
+ ];
+ env.src =
+ let
+ fs = lib.fileset;
+ in
+ (fs.toSource {
+ root = ../..;
+ fileset = fs.unions [
+ (fs.fileFilter (file: file.name == ".editorconfig") ../..)
+ (fs.fromSource nixtamal.src)
+ ../../nix
+ ];
+ });
+ }
+ /* sh */ ''
+ if [ -z "$src" ]; then
+ echo "Missing \$src" >&2
+ exit 1
+ fi
+ cd "$src"
+ editorconfig-checker | tee "$out"
+ ''
diff --git a/nix/check/nixfmt.nix b/nix/check/nixfmt.nix
new file mode 100644
index 0000000..4d22883
--- /dev/null
+++ b/nix/check/nixfmt.nix
@@ -0,0 +1,43 @@
+#โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+# SPDX-FileCopyrightText: 2025 toastal <https://toast.al/contact/> โ”‚
+# SPDX-License-Identifier: LGPL-2.1-or-later โ”‚
+#โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+{
+ lib,
+ runDashCommand,
+ parallel,
+ nixfmt,
+ keepLogOrder ? true,
+}:
+
+runDashCommand
+ {
+ name = "check-nixfmt";
+ runtimeInputs = [
+ parallel
+ nixfmt
+ ];
+ env.src =
+ let
+ fs = lib.fileset;
+ in
+ fs.toSource {
+ root = ../..;
+ fileset =
+ fs.intersection (fs.fileFilter (file: file.hasExt "nix") ../..)
+
+ (fs.difference (fs.fromSource (lib.cleanSource ../..)) ../tamal);
+ };
+ }
+ /* sh */ ''
+ if [ -z "$src" ]; then
+ echo "Missing \$src" >&2
+ exit 1
+ fi
+ find "$src" -type f \
+ | parallel --will-cite \
+ ${lib.optionalString keepLogOrder "--keep-order"} \
+ --jobs "''${NIX_BUILD_CORES:-1}" \
+ nixfmt --check {} \
+ | tee "$out"
+ ''
diff --git a/nix/overlay/check.nix b/nix/overlay/check.nix
index 8a6ec2b..98f60c0 100644
--- a/nix/overlay/check.nix
+++ b/nix/overlay/check.nix
@@ -5,27 +5,12 @@
final: prev: {
nixtamal = prev.nixtamal.overrideScope (
final': prev': {
- check = (prev'.check or { }) // {
- EditorConfig =
- final.runCommand "check-EditorConfig"
- {
- src =
- let
- fs = final.lib.fileset;
- in
- (fs.toSource {
- root = ../..;
- fileset = fs.unions [
- (fs.fileFilter (file: file.name == ".editorconfig") ../..)
- (fs.fromSource prev'.nixtamal.src)
- ../../nix
- ];
- });
- }
- ''
- cd $src
- ${final.lib.getExe final.editorconfig-checker} | tee $out
- '';
+ check = {
+ format = {
+ EditorConfig = final'.callPackage ../check/editorconfig.nix { };
+
+ nixfmt = final'.callPackage ../check/nixfmt.nix { };
+ };
};
}
);
diff --git a/release.nix b/release.nix
index fcb1a39..6e676e0 100644
--- a/release.nix
+++ b/release.nix
@@ -12,6 +12,8 @@ let
(import ./nix/overlay/check.nix)
];
};
+
+ inherit (pkgs) lib;
in
{
inherit (pkgs) nixtamal;
@@ -20,5 +22,14 @@ in
shell = pkgs.nixtamal.dev-shell;
- check = pkgs.nixtamal.check;
+ check = lib.concatMapAttrs (
+ parent: children:
+ if lib.isDerivation children then
+ { ${parent} = children; }
+ else
+ lib.mapAttrs' (child: value: {
+ name = "${parent}_${child}";
+ inherit value;
+ }) children
+ ) pkgs.nixtamal.check;
}