From 783611a249bcbb87087aaa49fd2e895bd6e95bdd Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Wed, 18 Dec 2024 12:22:03 -0500 Subject: [PATCH 1/2] ci: Run omnix on standard runners --- .github/workflows/ci.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9c89175c..836704d0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -138,3 +138,26 @@ jobs: echo "om binary failed due to lack of nix installation, as expected." exit 0 fi + + # Does omnix run on standard github runners? + github-actions-runners: + needs: main + runs-on: ${{ matrix.system }} + strategy: + matrix: + system: [ubuntu-latest, macos-latest] + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - name: Donwload om static binary + uses: actions/download-artifact@v4 + with: + name: om-${{ matrix.system == 'ubuntu-latest' && 'x86_64-linux' || matrix.system == 'macos-latest' && 'aarch64-darwin' || matrix.system }} + - name: Cache omnix source in Nix store + run: | + nix flake metadata . + nix flake show . + - name: Run omnix + run: | + chmod +x ./om + ./om ci run github:srid/haskell-multi-nix From da526fae32ba2824de53fc77c35efe1dda313553 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Wed, 18 Dec 2024 14:59:07 -0500 Subject: [PATCH 2/2] fix: nix-store failing on symlinks Resolves #363 by working around https://github.com/NixOS/nix/issues/10247 --- crates/nix_rs/src/store/command.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/nix_rs/src/store/command.rs b/crates/nix_rs/src/store/command.rs index e473b893..cedf75bf 100644 --- a/crates/nix_rs/src/store/command.rs +++ b/crates/nix_rs/src/store/command.rs @@ -100,7 +100,17 @@ impl NixStoreCmd { /// Run `nix-store --add` on the give path and return the store path added. pub async fn nix_store_add(&self, path: &Path) -> Result { let mut cmd = self.command(); - cmd.arg("--add").arg(path); + cmd.arg("--add"); + + // nix-store is unable to accept absolute paths if it involves a symlink + // https://github.com/juspay/omnix/issues/363 + // To workaround this, we pass the file directly. + if let Some(parent) = path.parent() { + cmd.current_dir(parent); + cmd.arg(path.file_name().unwrap()); + } else { + cmd.arg(path); + } let stdout = run_awaiting_stdout(&mut cmd).await?; Ok(StorePath::new(PathBuf::from(