juspay / omnix

🚧 A Nix wrapper to improve developer experience
https://omnix.page
GNU Affero General Public License v3.0
70 stars 5 forks source link

`om health`: Display which Nix installer was used #213

Closed shivaraj-bh closed 3 weeks ago

shivaraj-bh commented 1 month ago

resolves #206

Output when nix is not installed

❯ ./result/bin/om health
Nix is not installed. Please install Nix: https://nixos.asia/en/install

Installer info

🐚 nix --extra-experimental-features 'nix-command flakes' show-config --json
🐚 nix --version
🩺️ Checking the health of your Nix setup:
  - System: aarch64-darwin
  - OS: macOS
  - Installer: DetSys nix-installer (0.16.0)

🩺 Running health checks
✅ Rosetta Not Active
   apple emulation = None
✅ Minimum Nix Version
   nix version = 2.18.5

Question

This shouldn’t run on NixOS, how do we detect if we are on NixOS? (resolved in https://github.com/juspay/omnix/pull/213/commits/48a3e89ada788bebf63ed00e5a309610279f4bf7)

srid commented 1 month ago

The check name should not be hardcoded to DetSys. What is the flake config schema for this?

srid commented 1 month ago

This shouldn’t run on NixOS,

The check would be "skipped" on NixOS.

how do we detect if we are on NixOS?

https://github.com/juspay/omnix/blob/5ec3a5207773b7b9e9f999d03a49508b21b5ed06/crates/nix_rs/src/env.rs#L94-L95

srid commented 1 month ago

The installer info should probably be part of NixEnv itself.

shivaraj-bh commented 1 month ago

The installer info should probably be part of NixEnv itself.

Done in https://github.com/juspay/omnix/pull/213/commits/48a3e89ada788bebf63ed00e5a309610279f4bf7

shivaraj-bh commented 1 month ago

The check name should not be hardcoded to DetSys.

I have changed it from “DetSys nix-installer” -> “Nix installer used” in the latest commit.

What is the flake config schema for this?

As of now it is:

{
  nix-installer = {
    enable = true;
    required = true;
  };
}

As of now the recommended installer and its corresponding version is hard-coded. I am not sure about the exact schema to use to make them configurable.

shivaraj-bh commented 3 weeks ago

Shouldn’t this PR also update nix_rs changelog?

srid commented 3 weeks ago

Yes, let's always remember do that as part of the PR itself. Including updating https://omnix.page/history.html