From c94d7062dbbc5a7b446d358b73b7f53a7de96632 Mon Sep 17 00:00:00 2001 From: vkcku Date: Mon, 1 Jun 2026 08:35:46 +0530 Subject: root: add nix checks monorepo-revid: 0dc6923deca6e3944819a269bd100c56c9379031 --- root/nix/checks.nix | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 root/nix/checks.nix (limited to 'root/nix/checks.nix') diff --git a/root/nix/checks.nix b/root/nix/checks.nix new file mode 100644 index 0000000..9a0bc16 --- /dev/null +++ b/root/nix/checks.nix @@ -0,0 +1,57 @@ +{ inputs, self, ... }: +{ + perSystem = + { + lib, + pkgs, + system, + ... + }: + let + mkCheck = + prefix: key: value: + lib.attrsets.nameValuePair "${prefix}-${key}" value; + devshells = lib.attrsets.mapAttrs' (mkCheck "devshell") self.devShells."${system}"; + packages = lib.attrsets.mapAttrs' (mkCheck "build") self.packages."${system}"; + + nixos = + let + isCurrentSystem = _: conf: conf.pkgs.stdenv.hostPlatform.system == system; + nixos = lib.attrsets.filterAttrs isCurrentSystem self.nixosConfigurations; + in + lib.attrsets.mapAttrs' (mkCheck "nixos") ( + lib.attrsets.mapAttrs (_: conf: conf.config.system.build.toplevel) nixos + ); + in + { + checks = + packages + // nixos + // devshells + // { + root-lint = + let + treefmt = pkgs.callPackage ./_treefmt.nix { treefmt-nix = inputs.treefmt-nix; }; + in + pkgs.stdenvNoCC.mkDerivation { + name = "root-lint"; + version = "0.0.1"; + + src = lib.fileset.toSource { + root = ../../.; + fileset = lib.fileset.unions [ + ../../flake.lock + ../../flake.nix + ../../README.md + ../../root + ]; + }; + + buildPhase = '' + "${treefmt}/bin/treefmt" --ci + touch "$out" + ''; + }; + }; + }; +} -- cgit v1.3.1