From 272de1a114380fb839bb662c77c93c65a0231d38 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 14 Jun 2025 12:30:06 +0300 Subject: [PATCH] flake: export smfh package as an output --- flake.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index ffaedf6..d937983 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,9 @@ nixpkgs, ... } @ inputs: let + # We should only specify the modules Hjem explicitly supports, or we risk + # allowing not-so-defined behaviour. For example, adding nix-systems should + # be avoided, because it allows specifying Hjem is not tested on. forAllSystems = nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-linux"]; in { nixosModules = { @@ -19,18 +22,27 @@ default = self.nixosModules.hjem; }; + packages = forAllSystems (system: { + # Expose the 'smfh' instance used by Hjem as a package in the Hjem flake + # outputs. This allows consuming the exact copy of smfh used by Hjem. + smfh = inputs.smfh.packages.${system}.smfh; + }); + checks = forAllSystems (system: let checkArgs = { inherit self inputs; pkgs = nixpkgs.legacyPackages.${system}; }; in { + # Build the 'smfh' package as a part of Hjem's test suite. + # If 'nix flake check' is ran in the CI, this might inflate build times + # *a lot*. + inherit (self.packages.${system}) smfh; + + # Hjem Integration Tests hjem-basic = import ./tests/basic.nix checkArgs; hjem-special-args = import ./tests/special-args.nix checkArgs; hjem-linker = import ./tests/linker.nix checkArgs; - - # Build smfh as a part of 'nix flake check' - smfh = inputs.smfh.packages.${system}.smfh; }); devShells = forAllSystems (system: let