juspay / omnix

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

YAML for config #343

Open srid opened 1 day ago

srid commented 1 day ago

This would mitigate #339

Our entire omnix configuration (om.nix), https://github.com/juspay/omnix/blob/main/nix/modules/flake-parts/om.nix

can be written as YAML as well (see below). This has the benefit of not needing to evaluate the whole flake just to get the omnix config. This would then make om develop faster.

We may still have to support Nix-based config (but that piggyback on YAML using builtins.fromYAML) for cases where we evaluate a non-local flake (even then we can catch the flake in local nix store before looking up YAML, falling back to Nix eval).

Blocked on #341 (after which doing this should be straightforward).

ci:
  default:
    omnix:
      dir: "."
      steps:
        # build:
        #   enable: false
        flake-check:
          enable: false  # Not necessary
        custom:
          om-show:
            type: "app"
            # name: "default"
            args:
              - "show"
              - "."
          binary-size-is-small:
            type: "app"
            name: "check-closure-size"
            systems:
              - "x86_64-linux"  # We have static binary for Linux only.
          omnix-source-is-buildable:
            type: "app"
            name: "omnix-source-is-buildable"
          cargo-tests:
            type: "devshell"
            command:
              - "just"
              - "cargo-test"
            systems:
              - "x86_64-linux"
              - "aarch64-darwin"  # Avoid emulated systems
          cargo-clippy:
            type: "devshell"
            command:
              - "just"
              - "clippy"
            systems:
              - "x86_64-linux"
              - "aarch64-darwin"  # Avoid emulated systems
          cargo-doc:
            type: "devshell"
            command:
              - "just"
              - "cargo-doc"
            systems:
              - "x86_64-linux"
              - "aarch64-darwin"  # Avoid emulated systems
    doc:
      dir: "doc"
    registry:
      dir: "crates/omnix-init/registry"
      steps:
        build:
          enable: false
        custom: {}
    cli-test-dep-cache:
      dir: "crates/omnix-cli/tests"
      steps:
        lockfile:
          enable: false
        flake_check:
          enable: false
        custom: {}
health:
  default:
    nix-version:
      min-required: "2.16.0"
    caches:
      required:
        - "https://om.cachix.org"
    direnv:
      required: true
develop:
  default:
    readme: |
      🍾 Welcome to the **omnix** project

      To run omnix,

      ```sh-session
      just watch <args>
  (Now, as you edit the Rust sources, the above will reload!)

  🍎🍎 Run 'just' to see more commands. See <https://nixos.asia/en/vscode> for IDE setup.
srid commented 1 day ago

Oh well https://github.com/NixOS/nix/pull/7340

srid commented 1 day ago

even then we can catch the flake in local nix store before looking up YAML, falling back to Nix eval

So this is what we should do, nevermind fromYAML

image