Skip to content
Closed
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
14 changes: 11 additions & 3 deletions crates/nix_rs/crate.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{ pkgs, lib, ... }:
{
autoWire = [ ];
# Autowiring `crate` so that the tests are run in nix sandbox when `om ci` is used
autoWire = [ "crate" ];
crane = {
args = {
nativeBuildInputs = [
# nix # Tests need nix cli
buildInputs = lib.optionals pkgs.stdenv.isDarwin (
with pkgs.apple_sdk_frameworks; [
IOKit
SystemConfiguration
]
);
nativeBuildInputs = with pkgs; [
nix # Tests need nix cli
];
};
};
Expand Down
8 changes: 5 additions & 3 deletions crates/omnix-ci/crate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
] ++ [
libiconv
pkg-config
nix
];
buildInputs = lib.optionals pkgs.stdenv.isDarwin
(
Expand All @@ -22,9 +23,10 @@
) ++ lib.optionals pkgs.stdenv.isLinux [
pkgs.openssl
];
# Disable tests due to sandboxing issues; we run them on CI
# instead.
doCheck = false;
cargoTestExtraArgs = "-- " + (lib.concatStringsSep " " [
# requires networking
"--skip=config::core::tests::test_config_loading"
]);
};
};
}
26 changes: 23 additions & 3 deletions crates/omnix-cli/crate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ in
# > error: don't yet have a `targetPackages.darwin.LibsystemCross for x86_64-apple-darwin`
(if (stdenv.isDarwin && stdenv.isAarch64) then pkgsStatic.libiconv else pkgs.libiconv)
pkgs.pkg-config
pkgs.nix
];
buildInputs = lib.optionals pkgs.stdenv.isDarwin
(
Expand All @@ -32,9 +33,28 @@ in
pkgsStatic.openssl
];

# Disable tests due to sandboxing issues; we run them on CI
# instead.
doCheck = false;
cargoTestExtraArgs = "-- " + (lib.concatStringsSep " " [
# requires networking
"--skip=command::ci::build_flake_output"
"--skip=command::ci::test_haskell_multi_nix"
"--skip=command::ci::test_haskell_multi_nix_all_dependencies"
"--skip=command::ci::test_services_flake"
"--skip=command::show::om_show_nixos_configurations"
"--skip=command::show::om_show_remote"

# required health checks, like "Flakes Enabled" and "Max Jobs" fails in sandbox
"--skip=command::health::om_health"

# error: creating directory '/nix/var/nix/profiles': Permission denied
# TODO: elaborate on the error
"--skip=command::init::om_init"

# FIXME: This should pass in the sandbox
# > ❄\u{fe0f} nix -j auto eval --json --override-input flake ../.. --override-input flake-schemas /nix/store/0npxvlidr0w1b99lrvcmd2wd46y2kibh-flake-schemas --override-input systems /nix/store/g1pv78p6lk92hjzr7syrcihvj4rx1fnz-source --no-write-lock-file \'/nix/store/qm8q4kylp1jy68k34c2bskpamxgyc9ix-source#contents.excludingOutputPaths\' --quiet --quiet\u{fe0f}
# > error: experimental Nix feature \'nix-command\' is disabled; use \'--extra-experimental-features nix-command\' to override
# > Error: Unable to fetch flake
"--skip=command::show::om_show_local"
]);
Comment on lines +52 to +57

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srid This could be a potential bug. I even tried looking at how om ci works, but even that uses the same NixCmd::Default, so it is likely that even om ci doesn’t automatically apply the experimental-features when not enabled by default.

We don’t have a similar om_ci_local test (that can run in Nix sandbox), which could be why it went undetected.

@srid srid Mar 10, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: This happens on macOS only.

Is the error message in FIXME accurate? Because, when I allow om_show_local, it presents a different error message:

image

meta = {
description = "Command-line interface for Omnix";
mainProgram = "om";
Expand Down
16 changes: 15 additions & 1 deletion crates/omnix-common/crate.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
{ pkgs, lib, ... }:
{
autoWire = [ ];
# Autowiring `crate` so that the tests are run in nix sandbox when `om ci` is used
autoWire = [ "crate" ];
crane.args = {
buildInputs = lib.optionals pkgs.stdenv.isDarwin (
with pkgs.apple_sdk_frameworks; [
IOKit
SystemConfiguration
]
);
cargoTestExtraArgs = "-- " + (lib.concatStringsSep " " [
# requires networking
"--skip=config::test_get_omconfig_from_remote_flake_with_attr"
]);
};
}