Skip to content

Commit

Permalink
OS configurations: evaluate only when host system matches (#23)
Browse files Browse the repository at this point in the history
Impacts `nixosConfigurations` & `darwinConfigurations`
  • Loading branch information
srid authored Feb 21, 2024
1 parent c89ad7a commit 222d106
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
perSystem = { self', pkgs, lib, system, ... }: {
packages.default =
let
configForCurrentSystem = cfg: cfg.config.nixpkgs.hostPlatform.system == system;
# Given a flake output key, how to get the buildable derivation for
# any of its attr values?
flakeSchema = {
Expand All @@ -32,9 +33,9 @@
lookupFlake = k: lib.attrByPath [ k ] { };
getDrv = {
nixosConfigurations = _: cfg:
lib.optional pkgs.stdenv.isLinux cfg.config.system.build.toplevel;
lib.optional (configForCurrentSystem cfg) cfg.config.system.build.toplevel;
darwinConfigurations = _: cfg:
lib.optional pkgs.stdenv.isDarwin cfg.config.system.build.toplevel;
lib.optional (configForCurrentSystem cfg) cfg.config.system.build.toplevel;
};
};
};
Expand Down

0 comments on commit 222d106

Please sign in to comment.