From 74433e30bc3bd88cb7e2f1f43dce6179f7b3c143 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 20:41:22 -0700 Subject: [PATCH] build(nix): build the KDE and macOS packages from the whole repository The root flake no longer re-exports the nested flakes' own outputs. It keeps them as inputs for their pinned nixpkgs, crane and rust-overlay (inputs..inputs), but calls their lib.mkOutputs with the whole repository (self) as the source, a nested self carrying the root rev, dirtyRev and inputs, and the tree's directory, then re-exports packages, checks (without vm-*), legacyPackages.kfde-vm, nixosModules, overlays and darwinModules from those. flake.lock is updated for the changed nested flakes: the lock pins their content, so it needs 'nix flake update kfde kfm' whenever a file under komorebi-for-kde or komorebi-for-mac changes. Verified (Linux, x86_64): nix build -L of packages.kfde-komorebic and kfde-komorebi succeed and both binaries run with --help (exit 0); checks kfde-schema-fresh, nix-options-validation, keybindings-fixtures, komorebi-bridge-js, nixos-module-eval, plasma-guests-eval, run-kde-dry-run, run-kde-doctor, komorebi-workspace-fmt, -deny and -nextest build; kfde-komorebi-workspace-toml-fmt FAILS because komorebi-for-kde/Cargo.toml itself is not taplo-formatted (same result running taplo on the file directly; not caused by this change). nix eval of aarch64-darwin kfm-komorebic and kfm-komorebi drvPath print .drv paths (evaluated, not built). Windows clippy and default drvPaths are identical to those before this revision. nix flake check --no-build passes for x86_64-linux. Not verified: any darwin build, kfde clippy/doc, the VM suites. --- flake.lock | 4 ++-- flake.nix | 52 ++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index ce00665b..b7304c0c 100644 --- a/flake.lock +++ b/flake.lock @@ -284,7 +284,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-KjY8jnUOlUDKGebfim1z4D84bHzAYliSvue7CYbaN3E=", + "narHash": "sha256-YCSeq6arLSifLoHQi7wsJxAa3dM4suGJcxmKsOQ/tWg=", "path": "./komorebi-for-kde", "type": "path" }, @@ -304,7 +304,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-x4lQr5Onh7hOUASove2uGnNfItuuyTFzqBPzmUXwK9E=", + "narHash": "sha256-T8MkK2hVhFhbn044YpZGkTK3mktEbFgWQ5OqSsMCva0=", "path": "./komorebi-for-mac", "type": "path" }, diff --git a/flake.nix b/flake.nix index 024028b4..5a96f716 100644 --- a/flake.nix +++ b/flake.nix @@ -16,8 +16,8 @@ flake = false; }; - # the other platforms' flakes, built from their own directories with their own locks until - # their crates depend on the ones in this tree (see the build(nix) revisions that follow) + # the other platforms' flakes: their inputs and locks are used, their outputs are made with this + # tree as the source (see the imports below) kfde.url = "path:./komorebi-for-kde"; kfm.url = "path:./komorebi-for-mac"; }; @@ -298,15 +298,44 @@ inputs.treefmt-nix.flakeModule inputs.git-hooks-nix.flakeModule # komorebi for KDE Plasma (kfde) and komorebi for macOS (kfm), re-exported with a prefix. - # The VM tests of kfde are not re-exported as checks, so that `nix flake check` of this - # flake does not boot them; they are reachable as legacyPackages..kfde-vm. + # Their flakes keep their own inputs and lock files (inputs..inputs), but their + # outputs are made here, from the whole repository as the source: the Rust workspaces of + # both depend on the crates of this tree by path, which a flake of their own directory + # cannot see (their `lib.mkOutputs`). The VM tests of kfde are not re-exported as checks, + # so that `nix flake check` of this flake does not boot them; they are reachable as + # legacyPackages..kfde-vm. ( { lib, ... }: + let + # `self` of a nested flake: its own outputs, with the revision and the path of this one + nestedOutputs = + name: dir: + let + nestedSelf = + outputs + // lib.filterAttrs (n: _: n == "rev" || n == "dirtyRev") self + // { + outPath = self.outPath + "/${dir}"; + inputs = inputs.${name}.inputs; + }; + outputs = inputs.${name}.lib.mkOutputs { + self = nestedSelf; + inputs = inputs.${name}.inputs // { + self = nestedSelf; + }; + repoRoot = self; + platformDir = dir; + }; + in + outputs; + kfde = nestedOutputs "kfde" "komorebi-for-kde"; + kfm = nestedOutputs "kfm" "komorebi-for-mac"; + in { flake = { - nixosModules.komorebi-for-kde = inputs.kfde.nixosModules.default; - overlays.komorebi-for-kde = inputs.kfde.overlays.default; - darwinModules.komorebi-for-mac = inputs.kfm.darwinModules.default; + nixosModules.komorebi-for-kde = kfde.nixosModules.default; + overlays.komorebi-for-kde = kfde.overlays.default; + darwinModules.komorebi-for-mac = kfm.darwinModules.default; }; perSystem = @@ -317,12 +346,11 @@ in { packages = - prefixed "kfde" (inputs.kfde.packages.${system} or { }) - // prefixed "kfm" (inputs.kfm.packages.${system} or { }); + prefixed "kfde" (kfde.packages.${system} or { }) // prefixed "kfm" (kfm.packages.${system} or { }); checks = - prefixed "kfde" (withoutVmTests (inputs.kfde.checks.${system} or { })) - // prefixed "kfm" (inputs.kfm.checks.${system} or { }); - legacyPackages.kfde-vm = (inputs.kfde.legacyPackages.${system} or { }).vm or { }; + prefixed "kfde" (withoutVmTests (kfde.checks.${system} or { })) + // prefixed "kfm" (kfm.checks.${system} or { }); + legacyPackages.kfde-vm = (kfde.legacyPackages.${system} or { }).vm or { }; }; } )