Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix om ci crashing on standard GitHub runners #364

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 11 additions & 1 deletion crates/nix_rs/src/store/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<StorePath, NixStoreCmdError> {
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(
Expand Down
Loading