Full Code of juspay/omnix for AI

main 9a4899083cd3 cached
188 files
444.3 KB
119.7k tokens
573 symbols
1 requests
Download .txt
Showing preview only (491K chars total). Download the full file or copy to clipboard to get everything.
Repository: juspay/omnix
Branch: main
Commit: 9a4899083cd3
Files: 188
Total size: 444.3 KB

Directory structure:
gitextract_99yfqsb4/

├── .envrc
├── .gitattributes
├── .github/
│   └── workflows/
│       ├── ci.yaml
│       └── website.yaml
├── .gitignore
├── .vscode/
│   ├── extensions.json
│   └── settings.json
├── Cargo.toml
├── LICENSE
├── README.md
├── bacon.toml
├── crates/
│   ├── nix_rs/
│   │   ├── CHANGELOG.md
│   │   ├── Cargo.toml
│   │   ├── README.md
│   │   ├── crate.nix
│   │   └── src/
│   │       ├── arg.rs
│   │       ├── command.rs
│   │       ├── config.rs
│   │       ├── copy.rs
│   │       ├── detsys_installer.rs
│   │       ├── env.rs
│   │       ├── flake/
│   │       │   ├── command.rs
│   │       │   ├── eval.rs
│   │       │   ├── functions/
│   │       │   │   ├── README.md
│   │       │   │   ├── addstringcontext/
│   │       │   │   │   ├── flake.nix
│   │       │   │   │   └── mod.rs
│   │       │   │   ├── core.rs
│   │       │   │   ├── metadata/
│   │       │   │   │   ├── flake.nix
│   │       │   │   │   └── mod.rs
│   │       │   │   └── mod.rs
│   │       │   ├── mod.rs
│   │       │   ├── outputs.rs
│   │       │   ├── schema.rs
│   │       │   ├── system.rs
│   │       │   └── url/
│   │       │       ├── attr.rs
│   │       │       ├── core.rs
│   │       │       └── mod.rs
│   │       ├── info.rs
│   │       ├── lib.rs
│   │       ├── refs.rs
│   │       ├── store/
│   │       │   ├── command.rs
│   │       │   ├── mod.rs
│   │       │   ├── path.rs
│   │       │   └── uri.rs
│   │       ├── system_list.rs
│   │       ├── version.rs
│   │       └── version_spec.rs
│   ├── omnix-ci/
│   │   ├── CHANGELOG.md
│   │   ├── Cargo.toml
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── crate.nix
│   │   └── src/
│   │       ├── command/
│   │       │   ├── core.rs
│   │       │   ├── gh_matrix.rs
│   │       │   ├── mod.rs
│   │       │   ├── run.rs
│   │       │   └── run_remote.rs
│   │       ├── config/
│   │       │   ├── core.rs
│   │       │   ├── mod.rs
│   │       │   ├── subflake.rs
│   │       │   └── subflakes.rs
│   │       ├── flake_ref.rs
│   │       ├── github/
│   │       │   ├── actions.rs
│   │       │   ├── matrix.rs
│   │       │   ├── mod.rs
│   │       │   └── pull_request.rs
│   │       ├── lib.rs
│   │       ├── nix/
│   │       │   ├── devour_flake.rs
│   │       │   ├── lock.rs
│   │       │   └── mod.rs
│   │       └── step/
│   │           ├── build.rs
│   │           ├── core.rs
│   │           ├── custom.rs
│   │           ├── flake_check.rs
│   │           ├── lockfile.rs
│   │           └── mod.rs
│   ├── omnix-cli/
│   │   ├── Cargo.toml
│   │   ├── crate.nix
│   │   ├── src/
│   │   │   ├── args.rs
│   │   │   ├── command/
│   │   │   │   ├── ci.rs
│   │   │   │   ├── completion.rs
│   │   │   │   ├── core.rs
│   │   │   │   ├── develop.rs
│   │   │   │   ├── health.rs
│   │   │   │   ├── init.rs
│   │   │   │   ├── mod.rs
│   │   │   │   └── show.rs
│   │   │   ├── lib.rs
│   │   │   └── main.rs
│   │   └── tests/
│   │       ├── command/
│   │       │   ├── ci.rs
│   │       │   ├── core.rs
│   │       │   ├── health.rs
│   │       │   ├── init.rs
│   │       │   ├── mod.rs
│   │       │   └── show.rs
│   │       ├── flake.nix
│   │       └── test.rs
│   ├── omnix-common/
│   │   ├── Cargo.toml
│   │   ├── crate.nix
│   │   └── src/
│   │       ├── check.rs
│   │       ├── config.rs
│   │       ├── fs.rs
│   │       ├── lib.rs
│   │       ├── logging.rs
│   │       └── markdown.rs
│   ├── omnix-develop/
│   │   ├── Cargo.toml
│   │   ├── crate.nix
│   │   └── src/
│   │       ├── config.rs
│   │       ├── core.rs
│   │       ├── lib.rs
│   │       └── readme.rs
│   ├── omnix-gui/
│   │   ├── Cargo.toml
│   │   ├── Dioxus.toml
│   │   ├── assets/
│   │   │   └── tailwind.css
│   │   ├── build.rs
│   │   ├── crate.nix
│   │   ├── css/
│   │   │   └── input.css
│   │   ├── src/
│   │   │   ├── app/
│   │   │   │   ├── flake.rs
│   │   │   │   ├── health.rs
│   │   │   │   ├── info.rs
│   │   │   │   ├── mod.rs
│   │   │   │   ├── state/
│   │   │   │   │   ├── datum.rs
│   │   │   │   │   ├── db.rs
│   │   │   │   │   ├── error.rs
│   │   │   │   │   ├── mod.rs
│   │   │   │   │   └── refresh.rs
│   │   │   │   └── widget.rs
│   │   │   ├── cli.rs
│   │   │   └── main.rs
│   │   └── tailwind.config.js
│   ├── omnix-health/
│   │   ├── CHANGELOG.md
│   │   ├── Cargo.toml
│   │   ├── README.md
│   │   ├── crate.nix
│   │   ├── failing/
│   │   │   ├── .envrc
│   │   │   └── flake.nix
│   │   ├── module/
│   │   │   ├── flake-module.nix
│   │   │   └── flake.nix
│   │   └── src/
│   │       ├── check/
│   │       │   ├── caches.rs
│   │       │   ├── direnv.rs
│   │       │   ├── flake_enabled.rs
│   │       │   ├── homebrew.rs
│   │       │   ├── max_jobs.rs
│   │       │   ├── mod.rs
│   │       │   ├── nix_version.rs
│   │       │   ├── rosetta.rs
│   │       │   ├── shell.rs
│   │       │   └── trusted_users.rs
│   │       ├── json.rs
│   │       ├── lib.rs
│   │       ├── report.rs
│   │       └── traits.rs
│   └── omnix-init/
│       ├── Cargo.toml
│       ├── crate.nix
│       ├── registry/
│       │   └── flake.nix
│       └── src/
│           ├── action.rs
│           ├── config.rs
│           ├── core.rs
│           ├── lib.rs
│           ├── param.rs
│           ├── registry.rs
│           ├── template.rs
│           └── test.rs
├── doc/
│   ├── .gitignore
│   ├── config.md
│   ├── flake.nix
│   ├── history.md
│   ├── index.md
│   ├── index.yaml
│   ├── mod.just
│   ├── om/
│   │   ├── ci.md
│   │   ├── develop/
│   │   │   └── omnixrc/
│   │   │       └── v1
│   │   ├── develop.md
│   │   ├── health.md
│   │   ├── init.md
│   │   └── show.md
│   └── om.md
├── flake.nix
├── justfile
├── nix/
│   ├── envs/
│   │   └── default.nix
│   ├── flake-schemas/
│   │   └── flake.nix
│   └── modules/
│       └── flake/
│           ├── closure-size.nix
│           ├── devshell.nix
│           ├── nixpkgs.nix
│           ├── pre-commit.nix
│           └── rust.nix
├── om.yaml
└── rust-toolchain.toml

================================================
FILE CONTENTS
================================================

================================================
FILE: .envrc
================================================
source ./doc/om/develop/omnixrc/v1

# We don't watch on `flake/*.nix` to avoid changes in modules not relevant to devShell triggering reload
watch_file \
    ./doc/om/develop/omnixrc/v1 \
    nix/modules/flake/nixpkgs.nix \
    nix/modules/flake/rust.nix \
    nix/modules/flake/devshell.nix \
    nix/envs/default.nix \
    ./crates/*/crate.nix \
    *.nix \
    om.yaml \
    rust-toolchain.toml \
    crates/omnix-init/registry/flake.*

# Dogfood our own ./omnixrc!
use omnix


================================================
FILE: .gitattributes
================================================
flake.lock linguist-generated=true
crates/omnix-gui/assets/tailwind.css linguist-generated=true


================================================
FILE: .github/workflows/ci.yaml
================================================
name: "CI"
on:
  push:
    branches:
      - "main"
      - "ci/**"
  pull_request:

jobs:
  website:
    if: github.ref == 'refs/heads/main'
    needs: main
    uses: ./.github/workflows/website.yaml
    with:
      static-site-path: ${{ needs.main.outputs.OMWEBSITE }}
    secrets: inherit

  main:
    runs-on: ${{ matrix.system }}
    permissions:
      contents: read
    outputs:
      # It is important to match the matrix.system here
      # With that of website.yaml
      OMWEBSITE: ${{ steps.omci.outputs.OMWEBSITE_x86_64-linux }}
    strategy:
      matrix:
        system: [x86_64-linux, aarch64-linux, aarch64-darwin, x86_64-darwin]
        isMain:
          - ${{ contains(github.ref, 'main') }}
        # Excluded emulated builds on PRs
        exclude:
          - system: aarch64-linux
            isMain: false
          - system: x86_64-darwin
            isMain: false
      fail-fast: false
    steps:
      - uses: actions/checkout@v4

      # Build omnix first, so we can use it to build the rest of the flake outputs.
      # This also separates the CI log for both these obviously distinct steps.
      - name: Build Omnix package
        run: nix build --no-link --print-out-paths --accept-flake-config

      # Build flake outputs
      # Run omnix using self.
      - name: Omnix CI
        run: |
          nix --accept-flake-config run . -- ci run \
            --extra-access-tokens ${{ secrets.GITHUB_TOKEN }} \
            --systems "${{ matrix.system }}" \
            --results=$HOME/omci.json \
            -- --accept-flake-config

      - name: Omnix results
        id: omci
        run: |
          cat $HOME/omci.json | jq

          # Retrieve the store path for the given package out of the given subflake.
          get_output() {
            subflake=$1 name=$2 \
            jq -r '.result.[$ENV.subflake].build.byName.[$ENV.name]' < $HOME/omci.json
          }

          echo "OMCIJSON_PATH=$HOME/omci.json" >> "$GITHUB_OUTPUT"
          echo "OMCIJSON=$(cat $HOME/omci.json)" >> "$GITHUB_OUTPUT"
          echo "OMPACKAGE=$(get_output omnix omnix-cli)" >> "$GITHUB_OUTPUT"
          echo "OMWEBSITE_${{ matrix.system }}=$(get_output doc emanote-static-website-default)" >> "$GITHUB_OUTPUT"

      - name: "Omnix: Upload results"
        uses: actions/upload-artifact@v4
        with:
          name: omci-${{ matrix.system }}.json
          path: ${{ steps.omci.outputs.OMCIJSON_PATH }}
          if-no-files-found: error

      # Login to the Attic with the token that allows pushing Nix store objects to the cache
      - name: Attic login
        if: github.ref == 'refs/heads/main'
        run: attic login chutney https://cache.nixos.asia ${{ secrets.ATTIC_LOGIN_TOKEN }}

      # Push the Nix cache
      - name: Push to attic
        if: github.ref == 'refs/heads/main'
        run: attic push chutney:oss $HOME/omci.json



================================================
FILE: .github/workflows/website.yaml
================================================
name: Website Deploy

on:
  workflow_call:
    inputs:
      static-site-path:
        type: string
        required: true
        description: "Path to the static site to deploy"

jobs:
  upload:
    runs-on: x86_64-linux
    steps:
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ${{ inputs.static-site-path }}
  deploy:
    runs-on: x86_64-linux
    needs: upload
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
    permissions:
      contents: read
      pages: write
      id-token: write
    # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
    # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
    concurrency:
      group: "pages"
      cancel-in-progress: false
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4


================================================
FILE: .gitignore
================================================
/target
result
result-lib
dist
.direnv

/assets/tailwind.css

/.vscode/spellright.dict

/.pre-commit-config.yaml


================================================
FILE: .vscode/extensions.json
================================================
{
    "recommendations": [
        "rust-lang.rust-analyzer",
        "mkhl.direnv",
        "jnoortheen.nix-ide",
        "bradlc.vscode-tailwindcss",
        "tamasfe.even-better-toml",
        "fill-labs.dependi"
    ]
}

================================================
FILE: .vscode/settings.json
================================================
{
    "nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix",
    "rust-analyzer.cargo.features": "all",
    "rust-analyzer.check.command": "clippy",
    "editor.formatOnSave": true,
    // https://twitter.com/sridca/status/1674947342607216641
    "editor.inlayHints.enabled": "offUnlessPressed",
    "emmet.includeLanguages": {
        "rust": "html",
        "*.rs": "html"
    },
    "tailwindCSS.includeLanguages": {
        "rust": "html",
        "*.rs": "html"
    },
    "tailwindCSS.experimental.classRegex": [
        "class: \"(.*)\""
    ],
    "files.associations": {
        "*.css": "tailwindcss"
    }
}

================================================
FILE: Cargo.toml
================================================
[workspace]
resolver = "2"

members = [
  "crates/omnix-common",
  "crates/omnix-cli",
  "crates/omnix-init",
  "crates/omnix-develop",
  "crates/nix_rs",
  "crates/omnix-ci",
  "crates/omnix-health",
]

[workspace.dependencies]
anyhow = "1.0.75"
async-walkdir = "2.0.0"
bytesize = { version = "1.3.0", features = ["serde"] }
cfg-if = "1"
clap = { version = "4.3", features = ["derive", "env"] }
clap-verbosity-flag = "2.2.0"
colored = { version = "2.0" }
console = "0.15.8"
console_error_panic_hook = "0.1"
console_log = "1"
direnv = "0.1.1"
fermi = "0.4.3"
futures-lite = "2.3.0"
glob = "0.3.1"
globset = { version = "0.4", features = ["serde1"] }
http = "0.2"
human-panic = "1.1.5"
inquire = "0.7.5"
itertools = "0.13"
is_proc_translated = { version = "0.1.1" }
lazy_static = "1.4.0"
pulldown-cmark-mdcat = "2.5.0"
pulldown-cmark = { version = "0.12.1", default-features = false }
nix_rs = { version = "1.0.0", path = "./crates/nix_rs" }
nonempty = { version = "0.10.0", features = ["serialize"] }
omnix-ci = { version = "1.0.0", path = "./crates/omnix-ci" }
omnix-common = { version = "1.0.0", path = "./crates/omnix-common" }
omnix-develop = { version = "1.0.0", path = "./crates/omnix-develop" }
omnix-health = { version = "1.0.0", path = "./crates/omnix-health" }
omnix-init = { version = "1.0.0", path = "./crates/omnix-init" }
os_info = "3.7.0"
reqwest = { version = "0.11", features = ["blocking", "json"] }
regex = "1.9.3"
semver = { version = "1.0.22", features = ["serde"] }
serde = { version = "1.0.197", features = ["derive"] }
serde_qs = "0.13.0"
serde_json = "1.0"
serde_repr = "0.1.18"
serde_with = { version = "3.2", features = ["json"] }
serde_yaml = "0.9"
shell-words = { version = "1.1.0" }
sysinfo = "0.29.10"
syntect = { version = "5.3.0", features = ["default-syntaxes"] }
tabled = "0.15"
tempfile = "3"
termimad = "0.30.0"
thiserror = "1.0"
tokio = { version = "1.43.1", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
try-guard = "0.2.0"
url = { version = "2.4", features = ["serde"] }
urlencoding = "2.1.3"
uuid = { version = "1.3.0", features = ["serde", "v4", "js"] }
which = { version = "4.4.2" }
clap_complete = "4.5.0"
clap_complete_nushell = "4.5"
whoami = "1.5.2"

[profile.release]
strip = true    # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
lto = true


================================================
FILE: LICENSE
================================================
                    GNU AFFERO GENERAL PUBLIC LICENSE
                       Version 3, 19 November 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.

  A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate.  Many developers of free software are heartened and
encouraged by the resulting cooperation.  However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.

  The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community.  It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server.  Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.

  An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals.  This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU Affero General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Remote Network Interaction; Use with the GNU General Public License.

  Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software.  This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time.  Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published
    by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source.  For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code.  There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.


================================================
FILE: README.md
================================================
[![project chat](https://img.shields.io/github/discussions/juspay/omnix)](https://github.com/juspay/omnix/discussions)
[![Naiveté Compass of Mood](https://img.shields.io/badge/naïve-FF10F0)](https://compass.naivete.me/ "This project follows the 'Naiveté Compass of Mood'")

# omnix

<img width="10%" src="./doc/favicon.svg">

*Pronounced [`/ɒmˈnɪks/`](https://ipa-reader.com/?text=%C9%92m%CB%88n%C9%AAks&voice=Geraint)*

Omnix aims to supplement the [Nix](https://nixos.asia/en/nix) CLI to improve developer experience.

## Usage

See <https://omnix.page/>

## Developing

1. [Install Nix](https://nixos.asia/en/install)
1. [Setup `direnv`](https://nixos.asia/en/direnv)
1. Clone this repo, `cd` to it, and run `direnv allow`.

This will automatically activate the nix develop shell. Open VSCode and install recommended extensions, ensuring that direnv activates in VSCode as well.

### Running locally

To run `omnix-cli`,

```sh
just watch # Or `just w`; you can also pass args, e.g.: `just w show`
```

### Nix workflows

Inside the nix develop shell (activated by direnv) you can use any of the `cargo` or `rustc` commands, as well as [`just`](https://just.systems/) workflows. Nix specific commands can also be used to work with the project:

```sh
# Full nix build of CLI
nix build

# Build and run the CLI
nix run
```

### Contributing

>[!TIP]
> Run `just pca` to autoformat the source tree.

- Run `just ci` to **run CI locally**.
- Add **documentation** wherever useful.
    - Run `just doc run` to preview website docs; edit, and run `just doc check`
    - To preview Rust API docs, run `just doc cargo`.
- Changes must accompany a corresponding `history.md` entry.[^cc]

[^cc]: We don't use any automatic changelog generator for this repo.

### Release HOWTO

Begin with a release PR:

- Pick a version
- Update `history.md` to make sure new release header is present
- Run [`cargo workspace publish --force omnix-cli`](https://github.com/pksunkara/cargo-workspaces?tab=readme-ov-file#publish) in devShell, using the picked version.


================================================
FILE: bacon.toml
================================================
# This is a configuration file for the bacon tool
#
# Bacon repository: https://github.com/Canop/bacon
# Complete help on configuration: https://dystroy.org/bacon/config/
# You can also check bacon's own bacon.toml file
#  as an example: https://github.com/Canop/bacon/blob/main/bacon.toml

default_job = "check"

[jobs.check]
command = ["cargo", "check", "--color", "always"]
need_stdout = false

[jobs.check-all]
command = ["cargo", "check", "--all-targets", "--color", "always"]
need_stdout = false

# Run clippy on the default target
[jobs.clippy]
command = ["cargo", "clippy", "--color", "always"]
need_stdout = false

# Run clippy on all targets
# To disable some lints, you may change the job this way:
#    [jobs.clippy-all]
#    command = [
#        "cargo", "clippy",
#        "--all-targets",
#        "--color", "always",
#    	 "--",
#    	 "-A", "clippy::bool_to_int_with_if",
#    	 "-A", "clippy::collapsible_if",
#    	 "-A", "clippy::derive_partial_eq_without_eq",
#    ]
# need_stdout = false
[jobs.clippy-all]
command = ["cargo", "clippy", "--all-targets", "--color", "always"]
need_stdout = false

# This job lets you run
# - all tests: bacon test
# - a specific test: bacon test -- config::test_default_files
# - the tests of a package: bacon test -- -- -p config
[jobs.test]
command = [
  "cargo",
  "test",
  "--color",
  "always",
  "--",
  "--color",
  "always",  # see https://github.com/Canop/bacon/issues/124
]
need_stdout = true

[jobs.doc]
command = ["cargo", "doc", "--color", "always", "--no-deps"]
need_stdout = false

# If the doc compiles, then it opens in your browser and bacon switches
# to the previous job
[jobs.doc-open]
command = ["cargo", "doc", "--color", "always", "--no-deps", "--open"]
need_stdout = false
on_success = "back"                                                    # so that we don't open the browser at each change

# You can run your application and have the result displayed in bacon,
# *if* it makes sense for this crate.
# Don't forget the `--color always` part or the errors won't be
# properly parsed.
# If your program never stops (eg a server), you may set `background`
# to false to have the cargo run output immediately displayed instead
# of waiting for program's end.
[jobs.run]
command = [
  "cargo",
  "run",
  "--color",
  "always",
  # put launch parameters for your program behind a `--` separator
]
need_stdout = true
allow_warnings = true
background = true

[jobs.health-failing]
command = [
  "cargo",
  "run",
  "--color",
  "always",
  "--",
  "health",
  "./crates/omnix-health/failing",
]
need_stdout = true
allow_warnings = true

[jobs.develop]
command = [
  "cargo",
  "run",
  "--color",
  "always",
  "--",
  "develop",
  ".",
]
need_stdout = true
allow_warnings = true


# You may define here keybindings that would be specific to
# a project, for example a shortcut to launch a specific job.
# Shortcuts to internal functions (scrolling, toggling, etc.)
# should go in your personal global prefs.toml file instead.
[keybindings]
# alt-m = "job:my-job"
c = "job:clippy-all"     # comment this to have 'c' run clippy on only the default target
h = "job:health-failing"


================================================
FILE: crates/nix_rs/CHANGELOG.md
================================================
# Changelog

## Unreleased

- **`flake::url`**:
  - Remove `qualified_attr` module
- **`eval::nix_eval`**
  - Display evaluation progress
  - Decrease logging verbosity
- **`flake::schema`**
  - Don't hardcode flake schema types
- **`config`**
  - Don't enable flakes during `NixConfig::get`
- Support Nix 2.20
- **`flake::url`**
  - Add `without_attr`, `get_attr`
  - Simplify the return type of `RootQualifiedAttr::eval_flake`
  - Add `AsRef`, `Deref`, `From<&Path>` instances for `FlakeUrl`
  - `Path` instances for `FlakeUrl` no longer use the `path:` prefix (to avoid store copying)
  - **`attr`**:
    - Add `FlakeAttr::new` and `FlakeAttr::none` constructors
  - `qualified_attr` - vastly simplify module
- `flake::functions`:
  - Add new module
- **`flake::command`**:
  - Add module, for `nix run`, `nix build` and `nix develop`
- **`store`**:
  - Add module (upstreamed from nixci)
  - Add `StoreURI`
  - Avoid running `nix-store` multiple times.
- **`copy`**:
  - Takes `NixCopyOptions` now.
- **`env`**:
  - use `whoami` crate to find the current user instead of depending on environment variable `USER`
  - `NixEnv::detect`'s logging uses DEBUG level now (formerly INFO)
  - Add Nix installer to `NixEnv`
- **`command`
  - `run_with_args` is now `run_with`, and takes a function that mutates the `Command` at will.
  - Add `trace_cmd_with`
- **`version`**:
  - Add `NixVersion::get`
- **`system_list`**: New module
- **version_spec**: New `NixVersion` spec module

## 1.0.0

- **DeterminateSystems/flake-schemas**
  - Allow overriding the `nix` CLI command.
  - Switch to flake schema given by <https://github.com/DeterminateSystems/flake-schemas>
- **`flake::schema::FlakeSchema`**
  - Add `nixos_configurations`
- **`flake::url`**
  - `Flake::from_nix` explicitly takes `NixConfig` as argument, rather than implicitly running nix to get it.
  - Remove string convertion implementations; use `std::parse` instead, and handle errors explicitly.
  - Split attr code to its own module, `flake::url::attr`
  - Introduce `flake::url::qualified_attr` module
- **`eval`**
  - `nix_eval_attr_json`
    - No longer takes `default_if_missing`; instead (always) returns `None` if attribute is missing.
    - Rename to `nix_eval_maybe` (as there is no non-JSON variant)
- **`env::NixEnv`**
  - Clarify error message when `$USER` is not set
- **``command`**
  - Add `NixCmd::get()` to return flakes-enabled global command
  - `NixCmd::default()` returns the bare command (no experimental features enabled)
- ``config``
  - Add `NixConfig::get()` to get the once-created static value of `NixConfig`
- `info`
  - Add `NixInfo::get()` to get the once-created static value of `NixInfo`
  - Rename `NixInfo::from_nix()` to `NixInfo::new()`; the latter explicitly takes `NixConfig`

## [0.5.0](https://github.com/juspay/nix-rs/compare/0.4.0...0.5.0) (2024-06-05)

### Features

- Improve `with_flakes` to transform existing `NixCmd`
([f936e54](https://github.com/juspay/nix-rs/commit/f936e5401d1bc9b82084cf7b49402a5ee1a3b733))
- Add support for clap deriving
([f61bd2c](https://github.com/juspay/nix-rs/commit/f61bd2c740a23a10bbb89dfbd3b77fd4b2a49bac))
- Add `NixCmd::extra_access_tokens`
([a287ab2](https://github.com/juspay/nix-rs/commit/a287ab2ad2d21db6ac89e4ce94c55446a02af241))

## [0.4.0](https://github.com/juspay/nix-rs/compare/0.3.3...0.4.0) (2024-06-03)

### Features

- add `NixCmd::run_with_args`
([47f3170](https://github.com/juspay/nix-rs/commit/47f3170d57b72089eb977620217613571c52f456))
- add `FlakeUrl::with_attr`
([1ff343d](https://github.com/juspay/nix-rs/commit/1ff343d25f1a633c3caf2d6f723bbd1c9e352cbc))

### [0.3.3](https://github.com/juspay/nix-rs/compare/0.3.2...0.3.3) (2024-04-17)

#### Features

- **eval:** nix_eval_attr_json explicitly takes NixCmd
([cccdb43](https://github.com/juspay/nix-rs/commit/cccdb437f4f2b31d32778e9cf3de2ab1a61d9331))
- **command:** Add `with_flakes` returning smarter nix CLI with flakes enabled
([f7f217a](https://github.com/juspay/nix-rs/commit/f7f217a12acefc3992b5ff8ba59d861f5cc2abcb))

### 0.3.2 (2024-04-04)


================================================
FILE: crates/nix_rs/Cargo.toml
================================================
[package]
name = "nix_rs"
# Important: remember to update the top-level Cargo.toml if updating major version
version = "1.3.2"
license = "Apache-2.0"
repository = "https://github.com/juspay/omnix"
description = "Rust library for interacting with the Nix command"
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cfg-if = { workspace = true }
regex = { workspace = true }
os_info = { workspace = true }
thiserror = { workspace = true }
serde = { workspace = true }
serde_qs = { workspace = true }
serde_json = { workspace = true }
serde_with = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
url = { workspace = true }
colored = { workspace = true }
shell-words = { workspace = true }
is_proc_translated = { workspace = true }
sysinfo = { workspace = true }
tempfile = { workspace = true }
bytesize = { workspace = true }
clap = { workspace = true, optional = true }
nonempty = { workspace = true }
whoami = { workspace = true }
lazy_static = { workspace = true }
which = { workspace = true }

[features]
clap = ["dep:clap"]


================================================
FILE: crates/nix_rs/README.md
================================================
# nix_rs

[![Crates.io](https://img.shields.io/crates/v/nix_rs.svg)](https://crates.io/crates/nix_rs)

A Rust crate to interact with the [Nix](https://nixos.asia/en/nix) command. `nix_rs` also provides the needed Rust types which are guaranteed to compile in wasm.


================================================
FILE: crates/nix_rs/crate.nix
================================================
{
  autoWire = [ ];
  crane = {
    args = {
      nativeBuildInputs = [
        # nix # Tests need nix cli
      ];
    };
  };
}


================================================
FILE: crates/nix_rs/src/arg.rs
================================================
//! Nix command's arguments

use std::collections::HashMap;

use serde::{Deserialize, Serialize};

/// All arguments you can pass to the `nix` command
///
/// This struct is clap-friendly for using in your subcommands. The clap options will mirror that of `nix`.
///
/// To convert to `Command` args list, use `into_iter`.
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
#[cfg_attr(feature = "clap", derive(clap::Parser))]
pub struct NixArgs {
    /// Append to the experimental-features setting of Nix.
    #[cfg_attr(feature = "clap", arg(long))]
    pub extra_experimental_features: Vec<String>,

    /// Append to the access-tokens setting of Nix.
    #[cfg_attr(feature = "clap", arg(long))]
    pub extra_access_tokens: Vec<String>,

    /// Additional arguments to pass through to `nix`
    ///
    /// NOTE: Arguments irrelevant to a nix subcommand will automatically be ignored.
    #[cfg_attr(feature = "clap", arg(last = true))]
    pub extra_nix_args: Vec<String>,
}

impl NixArgs {
    /// Convert this [NixCmd] configuration into a list of arguments for
    /// [Command]
    pub fn to_args(&self, subcommands: &[&str]) -> Vec<String> {
        let mut args = vec![];
        if !self.extra_experimental_features.is_empty() {
            args.push("--extra-experimental-features".to_string());
            args.push(self.extra_experimental_features.join(" "));
        }
        if !self.extra_access_tokens.is_empty() {
            args.push("--extra-access-tokens".to_string());
            args.push(self.extra_access_tokens.join(" "));
        }
        let mut extra_nix_args = self.extra_nix_args.clone();
        remove_nonsense_args_when_subcommand(subcommands, &mut extra_nix_args);
        args.extend(extra_nix_args);
        args
    }

    /// Enable flakes on this [NixCmd] configuration
    pub fn with_flakes(&mut self) {
        self.extra_experimental_features
            .append(vec!["nix-command".to_string(), "flakes".to_string()].as_mut());
    }

    /// Enable nix-command on this [NixCmd] configuration
    pub fn with_nix_command(&mut self) {
        self.extra_experimental_features
            .append(vec!["nix-command".to_string()].as_mut());
    }
}

/// Certain options, like --rebuild, is not supported by all subcommands (e.g.
/// `nix develop`). We remove them here. Yes, this is a bit of HACK!
fn remove_nonsense_args_when_subcommand(subcommands: &[&str], args: &mut Vec<String>) {
    let unsupported = non_sense_options(subcommands);
    for (option, count) in unsupported {
        remove_arguments(args, option, count);
    }
}

fn non_sense_options<'a>(subcommands: &[&str]) -> HashMap<&'a str, usize> {
    let rebuild = ("--rebuild", 0);
    let override_input = ("--override-input", 2);
    match subcommands {
        ["eval"] => HashMap::from([rebuild, override_input]),
        ["flake", "lock"] => HashMap::from([rebuild, override_input]),
        ["flake", "check"] => HashMap::from([rebuild]),
        ["develop"] => HashMap::from([rebuild]),
        ["run"] => HashMap::from([rebuild]),
        _ => HashMap::new(),
    }
}

fn remove_arguments(vec: &mut Vec<String>, arg: &str, next: usize) {
    let mut i = 0;
    while i < vec.len() {
        if vec[i] == arg && i + next < vec.len() {
            vec.drain(i..i + next + 1);
        } else {
            i += 1;
        }
    }
}


================================================
FILE: crates/nix_rs/src/command.rs
================================================
//! Nix base command configuration
//!
//! # Example
//!
//! ```ignore
//! use nix_rs::command::NixCmd;
//! let cmd = NixCmd::default();
//! cmd.run_with_args_returning_stdout(&["--version"]);
//! ```

use std::{
    fmt::{self, Display},
    process::Stdio,
};

use serde::{Deserialize, Serialize};
use thiserror::Error;

use tokio::{process::Command, sync::OnceCell};

use tracing::instrument;

#[cfg(feature = "clap")]
use clap;

use crate::{arg::NixArgs, config::NixConfig};

/// The `nix` command's global options.
///
/// See [available global
/// options](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix#options)
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
#[cfg_attr(feature = "clap", derive(clap::Parser))]
pub struct NixCmd {
    /// The arguments to pass to `nix`
    #[cfg_attr(feature = "clap", clap(flatten))]
    pub args: NixArgs,
}

static NIXCMD: OnceCell<NixCmd> = OnceCell::const_new();

/// Trace a user-copyable command line
///
/// [tracing::info!] the given [tokio::process::Command] with human-readable
/// command-line string that can generally be copy-pasted by the user.
///
/// The command will be highlighted to distinguish it (for copying) from the
/// rest of the instrumentation parameters.
#[instrument(name = "command")]
pub fn trace_cmd(cmd: &tokio::process::Command) {
    trace_cmd_with("❄️ ", cmd);
}

/// Like [trace_cmd] but with a custom icon
#[instrument(name = "command")]
pub fn trace_cmd_with(icon: &str, cmd: &tokio::process::Command) {
    use colored::Colorize;
    tracing::info!("{}", format!("{} {}️", icon, to_cli(cmd)).dimmed());
}

impl NixCmd {
    /// Return a global `NixCmd` instance with flakes enabled.
    pub async fn get() -> &'static NixCmd {
        NIXCMD
            .get_or_init(|| async {
                let cfg = NixConfig::get().await.as_ref().unwrap_or_else(|err| {
                    panic!("Unable to get Nix config. Is your nix.conf valid?\n{}", err)
                });
                let mut cmd = NixCmd::default();
                if !cfg.is_flakes_enabled() {
                    cmd.args.with_flakes()
                }
                cmd
            })
            .await
    }

    /// Return a [Command] for this [NixCmd] configuration
    ///
    /// Arguments:
    /// - `subcommands`: Optional subcommands to pass. Note that `NixArgs` will
    ///   be passed *after* these subcommands.
    pub fn command(&self, subcommands: &[&str]) -> Command {
        let mut cmd = Command::new("nix");
        cmd.kill_on_drop(true);
        cmd.args(subcommands);
        cmd.args(self.args.to_args(subcommands));
        cmd
    }

    /// Run nix with given args, interpreting stdout as JSON, parsing into `T`
    pub async fn run_with_args_expecting_json<T>(
        &self,
        subcommands: &[&str],
        args: &[&str],
    ) -> Result<T, NixCmdError>
    where
        T: serde::de::DeserializeOwned,
    {
        let stdout: Vec<u8> = self
            .run_with_returning_stdout(subcommands, |c| {
                c.args(args);
            })
            .await?;
        let v = serde_json::from_slice::<T>(&stdout)?;
        Ok(v)
    }

    /// Run nix with given args, interpreting parsing stdout, via [std::str::FromStr], into `T`
    pub async fn run_with_args_expecting_fromstr<T>(
        &self,
        subcommands: &[&str],
        args: &[&str],
    ) -> Result<T, NixCmdError>
    where
        T: std::str::FromStr,
        <T as std::str::FromStr>::Err: std::fmt::Display,
    {
        let stdout = self
            .run_with_returning_stdout(subcommands, |c| {
                c.args(args);
            })
            .await?;
        let v = &String::from_utf8_lossy(&stdout);
        let v = T::from_str(v.trim()).map_err(|e| FromStrError(e.to_string()))?;
        Ok(v)
    }

    /// Like [Self::run_with] but returns stdout as a [`Vec<u8>`]
    pub async fn run_with_returning_stdout<F>(
        &self,
        subcommands: &[&str],
        f: F,
    ) -> Result<Vec<u8>, CommandError>
    where
        F: FnOnce(&mut Command),
    {
        let mut cmd = self.command(subcommands);
        f(&mut cmd);
        trace_cmd(&cmd);

        cmd.stdout(Stdio::piped());
        cmd.stderr(Stdio::piped());
        let child = cmd.spawn()?;
        let out = child.wait_with_output().await?;

        if out.status.success() {
            Ok(out.stdout)
        } else {
            let stderr = String::from_utf8_lossy(&out.stderr).to_string();
            Err(CommandError::ProcessFailed {
                stderr,
                exit_code: out.status.code(),
            })
        }
    }

    /// Run Nix with given [Command] customizations, while also tracing the command being run.
    ///
    /// Return the stdout bytes returned by [tokio::process::Child::wait_with_output]. In order to capture stdout, you must call `cmd.stdout(Stdio::piped());` inside the handler.
    pub async fn run_with<F>(&self, subcommands: &[&str], f: F) -> Result<Vec<u8>, CommandError>
    where
        F: FnOnce(&mut Command),
    {
        let mut cmd = self.command(subcommands);
        f(&mut cmd);
        trace_cmd(&cmd);
        let out = cmd.spawn()?.wait_with_output().await?;
        if out.status.success() {
            Ok(out.stdout)
        } else {
            let stderr = String::from_utf8_lossy(&out.stderr).to_string();
            Err(CommandError::ProcessFailed {
                stderr,
                exit_code: out.status.code(),
            })
        }
    }
}

/// Convert a Command to user-copyable CLI string
fn to_cli(cmd: &tokio::process::Command) -> String {
    use std::ffi::OsStr;
    let program = cmd.as_std().get_program().to_string_lossy().to_string();
    let args = cmd
        .as_std()
        .get_args()
        .collect::<Vec<&OsStr>>()
        .into_iter()
        .map(|s| s.to_string_lossy().to_string())
        .collect::<Vec<String>>();
    let cli = vec![program]
        .into_iter()
        .chain(args)
        .collect::<Vec<String>>();
    shell_words::join(cli)
}

/// Errors when running and interpreting the output of a nix command
#[derive(Error, Debug)]
pub enum NixCmdError {
    /// A [CommandError]
    #[error("Command error: {0}")]
    CmdError(#[from] CommandError),

    /// Failed to unicode-decode the output of a command
    #[error("Failed to decode command stdout (utf8 error): {0}")]
    DecodeErrorUtf8(#[from] std::string::FromUtf8Error),

    /// Failed to parse the output of a command
    #[error("Failed to decode command stdout (from_str error): {0}")]
    DecodeErrorFromStr(#[from] FromStrError),

    /// Failed to parse the output of a command as JSON
    #[error("Failed to decode command stdout (json error): {0}")]
    DecodeErrorJson(#[from] serde_json::Error),
}

/// Errors when parsing a string into a type
#[derive(Debug)]
pub struct FromStrError(String);

impl Display for FromStrError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "Failed to parse string: {}", self.0)
    }
}

impl std::error::Error for FromStrError {}

/// Errors when running a command
#[derive(Error, Debug)]
pub enum CommandError {
    /// Error when spawning a child process
    #[error("Child process error: {0}")]
    ChildProcessError(#[from] std::io::Error),

    /// Child process exited unsuccessfully
    #[error(
        "Process exited unsuccessfully. exit_code={:?} stderr={}",
        exit_code,
        stderr
    )]
    ProcessFailed {
        /// The stderr of the process, if available.
        stderr: String,
        /// The exit code of the process
        exit_code: Option<i32>,
    },

    /// Failed to decode the stderr of a command
    #[error("Failed to decode command stderr: {0}")]
    Decode(#[from] std::string::FromUtf8Error),
}


================================================
FILE: crates/nix_rs/src/config.rs
================================================
//! Rust module for `nix show-config`

use std::{convert::Infallible, str::FromStr};

use serde::{Deserialize, Serialize};
use serde_with::DeserializeFromStr;
use tokio::sync::OnceCell;
use tracing::instrument;
use url::Url;

use crate::{
    command::{NixCmd, NixCmdError},
    version::NixVersion,
};

use super::flake::system::System;

/// Nix configuration spit out by `nix show-config`
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct NixConfig {
    /// Number of CPU cores used for nix builds
    pub cores: ConfigVal<i32>,
    /// Experimental features currently enabled
    pub experimental_features: ConfigVal<Vec<String>>,
    /// Extra platforms to build for
    pub extra_platforms: ConfigVal<Vec<String>>,
    /// The flake registry to use to lookup atomic flake inputs
    pub flake_registry: ConfigVal<String>,
    /// Maximum number of jobs to run in parallel
    pub max_jobs: ConfigVal<i32>,
    /// Cache substituters
    pub substituters: ConfigVal<Vec<Url>>,
    /// Current system
    pub system: ConfigVal<System>,
    /// Trusted users
    pub trusted_users: ConfigVal<Vec<TrustedUserValue>>,
}

/// The value for each 'nix show-config --json' key.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ConfigVal<T> {
    /// Current value in use.
    pub value: T,
    /// Default value by Nix.
    pub default_value: T,
    /// Description of this config item.
    pub description: String,
}

static NIX_CONFIG: OnceCell<Result<NixConfig, NixConfigError>> = OnceCell::const_new();

static NIX_2_20_0: NixVersion = NixVersion {
    major: 2,
    minor: 20,
    patch: 0,
};

impl NixConfig {
    /// Get the once version of `NixConfig`.
    #[instrument(name = "show-config(once)")]
    pub async fn get() -> &'static Result<NixConfig, NixConfigError> {
        NIX_CONFIG
            .get_or_init(|| async {
                let mut cmd = NixCmd::default();
                cmd.args.with_nix_command(); // Enable nix-command, since don't yet know if it is already enabled.
                let nix_ver = NixVersion::get().await.as_ref()?;
                let cfg = NixConfig::from_nix(&cmd, nix_ver).await?;
                Ok(cfg)
            })
            .await
    }

    /// Get the output of `nix show-config`
    #[instrument(name = "show-config")]
    pub async fn from_nix(
        nix_cmd: &super::command::NixCmd,
        nix_version: &NixVersion,
    ) -> Result<NixConfig, super::command::NixCmdError> {
        let v = if nix_version >= &NIX_2_20_0 {
            nix_cmd
                .run_with_args_expecting_json(&["config", "show"], &["--json"])
                .await?
        } else {
            nix_cmd
                .run_with_args_expecting_json(&["show-config"], &["--json"])
                .await?
        };
        Ok(v)
    }

    /// Is flakes and command features enabled?
    pub fn is_flakes_enabled(&self) -> bool {
        self.experimental_features
            .value
            .contains(&"nix-command".to_string())
            && self
                .experimental_features
                .value
                .contains(&"flakes".to_string())
    }
}

/// Error type for `NixConfig`
#[derive(thiserror::Error, Debug)]
pub enum NixConfigError {
    /// A [NixCmdError]
    #[error("Nix command error: {0}")]
    NixCmdError(#[from] NixCmdError),

    /// A [NixCmdError] with a static lifetime
    #[error("Nix command error: {0}")]
    NixCmdErrorStatic(#[from] &'static NixCmdError),
}

/// Accepted value for "trusted-users" in nix.conf
#[derive(Debug, Clone, PartialEq, Eq, Serialize, DeserializeFromStr)]
pub enum TrustedUserValue {
    /// All users are trusted
    All,
    /// A specific user is trusted
    User(String),
    /// Users belonging to a specific group are trusted
    Group(String),
}

impl TrustedUserValue {
    fn from_str(s: &str) -> Self {
        // In nix.conf, groups are prefixed with '@'. '*' means all users are
        // trusted.
        if s == "*" {
            return Self::All;
        }
        match s.strip_prefix('@') {
            Some(s) => Self::Group(s.to_string()),
            None => Self::User(s.to_string()),
        }
    }

    /// Display the nix.conf original string
    pub fn display_original(val: &[TrustedUserValue]) -> String {
        val.iter()
            .map(|x| match x {
                TrustedUserValue::All => "*".to_string(),
                TrustedUserValue::User(x) => x.to_string(),
                TrustedUserValue::Group(x) => format!("@{}", x),
            })
            .collect::<Vec<String>>()
            .join(" ")
    }
}

impl From<String> for TrustedUserValue {
    fn from(s: String) -> Self {
        Self::from_str(&s)
    }
}

impl FromStr for TrustedUserValue {
    type Err = Infallible;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        Ok(Self::from_str(s))
    }
}

#[tokio::test]
async fn test_nix_config() -> Result<(), crate::command::NixCmdError> {
    let v = NixConfig::get().await.as_ref().unwrap();
    println!("Max Jobs: {}", v.max_jobs.value);
    Ok(())
}


================================================
FILE: crates/nix_rs/src/copy.rs
================================================
//! Rust module for `nix copy`.
use crate::{
    command::{CommandError, NixCmd},
    store::uri::StoreURI,
};
use std::{ffi::OsStr, path::Path};

/// Options for `nix copy`.
#[derive(Debug, Clone, Default)]
pub struct NixCopyOptions {
    /// The URI of the store to copy from.
    pub from: Option<StoreURI>,
    /// The URI of the store to copy to.
    pub to: Option<StoreURI>,
    /// Do not check signatures.
    pub no_check_sigs: bool,
}

/// Copy store paths to a remote Nix store using `nix copy`.
///
/// # Arguments
///
/// * `cmd` - The `nix` command
/// * `host` - The remote host to copy to
/// * `paths` - The paths to copy. Limit this to be within the limit of Unix process arguments size limit.
pub async fn nix_copy<I, P>(
    cmd: &NixCmd,
    options: NixCopyOptions,
    paths: I,
) -> Result<(), CommandError>
where
    I: IntoIterator<Item = P>,
    P: AsRef<Path> + AsRef<OsStr>,
{
    cmd.run_with(&["copy"], |cmd| {
        cmd.arg("-v");
        if let Some(uri) = options.from {
            cmd.arg("--from").arg(uri.to_string());
        }
        if let Some(uri) = options.to {
            cmd.arg("--to").arg(uri.to_string());
        }
        if options.no_check_sigs {
            cmd.arg("--no-check-sigs");
        }
        cmd.args(paths);
    })
    .await?;
    Ok(())
}


================================================
FILE: crates/nix_rs/src/detsys_installer.rs
================================================
//! DetSys installer detection
// TODO: Move this under 'env' module.
use serde::{Deserialize, Serialize};

use std::{fmt::Display, io::ErrorKind, path::Path, str::FromStr};

use regex::Regex;
use thiserror::Error;

/// The installer from <https://github.com/DeterminateSystems/nix-installer>
#[derive(Debug, Serialize, Deserialize, PartialEq, PartialOrd, Eq, Clone)]
pub struct DetSysNixInstaller {
    version: InstallerVersion,
}

impl DetSysNixInstaller {
    /// Detects if the DetSys nix-installer is installed
    pub fn detect() -> Result<Option<Self>, BadInstallerVersion> {
        let nix_installer_path = Path::new("/nix/nix-installer");
        if nix_installer_path.exists() {
            Ok(Some(DetSysNixInstaller {
                version: InstallerVersion::get_version(nix_installer_path)?,
            }))
        } else {
            Ok(None)
        }
    }
}

impl Display for DetSysNixInstaller {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "DetSys nix-installer ({})", self.version)
    }
}

// The version of Detsys/nix-installer
#[derive(Debug, Serialize, Deserialize, PartialEq, PartialOrd, Eq, Clone)]
struct InstallerVersion {
    major: u32,
    minor: u32,
    patch: u32,
}

impl Display for InstallerVersion {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}.{}.{}", self.major, self.minor, self.patch)
    }
}

/// Errors that can occur when trying to get the [DetSysNixInstaller] version
#[derive(Error, Debug)]
pub enum BadInstallerVersion {
    /// Regex error
    #[error("Regex error: {0}")]
    Regex(#[from] regex::Error),

    /// Failed to decode installer output
    #[error("Failed to decode installer output: {0}")]
    Decode(#[from] std::string::FromUtf8Error),

    /// Failed to parse installer version
    #[error("Failed to parse installer version: {0}")]
    Parse(#[from] std::num::ParseIntError),

    /// Failed to fetch installer version
    #[error("Failed to fetch installer version: {0}")]
    Command(std::io::Error),
}

impl FromStr for InstallerVersion {
    type Err = BadInstallerVersion;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let re = Regex::new(r"(\d+)\.(\d+)\.(\d+)")?;

        let captures = re
            .captures(s)
            .ok_or(BadInstallerVersion::Command(std::io::Error::new(
                ErrorKind::InvalidData,
                "Failed to capture regex",
            )))?;
        let major = captures[1].parse::<u32>()?;
        let minor = captures[2].parse::<u32>()?;
        let patch = captures[3].parse::<u32>()?;

        Ok(InstallerVersion {
            major,
            minor,
            patch,
        })
    }
}

impl InstallerVersion {
    pub fn get_version(executable_path: &Path) -> Result<Self, BadInstallerVersion> {
        let output = std::process::Command::new(executable_path)
            .arg("--version")
            .output()
            .map_err(BadInstallerVersion::Command)?;
        let version_str = String::from_utf8(output.stdout)?;
        version_str.parse()
    }
}


================================================
FILE: crates/nix_rs/src/env.rs
================================================
//! Information about the environment in which Nix will run
// TODO: Make this a package, and split (alongn with detsys_installer.rs)
use std::{fmt::Display, path::Path};

use bytesize::ByteSize;
use os_info;
use serde::{Deserialize, Serialize};
use serde_with::SerializeDisplay;
use std::process::Command;
use tracing::instrument;
use whoami;

/// The environment in which Nix operates
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NixEnv {
    /// Current user ($USER)
    pub current_user: String,
    /// Current user groups
    pub current_user_groups: Vec<String>,
    /// Underlying OS in which Nix runs
    pub os: OS,
    /// Total disk space of the volume where /nix exists.
    ///
    /// This is either root volume or the dedicated /nix volume.
    pub total_disk_space: ByteSize,
    /// Total memory
    pub total_memory: ByteSize,
    /// The installer used to install Nix
    pub installer: NixInstaller,
}

impl NixEnv {
    /// Determine [NixEnv] on the user's system

    #[instrument]
    pub async fn detect() -> Result<NixEnv, NixEnvError> {
        use sysinfo::{DiskExt, SystemExt};
        tracing::debug!("Detecting Nix environment");
        let os = OS::detect().await;
        tokio::task::spawn_blocking(|| {
            let current_user = whoami::username();
            let sys = sysinfo::System::new_with_specifics(
                sysinfo::RefreshKind::new().with_disks_list().with_memory(),
            );
            let total_disk_space = to_bytesize(get_nix_disk(&sys)?.total_space());
            let total_memory = to_bytesize(sys.total_memory());
            let current_user_groups = get_current_user_groups()?;
            let installer = NixInstaller::detect()?;
            Ok(NixEnv {
                current_user,
                current_user_groups,
                os,
                total_disk_space,
                total_memory,
                installer,
            })
        })
        .await
        .unwrap()
    }
}

/// Get the current user's groups
fn get_current_user_groups() -> Result<Vec<String>, NixEnvError> {
    let output = Command::new("groups")
        .output()
        .map_err(NixEnvError::GroupsError)?;
    let group_info = &String::from_utf8_lossy(&output.stdout);
    Ok(group_info
        .as_ref()
        .split_whitespace()
        .map(|v| v.to_string())
        .collect())
}

/// Get the disk where /nix exists
fn get_nix_disk(sys: &sysinfo::System) -> Result<&sysinfo::Disk, NixEnvError> {
    use sysinfo::{DiskExt, SystemExt};
    let by_mount_point: std::collections::HashMap<&Path, &sysinfo::Disk> = sys
        .disks()
        .iter()
        .map(|disk| (disk.mount_point(), disk))
        .collect();
    // Lookup /nix first, then /.
    by_mount_point
        .get(Path::new("/nix"))
        .copied()
        .or_else(|| by_mount_point.get(Path::new("/")).copied())
        .ok_or(NixEnvError::NoDisk)
}

/// The system under which Nix is installed and operates
#[derive(Debug, Clone, PartialEq, Eq, SerializeDisplay, Deserialize)]
pub enum OS {
    /// On macOS
    MacOS {
        /// Using nix-darwin
        nix_darwin: bool,
        /// Architecture
        arch: Option<String>,
        /// https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment
        proc_translated: bool,
    },
    /// On NixOS
    NixOS,
    /// Nix is individually installed on Linux or macOS
    Other(os_info::Type),
}

// The [Display] instance affects how [OS] is displayed to the app user
impl Display for OS {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            OS::MacOS {
                nix_darwin,
                arch: _,
                proc_translated: _,
            } => {
                if *nix_darwin {
                    write!(f, "macOS (nix-darwin)")
                } else {
                    write!(f, "macOS")
                }
            }
            OS::NixOS => write!(f, "NixOS"),
            OS::Other(os_type) => write!(f, "{}", os_type),
        }
    }
}

impl OS {
    /// Detect the OS
    pub async fn detect() -> Self {
        let os_info = tokio::task::spawn_blocking(os_info::get).await.unwrap();
        let os_type = os_info.os_type();
        let arch = os_info.architecture();
        async fn is_symlink(file_path: &str) -> std::io::Result<bool> {
            let metadata = tokio::fs::symlink_metadata(file_path).await?;
            Ok(metadata.file_type().is_symlink())
        }
        match os_type {
            os_info::Type::Macos => {
                // To detect that we are on NixDarwin, we check if /etc/nix/nix.conf
                // is a symlink (which nix-darwin manages like NixOS does)
                let nix_darwin = is_symlink("/etc/nix/nix.conf").await.unwrap_or(false);
                OS::MacOS {
                    nix_darwin,
                    arch: arch.map(|s| s.to_string()),
                    proc_translated: is_proc_translated::is_proc_translated(),
                }
            }
            os_info::Type::NixOS => OS::NixOS,
            _ => OS::Other(os_type),
        }
    }

    /// Return the label for nix-darwin or NixOS system
    pub fn nix_system_config_label(&self) -> Option<String> {
        // TODO: This should return Markdown
        match self {
            OS::MacOS {
                nix_darwin,
                arch: _,
                proc_translated: _,
            } if *nix_darwin => Some("nix-darwin configuration".to_string()),
            OS::NixOS => Some("nixos configuration".to_string()),
            _ => None,
        }
    }

    /// Return the label for where Nix is configured
    pub fn nix_config_label(&self) -> String {
        self.nix_system_config_label()
            .unwrap_or("/etc/nix/nix.conf".to_string())
    }
}

/// The installer used to install Nix (applicable only for non-NixOS systems)
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
#[serde(tag = "type")]
pub enum NixInstaller {
    /// The Determinate Systems installer
    DetSys(super::detsys_installer::DetSysNixInstaller),
    /// Either offical installer or from a different package manager
    Other,
}

impl Display for NixInstaller {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            NixInstaller::DetSys(installer) => write!(f, "{}", installer),
            NixInstaller::Other => {
                write!(f, "Unknown installer")
            }
        }
    }
}

impl NixInstaller {
    /// Detect the Nix installer
    pub fn detect() -> Result<Self, NixEnvError> {
        match super::detsys_installer::DetSysNixInstaller::detect()? {
            Some(installer) => Ok(NixInstaller::DetSys(installer)),
            None => Ok(NixInstaller::Other),
        }
    }
}

/// Errors while trying to fetch [NixEnv]
#[derive(thiserror::Error, Debug)]
pub enum NixEnvError {
    /// Unable to find user groups
    #[error("Failed to fetch groups: {0}")]
    GroupsError(std::io::Error),

    /// Unable to find /nix volume
    #[error("Unable to find root disk or /nix volume")]
    NoDisk,

    /// Unable to find Nix installer
    #[error("Failed to detect Nix installer: {0}")]
    InstallerError(#[from] super::detsys_installer::BadInstallerVersion),

    /// `nix` command not found
    #[error("`nix` not found in PATH: {0}")]
    NixPathError(#[from] which::Error),
}

/// Convert bytes to a closest [ByteSize]
///
/// Useful for displaying disk space and memory which are typically in GBs / TBs
fn to_bytesize(bytes: u64) -> ByteSize {
    let kb = bytes / 1024;
    let mb = kb / 1024;
    let gb = mb / 1024;
    if gb > 0 {
        ByteSize::gib(gb)
    } else if mb > 0 {
        ByteSize::mib(mb)
    } else if kb > 0 {
        ByteSize::kib(kb)
    } else {
        ByteSize::b(bytes)
    }
}

/// Test for [to_bytesize]

#[test]
fn test_to_bytesize() {
    assert_eq!(to_bytesize(0), ByteSize::b(0));
    assert_eq!(to_bytesize(1), ByteSize::b(1));
    assert_eq!(to_bytesize(1023), ByteSize::b(1023));
    assert_eq!(to_bytesize(1024), ByteSize::kib(1));
    assert_eq!(to_bytesize(1024 * 1024), ByteSize::mib(1));
    assert_eq!(to_bytesize(1024 * 1024 * 1024), ByteSize::gib(1));
}


================================================
FILE: crates/nix_rs/src/flake/command.rs
================================================
//! Nix commands for working with flakes
use std::{
    collections::{BTreeMap, HashMap},
    path::PathBuf,
};

use nonempty::NonEmpty;
use serde::{Deserialize, Serialize};
use tokio::process::Command;

use crate::command::{CommandError, NixCmd, NixCmdError};

use super::url::FlakeUrl;

/// Run `nix run` on the given flake app.
pub async fn run(
    nixcmd: &NixCmd,
    opts: &FlakeOptions,
    url: &FlakeUrl,
    args: Vec<String>,
) -> Result<(), CommandError> {
    nixcmd
        .run_with(&["run"], |cmd| {
            opts.use_in_command(cmd);
            cmd.args([url.to_string(), "--".to_string()]);
            cmd.args(args);
        })
        .await?;
    Ok(())
}

/// Run `nix develop` on the given flake devshell.
pub async fn develop(
    nixcmd: &NixCmd,
    opts: &FlakeOptions,
    url: &FlakeUrl,
    command: NonEmpty<String>,
) -> Result<(), CommandError> {
    nixcmd
        .run_with(&["develop"], |cmd| {
            opts.use_in_command(cmd);
            cmd.args([url.to_string(), "-c".to_string()]);
            cmd.args(command);
        })
        .await?;
    Ok(())
}

/// Run `nix build`
pub async fn build(
    cmd: &NixCmd,
    opts: &FlakeOptions,
    url: FlakeUrl,
) -> Result<Vec<OutPath>, NixCmdError> {
    let stdout: Vec<u8> = cmd
        .run_with_returning_stdout(&["build"], |c| {
            opts.use_in_command(c);
            c.args(["--no-link", "--json", &url]);
        })
        .await?;
    let v = serde_json::from_slice::<Vec<OutPath>>(&stdout)?;
    Ok(v)
}

/// Run `nix flake lock`
pub async fn lock(
    cmd: &NixCmd,
    opts: &FlakeOptions,
    args: &[&str],
    url: &FlakeUrl,
) -> Result<(), NixCmdError> {
    cmd.run_with(&["flake", "lock"], |c| {
        c.arg(url.to_string());
        opts.use_in_command(c);
        c.args(args);
    })
    .await?;
    Ok(())
}

/// Run `nix flake check`
pub async fn check(cmd: &NixCmd, opts: &FlakeOptions, url: &FlakeUrl) -> Result<(), NixCmdError> {
    cmd.run_with(&["flake", "check"], |c| {
        c.arg(url.to_string());
        opts.use_in_command(c);
    })
    .await?;
    Ok(())
}

/// A path built by nix, as returned by --print-out-paths
#[derive(Serialize, Deserialize)]
pub struct OutPath {
    /// The derivation that built these outputs
    #[serde(rename = "drvPath")]
    pub drv_path: PathBuf,
    /// Build outputs
    pub outputs: HashMap<String, PathBuf>,
}

impl OutPath {
    /// Return the first build output, if any
    pub fn first_output(&self) -> Option<&PathBuf> {
        self.outputs.values().next()
    }
}

/// Nix CLI options when interacting with a flake
#[derive(Debug, Clone, Default)]
pub struct FlakeOptions {
    /// The --override-input option to pass to Nix
    pub override_inputs: BTreeMap<String, FlakeUrl>,

    /// Pass --no-write-lock-file
    pub no_write_lock_file: bool,

    /// The directory from which to run our nix command (such that relative flake URLs resolve properly)
    pub current_dir: Option<PathBuf>,
}

impl FlakeOptions {
    /// Apply these options to a (Nix) [Command]
    pub fn use_in_command(&self, cmd: &mut Command) {
        if let Some(curent_dir) = &self.current_dir {
            cmd.current_dir(curent_dir);
        }
        for (name, url) in self.override_inputs.iter() {
            cmd.arg("--override-input").arg(name).arg(url.to_string());
        }
        if self.no_write_lock_file {
            cmd.arg("--no-write-lock-file");
        }
    }
}


================================================
FILE: crates/nix_rs/src/flake/eval.rs
================================================
//! Work with `nix eval`
use std::process::Stdio;

use crate::command::{CommandError, NixCmd, NixCmdError};

use super::{command::FlakeOptions, url::FlakeUrl};

/// Run `nix eval <url> --json` and parse its JSON
pub async fn nix_eval<T>(
    nixcmd: &NixCmd,
    opts: &FlakeOptions,
    url: &FlakeUrl,
) -> Result<T, NixCmdError>
where
    T: serde::de::DeserializeOwned,
{
    nix_eval_(nixcmd, opts, url, false).await
}

/// Like [nix_eval] but return `None` if the attribute is missing
pub async fn nix_eval_maybe<T>(
    cmd: &NixCmd,
    opts: &FlakeOptions,
    url: &FlakeUrl,
) -> Result<Option<T>, NixCmdError>
where
    T: Default + serde::de::DeserializeOwned,
{
    let result = nix_eval_(cmd, opts, url, true).await;
    match result {
        Ok(v) => Ok(Some(v)),
        Err(err) if error_is_missing_attribute(&err) => {
            Ok(None) // Attr is missing
        }
        Err(err) => Err(err),
    }
}

async fn nix_eval_<T>(
    nixcmd: &NixCmd,
    opts: &FlakeOptions,
    url: &FlakeUrl,
    capture_stderr: bool,
) -> Result<T, NixCmdError>
where
    T: serde::de::DeserializeOwned,
{
    let stdout = nixcmd
        .run_with(&["eval"], |cmd| {
            cmd.stdout(Stdio::piped());
            if capture_stderr {
                cmd.stderr(Stdio::piped());
            }
            cmd.args(["--json"]);
            opts.use_in_command(cmd);
            cmd.arg(url.to_string());
            // Avoid Nix from dumping logs related to `--override-input` use. Yes, this requires *double* use of `--quiet`.
            cmd.args(["--quiet", "--quiet"]);
        })
        .await?;
    let v = serde_json::from_slice::<T>(&stdout)?;
    Ok(v)
}

/// Check that [NixCmdError] is a missing attribute error
fn error_is_missing_attribute(err: &NixCmdError) -> bool {
    if let NixCmdError::CmdError(CommandError::ProcessFailed { stderr, .. }) = err {
        if stderr.contains("does not provide attribute") {
            return true;
        }
    }
    false
}


================================================
FILE: crates/nix_rs/src/flake/functions/README.md
================================================
## Rust + Nix FFI

https://github.com/srid/devour-flake introduced the idea of defining "functions" in Nix flake, that can be called from any external process. The flake's package derivation acts as the function "body", with its `inputs` acting as function "arguments"; the built output of that derivation is the function's "output".

This Rust package, `nix_rs::flake::functions`, provides the Rust FFI adapter to work with such Nix functions in Rust, using simpler API. You define your input & output structs in Rust, implement the `FlakeFn` trait and voilà !

In effect, this generalizes `devour-flake` to be able to define such functions. See `devour_flake.rs` in this repo for an example.

## Inspiration

- [devour-flake](https://github.com/srid/devour-flake): Original use of this pattern.
- [inspect](https://github.com/DeterminateSystems/inspect) works similar to `devour-flake`, but is tied to flake schemas, and the function body is hardcoded (just as `devour-flake`).


================================================
FILE: crates/nix_rs/src/flake/functions/addstringcontext/flake.nix
================================================
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    flake-parts.url = "github:hercules-ci/flake-parts";
    jsonfile = { flake = false; };
  };
  outputs = inputs:
    inputs.flake-parts.lib.mkFlake { inherit inputs; } {
      systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
      perSystem = { pkgs, lib, ... }:
        let
          json = builtins.fromJSON (builtins.readFile inputs.jsonfile);
          jsonWithPathContext = lib.flip lib.mapAttrsRecursive json (k: v:
            if lib.lists.last k == "outPaths" || lib.lists.last k == "allDeps" then
              builtins.map (path: builtins.storePath path) v
            else
              v
          );
        in
        {
          packages.default = pkgs.writeText "addstringcontext.json" (builtins.toJSON jsonWithPathContext);
        };
    };
}


================================================
FILE: crates/nix_rs/src/flake/functions/addstringcontext/mod.rs
================================================
//! Transform a JSON file with Nix store paths such that the resultant JSON file path will track those paths as dependencies. This requires use of `--impure`.
///
/// Only values of keys called `outPaths` in the JSON will be transformed.
///
/// https://nix.dev/manual/nix/2.23/language/string-context
use super::core::FlakeFn;
use crate::{command::NixCmd, flake::url::FlakeUrl};
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::{path::Path, path::PathBuf};

struct AddStringContextFn;

lazy_static! {
    /// URL to our flake function
    static ref FLAKE_ADDSTRINGCONTEXT: FlakeUrl = {
        let path = env!("FLAKE_ADDSTRINGCONTEXT");
        Into::<FlakeUrl>::into(Path::new(path)).with_attr("default")
    };
}

impl FlakeFn for AddStringContextFn {
    type Input = AddStringContextInput;
    type Output = Value; // We don't care to parse the output

    fn flake() -> &'static FlakeUrl {
        &FLAKE_ADDSTRINGCONTEXT
    }
}

/// Input to FlakeMetadata
#[derive(Serialize, Deserialize, Debug)]
struct AddStringContextInput {
    /// The JSON file to process
    jsonfile: FlakeUrl,
}

/// Add string context to `outPath`s in a JSON file.
///
/// Resultant JSON file will track those paths as dependencies. Additionally, an out-link will be created at `out_link` if provided.
pub async fn addstringcontext(
    cmd: &NixCmd,
    jsonfile: &Path,
    out_link: Option<&Path>,
) -> Result<PathBuf, super::core::Error> {
    const IMPURE: bool = true; // Our flake.nix uses builtin.storePath

    // We have to use relative paths to avoid a Nix issue on macOS witih /tmp paths.
    let jsonfile_parent = jsonfile.parent().unwrap();
    let jsonfile_name = jsonfile.file_name().unwrap().to_string_lossy();
    let pwd = Some(jsonfile_parent);

    let current_pwd = std::env::current_dir()?;
    let out_link_absolute: Option<PathBuf> = out_link.map(|p| current_pwd.join(p));

    let input = AddStringContextInput {
        jsonfile: FlakeUrl(format!("path:{}", jsonfile_name)),
    };
    let (path_with_string_context, _json_value) = AddStringContextFn::call(
        cmd,
        IMPURE,
        pwd,
        out_link_absolute.as_ref().map(PathBuf::as_ref),
        vec![],
        input,
    )
    .await?;
    Ok(path_with_string_context)
}


================================================
FILE: crates/nix_rs/src/flake/functions/core.rs
================================================
//! Flake function trait
use crate::{command::NixCmd, flake::url::FlakeUrl};
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::{
    env,
    ffi::OsString,
    os::unix::ffi::OsStringExt,
    path::{Path, PathBuf},
    process::Stdio,
};

lazy_static! {
    static ref TRUE_FLAKE: FlakeUrl = {
        let path = env!("TRUE_FLAKE");
        Into::<FlakeUrl>::into(Path::new(path))
    };
    static ref FALSE_FLAKE: FlakeUrl = {
        let path = env!("FALSE_FLAKE");
        Into::<FlakeUrl>::into(Path::new(path))
    };
}

/// Trait for flake functions
pub trait FlakeFn {
    /// Input type, corresponding to flake inputs
    ///
    /// A field named `flake` will be treated special (extra args' --override-inputs operates on this flake)
    type Input;
    /// Output generated by building the flake fn
    type Output;

    /// Get the flake URL referencing this function
    fn flake() -> &'static FlakeUrl;

    /// Initialize the type after reading from Nix build
    fn init(_out: &mut Self::Output) {}

    /// Call the flake function, taking `Self::Input`, returning `Self::Output` along with the built store path output as `PathBuf`.
    ///
    /// The store path output can be useful for further processing, if you need it with its entire closure (for e.g., to `nix copy` everything in `Self::Output` at once).
    ///
    /// Arguments:
    /// - `nixcmd`: The Nix command to use
    /// - `verbose`: Whether to avoid the --override-input noise suppression.
    /// - `extra_args`: Extra arguments to pass to `nix build`. --override-input is treated specially, to account for the flake input named `flake` (as defined in `Self::Input`)
    /// - `input`: The input arguments to the flake function.
    fn call(
        nixcmd: &NixCmd,
        // FIXME: Don't do this; instead take dyn trait options
        impure: bool,
        pwd: Option<&Path>,
        m_out_link: Option<&Path>,
        extra_args: Vec<String>,
        input: Self::Input,
    ) -> impl std::future::Future<Output = Result<(PathBuf, Self::Output), Error>> + Send
    where
        Self::Input: Serialize + Send + Sync,
        Self::Output: Sync + for<'de> Deserialize<'de>,
    {
        async move {
            let mut cmd = nixcmd.command(&["build"]);
            cmd.args([Self::flake(), "-L", "--print-out-paths"]);

            if impure {
                cmd.arg("--impure");
            }

            if let Some(out_link) = m_out_link {
                cmd.arg("--out-link");
                cmd.arg(out_link);
            } else {
                cmd.arg("--no-link");
            }

            let input_vec = to_vec(&input);
            for (k, v) in input_vec {
                cmd.arg("--override-input");
                cmd.arg(k);
                cmd.arg(v);
            }

            cmd.args(transform_override_inputs(&extra_args));

            if let Some(pwd) = pwd {
                cmd.current_dir(pwd);
            }

            crate::command::trace_cmd(&cmd);

            let output_fut = cmd.stdout(Stdio::piped()).spawn()?;
            let output = output_fut.wait_with_output().await?;
            if output.status.success() {
                let store_path =
                    PathBuf::from(OsString::from_vec(output.stdout.trim_ascii_end().into()));
                let mut v: Self::Output =
                    serde_json::from_reader(std::fs::File::open(&store_path)?)?;
                Self::init(&mut v);
                Ok((store_path, v))
            } else {
                Err(Error::NixBuildFailed(output.status.code()))
            }
        }
    }
}

/// Transform `--override-input` arguments to use `flake/` prefix, which
/// devour_flake expects.
///
/// NOTE: This assumes that Input struct contains a field named exactly "flake" referring to the flake. We should probably be smart about this.
fn transform_override_inputs(args: &[String]) -> Vec<String> {
    let mut new_args = Vec::with_capacity(args.len());
    let mut iter = args.iter().peekable();

    while let Some(arg) = iter.next() {
        new_args.push(arg.clone());
        if arg == "--override-input" {
            if let Some(next_arg) = iter.next() {
                new_args.push(format!("flake/{}", next_arg));
            }
        }
    }

    new_args
}

/// Convert a struct of uniform value types (Option allowed, however) into a vector of fields. The value should be of String kind.
fn to_vec<T>(value: &T) -> Vec<(String, String)>
where
    T: Serialize,
{
    let map = serde_json::to_value(value)
        .unwrap()
        .as_object()
        .unwrap_or_else(|| panic!("Bad struct for FlakeFn"))
        .clone();

    map.into_iter()
        .filter_map(|(k, v)| match v {
            Value::String(s) => Some((k, s.to_string())),
            Value::Bool(b) => Some((
                k,
                if b {
                    TRUE_FLAKE.to_string()
                } else {
                    FALSE_FLAKE.to_string()
                }
                .to_string(),
            )),
            _ => None,
        })
        .collect()
}

/// Errors associated with `FlakeFn::call`
#[derive(thiserror::Error, Debug)]
pub enum Error {
    /// IO error
    #[error("IO error: {0}")]
    IOError(#[from] std::io::Error),

    /// Non-zero exit code
    #[error("`nix build` failed; exit code: {0:?}")]
    NixBuildFailed(Option<i32>),

    /// JSON error
    #[error("JSON error: {0}")]
    JSONError(#[from] serde_json::Error),
}


================================================
FILE: crates/nix_rs/src/flake/functions/metadata/flake.nix
================================================
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    flake-parts.url = "github:hercules-ci/flake-parts";
    flake = { };
    include-inputs = { };
  };
  outputs = inputs:
    inputs.flake-parts.lib.mkFlake { inherit inputs; } {
      systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
      perSystem = { pkgs, lib, ... }:
        let
          include-inputs = inputs.include-inputs.value;
          fn = if include-inputs then "nix_rs-metadata-full.json" else "nix_rs-metadata-flakeonly.json";
        in
        {
          packages = {
            default = pkgs.writeText fn (builtins.toJSON {
              # *All* nested inputs are flattened into a single list of inputs.
              inputs = if !include-inputs then null else
              let
                inputsFor = visited: prefix: f:
                  let
                    here = builtins.unsafeDiscardStringContext "${f.outPath}";
                  in
                  # Keep track of visited nodes to workaround a nasty Nix design wart that leads to infinite recursion otherwise.
                    # https://github.com/NixOS/nix/issues/7807
                    # https://github.com/juspay/omnix/pull/389
                  lib.optionals (!lib.hasAttr here visited)
                    (lib.concatLists (lib.mapAttrsToList
                      (k: v: [{ name = "${prefix}__${k}"; path = v.outPath; }] ++
                        (lib.optionals (lib.hasAttr "inputs" v))
                          (inputsFor (visited // { "${here}" = true; }) "${prefix}/${k}" v))
                      f.inputs));
              in
              inputsFor { } "flake" inputs.flake;
              flake = inputs.flake.outPath;
            });
          };
        };
    };
}


================================================
FILE: crates/nix_rs/src/flake/functions/metadata/mod.rs
================================================
//! Retrieve metadata for a flake.
use super::core::FlakeFn;
use crate::{command::NixCmd, flake::url::FlakeUrl};
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use std::{path::Path, path::PathBuf};

/// Flake metadata computed in Nix.
pub struct FlakeMetadataFn;

lazy_static! {
    /// URL to our flake function
    static ref FLAKE_METADATA: FlakeUrl = {
        let path = env!("FLAKE_METADATA");
        Into::<FlakeUrl>::into(Path::new(path)).with_attr("default")
    };
}

impl FlakeFn for FlakeMetadataFn {
    type Input = FlakeMetadataInput;
    type Output = FlakeMetadata;

    fn flake() -> &'static FlakeUrl {
        &FLAKE_METADATA
    }
}

/// Input to FlakeMetadata
#[derive(Serialize, Deserialize, Debug)]
pub struct FlakeMetadataInput {
    /// The flake to operate on
    pub flake: FlakeUrl,

    /// Included flake inputs transitively in the result
    ///
    /// NOTE: This makes evaluation more expensive.
    #[serde(rename = "include-inputs")]
    pub include_inputs: bool,
}

/// Flake metadata
///
/// See [Nix doc](https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-flake-metadata)
#[derive(Serialize, Deserialize, Debug)]
pub struct FlakeMetadata {
    /// Store path to this flake
    pub flake: PathBuf,

    /// Store path to each flake input
    ///
    /// Only available if `FlakeInput::include_inputs` is enabled.
    pub inputs: Option<Vec<FlakeInput>>,
}

/// A flake input
#[derive(Serialize, Deserialize, Debug)]
pub struct FlakeInput {
    /// Unique identifier
    pub name: String,
    /// Local path to the input
    pub path: PathBuf,
}

impl FlakeMetadata {
    /// Get the [FlakeMetadata] for the given flake
    pub async fn from_nix(
        cmd: &NixCmd,
        input: FlakeMetadataInput,
    ) -> Result<(PathBuf, FlakeMetadata), super::core::Error> {
        FlakeMetadataFn::call(cmd, false, None, None, vec![], input).await
    }
}


================================================
FILE: crates/nix_rs/src/flake/functions/mod.rs
================================================
//! Calling Nix functions (defined in a flake) from Rust, as if to provide FFI.
//
// This model provides a simpler alternative to Flake Schemas, but it can also do more than Flake Schemas can (such as building derivations).

pub mod addstringcontext;
pub mod core;
pub mod metadata;


================================================
FILE: crates/nix_rs/src/flake/mod.rs
================================================
//! Rust module for Nix flakes

pub mod command;
pub mod eval;
pub mod functions;
pub mod outputs;
pub mod schema;
pub mod system;
pub mod url;

use schema::FlakeSchemas;
use serde::{Deserialize, Serialize};

use system::System;
use tracing::instrument;

use self::{outputs::FlakeOutputs, url::FlakeUrl};

use crate::{
    command::{NixCmd, NixCmdError},
    config::NixConfig,
};

/// All the information about a Nix flake
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Flake {
    /// The flake url which this struct represents
    pub url: FlakeUrl,
    /// Flake outputs derived from [FlakeSchemas]
    pub output: FlakeOutputs,
    // TODO: Add `nix flake metadata` info.
}

impl Flake {
    /// Get [Flake] info for the given flake url

    #[instrument(name = "flake", skip(nix_cmd))]
    pub async fn from_nix(
        nix_cmd: &NixCmd,
        nix_config: &NixConfig,
        url: FlakeUrl,
    ) -> Result<Flake, NixCmdError> {
        let schemas = FlakeSchemas::from_nix(nix_cmd, &url, &nix_config.system.value).await?;
        Ok(Flake {
            url,
            output: schemas.into(),
        })
    }
}


================================================
FILE: crates/nix_rs/src/flake/outputs.rs
================================================
//! Nix flake outputs

use serde::{Deserialize, Serialize};
use std::collections::HashMap;

use super::schema::{FlakeSchemas, Val};

/// Outputs of a flake
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FlakeOutputs {
    /// Terminal value that is not an attrset.
    Val(Val),
    /// An attrset of nested [FlakeOutputs]
    Attrset(HashMap<String, FlakeOutputs>),
}

impl FlakeOutputs {
    /// Get the terminal value
    pub fn get_val(&self) -> Option<&Val> {
        match self {
            Self::Val(v) => Some(v),
            _ => None,
        }
    }

    /// Get the attrset
    pub fn get_attrset(&self) -> Option<&HashMap<String, FlakeOutputs>> {
        match self {
            Self::Val(_) => None,
            Self::Attrset(map) => Some(map),
        }
    }

    /// Get the attrset as a vector of key-value pairs
    ///
    /// **NOTE**: Only terminal values are included!
    pub fn get_attrset_of_val(&self) -> Vec<(String, Val)> {
        self.get_attrset().map_or(vec![], |map| {
            map.iter()
                .filter_map(|(k, v)| v.get_val().map(|val| (k.clone(), val.clone())))
                .collect()
        })
    }

    /// Lookup the given path, returning a reference to the value if it exists.
    ///
    /// # Example
    /// ```no_run
    /// let tree : &nix_rs::flake::outputs::FlakeOutputs = todo!();
    /// let val = tree.get_by_path(&["aarch64-darwin", "default"]);
    /// ```
    pub fn get_by_path(&self, path: &[&str]) -> Option<&Self> {
        let mut current = self;
        for key in path {
            let map = current.get_attrset()?;
            current = map.get(*key)?;
        }
        Some(current)
    }
}

impl From<FlakeSchemas> for FlakeOutputs {
    fn from(schema: FlakeSchemas) -> Self {
        schema.to_flake_outputs()
    }
}


================================================
FILE: crates/nix_rs/src/flake/schema.rs
================================================
//! Nix flake-schemas

use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use std::{
    collections::{BTreeMap, HashMap},
    fmt::Display,
    path::Path,
};

use crate::system_list::SystemsListFlakeRef;

use super::{command::FlakeOptions, eval::nix_eval, outputs::FlakeOutputs, url::FlakeUrl};

lazy_static! {
  /// Flake URL of the default flake schemas
  ///
  /// We expect this environment to be set in Nix build and shell.
  pub static ref DEFAULT_FLAKE_SCHEMAS: FlakeUrl = {
    Into::<FlakeUrl>::into(Path::new(env!("DEFAULT_FLAKE_SCHEMAS")))
  };

  /// Flake URL of the flake that defines functions for inspecting flake outputs
  ///
  /// We expect this environment to be set in Nix build and shell.
  pub static ref INSPECT_FLAKE: FlakeUrl = {
    Into::<FlakeUrl>::into(Path::new(env!("INSPECT_FLAKE")))
  };
}

/// Represents the schema of a given flake evaluated using [static@INSPECT_FLAKE]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct FlakeSchemas {
    /// Each key in the map represents either a top-level flake output or other metadata (e.g. `docs`)
    pub inventory: HashMap<String, InventoryItem>,
}

/// A tree-like structure representing each flake output or metadata in [FlakeSchemas]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InventoryItem {
    /// Represents a terminal node in the tree
    Leaf(Leaf),
    /// Represents a non-terminal node in the tree
    Attrset(HashMap<String, InventoryItem>),
}

impl FlakeSchemas {
    /// Get the [FlakeSchemas] for the given flake
    ///
    /// This uses [static@INSPECT_FLAKE] and [static@DEFAULT_FLAKE_SCHEMAS]
    pub async fn from_nix(
        nix_cmd: &crate::command::NixCmd,
        flake_url: &super::url::FlakeUrl,
        system: &super::System,
    ) -> Result<Self, crate::command::NixCmdError> {
        let inspect_flake: FlakeUrl = INSPECT_FLAKE
            // Why `exculdingOutputPaths`?
            //   This function is much faster than `includingOutputPaths` and also solves <https://github.com/juspay/omnix/discussions/231>
            //   Also See: https://github.com/DeterminateSystems/inspect/blob/7f0275abbdc46b3487ca69e2acd932ce666a03ff/flake.nix#L139
            //
            //
            // Note: We might need to use `includingOutputPaths` in the future, when replacing `devour-flake`.
            // In which case, `om ci` and `om show` can invoke the appropriate function from `INSPECT_FLAKE`.
            //
            .with_attr("contents.excludingOutputPaths");
        let systems_flake = SystemsListFlakeRef::from_known_system(system)
            // TODO: don't use unwrap
            .unwrap()
            .0
            .clone();
        let flake_opts = FlakeOptions {
            no_write_lock_file: true,
            override_inputs: BTreeMap::from_iter([
                (
                    "flake-schemas".to_string(),
                    DEFAULT_FLAKE_SCHEMAS.to_owned(),
                ),
                ("flake".to_string(), flake_url.clone()),
                ("systems".to_string(), systems_flake),
            ]),
            ..Default::default()
        };
        let v = nix_eval::<Self>(nix_cmd, &flake_opts, &inspect_flake).await?;
        Ok(v)
    }

    /// Convert [FlakeSchemas] to [FlakeOutputs]
    pub(crate) fn to_flake_outputs(&self) -> FlakeOutputs {
        FlakeOutputs::Attrset(
            self.inventory
                .iter()
                .filter_map(|(k, v)| Some((k.clone(), v.to_flake_outputs()?)))
                .collect(),
        )
    }
}

impl InventoryItem {
    fn to_flake_outputs(&self) -> Option<FlakeOutputs> {
        match self {
            Self::Leaf(leaf) => leaf.get_val().cloned().map(FlakeOutputs::Val),
            Self::Attrset(map) => {
                if let Some(children) = map.get("children") {
                    children.to_flake_outputs()
                } else {
                    let filtered: HashMap<_, _> = map
                        .iter()
                        .filter_map(|(k, v)| Some((k.clone(), v.to_flake_outputs()?)))
                        .collect();
                    if filtered.is_empty() {
                        None
                    } else {
                        Some(FlakeOutputs::Attrset(filtered))
                    }
                }
            }
        }
    }
}

/// A terminal value of a flake schema
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum Leaf {
    #[allow(missing_docs)]
    Val(Val),
    /// Represents description for a flake output
    /// (e.g. `Doc` for `formatter` will be "The `formatter` output specifies the package to use to format the project.")
    Doc(String),
}

impl Leaf {
    /// Get the [Val] if any
    fn get_val(&self) -> Option<&Val> {
        match self {
            Self::Val(v) => Some(v),
            _ => None,
        }
    }
}

/// A terminal value of a flake output
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Val {
    #[serde(rename = "what")]
    /// Represents the type of the flake output
    pub type_: Type,
    /// If the flake output is a derivation, this will be the name of the derivation
    pub derivation_name: Option<String>,
    /// A short description derived from `meta.description` of the derivation with [Val::derivation_name]
    pub short_description: Option<String>,
}

impl Default for Val {
    fn default() -> Self {
        Self {
            type_: Type::Unknown,
            derivation_name: None,
            short_description: None,
        }
    }
}

/// The type of a flake output [Val]
///
/// These types can differ based on [static@DEFAULT_FLAKE_SCHEMAS].
/// The types here are based on <https://github.com/DeterminateSystems/flake-schemas>
/// For example, see [NixosModule type](https://github.com/DeterminateSystems/flake-schemas/blob/0a5c42297d870156d9c57d8f99e476b738dcd982/flake.nix#L268)
#[allow(missing_docs)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "NixOS module")]
    NixosModule,
    #[serde(rename = "NixOS configuration")]
    NixosConfiguration,
    #[serde(rename = "nix-darwin configuration")]
    DarwinConfiguration,
    #[serde(rename = "package")]
    Package,
    #[serde(rename = "development environment")]
    DevShell,
    #[serde(rename = "CI test")]
    Check,
    #[serde(rename = "app")]
    App,
    #[serde(rename = "template")]
    Template,
    #[serde(other)]
    Unknown,
}

impl Type {
    /// Get the icon for this type
    pub fn to_icon(&self) -> &'static str {
        match self {
            Self::NixosModule => "❄️",
            Self::NixosConfiguration => "🔧",
            Self::DarwinConfiguration => "🍎",
            Self::Package => "📦",
            Self::DevShell => "🐚",
            Self::Check => "🧪",
            Self::App => "📱",
            Self::Template => "🏗️",
            Self::Unknown => "❓",
        }
    }
}

impl Display for Type {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&format!("{:?}", self))
    }
}


================================================
FILE: crates/nix_rs/src/flake/system.rs
================================================
//! Nix system types
use std::{
    convert::Infallible,
    fmt::{Display, Formatter},
    str::FromStr,
};

use serde::{Deserialize, Serialize};
use serde_with::{DeserializeFromStr, SerializeDisplay};

/// The system for which a derivation will build
///
/// The enum includes the four standard systems, as well as a fallback to
/// capture the rest.
#[derive(
    Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, SerializeDisplay, DeserializeFromStr,
)]
pub enum System {
    /// macOS system
    Darwin(Arch),
    /// Linux system
    Linux(Arch),
    /// Other system
    Other(String),
}

/// CPU architecture in the system
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
pub enum Arch {
    /// aarch64
    Aarch64,
    /// x86_64
    X86_64,
}

impl FromStr for System {
    type Err = Infallible;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        Ok(Self::from(s))
    }
}

impl From<&str> for System {
    fn from(s: &str) -> Self {
        match s {
            "aarch64-linux" => Self::Linux(Arch::Aarch64),
            "x86_64-linux" => Self::Linux(Arch::X86_64),
            "x86_64-darwin" => Self::Darwin(Arch::X86_64),
            "aarch64-darwin" => Self::Darwin(Arch::Aarch64),
            _ => Self::Other(s.to_string()),
        }
    }
}

impl From<String> for System {
    fn from(s: String) -> Self {
        Self::from(s.as_str())
    }
}

impl AsRef<str> for System {
    fn as_ref(&self) -> &str {
        match self {
            System::Linux(Arch::Aarch64) => "aarch64-linux",
            System::Linux(Arch::X86_64) => "x86_64-linux",
            System::Darwin(Arch::X86_64) => "x86_64-darwin",
            System::Darwin(Arch::Aarch64) => "aarch64-darwin",
            System::Other(s) => s,
        }
    }
}

impl From<System> for String {
    fn from(s: System) -> Self {
        s.as_ref().to_string()
    }
}

impl Display for System {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.as_ref())
    }
}

impl System {
    /// Return the human readable title for the Nix system
    pub fn human_readable(&self) -> String {
        match self {
            System::Linux(arch) => format!("Linux ({})", arch.human_readable()),
            System::Darwin(arch) => format!("macOS ({})", arch.human_readable()),
            System::Other(s) => s.clone(),
        }
    }
}

impl Arch {
    /// Return the human readable title for the CPU architecture
    pub fn human_readable(&self) -> &'static str {
        match self {
            Self::Aarch64 => "ARM",
            Self::X86_64 => "Intel",
        }
    }
}


================================================
FILE: crates/nix_rs/src/flake/url/attr.rs
================================================
//! Work with flake attributes
use serde::{Deserialize, Serialize};

/// The (optional) attribute output part of a [super::FlakeUrl]
///
/// Example: `foo` in `.#foo`.
#[derive(Debug, Clone, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct FlakeAttr(pub Option<String>);

impl FlakeAttr {
    /// Create a new [FlakeAttr]
    pub fn new(attr: &str) -> Self {
        FlakeAttr(Some(attr.to_owned()))
    }

    /// A missing flake attribute
    pub fn none() -> Self {
        FlakeAttr(None)
    }

    /// Get the attribute name.
    ///
    /// If no such attribute exists, return "default".
    pub fn get_name(&self) -> String {
        self.0.clone().unwrap_or_else(|| "default".to_string())
    }

    /// Whether an explicit attribute is not set
    pub fn is_none(&self) -> bool {
        self.0.is_none()
    }

    /// Return nested attrs if the user specified one is separated by '.'
    pub fn as_list(&self) -> Vec<String> {
        self.0
            .clone()
            .map(|s| s.split('.').map(|s| s.to_string()).collect())
            .unwrap_or_default()
    }
}


================================================
FILE: crates/nix_rs/src/flake/url/core.rs
================================================
//! Flake URL types
//!
//! See <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#url-like-syntax>
use std::{
    fmt::{Display, Formatter},
    ops::Deref,
    path::{Path, PathBuf},
    str::FromStr,
};

use serde::{Deserialize, Serialize};

use crate::{
    command::NixCmd,
    flake::functions::metadata::{FlakeMetadata, FlakeMetadataInput},
};

use super::attr::FlakeAttr;

/// A flake URL
///
/// See [syntax here](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#url-like-syntax).
///
/// Use `FromStr` to parse a string into a `FlakeUrl`. Or `From` or `Into` if
/// you know the URL is valid.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct FlakeUrl(pub String);

impl AsRef<str> for FlakeUrl {
    fn as_ref(&self) -> &str {
        &self.0
    }
}

impl Deref for FlakeUrl {
    type Target = str;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl FlakeUrl {
    /// Return the local path if the flake URL is a local path
    ///
    /// Applicable only if the flake URL uses the [Path-like
    /// syntax](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#path-like-syntax)
    pub fn as_local_path(&self) -> Option<&Path> {
        let s = self.0.strip_prefix("path:").unwrap_or(&self.0);
        if s.starts_with('.') || s.starts_with('/') {
            // Strip query (`?..`) and attrs (`#..`)
            let s = s.split('?').next().unwrap_or(s);
            let s = s.split('#').next().unwrap_or(s);
            Some(Path::new(s))
        } else {
            None
        }
    }

    /// Return the flake as local path. If the flake is a remote reference, catch it to local Nix store first.
    pub async fn as_local_path_or_fetch(
        &self,
        cmd: &NixCmd,
    ) -> Result<PathBuf, crate::flake::functions::core::Error> {
        if let Some(path) = self.as_local_path() {
            Ok(path.to_path_buf())
        } else {
            let (_, meta) = FlakeMetadata::from_nix(
                cmd,
                FlakeMetadataInput {
                    flake: self.clone(),
                    include_inputs: false, // Don't care about inputs
                },
            )
            .await?;
            Ok(meta.flake)
        }
    }

    /// Split the [super::attr::FlakeAttr] out of the [FlakeUrl]
    pub fn split_attr(&self) -> (Self, FlakeAttr) {
        match self.0.split_once('#') {
            Some((url, attr)) => (FlakeUrl(url.to_string()), FlakeAttr(Some(attr.to_string()))),
            None => (self.clone(), FlakeAttr(None)),
        }
    }

    /// Return the [super::attr::FlakeAttr] of the [FlakeUrl]
    pub fn get_attr(&self) -> FlakeAttr {
        self.split_attr().1
    }

    /// Return the flake URL without the attribute
    pub fn without_attr(&self) -> Self {
        let (url, _) = self.split_attr();
        url
    }

    /// Return the flake URL with the given attribute
    pub fn with_attr(&self, attr: &str) -> Self {
        let (url, _) = self.split_attr();
        FlakeUrl(format!("{}#{}", url.0, attr))
    }

    /// Return the flake URL pointing to the sub-flake
    pub fn sub_flake_url(&self, dir: String) -> FlakeUrl {
        if dir == "." {
            self.clone()
        } else if let Some(path) = self.as_local_path() {
            // Local path; just join the dir
            let path_with_dir = path.join(dir);
            FlakeUrl::from(path_with_dir)
        } else {
            // Non-path URL; append `dir` query parameter
            let mut url = self.0.clone();
            if url.contains('?') {
                url.push_str("&dir=");
            } else {
                url.push_str("?dir=");
            }
            url.push_str(&dir);
            FlakeUrl(url)
        }
    }
}

impl From<PathBuf> for FlakeUrl {
    fn from(path: PathBuf) -> Self {
        FlakeUrl::from(path.as_ref())
    }
}

impl From<&Path> for FlakeUrl {
    fn from(path: &Path) -> Self {
        // We do not use `path:` here, because that will trigger copying to the Nix store.
        FlakeUrl(format!("{}", path.display()))
    }
}

impl FromStr for FlakeUrl {
    type Err = FlakeUrlError;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let s = s.trim();
        if s.is_empty() {
            Err(FlakeUrlError::Empty)
        } else {
            Ok(FlakeUrl(s.to_string()))
        }
    }
}

/// Error type for parsing a [FlakeUrl]
#[derive(thiserror::Error, Debug)]
pub enum FlakeUrlError {
    /// Empty string is not a valid Flake URL
    #[error("Empty string is not a valid Flake URL")]
    Empty,
}

impl Display for FlakeUrl {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_flake_url_and_attr() {
        let url = FlakeUrl("github:srid/nixci".to_string());
        assert_eq!(url.split_attr(), (url.clone(), FlakeAttr(None)));
        assert_eq!(url.split_attr().1.as_list(), [] as [&str; 0]);

        let url = FlakeUrl("github:srid/nixci#extra-tests".to_string());
        assert_eq!(
            url.split_attr(),
            (
                FlakeUrl("github:srid/nixci".to_string()),
                FlakeAttr(Some("extra-tests".to_string()))
            )
        );
        assert_eq!(
            url.split_attr().1.as_list(),
            vec!["extra-tests".to_string()]
        );

        let url = FlakeUrl(".#foo.bar.qux".to_string());
        assert_eq!(
            url.split_attr(),
            (
                FlakeUrl(".".to_string()),
                FlakeAttr(Some("foo.bar.qux".to_string()))
            )
        );
        assert_eq!(
            url.split_attr().1.as_list(),
            vec!["foo".to_string(), "bar".to_string(), "qux".to_string()]
        )
    }

    #[test]
    fn test_as_local_path() {
        let url = FlakeUrl("github:srid/nixci".to_string());
        assert_eq!(url.as_local_path(), None);

        let url = FlakeUrl(".".to_string());
        assert_eq!(url.as_local_path().map(|p| p.to_str().unwrap()), Some("."));

        let url = FlakeUrl("/foo".to_string());
        assert_eq!(url.as_local_path(), Some(std::path::Path::new("/foo")));

        let url = FlakeUrl("./foo?q=bar".to_string());
        assert_eq!(url.as_local_path(), Some(std::path::Path::new("./foo")));

        let url = FlakeUrl("./foo#attr".to_string());
        assert_eq!(url.as_local_path(), Some(std::path::Path::new("./foo")));

        let url = FlakeUrl("/foo?q=bar#attr".to_string());
        assert_eq!(url.as_local_path(), Some(std::path::Path::new("/foo")));

        let url = FlakeUrl("path:.".to_string());
        assert_eq!(url.as_local_path(), Some(std::path::Path::new(".")));

        let url = FlakeUrl("path:./foo".to_string());
        assert_eq!(url.as_local_path(), Some(std::path::Path::new("./foo")));

        let url = FlakeUrl("path:./foo?q=bar".to_string());
        assert_eq!(url.as_local_path(), Some(std::path::Path::new("./foo")));

        let url = FlakeUrl("path:./foo#attr".to_string());
        assert_eq!(url.as_local_path(), Some(std::path::Path::new("./foo")));

        let url = FlakeUrl("path:/foo?q=bar#attr".to_string());
        assert_eq!(url.as_local_path(), Some(std::path::Path::new("/foo")));

        /* FIXME!
        let url = FlakeUrl("/project?dir=bar".to_string());
        assert_eq!(
            url.as_local_path(),
            Some(std::path::Path::new("/project/bar"))
        );
        */
    }

    #[test]
    fn test_sub_flake_url() {
        // Path refs
        let url = FlakeUrl(".".to_string());
        assert_eq!(url.sub_flake_url(".".to_string()), url.clone());
        assert_eq!(
            url.sub_flake_url("sub".to_string()),
            FlakeUrl("./sub".to_string())
        );

        // URI refs
        let url = FlakeUrl("github:srid/nixci".to_string());
        assert_eq!(url.sub_flake_url(".".to_string()), url.clone());
        assert_eq!(
            url.sub_flake_url("dev".to_string()),
            FlakeUrl("github:srid/nixci?dir=dev".to_string())
        );
    }

    #[test]
    fn test_sub_flake_url_with_query() {
        let url = FlakeUrl("git+https://example.org/my/repo?ref=master".to_string());
        assert_eq!(url.sub_flake_url(".".to_string()), url.clone());
        assert_eq!(
            url.sub_flake_url("dev".to_string()),
            FlakeUrl("git+https://example.org/my/repo?ref=master&dir=dev".to_string())
        );
    }

    #[test]
    fn test_with_attr() {
        let url = FlakeUrl("github:srid/nixci".to_string());
        assert_eq!(
            url.with_attr("foo"),
            FlakeUrl("github:srid/nixci#foo".to_string())
        );

        let url: FlakeUrl = "github:srid/nixci#foo".parse().unwrap();
        assert_eq!(
            url.with_attr("bar"),
            FlakeUrl("github:srid/nixci#bar".to_string())
        );
    }
}


================================================
FILE: crates/nix_rs/src/flake/url/mod.rs
================================================
//! Work with flake URLs
pub mod attr;
mod core;

pub use core::*;


================================================
FILE: crates/nix_rs/src/info.rs
================================================
//! Information about the user's Nix installation
use serde::{Deserialize, Serialize};
use tokio::sync::OnceCell;

use crate::{config::NixConfig, env::NixEnv, version::NixVersion};

/// All the information about the user's Nix installation
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NixInfo {
    /// Nix version string
    pub nix_version: NixVersion,
    /// nix.conf configuration
    pub nix_config: NixConfig,
    /// Environment in which Nix was installed
    pub nix_env: NixEnv,
}

static NIX_INFO: OnceCell<Result<NixInfo, NixInfoError>> = OnceCell::const_new();

impl NixInfo {
    /// Get the once version  of `NixInfo`
    pub async fn get() -> &'static Result<NixInfo, NixInfoError> {
        NIX_INFO
            .get_or_init(|| async {
                let nix_version = NixVersion::get().await.as_ref()?;
                let nix_config = NixConfig::get().await.as_ref()?;
                let info = NixInfo::new(*nix_version, nix_config.clone()).await?;
                Ok(info)
            })
            .await
    }

    /// Determine [NixInfo] on the user's system
    pub async fn new(
        nix_version: NixVersion,
        nix_config: NixConfig,
    ) -> Result<NixInfo, NixInfoError> {
        let nix_env = NixEnv::detect().await?;
        Ok(NixInfo {
            nix_version,
            nix_config,
            nix_env,
        })
    }
}

/// Error type for [NixInfo]
#[derive(thiserror::Error, Debug)]
pub enum NixInfoError {
    /// A [crate::command::NixCmdError]
    #[error("Nix command error: {0}")]
    NixCmdError(#[from] crate::command::NixCmdError),

    /// A [crate::command::NixCmdError] with a static lifetime
    #[error("Nix command error: {0}")]
    NixCmdErrorStatic(#[from] &'static crate::command::NixCmdError),

    /// A [crate::env::NixEnvError]
    #[error("Nix environment error: {0}")]
    NixEnvError(#[from] crate::env::NixEnvError),

    /// A [crate::config::NixConfigError]
    #[error("Nix config error: {0}")]
    NixConfigError(#[from] &'static crate::config::NixConfigError),
}


================================================
FILE: crates/nix_rs/src/lib.rs
================================================
//! Rust crate to interact with Nix
//!
//! This crate exposes various types representing what nix command gives us,
//! along with a `from_nix` command to evaluate them.
#![warn(missing_docs)]
pub mod arg;
pub mod command;
pub mod config;
pub mod copy;
pub mod detsys_installer;
pub mod env;
pub mod flake;
pub mod info;
pub mod refs;
pub mod store;
pub mod system_list;
pub mod version;
pub mod version_spec;


================================================
FILE: crates/nix_rs/src/refs.rs
================================================
//! Links to Nix manual and other documentation

/// Link to information about the various Nix versions
pub const RELEASE_HISTORY: &str =
    "https://nixos.org/manual/nix/stable/release-notes/release-notes.html";


================================================
FILE: crates/nix_rs/src/store/command.rs
================================================
//! Rust wrapper for `nix-store`
use std::path::{Path, PathBuf};

use crate::command::{CommandError, NixCmdError};
use serde::{Deserialize, Serialize};
use tempfile::TempDir;
use thiserror::Error;
use tokio::process::Command;

use super::path::StorePath;

/// The `nix-store` command
/// See documentation for [nix-store](https://nixos.org/manual/nix/stable/command-ref/nix-store.html)
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
pub struct NixStoreCmd;

impl NixStoreCmd {
    /// Get the associated [Command]
    pub fn command(&self) -> Command {
        let mut cmd = Command::new("nix-store");
        cmd.kill_on_drop(true);
        cmd
    }
}

impl NixStoreCmd {
    /// Fetch all build and runtime dependencies of given derivation outputs.
    ///
    /// This is done by querying the deriver of each derivation output
    /// using [NixStoreCmd::nix_store_query_deriver] and then querying all
    /// dependencies of each deriver using
    /// [NixStoreCmd::nix_store_query_requisites_with_outputs].  Finally, all
    /// dependencies of each deriver are collected and returned as
    /// `Vec<StorePath>`.
    pub async fn fetch_all_deps(
        &self,
        out_paths: &[StorePath],
    ) -> Result<Vec<StorePath>, NixStoreCmdError> {
        let all_drvs = self.nix_store_query_deriver(out_paths).await?;
        let all_outs = self
            .nix_store_query_requisites_with_outputs(&all_drvs)
            .await?;
        Ok(all_outs)
    }

    /// Return the derivations used to build the given build output.
    pub async fn nix_store_query_deriver(
        &self,
        out_paths: &[StorePath],
    ) -> Result<Vec<PathBuf>, NixStoreCmdError> {
        let mut cmd = self.command();
        cmd.args(["--query", "--valid-derivers"])
            .args(out_paths.iter().map(StorePath::as_path));

        let stdout = run_awaiting_stdout(&mut cmd).await?;
        let drv_paths: Vec<PathBuf> = String::from_utf8(stdout)?
            .lines()
            .map(PathBuf::from)
            .collect();
        if drv_paths.contains(&PathBuf::from("unknown-deriver")) {
            return Err(NixStoreCmdError::UnknownDeriver);
        }
        Ok(drv_paths)
    }

    /// Given the derivation paths, this function recursively queries and return all
    /// of its dependencies in the Nix store.
    pub async fn nix_store_query_requisites_with_outputs(
        &self,
        drv_paths: &[PathBuf],
    ) -> Result<Vec<StorePath>, NixStoreCmdError> {
        let mut cmd = self.command();
        cmd.args(["--query", "--requisites", "--include-outputs"])
            .args(drv_paths);

        let stdout = run_awaiting_stdout(&mut cmd).await?;
        Ok(String::from_utf8(stdout)?
            .lines()
            .map(|line| StorePath::new(PathBuf::from(line)))
            .collect())
    }

    /// Create a file in the Nix store such that it escapes garbage collection.
    ///
    /// Return the nix store path added.
    pub async fn add_file_permanently(
        &self,
        symlink: &Path,
        contents: &str,
    ) -> Result<StorePath, NixStoreCmdError> {
        let temp_dir = TempDir::with_prefix("omnix-ci-")?;
        let temp_file = temp_dir.path().join("om.json");
        std::fs::write(&temp_file, contents)?;

        let path = self.nix_store_add(&temp_file).await?;
        self.nix_store_add_root(symlink, &[&path]).await?;
        Ok(path)
    }

    /// 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");

        // 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(
            String::from_utf8(stdout)?.trim_end(),
        )))
    }

    /// Run `nix-store --add-root` on the given paths and return the store path added.
    pub async fn nix_store_add_root(
        &self,
        symlink: &Path,
        paths: &[&StorePath],
    ) -> Result<(), NixStoreCmdError> {
        let mut cmd = self.command();
        cmd.arg("--add-root")
            .arg(symlink)
            .arg("--realise")
            .args(paths);

        run_awaiting_stdout(&mut cmd).await?;
        Ok(())
    }
}

async fn run_awaiting_stdout(cmd: &mut Command) -> Result<Vec<u8>, NixStoreCmdError> {
    crate::command::trace_cmd(cmd);
    let out = cmd.output().await?;
    if out.status.success() {
        Ok(out.stdout)
    } else {
        let stderr = String::from_utf8_lossy(&out.stderr).to_string();
        let exit_code = out.status.code();
        Err(CommandError::ProcessFailed { stderr, exit_code }.into())
    }
}

/// `nix-store` command errors
#[derive(Error, Debug)]
pub enum NixStoreCmdError {
    /// A [NixCmdError]
    #[error(transparent)]
    NixCmdError(#[from] NixCmdError),

    /// nix-store returned "unknown-deriver"
    #[error("Unknown deriver")]
    UnknownDeriver,
}

impl From<std::io::Error> for NixStoreCmdError {
    fn from(err: std::io::Error) -> Self {
        let cmd_error: CommandError = err.into();
        cmd_error.into()
    }
}

impl From<std::string::FromUtf8Error> for NixStoreCmdError {
    fn from(err: std::string::FromUtf8Error) -> Self {
        let cmd_error: CommandError = err.into();
        cmd_error.into()
    }
}

impl From<CommandError> for NixStoreCmdError {
    fn from(err: CommandError) -> Self {
        let nixcmd_error: NixCmdError = err.into();
        nixcmd_error.into()
    }
}


================================================
FILE: crates/nix_rs/src/store/mod.rs
================================================
//! Dealing with the Nix store
pub mod command;
pub mod path;
pub mod uri;


================================================
FILE: crates/nix_rs/src/store/path.rs
================================================
//! Store path management
use std::{
    convert::Infallible,
    fmt,
    path::{Path, PathBuf},
    str::FromStr,
};

use serde_with::{DeserializeFromStr, SerializeDisplay};

/// Represents a path in the Nix store, see: <https://zero-to-nix.com/concepts/nix-store#store-paths>
#[derive(
    Debug, Ord, PartialOrd, Eq, PartialEq, Clone, Hash, DeserializeFromStr, SerializeDisplay,
)]
pub enum StorePath {
    /// Derivation path (ends with `.drv`).
    Drv(PathBuf),
    /// Other paths in the Nix store, such as build outputs.
    /// This won't be a derivation path.
    Other(PathBuf),
}

impl FromStr for StorePath {
    type Err = Infallible;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        Ok(StorePath::new(PathBuf::from(s)))
    }
}

impl AsRef<Path> for StorePath {
    fn as_ref(&self) -> &Path {
        self.as_path().as_ref()
    }
}

impl AsRef<std::ffi::OsStr> for StorePath {
    fn as_ref(&self) -> &std::ffi::OsStr {
        self.as_path().as_os_str()
    }
}

impl StorePath {
    /// Create a new `StorePath` from the given path
    pub fn new(path: PathBuf) -> Self {
        if path.ends_with(".drv") {
            StorePath::Drv(path)
        } else {
            StorePath::Other(path)
        }
    }

    /// Drop store path type distinction, returning the inner path.
    pub fn as_path(&self) -> &PathBuf {
        match self {
            StorePath::Drv(p) => p,
            StorePath::Other(p) => p,
        }
    }
}

impl fmt::Display for StorePath {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_path().display())
    }
}


================================================
FILE: crates/nix_rs/src/store/uri.rs
================================================
//! Store URI management
use std::{fmt, str::FromStr};

use serde::{Deserialize, Serialize};
use thiserror::Error;
use url::Url;

/// Refers to a Nix store somewhere.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum StoreURI {
    /// Nix store accessible over SSH.
    SSH(SSHStoreURI, Opts),
}

/// User passed options for a store URI
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Opts {
    /// Whether to copy all flake inputs recursively
    ///
    /// If disabled, we copy only the flake source itself. Enabling this option is useful when there are private Git inputs but the target machine does not have access to them.
    #[serde(rename = "copy-inputs", default = "bool::default")]
    pub copy_inputs: bool,
}

/// Remote SSH store URI
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SSHStoreURI {
    /// SSH user
    pub user: Option<String>,
    /// SSH host
    pub host: String,
}

/// Error parsing a store URI
#[derive(Error, Debug)]
pub enum StoreURIParseError {
    /// Parse error
    #[error(transparent)]
    ParseError(#[from] url::ParseError),
    /// Unsupported scheme
    #[error("Unsupported scheme: {0}")]
    UnsupportedScheme(String),
    /// Missing host
    #[error("Missing host")]
    MissingHost,
    /// Query string parse error
    #[error(transparent)]
    QueryParseError(#[from] serde_qs::Error),
}

impl StoreURI {
    /// Parse a Nix store URI
    ///
    /// Currently only supports `ssh` scheme
    pub fn parse(uri: &str) -> Result<Self, StoreURIParseError> {
        let url = Url::parse(uri)?;
        match url.scheme() {
            "ssh" => {
                let host = url
                    .host_str()
                    .ok_or(StoreURIParseError::MissingHost)?
                    .to_string();
                let user = if !url.username().is_empty() {
                    Some(url.username().to_string())
                } else {
                    None
                };
                let opts = serde_qs::from_str(url.query().unwrap_or(""))?;
                let ssh_uri = SSHStoreURI { user, host };
                let store_uri = StoreURI::SSH(ssh_uri, opts);
                Ok(store_uri)
            }
            // Add future schemes here
            scheme => Err(StoreURIParseError::UnsupportedScheme(scheme.to_string())),
        }
    }

    /// Get the options for this store URI
    pub fn get_options(&self) -> &Opts {
        match self {
            StoreURI::SSH(_, opts) => opts,
        }
    }
}

impl FromStr for StoreURI {
    type Err = StoreURIParseError;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        StoreURI::parse(s)
    }
}

impl fmt::Display for SSHStoreURI {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        if let Some(user) = &self.user {
            write!(f, "{}@{}", user, self.host)
        } else {
            write!(f, "{}", self.host)
        }
    }
}
impl fmt::Display for StoreURI {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            StoreURI::SSH(uri, _opts) => {
                // This should construct a valid store URI.
                write!(f, "ssh://{}", uri)
            }
        }
    }
}


================================================
FILE: crates/nix_rs/src/system_list.rs
================================================
//! Dealing with system lists
use std::{collections::HashMap, convert::Infallible, str::FromStr};

use crate::{
    command::{NixCmd, NixCmdError},
    flake::{system::System, url::FlakeUrl},
};
use lazy_static::lazy_static;

lazy_static! {
    /// Builtin list of [SystemsListFlakeRef]
    pub static ref NIX_SYSTEMS: HashMap<String, FlakeUrl> = {
        serde_json::from_str(env!("NIX_SYSTEMS")).unwrap()
    };
}

/// A flake referencing a [SystemsList]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SystemsListFlakeRef(pub FlakeUrl);

impl SystemsListFlakeRef {
    /// Lookup a known [SystemsListFlakeRef] that will not require network calls
    pub fn from_known_system(system: &System) -> Option<Self> {
        NIX_SYSTEMS
            .get(&system.to_string())
            .map(|url| SystemsListFlakeRef(url.clone()))
    }
}

impl FromStr for SystemsListFlakeRef {
    type Err = Infallible;
    fn from_str(s: &str) -> Result<SystemsListFlakeRef, Infallible> {
        let system = System::from(s);
        match SystemsListFlakeRef::from_known_system(&system) {
            Some(url) => Ok(url),
            None => Ok(SystemsListFlakeRef(FlakeUrl(s.to_string()))),
        }
    }
}

/// A list of [System]s
pub struct SystemsList(pub Vec<System>);

impl SystemsList {
    /// Load the list of systems from a [SystemsListFlakeRef]
    pub async fn from_flake(cmd: &NixCmd, url: &SystemsListFlakeRef) -> Result<Self, NixCmdError> {
        // Nix eval, and then return the systems
        match SystemsList::from_known_flake(url) {
            Some(systems) => Ok(systems),
            None => SystemsList::from_remote_flake(cmd, url).await,
        }
    }

    async fn from_remote_flake(
        cmd: &NixCmd,
        url: &SystemsListFlakeRef,
    ) -> Result<Self, NixCmdError> {
        let systems = nix_import_flake::<Vec<System>>(cmd, &url.0).await?;
        Ok(SystemsList(systems))
    }

    /// Handle known repos of <https://github.com/nix-systems> thereby avoiding
    /// network calls.
    fn from_known_flake(url: &SystemsListFlakeRef) -> Option<Self> {
        let system = NIX_SYSTEMS
            .iter()
            .find_map(|(v, u)| if u == &url.0 { Some(v) } else { None })?;
        Some(SystemsList(vec![system.clone().into()]))
    }
}

/// Evaluate `import <flake-url>` and return the result JSON parsed.
async fn nix_import_flake<T>(cmd: &NixCmd, url: &FlakeUrl) -> Result<T, NixCmdError>
where
    T: Default + serde::de::DeserializeOwned,
{
    let flake_path =
        nix_eval_impure_expr::<String>(cmd, format!("builtins.getFlake \"{}\"", url.0)).await?;
    let v = nix_eval_impure_expr(cmd, format!("import {}", flake_path)).await?;
    Ok(v)
}

async fn nix_eval_impure_expr<T>(cmd: &NixCmd, expr: String) -> Result<T, NixCmdError>
where
    T: Default + serde::de::DeserializeOwned,
{
    let v = cmd
        .run_with_args_expecting_json::<T>(&["eval"], &["--impure", "--json", "--expr", &expr])
        .await?;
    Ok(v)
}


================================================
FILE: crates/nix_rs/src/version.rs
================================================
//! Rust module for `nix --version`
use regex::Regex;
use serde_with::{DeserializeFromStr, SerializeDisplay};
use std::{fmt, str::FromStr};
use thiserror::Error;
use tokio::sync::OnceCell;

use tracing::instrument;

use crate::command::{NixCmd, NixCmdError};

/// Nix version as parsed from `nix --version`
#[derive(Clone, Copy, PartialOrd, PartialEq, Eq, Debug, SerializeDisplay, DeserializeFromStr)]
pub struct NixVersion {
    /// Major version
    pub major: u32,
    /// Minor version
    pub minor: u32,
    /// Patch version
    pub patch: u32,
}

/// Error type for parsing `nix --version`
#[derive(Error, Debug, Clone, PartialEq)]
pub enum BadNixVersion {
    /// Regex error
    #[error("Regex error: {0}")]
    Regex(#[from] regex::Error),

    /// Parse error
    #[error("Parse error (regex): `nix --version` cannot be parsed")]
    Parse(#[from] std::num::ParseIntError),

    /// Command error
    #[error("Parse error (int): `nix --version` cannot be parsed")]
    Command,
}

impl FromStr for NixVersion {
    type Err = BadNixVersion;

    /// Parse the string output of `nix --version` into a [NixVersion]
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        // NOTE: The parser is lenient in allowing pure nix version (produced
        // by [Display] instance), so as to work with serde_with instances.
        let re = Regex::new(r"(?:nix \(Nix\) )?(\d+)\.(\d+)\.(\d+)(?:\+(\d+))?$")?;

        let captures = re.captures(s).ok_or(BadNixVersion::Command)?;
        let major = captures[1].parse::<u32>()?;
        let minor = captures[2].parse::<u32>()?;
        let patch = captures[3].parse::<u32>()?;

        Ok(NixVersion {
            major,
            minor,
            patch,
        })
    }
}

static NIX_VERSION: OnceCell<Result<NixVersion, NixCmdError>> = OnceCell::const_new();

impl NixVersion {
    /// Get the once version of `NixVersion`.
    #[instrument(name = "show-config(once)")]
    pub async fn get() -> &'static Result<NixVersion, NixCmdError> {
        NIX_VERSION
            .get_or_init(|| async {
                let cmd = NixCmd::default();
                let nix_ver = NixVersion::from_nix(&cmd).await?;
                Ok(nix_ver)
            })
            .await
    }
    /// Get the output of `nix --version`
    #[instrument(name = "version")]
    pub async fn from_nix(cmd: &NixCmd) -> Result<NixVersion, super::command::NixCmdError> {
        let v = cmd
            .run_with_args_expecting_fromstr(&[], &["--version"])
            .await?;
        Ok(v)
    }
}
/// The String view for [NixVersion]
impl fmt::Display for NixVersion {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}.{}.{}", self.major, self.minor, self.patch)
    }
}

#[tokio::test]
async fn test_run_nix_version() {
    let nix_version = NixVersion::from_nix(&NixCmd::default()).await.unwrap();
    println!("Nix version: {}", nix_version);
}

#[tokio::test]
async fn test_parse_nix_version() {
    assert_eq!(
        NixVersion::from_str("nix (Nix) 2.13.0"),
        Ok(NixVersion {
            major: 2,
            minor: 13,
            patch: 0
        })
    );

    // Parse simple nix version
    assert_eq!(
        NixVersion::from_str("2.13.0"),
        Ok(NixVersion {
            major: 2,
            minor: 13,
            patch: 0
        })
    );

    // Parse Determinate Nix Version
    assert_eq!(
        NixVersion::from_str("nix (Determinate Nix 3.6.6) 2.29.0"),
        Ok(NixVersion {
            major: 2,
            minor: 29,
            patch: 0
        })
    );
}


================================================
FILE: crates/nix_rs/src/version_spec.rs
================================================
//! Version requirement spec for [NixVersion]

use std::{fmt, str::FromStr};

use regex::Regex;
use serde::{Deserialize, Serialize};
use serde_with::{DeserializeFromStr, SerializeDisplay};
use thiserror::Error;

use crate::version::NixVersion;

/// An individual component of [NixVersionReq]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum NixVersionSpec {
    /// Version must be greater than the specified version
    Gt(NixVersion),
    /// Version must be greater than or equal to the specified version
    Gteq(NixVersion),
    /// Version must be less than the specified version
    Lt(NixVersion),
    /// Version must be less than or equal to the specified version
    Lteq(NixVersion),
    /// Version must not equal the specified version
    Neq(NixVersion),
}

/// Version requirement for [NixVersion]
///
/// Example:
/// ">=2.8, <2.14, 12.13.4"
#[derive(Debug, Clone, PartialEq, SerializeDisplay, DeserializeFromStr)]
pub struct NixVersionReq {
    /// List of version specifications
    pub specs: Vec<NixVersionSpec>,
}

/// Errors that can occur while parsing or validating version specifications
#[derive(Error, Debug)]
pub enum BadNixVersionSpec {
    /// Regex error
    #[error("Regex error: {0}")]
    Regex(#[from] regex::Error),

    /// Invalid [NixVersionSpec]
    #[error("Parse error(regex): Invalid version spec format")]
    InvalidFormat,

    /// Parse error (Int)
    #[error("Parse error(int): Invalid version spec format")]
    Parse(#[from] std::num::ParseIntError),

    /// An unknown comparison operator was used
    #[error("Unknown operator in the Nix version spec: {0}")]
    UnknownOperator(String),
}

impl FromStr for NixVersionReq {
    type Err = BadNixVersionSpec;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let specs = s
            .split(',')
            .map(str::trim)
            .map(NixVersionSpec::from_str)
            .collect::<Result<Vec<_>, _>>()?;

        Ok(NixVersionReq { specs })
    }
}

impl NixVersionSpec {
    /// Checks if a given Nix version satisfies this version specification
    pub fn matches(&self, version: &NixVersion) -> bool {
        match self {
            NixVersionSpec::Gt(v) => version > v,
            NixVersionSpec::Gteq(v) => version >= v,
            NixVersionSpec::Lt(v) => version < v,
            NixVersionSpec::Lteq(v) => version <= v,
            NixVersionSpec::Neq(v) => version != v,
        }
    }
}

impl FromStr for NixVersionSpec {
    type Err = BadNixVersionSpec;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        use NixVersionSpec::{Gt, Gteq, Lt, Lteq, Neq};
        let re = Regex::new(
            r#"(?x)
            ^
            (?P<op>>=|<=|>|<|!=)
            (?P<major>\d+)
            (?:\.
                (?P<minor>\d+)
            )?
            (?:\.
                (?P<patch>\d+)
            )?
            $
            "#,
        )?;

        let captures = re.captures(s).ok_or(BadNixVersionSpec::InvalidFormat)?;

        let op = captures
            .name("op")
            .ok_or(BadNixVersionSpec::InvalidFormat)?
            .as_str();
        let major: u32 = captures
            .name("major")
            .ok_or(BadNixVersionSpec::InvalidFormat)?
            .as_str()
            .parse()?;
        let minor = captures
            .name("minor")
            .map_or(Ok(0), |m| m.as_str().parse::<u32>())?;
        let patch = captures
            .name("patch")
            .map_or(Ok(0), |m| m.as_str().parse::<u32>())?;

        let nix_version = NixVersion {
            major,
            minor,
            patch,
        };

        match op {
            ">=" => Ok(Gteq(nix_version)),
            "<=" => Ok(Lteq(nix_version)),
            ">" => Ok(Gt(nix_version)),
            "<" => Ok(Lt(nix_version)),
            "!=" => Ok(Neq(nix_version)),
            unknown_op => Err(BadNixVersionSpec::UnknownOperator(unknown_op.to_string())),
        }
    }
}

impl fmt::Display for NixVersionSpec {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            NixVersionSpec::Gt(v) => write!(f, ">{}", v),
            NixVersionSpec::Gteq(v) => write!(f, ">={}", v),
            NixVersionSpec::Lt(v) => write!(f, "<{}", v),
            NixVersionSpec::Lteq(v) => write!(f, "<={}", v),
            NixVersionSpec::Neq(v) => write!(f, "!={}", v),
        }
    }
}

impl fmt::Display for NixVersionReq {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(
            f,
            "{}",
            self.specs
                .iter()
                .map(|s| s.to_string())
                .collect::<Vec<_>>()
                .join(", ")
        )
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_parse() {
        assert_eq!(
            NixVersionSpec::from_str(">2.8").unwrap(),
            NixVersionSpec::Gt(NixVersion {
                major: 2,
                minor: 8,
                patch: 0
            })
        );
        assert_eq!(
            NixVersionSpec::from_str(">2").unwrap(),
            NixVersionSpec::Gt(NixVersion {
                major: 2,
                minor: 0,
                patch: 0
            })
        );
    }

    #[test]
    fn test_matches() {
        let req = NixVersionReq::from_str("!=2.9, >2.8").unwrap();

        let version = NixVersion::from_str("2.9.0").unwrap();
        assert!(!req.specs.iter().all(|spec| spec.matches(&version)));
        let version = NixVersion::from_str("2.9.1").unwrap();
        assert!(req.specs.iter().all(|spec| spec.matches(&version)));
    }
}


================================================
FILE: crates/omnix-ci/CHANGELOG.md
================================================
## Unreleased

- Crate renamed to `omnix-ci`
- New
  - Introduced notion of 'steps'. Renamed 'build' to 'run'.
    - Added a step to run `nix flake check`
    - Support for custom steps
- `config.rs`: Refactored to change API.
- Locally cache `github:nix-systems` (to avoid Github API rate limit)
- The default subflake now uses `ROOT` instead `<root>` as the key.

## 1.1.0

- Remove executable
  - `nixci` executable will no longer be updated past 1.0.0; use `omnix` (`om ci`) instead.
- Port to newer `nix_rs`
- Use `om.ci` as configuration key
- tests: Removed, and moved to omnix-cli crate.
- Fix:
  - Passing `.#foo` where "foo" is missing now errors out, instead of silently defaulting.

## [1.0.0](https://github.com/srid/nixci/compare/0.5.0...1.0.0) (2024-07-23)

### Features

* add shell completions (#87)
([1b2caf3](https://github.com/srid/nixci/commit/1b2caf369c739382e2f1c22bfb32096f65addfba)),
closes [#87](https://github.com/srid/nixci/issues/87)
* **build:** Check for minimum nix version before running nixci (#75)
([ac5a011](https://github.com/srid/nixci/commit/ac5a011c76e9537426e0265b20e46f8efea44d40)),
closes [#75](https://github.com/srid/nixci/issues/75)
* **cli:** Allow `--override-input` to refer to flake name without `flake/`
prefix of devour_flake (#74)
([c17f42f](https://github.com/srid/nixci/commit/c17f42f3480b4b265bac0d94e7169ca01201fb9d)),
closes [#74](https://github.com/srid/nixci/issues/74)

### Fixes

* `--print-all-dependencies` should ignore `unknown-deriver` (#76)
([d26bab1](https://github.com/srid/nixci/commit/d26bab116f19ac248a7073de9de3ae8a3ac0271f)),
closes [#76](https://github.com/srid/nixci/issues/76)
* `--print-all-dependencies` should handle `unknown-deriver` (#70)
([16815b6](https://github.com/srid/nixci/commit/16815b6c9e476defd993368d0957335f86f9c055)),
closes [#70](https://github.com/srid/nixci/issues/70)

## [0.5.0](https://github.com/srid/nixci/compare/0.4.0...0.5.0) (2024-06-15)

### Features

* Avoid fetching for known `--system` combinations
([6164d6c](https://github.com/srid/nixci/commit/6164d6c6d37ccab02ddc4943962fd7c21828054c))
* **api:** Pass `NixCmd` explicitly around
([6a672e2](https://github.com/srid/nixci/commit/6a672e28811f716a8cff5108dc720269d897d246))
* Accept global options to pass to Nix
([cca8b98](https://github.com/srid/nixci/commit/cca8b988e24d5d4e7d76e6d2398a0f2e0b686abf))
* **cli:** add `--print-all-depedencies` to `nixci build` subcommand (#60)
([4109ce9](https://github.com/srid/nixci/commit/4109ce9982ad2f54e769c302ab044f16f8bd865c)),
closes [#60](https://github.com/srid/nixci/issues/60)

## 0.4.0 (Apr 19, 2024)

- New features
    - Add new config `nixci.*.*.systems` acting as a whitelist of systems to build that subflake.
    - Add `nixci build --systems` option to build on an arbitrary systems (\#39)
    - Allow selecting sub-flake to build, e.g.: `nixci .#default.myflake`  (\#45)
    - Add subcommand to generate Github Actions matrix (\#50)
        - Consequently, you must run `nixci build` instead of `nixci` now.
    - Pass `--extra-experimental-features` only when necessary. Simplifies logging. (#46)
- Fixes
    - Fix regression in Nix 2.19+ (`devour-flake produced an outpath with no outputs`) (\#35)
    - Evaluate OS configurations for current system only (\#38)
    - Fail correctly if nixci is passed a missing flake attribute (\#44)

## 0.2.0 (Sep 14, 2023)

- Breaking changes
    - Change flake schema: evaluates `nixci.default` instead of `nixci`; this allows more than one configuration (#20)
- Pass the rest of CLI arguments after `--` as-is to `nix build`
    - Consequently, remove `--rebuild`, `--no-refresh` and `--system` options, because these can be specified using the new CLI spec.
- Bug fixes
    - Fix nixci breaking if branch name of a PR has `#` (#17)
- Misc changes
    - Iterate configs in a deterministic order
    - stdout outputs are uniquely printed, in sorted order
    - stderr output is now logged using the `tracing` crate.
    - Pass `--extra-experimental-features` to enable flakes
    - `nixci` can now be used as a Rust library
    - `nixci` no longer depends on `devour-flake` the *executable package*, only on the flake.

## 0.1.3

- Pass `-j auto` to nix builds.

## 0.1.2

Initial release


================================================
FILE: crates/omnix-ci/Cargo.toml
================================================
[package]
authors = ["Sridhar Ratnakumar <srid@srid.ca>"]
edition = "2021"
# If you change the name here, you must also do it in flake.nix (and run `cargo generate-lockfile` afterwards)
name = "omnix-ci"
version = "1.3.2"
license = "AGPL-3.0-only"
readme = "README.md"
description = "Define and build CI for Nix projects anywhere"
homepage = "https://omnix.page"
repository = "https://github.com/juspay/omnix"
keywords = ["nix"]

[lib]
crate-type = ["cdylib", "rlib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = { workspace = true }
clap = { workspace = true }
colored = { workspace = true }
futures-lite = { workspace = true }
lazy_static = { workspace = true }
omnix-health = { workspace = true }
nix_rs = { workspace = true, features = ["clap"] }
nonempty = { workspace = true }
omnix-common = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
shell-words = { workspace = true }
tempfile = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
try-guard = { workspace = true }
url = { workspace = true }
urlencoding = { workspace = true }


================================================
FILE: crates/omnix-ci/LICENSE
================================================
                    GNU AFFERO GENERAL PUBLIC LICENSE
                       Version 3, 19 November 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.

  A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate.  Many developers of free software are heartened and
encouraged by the resulting cooperation.  However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.

  The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community.  It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server.  Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.

  An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals.  This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU Affero General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Remote Network Interaction; Use with the GNU General Public License.

  Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software.  This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time.  Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source.  For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code.  There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.


================================================
FILE: crates/omnix-ci/README.md
================================================
# `omnix-ci`

[![Crates.io](https://img.shields.io/crates/v/omnix-ci.svg)](https://crates.io/crates/omnix-ci)

The Rust crate responsible for [`om ci`](https://omnix.page/om/ci.html).


================================================
FILE: crates/omnix-ci/crate.nix
================================================
{ pkgs
, lib
, ...
}:
{
  autoWire = [ ];
  crane = {
    args = {
      nativeBuildInputs = with pkgs; lib.optionals stdenv.isDarwin [
        libiconv
        pkg-config
      ];
      buildInputs = lib.optionals pkgs.stdenv.isLinux [
        pkgs.openssl
      ];
      # Disable tests due to sandboxing issues; we run them on CI
      # instead.
      doCheck = false;
    };
  };
}


================================================
FILE: crates/omnix-ci/src/command/core.rs
================================================
//! The `om ci` subcommands
use clap::Subcommand;
use colored::Colorize;
use nix_rs::command::NixCmd;
use omnix_common::config::OmConfig;
use tracing::instrument;

use crate::flake_ref::FlakeRef;

use super::{gh_matrix::GHMatrixCommand, run::RunCommand};

/// Top-level commands for `om ci`
#[derive(Debug, Subcommand, Clone)]
pub enum Command {
    /// Run all CI steps for all or given subflakes
    Run(RunCommand),

    /// Print the Github Actions matrix configuration as JSON
    #[clap(name = "gh-matrix")]
    DumpGithubActionsMatrix(GHMatrixCommand),
}

impl Default for Command {
    fn default() -> Self {
        Self::Run(Default::default())
    }
}

impl Command {
    /// Run the command
    #[instrument(name = "run", skip(self))]
    pub async fn run(self) -> anyhow::Result<()> {
        tracing::info!("{}", "\n👟 Reading om.ci config from flake".bold());
        let url = self.get_flake_ref().to_flake_url().await?;
        let cfg = OmConfig::get(self.nixcmd(), &url).await?;

        tracing::debug!("OmConfig: {cfg:?}");
        match self {
            Command::Run(cmd) => cmd.run(cfg).await,
            Command::DumpGithubActionsMatrix(cmd) => cmd.run(cfg).await,
        }
    }

    fn nixcmd(&self) -> &NixCmd {
        match self {
            Command::Run(cmd) => &cmd.nixcmd,
            Command::DumpGithubActionsMatrix(cmd) => &cmd.nixcmd,
        }
    }

    /// Get the [FlakeRef] associated with this subcommand
    fn get_flake_ref(&self) -> &FlakeRef {
        match self {
            Command::Run(cmd) => &cmd.flake_ref,
            Command::DumpGithubActionsMatrix(cmd) => &cmd.flake_ref,
        }
    }

    /// Convert this type back to the user-facing command line arguments
    pub fn to_cli_args(&self) -> Vec<String> {
        let mut args = vec!["ci".to_string(), "run".to_string()];
        match self {
            Command::Run(cmd) => {
                args.extend(cmd.to_cli_args());
            }
            Command::DumpGithubActionsMatrix(_cmd) => {
          
Download .txt
gitextract_99yfqsb4/

├── .envrc
├── .gitattributes
├── .github/
│   └── workflows/
│       ├── ci.yaml
│       └── website.yaml
├── .gitignore
├── .vscode/
│   ├── extensions.json
│   └── settings.json
├── Cargo.toml
├── LICENSE
├── README.md
├── bacon.toml
├── crates/
│   ├── nix_rs/
│   │   ├── CHANGELOG.md
│   │   ├── Cargo.toml
│   │   ├── README.md
│   │   ├── crate.nix
│   │   └── src/
│   │       ├── arg.rs
│   │       ├── command.rs
│   │       ├── config.rs
│   │       ├── copy.rs
│   │       ├── detsys_installer.rs
│   │       ├── env.rs
│   │       ├── flake/
│   │       │   ├── command.rs
│   │       │   ├── eval.rs
│   │       │   ├── functions/
│   │       │   │   ├── README.md
│   │       │   │   ├── addstringcontext/
│   │       │   │   │   ├── flake.nix
│   │       │   │   │   └── mod.rs
│   │       │   │   ├── core.rs
│   │       │   │   ├── metadata/
│   │       │   │   │   ├── flake.nix
│   │       │   │   │   └── mod.rs
│   │       │   │   └── mod.rs
│   │       │   ├── mod.rs
│   │       │   ├── outputs.rs
│   │       │   ├── schema.rs
│   │       │   ├── system.rs
│   │       │   └── url/
│   │       │       ├── attr.rs
│   │       │       ├── core.rs
│   │       │       └── mod.rs
│   │       ├── info.rs
│   │       ├── lib.rs
│   │       ├── refs.rs
│   │       ├── store/
│   │       │   ├── command.rs
│   │       │   ├── mod.rs
│   │       │   ├── path.rs
│   │       │   └── uri.rs
│   │       ├── system_list.rs
│   │       ├── version.rs
│   │       └── version_spec.rs
│   ├── omnix-ci/
│   │   ├── CHANGELOG.md
│   │   ├── Cargo.toml
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── crate.nix
│   │   └── src/
│   │       ├── command/
│   │       │   ├── core.rs
│   │       │   ├── gh_matrix.rs
│   │       │   ├── mod.rs
│   │       │   ├── run.rs
│   │       │   └── run_remote.rs
│   │       ├── config/
│   │       │   ├── core.rs
│   │       │   ├── mod.rs
│   │       │   ├── subflake.rs
│   │       │   └── subflakes.rs
│   │       ├── flake_ref.rs
│   │       ├── github/
│   │       │   ├── actions.rs
│   │       │   ├── matrix.rs
│   │       │   ├── mod.rs
│   │       │   └── pull_request.rs
│   │       ├── lib.rs
│   │       ├── nix/
│   │       │   ├── devour_flake.rs
│   │       │   ├── lock.rs
│   │       │   └── mod.rs
│   │       └── step/
│   │           ├── build.rs
│   │           ├── core.rs
│   │           ├── custom.rs
│   │           ├── flake_check.rs
│   │           ├── lockfile.rs
│   │           └── mod.rs
│   ├── omnix-cli/
│   │   ├── Cargo.toml
│   │   ├── crate.nix
│   │   ├── src/
│   │   │   ├── args.rs
│   │   │   ├── command/
│   │   │   │   ├── ci.rs
│   │   │   │   ├── completion.rs
│   │   │   │   ├── core.rs
│   │   │   │   ├── develop.rs
│   │   │   │   ├── health.rs
│   │   │   │   ├── init.rs
│   │   │   │   ├── mod.rs
│   │   │   │   └── show.rs
│   │   │   ├── lib.rs
│   │   │   └── main.rs
│   │   └── tests/
│   │       ├── command/
│   │       │   ├── ci.rs
│   │       │   ├── core.rs
│   │       │   ├── health.rs
│   │       │   ├── init.rs
│   │       │   ├── mod.rs
│   │       │   └── show.rs
│   │       ├── flake.nix
│   │       └── test.rs
│   ├── omnix-common/
│   │   ├── Cargo.toml
│   │   ├── crate.nix
│   │   └── src/
│   │       ├── check.rs
│   │       ├── config.rs
│   │       ├── fs.rs
│   │       ├── lib.rs
│   │       ├── logging.rs
│   │       └── markdown.rs
│   ├── omnix-develop/
│   │   ├── Cargo.toml
│   │   ├── crate.nix
│   │   └── src/
│   │       ├── config.rs
│   │       ├── core.rs
│   │       ├── lib.rs
│   │       └── readme.rs
│   ├── omnix-gui/
│   │   ├── Cargo.toml
│   │   ├── Dioxus.toml
│   │   ├── assets/
│   │   │   └── tailwind.css
│   │   ├── build.rs
│   │   ├── crate.nix
│   │   ├── css/
│   │   │   └── input.css
│   │   ├── src/
│   │   │   ├── app/
│   │   │   │   ├── flake.rs
│   │   │   │   ├── health.rs
│   │   │   │   ├── info.rs
│   │   │   │   ├── mod.rs
│   │   │   │   ├── state/
│   │   │   │   │   ├── datum.rs
│   │   │   │   │   ├── db.rs
│   │   │   │   │   ├── error.rs
│   │   │   │   │   ├── mod.rs
│   │   │   │   │   └── refresh.rs
│   │   │   │   └── widget.rs
│   │   │   ├── cli.rs
│   │   │   └── main.rs
│   │   └── tailwind.config.js
│   ├── omnix-health/
│   │   ├── CHANGELOG.md
│   │   ├── Cargo.toml
│   │   ├── README.md
│   │   ├── crate.nix
│   │   ├── failing/
│   │   │   ├── .envrc
│   │   │   └── flake.nix
│   │   ├── module/
│   │   │   ├── flake-module.nix
│   │   │   └── flake.nix
│   │   └── src/
│   │       ├── check/
│   │       │   ├── caches.rs
│   │       │   ├── direnv.rs
│   │       │   ├── flake_enabled.rs
│   │       │   ├── homebrew.rs
│   │       │   ├── max_jobs.rs
│   │       │   ├── mod.rs
│   │       │   ├── nix_version.rs
│   │       │   ├── rosetta.rs
│   │       │   ├── shell.rs
│   │       │   └── trusted_users.rs
│   │       ├── json.rs
│   │       ├── lib.rs
│   │       ├── report.rs
│   │       └── traits.rs
│   └── omnix-init/
│       ├── Cargo.toml
│       ├── crate.nix
│       ├── registry/
│       │   └── flake.nix
│       └── src/
│           ├── action.rs
│           ├── config.rs
│           ├── core.rs
│           ├── lib.rs
│           ├── param.rs
│           ├── registry.rs
│           ├── template.rs
│           └── test.rs
├── doc/
│   ├── .gitignore
│   ├── config.md
│   ├── flake.nix
│   ├── history.md
│   ├── index.md
│   ├── index.yaml
│   ├── mod.just
│   ├── om/
│   │   ├── ci.md
│   │   ├── develop/
│   │   │   └── omnixrc/
│   │   │       └── v1
│   │   ├── develop.md
│   │   ├── health.md
│   │   ├── init.md
│   │   └── show.md
│   └── om.md
├── flake.nix
├── justfile
├── nix/
│   ├── envs/
│   │   └── default.nix
│   ├── flake-schemas/
│   │   └── flake.nix
│   └── modules/
│       └── flake/
│           ├── closure-size.nix
│           ├── devshell.nix
│           ├── nixpkgs.nix
│           ├── pre-commit.nix
│           └── rust.nix
├── om.yaml
└── rust-toolchain.toml
Download .txt
SYMBOL INDEX (573 symbols across 98 files)

FILE: crates/nix_rs/src/arg.rs
  type NixArgs (line 14) | pub struct NixArgs {
    method to_args (line 33) | pub fn to_args(&self, subcommands: &[&str]) -> Vec<String> {
    method with_flakes (line 50) | pub fn with_flakes(&mut self) {
    method with_nix_command (line 56) | pub fn with_nix_command(&mut self) {
  function remove_nonsense_args_when_subcommand (line 64) | fn remove_nonsense_args_when_subcommand(subcommands: &[&str], args: &mut...
  function non_sense_options (line 71) | fn non_sense_options<'a>(subcommands: &[&str]) -> HashMap<&'a str, usize> {
  function remove_arguments (line 84) | fn remove_arguments(vec: &mut Vec<String>, arg: &str, next: usize) {

FILE: crates/nix_rs/src/command.rs
  type NixCmd (line 34) | pub struct NixCmd {
    method get (line 63) | pub async fn get() -> &'static NixCmd {
    method command (line 83) | pub fn command(&self, subcommands: &[&str]) -> Command {
    method run_with_args_expecting_json (line 92) | pub async fn run_with_args_expecting_json<T>(
    method run_with_args_expecting_fromstr (line 110) | pub async fn run_with_args_expecting_fromstr<T>(
    method run_with_returning_stdout (line 130) | pub async fn run_with_returning_stdout<F>(
    method run_with (line 161) | pub async fn run_with<F>(&self, subcommands: &[&str], f: F) -> Result<...
  function trace_cmd (line 50) | pub fn trace_cmd(cmd: &tokio::process::Command) {
  function trace_cmd_with (line 56) | pub fn trace_cmd_with(icon: &str, cmd: &tokio::process::Command) {
  function to_cli (line 182) | fn to_cli(cmd: &tokio::process::Command) -> String {
  type NixCmdError (line 201) | pub enum NixCmdError {
  type FromStrError (line 221) | pub struct FromStrError(String);
  method fmt (line 224) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type CommandError (line 233) | pub enum CommandError {

FILE: crates/nix_rs/src/config.rs
  type NixConfig (line 21) | pub struct NixConfig {
    method get (line 63) | pub async fn get() -> &'static Result<NixConfig, NixConfigError> {
    method from_nix (line 77) | pub async fn from_nix(
    method is_flakes_enabled (line 94) | pub fn is_flakes_enabled(&self) -> bool {
  type ConfigVal (line 43) | pub struct ConfigVal<T> {
  type NixConfigError (line 107) | pub enum NixConfigError {
  type TrustedUserValue (line 119) | pub enum TrustedUserValue {
    method from_str (line 129) | fn from_str(s: &str) -> Self {
    method display_original (line 142) | pub fn display_original(val: &[TrustedUserValue]) -> String {
    method from (line 155) | fn from(s: String) -> Self {
  type Err (line 161) | type Err = Infallible;
  method from_str (line 163) | fn from_str(s: &str) -> Result<Self, Self::Err> {
  function test_nix_config (line 169) | async fn test_nix_config() -> Result<(), crate::command::NixCmdError> {

FILE: crates/nix_rs/src/copy.rs
  type NixCopyOptions (line 10) | pub struct NixCopyOptions {
  function nix_copy (line 26) | pub async fn nix_copy<I, P>(

FILE: crates/nix_rs/src/detsys_installer.rs
  type DetSysNixInstaller (line 12) | pub struct DetSysNixInstaller {
    method detect (line 18) | pub fn detect() -> Result<Option<Self>, BadInstallerVersion> {
  method fmt (line 31) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  type InstallerVersion (line 38) | struct InstallerVersion {
    method get_version (line 95) | pub fn get_version(executable_path: &Path) -> Result<Self, BadInstalle...
  method fmt (line 45) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  type BadInstallerVersion (line 52) | pub enum BadInstallerVersion {
  type Err (line 71) | type Err = BadInstallerVersion;
  method from_str (line 73) | fn from_str(s: &str) -> Result<Self, Self::Err> {

FILE: crates/nix_rs/src/env.rs
  type NixEnv (line 15) | pub struct NixEnv {
    method detect (line 36) | pub async fn detect() -> Result<NixEnv, NixEnvError> {
  function get_current_user_groups (line 64) | fn get_current_user_groups() -> Result<Vec<String>, NixEnvError> {
  function get_nix_disk (line 77) | fn get_nix_disk(sys: &sysinfo::System) -> Result<&sysinfo::Disk, NixEnvE...
  type OS (line 94) | pub enum OS {
    method detect (line 133) | pub async fn detect() -> Self {
    method nix_system_config_label (line 158) | pub fn nix_system_config_label(&self) -> Option<String> {
    method nix_config_label (line 172) | pub fn nix_config_label(&self) -> String {
  method fmt (line 112) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  type NixInstaller (line 181) | pub enum NixInstaller {
    method detect (line 201) | pub fn detect() -> Result<Self, NixEnvError> {
  method fmt (line 189) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  type NixEnvError (line 211) | pub enum NixEnvError {
  function to_bytesize (line 232) | fn to_bytesize(bytes: u64) -> ByteSize {
  function test_to_bytesize (line 250) | fn test_to_bytesize() {

FILE: crates/nix_rs/src/flake/command.rs
  function run (line 16) | pub async fn run(
  function develop (line 33) | pub async fn develop(
  function build (line 50) | pub async fn build(
  function lock (line 66) | pub async fn lock(
  function check (line 82) | pub async fn check(cmd: &NixCmd, opts: &FlakeOptions, url: &FlakeUrl) ->...
  type OutPath (line 93) | pub struct OutPath {
    method first_output (line 103) | pub fn first_output(&self) -> Option<&PathBuf> {
  type FlakeOptions (line 110) | pub struct FlakeOptions {
    method use_in_command (line 123) | pub fn use_in_command(&self, cmd: &mut Command) {

FILE: crates/nix_rs/src/flake/eval.rs
  function nix_eval (line 9) | pub async fn nix_eval<T>(
  function nix_eval_maybe (line 21) | pub async fn nix_eval_maybe<T>(
  function nix_eval_ (line 39) | async fn nix_eval_<T>(
  function error_is_missing_attribute (line 66) | fn error_is_missing_attribute(err: &NixCmdError) -> bool {

FILE: crates/nix_rs/src/flake/functions/addstringcontext/mod.rs
  type AddStringContextFn (line 13) | struct AddStringContextFn;
  type Input (line 24) | type Input = AddStringContextInput;
  type Output (line 25) | type Output = Value;
  method flake (line 27) | fn flake() -> &'static FlakeUrl {
  type AddStringContextInput (line 34) | struct AddStringContextInput {
  function addstringcontext (line 42) | pub async fn addstringcontext(

FILE: crates/nix_rs/src/flake/functions/core.rs
  type FlakeFn (line 26) | pub trait FlakeFn {
    method flake (line 35) | fn flake() -> &'static FlakeUrl;
    method init (line 38) | fn init(_out: &mut Self::Output) {}
    method call (line 49) | fn call(
  function transform_override_inputs (line 112) | fn transform_override_inputs(args: &[String]) -> Vec<String> {
  function to_vec (line 129) | fn to_vec<T>(value: &T) -> Vec<(String, String)>
  type Error (line 158) | pub enum Error {

FILE: crates/nix_rs/src/flake/functions/metadata/mod.rs
  type FlakeMetadataFn (line 9) | pub struct FlakeMetadataFn;
  type Input (line 20) | type Input = FlakeMetadataInput;
  type Output (line 21) | type Output = FlakeMetadata;
  method flake (line 23) | fn flake() -> &'static FlakeUrl {
  type FlakeMetadataInput (line 30) | pub struct FlakeMetadataInput {
  type FlakeMetadata (line 45) | pub struct FlakeMetadata {
    method from_nix (line 66) | pub async fn from_nix(
  type FlakeInput (line 57) | pub struct FlakeInput {

FILE: crates/nix_rs/src/flake/mod.rs
  type Flake (line 26) | pub struct Flake {
    method from_nix (line 38) | pub async fn from_nix(

FILE: crates/nix_rs/src/flake/outputs.rs
  type FlakeOutputs (line 11) | pub enum FlakeOutputs {
    method get_val (line 20) | pub fn get_val(&self) -> Option<&Val> {
    method get_attrset (line 28) | pub fn get_attrset(&self) -> Option<&HashMap<String, FlakeOutputs>> {
    method get_attrset_of_val (line 38) | pub fn get_attrset_of_val(&self) -> Vec<(String, Val)> {
    method get_by_path (line 53) | pub fn get_by_path(&self, path: &[&str]) -> Option<&Self> {
    method from (line 64) | fn from(schema: FlakeSchemas) -> Self {

FILE: crates/nix_rs/src/flake/schema.rs
  type FlakeSchemas (line 33) | pub struct FlakeSchemas {
    method from_nix (line 52) | pub async fn from_nix(
    method to_flake_outputs (line 89) | pub(crate) fn to_flake_outputs(&self) -> FlakeOutputs {
  type InventoryItem (line 41) | pub enum InventoryItem {
    method to_flake_outputs (line 100) | fn to_flake_outputs(&self) -> Option<FlakeOutputs> {
  type Leaf (line 125) | pub enum Leaf {
    method get_val (line 135) | fn get_val(&self) -> Option<&Val> {
  type Val (line 146) | pub struct Val {
  method default (line 157) | fn default() -> Self {
  type Type (line 173) | pub enum Type {
    method to_icon (line 196) | pub fn to_icon(&self) -> &'static str {
  method fmt (line 212) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {

FILE: crates/nix_rs/src/flake/system.rs
  type System (line 18) | pub enum System {
    method from (line 45) | fn from(s: &str) -> Self {
    method from (line 57) | fn from(s: String) -> Self {
    method as_ref (line 63) | fn as_ref(&self) -> &str {
    method human_readable (line 88) | pub fn human_readable(&self) -> String {
  type Arch (line 29) | pub enum Arch {
    method human_readable (line 99) | pub fn human_readable(&self) -> &'static str {
  type Err (line 37) | type Err = Infallible;
  method from_str (line 39) | fn from_str(s: &str) -> Result<Self, Self::Err> {
  method from (line 75) | fn from(s: System) -> Self {
  method fmt (line 81) | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {

FILE: crates/nix_rs/src/flake/url/attr.rs
  type FlakeAttr (line 8) | pub struct FlakeAttr(pub Option<String>);
    method new (line 12) | pub fn new(attr: &str) -> Self {
    method none (line 17) | pub fn none() -> Self {
    method get_name (line 24) | pub fn get_name(&self) -> String {
    method is_none (line 29) | pub fn is_none(&self) -> bool {
    method as_list (line 34) | pub fn as_list(&self) -> Vec<String> {

FILE: crates/nix_rs/src/flake/url/core.rs
  type FlakeUrl (line 27) | pub struct FlakeUrl(pub String);
    method as_ref (line 30) | fn as_ref(&self) -> &str {
    method as_local_path (line 48) | pub fn as_local_path(&self) -> Option<&Path> {
    method as_local_path_or_fetch (line 61) | pub async fn as_local_path_or_fetch(
    method split_attr (line 81) | pub fn split_attr(&self) -> (Self, FlakeAttr) {
    method get_attr (line 89) | pub fn get_attr(&self) -> FlakeAttr {
    method without_attr (line 94) | pub fn without_attr(&self) -> Self {
    method with_attr (line 100) | pub fn with_attr(&self, attr: &str) -> Self {
    method sub_flake_url (line 106) | pub fn sub_flake_url(&self, dir: String) -> FlakeUrl {
    method from (line 128) | fn from(path: PathBuf) -> Self {
    method from (line 134) | fn from(path: &Path) -> Self {
  type Target (line 36) | type Target = str;
  method deref (line 38) | fn deref(&self) -> &Self::Target {
  type Err (line 141) | type Err = FlakeUrlError;
  method from_str (line 143) | fn from_str(s: &str) -> Result<Self, Self::Err> {
  type FlakeUrlError (line 155) | pub enum FlakeUrlError {
  method fmt (line 162) | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
  function test_flake_url_and_attr (line 172) | fn test_flake_url_and_attr() {
  function test_as_local_path (line 205) | fn test_as_local_path() {
  function test_sub_flake_url (line 249) | fn test_sub_flake_url() {
  function test_sub_flake_url_with_query (line 268) | fn test_sub_flake_url_with_query() {
  function test_with_attr (line 278) | fn test_with_attr() {

FILE: crates/nix_rs/src/info.rs
  type NixInfo (line 9) | pub struct NixInfo {
    method get (line 22) | pub async fn get() -> &'static Result<NixInfo, NixInfoError> {
    method new (line 34) | pub async fn new(
  type NixInfoError (line 49) | pub enum NixInfoError {

FILE: crates/nix_rs/src/refs.rs
  constant RELEASE_HISTORY (line 4) | pub const RELEASE_HISTORY: &str =

FILE: crates/nix_rs/src/store/command.rs
  type NixStoreCmd (line 15) | pub struct NixStoreCmd;
    method command (line 19) | pub fn command(&self) -> Command {
    method fetch_all_deps (line 35) | pub async fn fetch_all_deps(
    method nix_store_query_deriver (line 47) | pub async fn nix_store_query_deriver(
    method nix_store_query_requisites_with_outputs (line 68) | pub async fn nix_store_query_requisites_with_outputs(
    method add_file_permanently (line 86) | pub async fn add_file_permanently(
    method nix_store_add (line 101) | pub async fn nix_store_add(&self, path: &Path) -> Result<StorePath, Ni...
    method nix_store_add_root (line 122) | pub async fn nix_store_add_root(
  function run_awaiting_stdout (line 138) | async fn run_awaiting_stdout(cmd: &mut Command) -> Result<Vec<u8>, NixSt...
  type NixStoreCmdError (line 152) | pub enum NixStoreCmdError {
    method from (line 163) | fn from(err: std::io::Error) -> Self {
    method from (line 170) | fn from(err: std::string::FromUtf8Error) -> Self {
    method from (line 177) | fn from(err: CommandError) -> Self {

FILE: crates/nix_rs/src/store/path.rs
  type StorePath (line 15) | pub enum StorePath {
    method as_ref (line 32) | fn as_ref(&self) -> &Path {
    method as_ref (line 38) | fn as_ref(&self) -> &std::ffi::OsStr {
    method new (line 45) | pub fn new(path: PathBuf) -> Self {
    method as_path (line 54) | pub fn as_path(&self) -> &PathBuf {
    method fmt (line 63) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type Err (line 24) | type Err = Infallible;
  method from_str (line 26) | fn from_str(s: &str) -> Result<Self, Self::Err> {

FILE: crates/nix_rs/src/store/uri.rs
  type StoreURI (line 10) | pub enum StoreURI {
    method parse (line 55) | pub fn parse(uri: &str) -> Result<Self, StoreURIParseError> {
    method get_options (line 79) | pub fn get_options(&self) -> &Opts {
    method fmt (line 104) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type Opts (line 17) | pub struct Opts {
  type SSHStoreURI (line 27) | pub struct SSHStoreURI {
    method fmt (line 95) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type StoreURIParseError (line 36) | pub enum StoreURIParseError {
  type Err (line 87) | type Err = StoreURIParseError;
  method from_str (line 89) | fn from_str(s: &str) -> Result<Self, Self::Err> {

FILE: crates/nix_rs/src/system_list.rs
  type SystemsListFlakeRef (line 19) | pub struct SystemsListFlakeRef(pub FlakeUrl);
    method from_known_system (line 23) | pub fn from_known_system(system: &System) -> Option<Self> {
  type Err (line 31) | type Err = Infallible;
  method from_str (line 32) | fn from_str(s: &str) -> Result<SystemsListFlakeRef, Infallible> {
  type SystemsList (line 42) | pub struct SystemsList(pub Vec<System>);
    method from_flake (line 46) | pub async fn from_flake(cmd: &NixCmd, url: &SystemsListFlakeRef) -> Re...
    method from_remote_flake (line 54) | async fn from_remote_flake(
    method from_known_flake (line 64) | fn from_known_flake(url: &SystemsListFlakeRef) -> Option<Self> {
  function nix_import_flake (line 73) | async fn nix_import_flake<T>(cmd: &NixCmd, url: &FlakeUrl) -> Result<T, ...
  function nix_eval_impure_expr (line 83) | async fn nix_eval_impure_expr<T>(cmd: &NixCmd, expr: String) -> Result<T...

FILE: crates/nix_rs/src/version.rs
  type NixVersion (line 14) | pub struct NixVersion {
    method get (line 66) | pub async fn get() -> &'static Result<NixVersion, NixCmdError> {
    method from_nix (line 77) | pub async fn from_nix(cmd: &NixCmd) -> Result<NixVersion, super::comma...
    method fmt (line 86) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type BadNixVersion (line 25) | pub enum BadNixVersion {
  type Err (line 40) | type Err = BadNixVersion;
  method from_str (line 43) | fn from_str(s: &str) -> Result<Self, Self::Err> {
  function test_run_nix_version (line 92) | async fn test_run_nix_version() {
  function test_parse_nix_version (line 98) | async fn test_parse_nix_version() {

FILE: crates/nix_rs/src/version_spec.rs
  type NixVersionSpec (line 14) | pub enum NixVersionSpec {
    method matches (line 73) | pub fn matches(&self, version: &NixVersion) -> bool {
    method fmt (line 140) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type NixVersionReq (line 32) | pub struct NixVersionReq {
    method fmt (line 152) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type BadNixVersionSpec (line 39) | pub enum BadNixVersionSpec {
  type Err (line 58) | type Err = BadNixVersionSpec;
  method from_str (line 60) | fn from_str(s: &str) -> Result<Self, Self::Err> {
  type Err (line 85) | type Err = BadNixVersionSpec;
  method from_str (line 87) | fn from_str(s: &str) -> Result<Self, Self::Err> {
  function test_parse (line 170) | fn test_parse() {
  function test_matches (line 190) | fn test_matches() {

FILE: crates/omnix-ci/src/command/core.rs
  type Command (line 14) | pub enum Command {
    method run (line 32) | pub async fn run(self) -> anyhow::Result<()> {
    method nixcmd (line 44) | fn nixcmd(&self) -> &NixCmd {
    method get_flake_ref (line 52) | fn get_flake_ref(&self) -> &FlakeRef {
    method to_cli_args (line 60) | pub fn to_cli_args(&self) -> Vec<String> {
  method default (line 24) | fn default() -> Self {

FILE: crates/omnix-ci/src/command/gh_matrix.rs
  type GHMatrixCommand (line 10) | pub struct GHMatrixCommand {
    method run (line 29) | pub async fn run(&self, cfg: OmConfig) -> anyhow::Result<()> {

FILE: crates/omnix-ci/src/command/run.rs
  type RunCommand (line 34) | pub struct RunCommand {
    method get_out_link (line 92) | pub fn get_out_link(&self) -> Option<&Path> {
    method local_with (line 101) | pub fn local_with(&self, flake_ref: FlakeRef, out_link: Option<PathBuf...
    method run (line 111) | pub async fn run(&self, cfg: OmConfig) -> anyhow::Result<()> {
    method run_local (line 121) | async fn run_local(&self, cfg: OmConfig) -> anyhow::Result<()> {
    method get_systems (line 184) | pub async fn get_systems(&self, cmd: &NixCmd, nix_config: &NixConfig) ...
    method to_cli_args (line 199) | pub fn to_cli_args(&self) -> Vec<String> {
  method default (line 85) | fn default() -> Self {
  function check_nix_version (line 230) | pub async fn check_nix_version(cfg: &OmConfig, nix_info: &NixInfo) -> an...
  function ci_run (line 244) | pub async fn ci_run(
  type RunResult (line 304) | pub struct RunResult {
    method all_out_paths (line 315) | pub fn all_out_paths(&self) -> Vec<StorePath> {

FILE: crates/omnix-ci/src/command/run_remote.rs
  constant OMNIX_SOURCE (line 24) | const OMNIX_SOURCE: &str = env!("OMNIX_SOURCE");
  function run_on_remote_store (line 27) | pub async fn run_on_remote_store(
  function nix_copy_to_remote (line 105) | async fn nix_copy_to_remote<I, P>(
  function nix_copy_from_remote (line 126) | async fn nix_copy_from_remote<I, P>(
  function parse_path_line (line 147) | fn parse_path_line(bytes: &[u8]) -> PathBuf {
  function nixpkgs_cmd (line 153) | fn nixpkgs_cmd(package: &str, cmd: &[&str]) -> Vec<String> {
  function cache_flake (line 165) | async fn cache_flake(
  function om_cli_with (line 189) | fn om_cli_with(run_cmd: RunCommand) -> Vec<String> {
  function run_ssh (line 210) | async fn run_ssh(host: &str, args: &[String]) -> anyhow::Result<()> {
  function run_ssh_with_output (line 224) | async fn run_ssh_with_output<I, S>(host: &str, args: I) -> anyhow::Resul...

FILE: crates/omnix-ci/src/config/core.rs
  function test_config_loading (line 11) | async fn test_config_loading() {

FILE: crates/omnix-ci/src/config/subflake.rs
  type SubflakeConfig (line 14) | pub struct SubflakeConfig {
    method can_run_on (line 51) | pub fn can_run_on(&self, systems: &[System]) -> bool {
  method default (line 38) | fn default() -> Self {

FILE: crates/omnix-ci/src/config/subflakes.rs
  type SubflakesConfig (line 10) | pub struct SubflakesConfig(
  method default (line 18) | fn default() -> Self {

FILE: crates/omnix-ci/src/flake_ref.rs
  type FlakeRef (line 16) | pub enum FlakeRef {
    method from (line 35) | fn from(url: FlakeUrl) -> Self {
    method to_flake_url (line 51) | pub async fn to_flake_url(&self) -> Result<FlakeUrl> {
  type Err (line 24) | type Err = String;
  method from_str (line 25) | fn from_str(s: &str) -> std::result::Result<FlakeRef, String> {
  method fmt (line 41) | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
  function test_github_pr (line 67) | fn test_github_pr() {
  function test_current_dir (line 79) | fn test_current_dir() {
  function test_flake_url (line 87) | fn test_flake_url() {

FILE: crates/omnix-ci/src/github/actions.rs
  function in_github_log_group (line 8) | pub async fn in_github_log_group<T, F, Fut>(name: &str, enable: bool, f:...

FILE: crates/omnix-ci/src/github/matrix.rs
  type GitHubMatrixRow (line 9) | pub struct GitHubMatrixRow {
  type GitHubMatrix (line 18) | pub struct GitHubMatrix {
    method from (line 25) | pub fn from(systems: Vec<System>, subflakes: &SubflakesConfig) -> Self {

FILE: crates/omnix-ci/src/github/pull_request.rs
  type PullRequestRef (line 14) | pub struct PullRequestRef {
    method api_url (line 31) | fn api_url(&self) -> String {
    method from_web_url (line 38) | pub fn from_web_url(url: &str) -> Option<Self> {
  method fmt (line 21) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  type PullRequest (line 58) | pub struct PullRequest {
    method get (line 84) | pub async fn get(ref_: &PullRequestRef) -> anyhow::Result<Self> {
    method flake_url (line 90) | pub fn flake_url(&self) -> FlakeUrl {
  type Head (line 67) | pub struct Head {
  type Repo (line 77) | pub struct Repo {
  function api_get (line 103) | async fn api_get<T>(url: String) -> anyhow::Result<T>

FILE: crates/omnix-ci/src/nix/devour_flake.rs
  type DevourFlake (line 12) | pub struct DevourFlake;
  type Input (line 23) | type Input = DevourFlakeInput;
  type Output (line 24) | type Output = DevourFlakeOutput;
  method flake (line 26) | fn flake() -> &'static FlakeUrl {
  method init (line 30) | fn init(out: &mut DevourFlakeOutput) {
  type DevourFlakeInput (line 40) | pub struct DevourFlakeInput {
  type DevourFlakeOutput (line 49) | pub struct DevourFlakeOutput {

FILE: crates/omnix-ci/src/nix/lock.rs
  function nix_flake_lock_check (line 10) | pub async fn nix_flake_lock_check(nixcmd: &NixCmd, url: &FlakeUrl) -> Re...

FILE: crates/omnix-ci/src/step/build.rs
  type BuildStep (line 23) | pub struct BuildStep {
    method run (line 42) | pub async fn run(
  method default (line 32) | fn default() -> Self {
  function subflake_extra_args (line 87) | fn subflake_extra_args(subflake: &SubflakeConfig) -> Vec<String> {
  type BuildStepArgs (line 103) | pub struct BuildStepArgs {
    method to_cli_args (line 114) | pub fn to_cli_args(&self) -> Vec<String> {
  type BuildStepResult (line 127) | pub struct BuildStepResult {

FILE: crates/omnix-ci/src/step/core.rs
  type Steps (line 22) | pub struct Steps {
    method run (line 58) | pub async fn run(
  type StepsArgs (line 42) | pub struct StepsArgs {
    method to_cli_args (line 89) | pub fn to_cli_args(&self) -> Vec<String> {
  type StepsResult (line 50) | pub struct StepsResult {

FILE: crates/omnix-ci/src/step/custom.rs
  type CustomStep (line 23) | pub enum CustomStep {
    method run (line 52) | pub async fn run(
    method run_on_local_path (line 65) | async fn run_on_local_path(
    method can_run_on (line 104) | fn can_run_on(&self, systems: &[System]) -> bool {
    method get_systems (line 111) | fn get_systems(&self) -> &Option<Vec<System>> {
  type CustomSteps (line 121) | pub struct CustomSteps(BTreeMap<String, CustomStep>);
    method run (line 125) | pub async fn run(
  function with_writeable_flake_dir (line 159) | async fn with_writeable_flake_dir<F, Fut>(

FILE: crates/omnix-ci/src/step/flake_check.rs
  type FlakeCheckStep (line 15) | pub struct FlakeCheckStep {
    method run (line 24) | pub async fn run(

FILE: crates/omnix-ci/src/step/lockfile.rs
  type LockfileStep (line 10) | pub struct LockfileStep {
    method run (line 23) | pub async fn run(
  method default (line 16) | fn default() -> Self {

FILE: crates/omnix-cli/src/args.rs
  type Args (line 9) | pub struct Args {

FILE: crates/omnix-cli/src/command/ci.rs
  type CICommand (line 6) | pub struct CICommand {
    method run (line 13) | pub async fn run(&self) -> anyhow::Result<()> {
    method command (line 21) | fn command(&self) -> Command {

FILE: crates/omnix-cli/src/command/completion.rs
  type CompletionCommand (line 7) | pub struct CompletionCommand {
    method run (line 13) | pub fn run(&self) -> anyhow::Result<()> {
  type Shell2 (line 22) | enum Shell2 {
    method nushell_or (line 32) | fn nushell_or(self) -> Result<clap_complete::Shell, clap_complete_nush...
  function generate_completion (line 44) | fn generate_completion(shell: Shell2) {

FILE: crates/omnix-cli/src/command/core.rs
  type Command (line 4) | pub enum Command {
    method run (line 20) | pub async fn run(&self) -> anyhow::Result<()> {

FILE: crates/omnix-cli/src/command/develop.rs
  type DevelopCommand (line 7) | pub struct DevelopCommand {
    method run (line 32) | pub async fn run(&self) -> anyhow::Result<()> {
  type Stage (line 23) | enum Stage {

FILE: crates/omnix-cli/src/command/health.rs
  type HealthCommand (line 7) | pub struct HealthCommand {
    method run (line 27) | pub async fn run(&self) -> anyhow::Result<()> {

FILE: crates/omnix-cli/src/command/init.rs
  type InitCommand (line 9) | pub struct InitCommand {
    method run (line 49) | pub async fn run(&self) -> anyhow::Result<()> {
    method registry_choose (line 80) | async fn registry_choose(&self) -> anyhow::Result<FlakeUrl> {
  type Params (line 90) | struct Params(HashMap<String, Value>);
  type Err (line 94) | type Err = serde_json::Error;
  method from_str (line 96) | fn from_str(s: &str) -> Result<Self, Self::Err> {

FILE: crates/omnix-cli/src/command/show.rs
  type ShowCommand (line 18) | pub struct ShowCommand {
    method run (line 96) | pub async fn run(&self) -> anyhow::Result<()> {
  type FlakeOutputTable (line 29) | pub struct FlakeOutputTable {
    method to_tabled (line 40) | fn to_tabled(&self) -> Table {
    method print (line 50) | pub fn print(&self) {
  type Row (line 70) | pub struct Row {
    method vec_from_flake_output (line 79) | pub fn vec_from_flake_output(output: &FlakeOutputs) -> Vec<Row> {

FILE: crates/omnix-cli/src/main.rs
  function main (line 4) | async fn main() -> anyhow::Result<()> {

FILE: crates/omnix-cli/tests/command/ci.rs
  function om_ci_run (line 12) | async fn om_ci_run(args: &[&str]) -> anyhow::Result<StorePath> {
  function build_flake_output (line 30) | async fn build_flake_output() -> anyhow::Result<()> {
  function test_haskell_multi_nix (line 46) | async fn test_haskell_multi_nix() -> anyhow::Result<()> {
  function test_haskell_multi_nix_all_dependencies (line 66) | async fn test_haskell_multi_nix_all_dependencies() -> anyhow::Result<()> {
  function test_haskell_multi_nix_override_input (line 83) | async fn test_haskell_multi_nix_override_input() -> anyhow::Result<()> {
  function test_services_flake (line 98) | async fn test_services_flake() -> anyhow::Result<()> {
  function assert_same_drvs (line 118) | pub fn assert_same_drvs(drvs1: Vec<PathBuf>, drvs2: Vec<PathBuf>) {
  function without_hash (line 133) | pub fn without_hash(out_path: &Path) -> String {
  function lookup_path (line 140) | fn lookup_path<T>(v: &Value, path: &[&str]) -> Option<T>

FILE: crates/omnix-cli/tests/command/core.rs
  function om_help (line 5) | fn om_help() -> anyhow::Result<()> {
  function om (line 11) | pub(crate) fn om() -> anyhow::Result<Command> {

FILE: crates/omnix-cli/tests/command/health.rs
  function om_health (line 7) | fn om_health() -> anyhow::Result<()> {

FILE: crates/omnix-cli/tests/command/init.rs
  function om_init (line 5) | async fn om_init() -> anyhow::Result<()> {

FILE: crates/omnix-cli/tests/command/show.rs
  function om_show_local (line 7) | fn om_show_local() -> anyhow::Result<()> {
  function om_show_remote (line 19) | fn om_show_remote() -> anyhow::Result<()> {
  function om_show_nixos_configurations (line 34) | fn om_show_nixos_configurations() -> anyhow::Result<()> {

FILE: crates/omnix-common/src/check.rs
  function nix_installed (line 7) | pub fn nix_installed() -> bool {
  function which_strict (line 13) | pub fn which_strict(binary: &str) -> Option<PathBuf> {

FILE: crates/omnix-common/src/config.rs
  type OmConfig (line 17) | pub struct OmConfig {
    method get (line 30) | pub async fn get(nixcmd: &NixCmd, flake_url: &FlakeUrl) -> Result<Self...
    method from_yaml (line 38) | async fn from_yaml(
    method from_flake (line 66) | async fn from_flake(nixcmd: &NixCmd, flake_url: &FlakeUrl) -> Result<S...
    method get_sub_config_under (line 79) | pub fn get_sub_config_under<T>(&self, root_key: &str) -> Result<(T, &[...
  type OmConfigTree (line 101) | pub struct OmConfigTree(BTreeMap<String, BTreeMap<String, serde_json::Va...
    method get (line 107) | pub fn get<T>(&self, key: &str) -> Result<Option<BTreeMap<String, T>>,...
  type OmConfigError (line 126) | pub enum OmConfigError {
  function test_get_missing_sub_config (line 153) | async fn test_get_missing_sub_config() {
  function test_get_omconfig_from_remote_flake_with_attr (line 177) | async fn test_get_omconfig_from_remote_flake_with_attr() {

FILE: crates/omnix-common/src/fs.rs
  function copy_dir_all (line 13) | pub async fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) ...
  function copy_entry (line 22) | async fn copy_entry(
  function make_owner_writeable (line 54) | async fn make_owner_writeable(path: impl AsRef<Path>) -> anyhow::Result<...
  function find_paths (line 65) | pub async fn find_paths(dir: impl AsRef<Path> + Copy) -> anyhow::Result<...
  function remove_all (line 79) | pub async fn remove_all(path: impl AsRef<Path>) -> anyhow::Result<()> {

FILE: crates/omnix-common/src/logging.rs
  function setup_logging (line 14) | pub fn setup_logging(verbosity: &Verbosity<InfoLevel>, bare: bool) {
  function log_filter (line 27) | fn log_filter(v: &Verbosity<InfoLevel>) -> EnvFilter {
  function log_directives (line 35) | fn log_directives(v: &Verbosity<InfoLevel>) -> Vec<Directive> {
  type BareFormatter (line 80) | struct BareFormatter;
    method format_event (line 87) | fn format_event(

FILE: crates/omnix-common/src/markdown.rs
  function print_markdown (line 24) | pub async fn print_markdown(base_dir: &Path, s: &str) -> anyhow::Result<...
  function render_markdown (line 31) | pub async fn render_markdown(base_dir: &Path, s: &str) -> anyhow::Result...
  function print_markdown_to (line 41) | async fn print_markdown_to<W>(base_dir: &Path, w: &mut W, s: &str) -> an...

FILE: crates/omnix-develop/src/config.rs
  type DevelopConfig (line 8) | pub struct DevelopConfig {
    method from_om_config (line 19) | pub fn from_om_config(om_config: &OmConfig) -> anyhow::Result<Self> {
  type CacheConfig (line 13) | pub struct CacheConfig {

FILE: crates/omnix-develop/src/core.rs
  type Project (line 11) | pub struct Project {
    method new (line 21) | pub async fn new(flake: FlakeUrl, om_config: OmConfig) -> anyhow::Resu...
  function develop_on (line 34) | pub async fn develop_on(prj: &Project) -> anyhow::Result<()> {
  function develop_on_pre_shell (line 45) | pub async fn develop_on_pre_shell(prj: &Project) -> anyhow::Result<()> {
  function develop_on_post_shell (line 91) | pub async fn develop_on_post_shell(prj: &Project) -> anyhow::Result<()> {
  function parse_many (line 101) | fn parse_many<'a, T, Q, F>(vec: &'a [T], f: F) -> (Vec<Q>, Vec<&'a T>)

FILE: crates/omnix-develop/src/readme.rs
  constant DEFAULT (line 3) | const DEFAULT: &str = r#"🍾 Welcome to the project
  type Readme (line 10) | pub struct Readme(pub String);
    method get_markdown (line 20) | pub fn get_markdown(&self) -> &str {
  method default (line 13) | fn default() -> Self {

FILE: crates/omnix-gui/build.rs
  constant INPUT_CSS_PATH (line 3) | const INPUT_CSS_PATH: &str = "./css/input.css";
  constant PUBLIC_DIR (line 4) | const PUBLIC_DIR: &str = "./assets/";
  function main (line 6) | fn main() {
  function run_tailwind (line 10) | fn run_tailwind() {

FILE: crates/omnix-gui/src/app/flake.rs
  function Flake (line 20) | pub fn Flake() -> Element {
  function FlakeInput (line 34) | pub fn FlakeInput() -> Element {
  function FlakeRaw (line 63) | pub fn FlakeRaw() -> Element {
  function FlakeView (line 78) | pub fn FlakeView(flake: Flake) -> Element {
  function SectionHeading (line 91) | pub fn SectionHeading(title: &'static str, extra: Option<String>) -> Ele...
  function FlakeSchemaView (line 104) | pub fn FlakeSchemaView(schema: FlakeSchema) -> Element {
  function BtreeMapView (line 145) | pub fn BtreeMapView(title: &'static str, tree: BTreeMap<String, Leaf>) -...
  function BtreeMapBodyView (line 155) | pub fn BtreeMapBodyView(tree: BTreeMap<String, Leaf>) -> Element {
  function FlakeValView (line 166) | pub fn FlakeValView(k: String, v: Val) -> Element {
  function FlakeOutputsRawView (line 192) | pub fn FlakeOutputsRawView(outs: FlakeOutputs) -> Element {

FILE: crates/omnix-gui/src/app/health.rs
  function Health (line 9) | pub fn Health() -> Element {
  function ViewCheck (line 29) | fn ViewCheck(check: Check) -> Element {
  function CheckResultSummaryView (line 62) | pub fn CheckResultSummaryView(green: bool) -> Element {

FILE: crates/omnix-gui/src/app/info.rs
  function Info (line 12) | pub fn Info() -> Element {
  function NixInfoView (line 28) | fn NixInfoView(info: NixInfo) -> Element {
  function NixVersionView (line 50) | fn NixVersionView(version: NixVersion) -> Element {
  function NixConfigView (line 62) | fn NixConfigView(config: NixConfig) -> Element {
  function ConfigValList (line 80) | fn ConfigValList<T: 'static + PartialEq + Display>(items: Vec<T>) -> Ele...
  function NixEnvView (line 91) | fn NixEnvView(env: NixEnv) -> Element {
  function TableRow (line 115) | fn TableRow(name: &'static str, title: String, children: Element) -> Ele...

FILE: crates/omnix-gui/src/app/mod.rs
  type Route (line 26) | enum Route {
    method go_to_flake (line 41) | fn go_to_flake(url: FlakeUrl) {
    method go_to_dashboard (line 46) | fn go_to_dashboard() {
  function App (line 53) | pub fn App() -> Element {
  function Wrapper (line 60) | fn Wrapper() -> Element {
  function TopBar (line 71) | fn TopBar() -> Element {
  function ViewRefreshButton (line 125) | fn ViewRefreshButton() -> Element {
  function Footer (line 153) | fn Footer() -> Element {
  function Dashboard (line 164) | fn Dashboard() -> Element {

FILE: crates/omnix-gui/src/app/state/datum.rs
  type Datum (line 9) | pub struct Datum<T> {
  method default (line 18) | fn default() -> Self {
  function is_loading_or_refreshing (line 27) | pub fn is_loading_or_refreshing(&self) -> bool {
  function current_value (line 32) | pub fn current_value(&self) -> Option<&T> {
  function set_value (line 36) | pub async fn set_value(signal: &mut Signal<Datum<T>>, value: T)
  function refresh_with (line 46) | pub async fn refresh_with<F>(signal: &mut Signal<Datum<T>>, f: F) -> Opt...
  function render_with (line 103) | pub fn render_with<F>(&self, component: F) -> Element

FILE: crates/omnix-gui/src/app/state/db.rs
  type FlakeCache (line 19) | pub struct FlakeCache(HashMap<FlakeUrl, Option<(SystemTime, Flake)>>);
    method new_signal (line 23) | pub fn new_signal() -> Signal<FlakeCache> {
    method get (line 35) | pub fn get(&self, k: &FlakeUrl) -> Option<Flake> {
    method update (line 42) | pub fn update(&mut self, k: FlakeUrl, flake: Flake) {
    method recent_flakes (line 48) | pub fn recent_flakes(&self) -> Vec<FlakeUrl> {

FILE: crates/omnix-gui/src/app/state/error.rs
  type SystemError (line 5) | pub struct SystemError {
    method from (line 16) | fn from(message: String) -> Self {
  method fmt (line 10) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {

FILE: crates/omnix-gui/src/app/state/mod.rs
  type AppState (line 25) | pub struct AppState {
    method new (line 48) | fn new() -> Self {
    method use_state (line 59) | pub fn use_state() -> Self {
    method provide_state (line 63) | pub fn provide_state() {
    method get_flake_url_string (line 71) | pub fn get_flake_url_string(&self) -> String {
    method set_flake_url (line 78) | pub fn set_flake_url(&mut self, url: FlakeUrl) {
    method reset_flake_data (line 84) | pub fn reset_flake_data(&mut self) {
    method build_network (line 96) | fn build_network(&mut self) {

FILE: crates/omnix-gui/src/app/state/refresh.rs
  type Refresh (line 5) | pub struct Refresh {
    method request_refresh (line 16) | pub fn request_refresh(&mut self) {
  method fmt (line 10) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {

FILE: crates/omnix-gui/src/app/widget.rs
  function RefreshButton (line 8) | pub fn RefreshButton<F: 'static + FnMut(Event<MouseData>)>(busy: bool, m...
  function FolderDialogButton (line 30) | pub fn FolderDialogButton<F: 'static + FnMut(PathBuf)>(mut handler: F) -...
  function get_selected_path (line 61) | fn get_selected_path(evt: Event<FormData>) -> Option<PathBuf> {
  function Loader (line 75) | pub fn Loader() -> Element {
  function LoaderIcon (line 84) | pub fn LoaderIcon(loading: bool) -> Element {
  function Scrollable (line 115) | pub fn Scrollable(children: Element) -> Element {

FILE: crates/omnix-gui/src/cli.rs
  type Args (line 6) | pub struct Args {

FILE: crates/omnix-gui/src/main.rs
  function main (line 8) | fn main() {

FILE: crates/omnix-health/src/check/caches.rs
  type Caches (line 11) | pub struct Caches {
    method get_missing_caches (line 71) | pub fn get_missing_caches(&self, nix_info: &info::NixInfo) -> Vec<Url> {
  method default (line 16) | fn default() -> Self {
  method check (line 24) | fn check(
  type CachixCache (line 81) | pub struct CachixCache(pub String);
    method from_url (line 85) | pub fn from_url(url: &Url) -> Option<Self> {
    method cachix_use (line 97) | pub async fn cachix_use(&self) -> anyhow::Result<()> {

FILE: crates/omnix-health/src/check/direnv.rs
  type Direnv (line 9) | pub struct Direnv {
  method default (line 16) | fn default() -> Self {
  method check (line 25) | fn check(
  function install_check (line 65) | fn install_check(
  function is_path_in_nix_store (line 100) | pub fn is_path_in_nix_store(path: &std::path::Path) -> bool {
  function allowed_check (line 105) | fn allowed_check(

FILE: crates/omnix-health/src/check/flake_enabled.rs
  type FlakeEnabled (line 9) | pub struct FlakeEnabled {}
  method check (line 12) | fn check(

FILE: crates/omnix-health/src/check/homebrew.rs
  type Homebrew (line 10) | pub struct Homebrew {
  method check (line 16) | fn check(
  type HomebrewInstall (line 36) | pub struct HomebrewInstall {
    method detect (line 43) | pub fn detect() -> Option<Self> {
  function installation_check (line 49) | fn installation_check(homebrew_result: &Option<HomebrewInstall>, require...
  constant HOMEBREW_REMOVAL_INSTRUCTIONS (line 80) | const HOMEBREW_REMOVAL_INSTRUCTIONS: &str = r#"To completely remove Home...

FILE: crates/omnix-health/src/check/max_jobs.rs
  type MaxJobs (line 9) | pub struct MaxJobs {}
  method check (line 12) | fn check(

FILE: crates/omnix-health/src/check/nix_version.rs
  type NixVersionCheck (line 13) | pub struct NixVersionCheck {
  method default (line 18) | fn default() -> Self {
  method check (line 26) | fn check(

FILE: crates/omnix-health/src/check/rosetta.rs
  type Rosetta (line 11) | pub struct Rosetta {
  method default (line 17) | fn default() -> Self {
  method check (line 26) | fn check(
  function get_apple_emulation (line 55) | fn get_apple_emulation(system: &OS) -> Option<bool> {

FILE: crates/omnix-health/src/check/shell.rs
  type ShellCheck (line 12) | pub struct ShellCheck {
  method default (line 19) | fn default() -> Self {
  method check (line 28) | fn check(
  type CurrentUserShellEnv (line 87) | struct CurrentUserShellEnv {
    method new (line 98) | fn new(os: &OS) -> Result<Self, ShellError> {
  type ShellError (line 112) | enum ShellError {
  type Shell (line 129) | enum Shell {
    method current_shell (line 137) | fn current_shell() -> Result<Self, ShellError> {
    method from_path (line 144) | fn from_path(exe_path: PathBuf) -> Result<Self, ShellError> {
    method dotfile_names (line 159) | fn dotfile_names(&self, os: &OS) -> Vec<String> {
    method get_dotfiles (line 186) | fn get_dotfiles(&self, os: &OS, home_dir: &Path) -> std::io::Result<Ha...

FILE: crates/omnix-health/src/check/trusted_users.rs
  type TrustedUsers (line 11) | pub struct TrustedUsers {
  method check (line 18) | fn check(
  function is_current_user_trusted (line 59) | fn is_current_user_trusted(nix_info: &nix_rs::info::NixInfo) -> bool {

FILE: crates/omnix-health/src/json.rs
  type HealthOutput (line 15) | pub struct HealthOutput {
    method get (line 23) | pub async fn get(checks: Vec<(&'static str, Check)>) -> anyhow::Result...
  type HealthEnvInfo (line 35) | pub struct HealthEnvInfo {
    method get (line 47) | pub async fn get() -> anyhow::Result<Self> {

FILE: crates/omnix-health/src/lib.rs
  type NixHealth (line 35) | pub struct NixHealth {
    method from_om_config (line 74) | pub fn from_om_config(om_config: &OmConfig) -> Result<Self, OmConfigEr...
    method run_all_checks (line 81) | pub fn run_all_checks(
    method print_report_returning_exit_code (line 91) | pub async fn print_report_returning_exit_code(
    method schema (line 114) | pub fn schema() -> Result<String, serde_json::Error> {
  type Item (line 49) | type Item = &'a dyn traits::Checkable;
  type IntoIter (line 50) | type IntoIter = std::vec::IntoIter<Self::Item>;
  method into_iter (line 53) | fn into_iter(self) -> Self::IntoIter {
  function run_all_checks_with (line 120) | pub async fn run_all_checks_with(
  function print_info_banner (line 154) | async fn print_info_banner(flake_url: Option<&FlakeUrl>, nix_info: &NixI...
  type AllChecksResult (line 187) | enum AllChecksResult {
    method new (line 194) | fn new() -> Self {
    method register_failure (line 198) | fn register_failure(&mut self, required: bool) {
    method report (line 207) | fn report(self) -> i32 {
  function test_json_deserialize_empty (line 238) | fn test_json_deserialize_empty() {
  function test_json_deserialize_nix_version (line 247) | fn test_json_deserialize_nix_version() {
  function test_json_deserialize_caches (line 258) | fn test_json_deserialize_caches() {

FILE: crates/omnix-health/src/report.rs
  type Report (line 9) | pub enum Report<T> {
  type NoDetails (line 17) | pub struct NoDetails;
  function is_green (line 20) | pub fn is_green(&self) -> bool {
  function is_red (line 27) | pub fn is_red(&self) -> bool {
  type WithDetails (line 34) | pub struct WithDetails {
  function without_details (line 43) | pub fn without_details(&self) -> Report<NoDetails> {
  function get_red_details (line 50) | pub fn get_red_details(&self) -> Option<WithDetails> {

FILE: crates/omnix-health/src/traits.rs
  type Checkable (line 5) | pub trait Checkable {
    method check (line 10) | fn check(
  type Check (line 23) | pub struct Check {
    method tracing_log (line 44) | pub async fn tracing_log(&self) -> anyhow::Result<()> {
  type CheckResult (line 81) | pub enum CheckResult {
    method green (line 96) | pub fn green(&self) -> bool {

FILE: crates/omnix-init/src/action.rs
  type Action (line 13) | pub enum Action {
    method has_value (line 52) | pub fn has_value(&self) -> bool {
    method apply (line 60) | pub async fn apply(&self, out_dir: &Path) -> anyhow::Result<()> {
  method fmt (line 33) | fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
  function build_glob_set (line 124) | fn build_glob_set(globs: &[Glob]) -> anyhow::Result<globset::GlobSet> {
  method cmp (line 135) | fn cmp(&self, other: &Self) -> Ordering {
  method partial_cmp (line 145) | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {

FILE: crates/omnix-init/src/config.rs
  type FlakeTemplate (line 11) | pub struct FlakeTemplate<'a> {
  method fmt (line 19) | fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
  function load_templates (line 35) | pub async fn load_templates<'a>(

FILE: crates/omnix-init/src/core.rs
  function select_from_registry (line 12) | pub async fn select_from_registry(nixcmd: &NixCmd) -> anyhow::Result<Fla...
  function run_tests (line 24) | pub async fn run_tests(
  function run (line 59) | pub async fn run(
  function initialize_template (line 114) | async fn initialize_template(path: &Path, template: &FlakeTemplate<'_>) ...

FILE: crates/omnix-init/src/param.rs
  type Param (line 10) | pub struct Param {
    method set_value (line 24) | pub fn set_value(&mut self, val: &Value) {
    method set_value_by_prompting (line 36) | pub fn set_value_by_prompting(&mut self) -> anyhow::Result<()> {
  method fmt (line 18) | fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {

FILE: crates/omnix-init/src/registry.rs
  type Registry (line 22) | pub struct Registry(pub HashMap<String, FlakeUrl>);
  function get (line 24) | pub async fn get(nixcmd: &NixCmd) -> &'static Result<Registry, NixCmdErr...

FILE: crates/omnix-init/src/template.rs
  type Template (line 15) | pub struct Template {
    method scaffold_at (line 35) | pub async fn scaffold_at(&self, out_dir: &Path) -> anyhow::Result<Path...
    method set_param_values (line 52) | pub fn set_param_values(&mut self, values: &HashMap<String, Value>) {
    method apply_actions (line 60) | async fn apply_actions(&self, out_dir: &Path) -> anyhow::Result<()> {
  type NixTemplate (line 24) | pub struct NixTemplate {

FILE: crates/omnix-init/src/test.rs
  type OmInitTest (line 18) | pub struct OmInitTest {
    method can_run_on (line 32) | pub fn can_run_on(&self, system: &System) -> bool {
    method run_test (line 41) | pub async fn run_test(
  type Asserts (line 91) | pub struct Asserts {
    method assert (line 102) | async fn assert(&self, dir: &Path) -> anyhow::Result<()> {
  type PathAsserts (line 128) | pub struct PathAsserts(HashMap<String, bool>);
    method assert (line 131) | fn assert(&self, dir: &Path) {
Condensed preview — 188 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (485K chars).
[
  {
    "path": ".envrc",
    "chars": 479,
    "preview": "source ./doc/om/develop/omnixrc/v1\n\n# We don't watch on `flake/*.nix` to avoid changes in modules not relevant to devShe"
  },
  {
    "path": ".gitattributes",
    "chars": 96,
    "preview": "flake.lock linguist-generated=true\ncrates/omnix-gui/assets/tailwind.css linguist-generated=true\n"
  },
  {
    "path": ".github/workflows/ci.yaml",
    "chars": 2880,
    "preview": "name: \"CI\"\non:\n  push:\n    branches:\n      - \"main\"\n      - \"ci/**\"\n  pull_request:\n\njobs:\n  website:\n    if: github.ref"
  },
  {
    "path": ".github/workflows/website.yaml",
    "chars": 1077,
    "preview": "name: Website Deploy\n\non:\n  workflow_call:\n    inputs:\n      static-site-path:\n        type: string\n        required: tr"
  },
  {
    "path": ".gitignore",
    "chars": 113,
    "preview": "/target\nresult\nresult-lib\ndist\n.direnv\n\n/assets/tailwind.css\n\n/.vscode/spellright.dict\n\n/.pre-commit-config.yaml\n"
  },
  {
    "path": ".vscode/extensions.json",
    "chars": 223,
    "preview": "{\n    \"recommendations\": [\n        \"rust-lang.rust-analyzer\",\n        \"mkhl.direnv\",\n        \"jnoortheen.nix-ide\",\n     "
  },
  {
    "path": ".vscode/settings.json",
    "chars": 619,
    "preview": "{\n    \"nixEnvSelector.nixFile\": \"${workspaceRoot}/shell.nix\",\n    \"rust-analyzer.cargo.features\": \"all\",\n    \"rust-analy"
  },
  {
    "path": "Cargo.toml",
    "chars": 2387,
    "preview": "[workspace]\nresolver = \"2\"\n\nmembers = [\n  \"crates/omnix-common\",\n  \"crates/omnix-cli\",\n  \"crates/omnix-init\",\n  \"crates/"
  },
  {
    "path": "LICENSE",
    "chars": 34523,
    "preview": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C)"
  },
  {
    "path": "README.md",
    "chars": 2045,
    "preview": "[![project chat](https://img.shields.io/github/discussions/juspay/omnix)](https://github.com/juspay/omnix/discussions)\n["
  },
  {
    "path": "bacon.toml",
    "chars": 3158,
    "preview": "# This is a configuration file for the bacon tool\n#\n# Bacon repository: https://github.com/Canop/bacon\n# Complete help o"
  },
  {
    "path": "crates/nix_rs/CHANGELOG.md",
    "chars": 4064,
    "preview": "# Changelog\n\n## Unreleased\n\n- **`flake::url`**:\n  - Remove `qualified_attr` module\n- **`eval::nix_eval`**\n  - Display ev"
  },
  {
    "path": "crates/nix_rs/Cargo.toml",
    "chars": 1178,
    "preview": "[package]\nname = \"nix_rs\"\n# Important: remember to update the top-level Cargo.toml if updating major version\nversion = \""
  },
  {
    "path": "crates/nix_rs/README.md",
    "chars": 265,
    "preview": "# nix_rs\n\n[![Crates.io](https://img.shields.io/crates/v/nix_rs.svg)](https://crates.io/crates/nix_rs)\n\nA Rust crate to i"
  },
  {
    "path": "crates/nix_rs/crate.nix",
    "chars": 131,
    "preview": "{\n  autoWire = [ ];\n  crane = {\n    args = {\n      nativeBuildInputs = [\n        # nix # Tests need nix cli\n      ];\n   "
  },
  {
    "path": "crates/nix_rs/src/arg.rs",
    "chars": 3381,
    "preview": "//! Nix command's arguments\n\nuse std::collections::HashMap;\n\nuse serde::{Deserialize, Serialize};\n\n/// All arguments you"
  },
  {
    "path": "crates/nix_rs/src/command.rs",
    "chars": 7814,
    "preview": "//! Nix base command configuration\n//!\n//! # Example\n//!\n//! ```ignore\n//! use nix_rs::command::NixCmd;\n//! let cmd = Ni"
  },
  {
    "path": "crates/nix_rs/src/config.rs",
    "chars": 5162,
    "preview": "//! Rust module for `nix show-config`\n\nuse std::{convert::Infallible, str::FromStr};\n\nuse serde::{Deserialize, Serialize"
  },
  {
    "path": "crates/nix_rs/src/copy.rs",
    "chars": 1313,
    "preview": "//! Rust module for `nix copy`.\nuse crate::{\n    command::{CommandError, NixCmd},\n    store::uri::StoreURI,\n};\nuse std::"
  },
  {
    "path": "crates/nix_rs/src/detsys_installer.rs",
    "chars": 3110,
    "preview": "//! DetSys installer detection\n// TODO: Move this under 'env' module.\nuse serde::{Deserialize, Serialize};\n\nuse std::{fm"
  },
  {
    "path": "crates/nix_rs/src/env.rs",
    "chars": 8280,
    "preview": "//! Information about the environment in which Nix will run\n// TODO: Make this a package, and split (alongn with detsys_"
  },
  {
    "path": "crates/nix_rs/src/flake/command.rs",
    "chars": 3455,
    "preview": "//! Nix commands for working with flakes\nuse std::{\n    collections::{BTreeMap, HashMap},\n    path::PathBuf,\n};\n\nuse non"
  },
  {
    "path": "crates/nix_rs/src/flake/eval.rs",
    "chars": 1992,
    "preview": "//! Work with `nix eval`\nuse std::process::Stdio;\n\nuse crate::command::{CommandError, NixCmd, NixCmdError};\n\nuse super::"
  },
  {
    "path": "crates/nix_rs/src/flake/functions/README.md",
    "chars": 980,
    "preview": "## Rust + Nix FFI\n\nhttps://github.com/srid/devour-flake introduced the idea of defining \"functions\" in Nix flake, that c"
  },
  {
    "path": "crates/nix_rs/src/flake/functions/addstringcontext/flake.nix",
    "chars": 868,
    "preview": "{\n  inputs = {\n    nixpkgs.url = \"github:nixos/nixpkgs/nixpkgs-unstable\";\n    flake-parts.url = \"github:hercules-ci/flak"
  },
  {
    "path": "crates/nix_rs/src/flake/functions/addstringcontext/mod.rs",
    "chars": 2304,
    "preview": "//! Transform a JSON file with Nix store paths such that the resultant JSON file path will track those paths as dependen"
  },
  {
    "path": "crates/nix_rs/src/flake/functions/core.rs",
    "chars": 5512,
    "preview": "//! Flake function trait\nuse crate::{command::NixCmd, flake::url::FlakeUrl};\nuse lazy_static::lazy_static;\nuse serde::{D"
  },
  {
    "path": "crates/nix_rs/src/flake/functions/metadata/flake.nix",
    "chars": 1786,
    "preview": "{\n  inputs = {\n    nixpkgs.url = \"github:nixos/nixpkgs/nixpkgs-unstable\";\n    flake-parts.url = \"github:hercules-ci/flak"
  },
  {
    "path": "crates/nix_rs/src/flake/functions/metadata/mod.rs",
    "chars": 1915,
    "preview": "//! Retrieve metadata for a flake.\nuse super::core::FlakeFn;\nuse crate::{command::NixCmd, flake::url::FlakeUrl};\nuse laz"
  },
  {
    "path": "crates/nix_rs/src/flake/functions/mod.rs",
    "chars": 284,
    "preview": "//! Calling Nix functions (defined in a flake) from Rust, as if to provide FFI.\n//\n// This model provides a simpler alte"
  },
  {
    "path": "crates/nix_rs/src/flake/mod.rs",
    "chars": 1150,
    "preview": "//! Rust module for Nix flakes\n\npub mod command;\npub mod eval;\npub mod functions;\npub mod outputs;\npub mod schema;\npub m"
  },
  {
    "path": "crates/nix_rs/src/flake/outputs.rs",
    "chars": 1851,
    "preview": "//! Nix flake outputs\n\nuse serde::{Deserialize, Serialize};\nuse std::collections::HashMap;\n\nuse super::schema::{FlakeSch"
  },
  {
    "path": "crates/nix_rs/src/flake/schema.rs",
    "chars": 7207,
    "preview": "//! Nix flake-schemas\n\nuse lazy_static::lazy_static;\nuse serde::{Deserialize, Serialize};\nuse std::{\n    collections::{B"
  },
  {
    "path": "crates/nix_rs/src/flake/system.rs",
    "chars": 2643,
    "preview": "//! Nix system types\nuse std::{\n    convert::Infallible,\n    fmt::{Display, Formatter},\n    str::FromStr,\n};\n\nuse serde:"
  },
  {
    "path": "crates/nix_rs/src/flake/url/attr.rs",
    "chars": 1101,
    "preview": "//! Work with flake attributes\nuse serde::{Deserialize, Serialize};\n\n/// The (optional) attribute output part of a [supe"
  },
  {
    "path": "crates/nix_rs/src/flake/url/core.rs",
    "chars": 8982,
    "preview": "//! Flake URL types\n//!\n//! See <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#url-like-syntax"
  },
  {
    "path": "crates/nix_rs/src/flake/url/mod.rs",
    "chars": 67,
    "preview": "//! Work with flake URLs\npub mod attr;\nmod core;\n\npub use core::*;\n"
  },
  {
    "path": "crates/nix_rs/src/info.rs",
    "chars": 2074,
    "preview": "//! Information about the user's Nix installation\nuse serde::{Deserialize, Serialize};\nuse tokio::sync::OnceCell;\n\nuse c"
  },
  {
    "path": "crates/nix_rs/src/lib.rs",
    "chars": 411,
    "preview": "//! Rust crate to interact with Nix\n//!\n//! This crate exposes various types representing what nix command gives us,\n//!"
  },
  {
    "path": "crates/nix_rs/src/refs.rs",
    "chars": 214,
    "preview": "//! Links to Nix manual and other documentation\n\n/// Link to information about the various Nix versions\npub const RELEAS"
  },
  {
    "path": "crates/nix_rs/src/store/command.rs",
    "chars": 5908,
    "preview": "//! Rust wrapper for `nix-store`\nuse std::path::{Path, PathBuf};\n\nuse crate::command::{CommandError, NixCmdError};\nuse s"
  },
  {
    "path": "crates/nix_rs/src/store/mod.rs",
    "chars": 75,
    "preview": "//! Dealing with the Nix store\npub mod command;\npub mod path;\npub mod uri;\n"
  },
  {
    "path": "crates/nix_rs/src/store/path.rs",
    "chars": 1621,
    "preview": "//! Store path management\nuse std::{\n    convert::Infallible,\n    fmt,\n    path::{Path, PathBuf},\n    str::FromStr,\n};\n\n"
  },
  {
    "path": "crates/nix_rs/src/store/uri.rs",
    "chars": 3271,
    "preview": "//! Store URI management\nuse std::{fmt, str::FromStr};\n\nuse serde::{Deserialize, Serialize};\nuse thiserror::Error;\nuse u"
  },
  {
    "path": "crates/nix_rs/src/system_list.rs",
    "chars": 2980,
    "preview": "//! Dealing with system lists\nuse std::{collections::HashMap, convert::Infallible, str::FromStr};\n\nuse crate::{\n    comm"
  },
  {
    "path": "crates/nix_rs/src/version.rs",
    "chars": 3579,
    "preview": "//! Rust module for `nix --version`\nuse regex::Regex;\nuse serde_with::{DeserializeFromStr, SerializeDisplay};\nuse std::{"
  },
  {
    "path": "crates/nix_rs/src/version_spec.rs",
    "chars": 5632,
    "preview": "//! Version requirement spec for [NixVersion]\n\nuse std::{fmt, str::FromStr};\n\nuse regex::Regex;\nuse serde::{Deserialize,"
  },
  {
    "path": "crates/omnix-ci/CHANGELOG.md",
    "chars": 4248,
    "preview": "## Unreleased\n\n- Crate renamed to `omnix-ci`\n- New\n  - Introduced notion of 'steps'. Renamed 'build' to 'run'.\n    - Add"
  },
  {
    "path": "crates/omnix-ci/Cargo.toml",
    "chars": 1288,
    "preview": "[package]\nauthors = [\"Sridhar Ratnakumar <srid@srid.ca>\"]\nedition = \"2021\"\n# If you change the name here, you must also "
  },
  {
    "path": "crates/omnix-ci/LICENSE",
    "chars": 34523,
    "preview": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C)"
  },
  {
    "path": "crates/omnix-ci/README.md",
    "chars": 184,
    "preview": "# `omnix-ci`\n\n[![Crates.io](https://img.shields.io/crates/v/omnix-ci.svg)](https://crates.io/crates/omnix-ci)\n\nThe Rust "
  },
  {
    "path": "crates/omnix-ci/crate.nix",
    "chars": 387,
    "preview": "{ pkgs\n, lib\n, ...\n}:\n{\n  autoWire = [ ];\n  crane = {\n    args = {\n      nativeBuildInputs = with pkgs; lib.optionals st"
  },
  {
    "path": "crates/omnix-ci/src/command/core.rs",
    "chars": 2135,
    "preview": "//! The `om ci` subcommands\nuse clap::Subcommand;\nuse colored::Colorize;\nuse nix_rs::command::NixCmd;\nuse omnix_common::"
  },
  {
    "path": "crates/omnix-ci/src/command/gh_matrix.rs",
    "chars": 1110,
    "preview": "//! The gh-matrix command\nuse clap::Parser;\nuse nix_rs::{command::NixCmd, flake::system::System};\nuse omnix_common::conf"
  },
  {
    "path": "crates/omnix-ci/src/command/mod.rs",
    "chars": 96,
    "preview": "//! CLI commands for omnix-ci\npub mod core;\npub mod gh_matrix;\npub mod run;\npub mod run_remote;\n"
  },
  {
    "path": "crates/omnix-ci/src/command/run.rs",
    "chars": 9843,
    "preview": "//! The run command\nuse std::{\n    collections::HashMap,\n    env,\n    io::Write,\n    path::{Path, PathBuf},\n};\n\nuse anyh"
  },
  {
    "path": "crates/omnix-ci/src/command/run_remote.rs",
    "chars": 7466,
    "preview": "//! Functions for running `ci run` on remote machine.\n\nuse colored::Colorize;\nuse nix_rs::{\n    command::{CommandError, "
  },
  {
    "path": "crates/omnix-ci/src/config/core.rs",
    "chars": 928,
    "preview": "//! The top-level configuration of omnix-ci, as defined in flake.nix\n\n#[cfg(test)]\nmod tests {\n    use nix_rs::{command:"
  },
  {
    "path": "crates/omnix-ci/src/config/mod.rs",
    "chars": 94,
    "preview": "//! omnix-ci config defined in `flake.nix`\npub mod core;\npub mod subflake;\npub mod subflakes;\n"
  },
  {
    "path": "crates/omnix-ci/src/config/subflake.rs",
    "chars": 1712,
    "preview": "//! Subflake configuration\nuse std::collections::BTreeMap;\n\nuse nix_rs::flake::{system::System, url::FlakeUrl};\nuse serd"
  },
  {
    "path": "crates/omnix-ci/src/config/subflakes.rs",
    "chars": 705,
    "preview": "//! Subflakes configuration group.\nuse std::collections::BTreeMap;\n\nuse serde::Deserialize;\n\nuse super::subflake::Subfla"
  },
  {
    "path": "crates/omnix-ci/src/flake_ref.rs",
    "chars": 2364,
    "preview": "//! A reference to some flake living somewhere\nuse std::{\n    fmt::{Display, Formatter},\n    str::FromStr,\n};\n\nuse anyho"
  },
  {
    "path": "crates/omnix-ci/src/github/actions.rs",
    "chars": 552,
    "preview": "//! Working with GitHub Actions\n\nuse std::future::Future;\n\n/// Group log lines in GitHub Actions\n///\n/// https://docs.gi"
  },
  {
    "path": "crates/omnix-ci/src/github/matrix.rs",
    "chars": 1269,
    "preview": "//! Github Actions matrix\nuse nix_rs::flake::system::System;\nuse serde::{Deserialize, Serialize};\n\nuse crate::config::su"
  },
  {
    "path": "crates/omnix-ci/src/github/mod.rs",
    "chars": 95,
    "preview": "//! GitHub related types and functions.\npub mod actions;\npub mod matrix;\npub mod pull_request;\n"
  },
  {
    "path": "crates/omnix-ci/src/github/pull_request.rs",
    "chars": 3501,
    "preview": "//! Github Pull Request API\nuse std::fmt::Display;\n\n/// Enough types to get branch info from Pull Request URL\nuse anyhow"
  },
  {
    "path": "crates/omnix-ci/src/lib.rs",
    "chars": 152,
    "preview": "//! omnix-ci: CI for Nix projects\n#![warn(missing_docs)]\npub mod command;\npub mod config;\npub mod flake_ref;\npub mod git"
  },
  {
    "path": "crates/omnix-ci/src/nix/devour_flake.rs",
    "chars": 1638,
    "preview": "//! Rust support for invoking <https://github.com/srid/devour-flake>\n\nuse lazy_static::lazy_static;\nuse nix_rs::{\n    fl"
  },
  {
    "path": "crates/omnix-ci/src/nix/lock.rs",
    "chars": 465,
    "preview": "//! Functions for working with `nix flake lock`.\n\nuse anyhow::{Ok, Result};\nuse nix_rs::{\n    command::NixCmd,\n    flake"
  },
  {
    "path": "crates/omnix-ci/src/nix/mod.rs",
    "chars": 73,
    "preview": "//! Nix-specific types and functions\npub mod devour_flake;\npub mod lock;\n"
  },
  {
    "path": "crates/omnix-ci/src/step/build.rs",
    "chars": 3734,
    "preview": "//! The build step\nuse clap::Parser;\nuse colored::Colorize;\nuse nix_rs::{\n    command::NixCmd,\n    flake::{functions::co"
  },
  {
    "path": "crates/omnix-ci/src/step/core.rs",
    "chars": 2369,
    "preview": "//! All CI steps available\nuse clap::Parser;\nuse nix_rs::{\n    command::NixCmd,\n    flake::{system::System, url::FlakeUr"
  },
  {
    "path": "crates/omnix-ci/src/step/custom.rs",
    "chars": 5959,
    "preview": "//! Custom steps in the CI pipeline\nuse colored::Colorize;\nuse nonempty::NonEmpty;\nuse serde::Deserialize;\nuse std::{col"
  },
  {
    "path": "crates/omnix-ci/src/step/flake_check.rs",
    "chars": 1290,
    "preview": "//! The cachix step\nuse colored::Colorize;\nuse nix_rs::{\n    command::NixCmd,\n    flake::{self, command::FlakeOptions, u"
  },
  {
    "path": "crates/omnix-ci/src/step/lockfile.rs",
    "chars": 1035,
    "preview": "//! The lockfile step\nuse colored::Colorize;\nuse nix_rs::{command::NixCmd, flake::url::FlakeUrl};\nuse serde::Deserialize"
  },
  {
    "path": "crates/omnix-ci/src/step/mod.rs",
    "chars": 128,
    "preview": "//! CI is broken down into various 'steps'.\npub mod build;\npub mod core;\npub mod custom;\npub mod flake_check;\npub mod lo"
  },
  {
    "path": "crates/omnix-cli/Cargo.toml",
    "chars": 1216,
    "preview": "[package]\nname = \"omnix-cli\"\nversion = \"1.3.2\"\nedition = \"2021\"\ndefault-run = \"om\"\n# NOTE: The 'description' here will b"
  },
  {
    "path": "crates/omnix-cli/crate.nix",
    "chars": 1402,
    "preview": "{ pkgs\n, lib\n, ...\n}:\n\nlet\n  inherit (pkgs) stdenv pkgsStatic;\nin\n{\n  autoWire = [ ];\n  crane = {\n    args = {\n      nat"
  },
  {
    "path": "crates/omnix-cli/src/args.rs",
    "chars": 339,
    "preview": "use clap::Parser;\nuse clap_verbosity_flag::{InfoLevel, Verbosity};\n\nuse crate::command::core::Command;\n\n/// Omnix CLI en"
  },
  {
    "path": "crates/omnix-cli/src/command/ci.rs",
    "chars": 564,
    "preview": "use clap::Parser;\nuse omnix_ci::command::core::Command;\n\n/// Build all outputs of the flake\n#[derive(Parser, Debug)]\npub"
  },
  {
    "path": "crates/omnix-cli/src/command/completion.rs",
    "chars": 1391,
    "preview": "use clap::CommandFactory;\nuse clap::Parser;\nuse clap_complete::generate;\n\n/// Generates shell completion scripts\n#[deriv"
  },
  {
    "path": "crates/omnix-cli/src/command/core.rs",
    "chars": 989,
    "preview": "use clap::Subcommand;\n\n#[derive(Subcommand, Debug)]\npub enum Command {\n    Show(super::show::ShowCommand),\n\n    Init(sup"
  },
  {
    "path": "crates/omnix-cli/src/command/develop.rs",
    "chars": 1386,
    "preview": "use clap::Parser;\nuse nix_rs::{command::NixCmd, flake::url::FlakeUrl};\nuse omnix_common::config::OmConfig;\n\n/// Prepare "
  },
  {
    "path": "crates/omnix-cli/src/command/health.rs",
    "chars": 1176,
    "preview": "use clap::Parser;\nuse nix_rs::{command::NixCmd, flake::url::FlakeUrl};\nuse omnix_health::{run_all_checks_with, NixHealth"
  },
  {
    "path": "crates/omnix-cli/src/command/init.rs",
    "chars": 3008,
    "preview": "use std::{collections::HashMap, path::PathBuf, str::FromStr};\n\nuse clap::Parser;\nuse nix_rs::{command::NixCmd, config::N"
  },
  {
    "path": "crates/omnix-cli/src/command/mod.rs",
    "chars": 107,
    "preview": "pub mod ci;\npub mod completion;\npub mod core;\npub mod develop;\npub mod health;\npub mod init;\npub mod show;\n"
  },
  {
    "path": "crates/omnix-cli/src/command/show.rs",
    "chars": 4935,
    "preview": "use std::io::IsTerminal;\n\nuse anyhow::Context;\nuse clap::Parser;\nuse colored::Colorize;\nuse nix_rs::{\n    command::NixCm"
  },
  {
    "path": "crates/omnix-cli/src/lib.rs",
    "chars": 31,
    "preview": "pub mod args;\npub mod command;\n"
  },
  {
    "path": "crates/omnix-cli/src/main.rs",
    "chars": 551,
    "preview": "use clap::Parser;\n\n#[tokio::main]\nasync fn main() -> anyhow::Result<()> {\n    // To avoid clippy warning\n    // error: u"
  },
  {
    "path": "crates/omnix-cli/tests/command/ci.rs",
    "chars": 5007,
    "preview": "use std::path::{Path, PathBuf};\n\nuse anyhow::bail;\nuse nix_rs::store::path::StorePath;\nuse regex::Regex;\nuse serde::de::"
  },
  {
    "path": "crates/omnix-cli/tests/command/core.rs",
    "chars": 291,
    "preview": "use assert_cmd::Command;\n\n/// `om --help` works\n#[test]\nfn om_help() -> anyhow::Result<()> {\n    om()?.arg(\"--help\").ass"
  },
  {
    "path": "crates/omnix-cli/tests/command/health.rs",
    "chars": 321,
    "preview": "use predicates::{prelude::*, str::contains};\n\nuse super::core::om;\n\n/// `om health` runs, and succeeds.\n#[test]\nfn om_he"
  },
  {
    "path": "crates/omnix-cli/tests/command/init.rs",
    "chars": 1466,
    "preview": "use nix_rs::{command::NixCmd, config::NixConfig};\n\n/// `om init` runs and successfully initializes a template\n#[tokio::t"
  },
  {
    "path": "crates/omnix-cli/tests/command/mod.rs",
    "chars": 50,
    "preview": "mod ci;\nmod core;\nmod health;\nmod init;\nmod show;\n"
  },
  {
    "path": "crates/omnix-cli/tests/command/show.rs",
    "chars": 1289,
    "preview": "use predicates::{prelude::*, str::contains};\n\nuse super::core::om;\n\n/// `om show` runs, and succeeds for a local flake.\n"
  },
  {
    "path": "crates/omnix-cli/tests/flake.nix",
    "chars": 1416,
    "preview": "# A dummy flake to cache test dependencies in Nix store.\n{\n  inputs = {\n    nixpkgs.url = \"github:nixos/nixpkgs/nixpkgs-"
  },
  {
    "path": "crates/omnix-cli/tests/test.rs",
    "chars": 42,
    "preview": "extern crate assert_matches;\nmod command;\n"
  },
  {
    "path": "crates/omnix-common/Cargo.toml",
    "chars": 865,
    "preview": "[package]\nname = \"omnix-common\"\nversion = \"1.3.0\"\nedition = \"2021\"\nrepository = \"https://github.com/juspay/omnix\"\nlicens"
  },
  {
    "path": "crates/omnix-common/crate.nix",
    "chars": 22,
    "preview": "{\n  autoWire = [ ];\n}\n"
  },
  {
    "path": "crates/omnix-common/src/check.rs",
    "chars": 652,
    "preview": "//! Prerequisite checks for the Omnix project.\n\nuse std::path::PathBuf;\nuse which::{which, Error};\n\n/// Check if Nix is "
  },
  {
    "path": "crates/omnix-common/src/config.rs",
    "chars": 6261,
    "preview": "//! Manage omnix configuration in flake.nix\n\nuse std::collections::BTreeMap;\n\nuse nix_rs::{\n    command::NixCmd,\n    fla"
  },
  {
    "path": "crates/omnix-common/src/fs.rs",
    "chars": 2680,
    "preview": "//! Filesystem utilities\nuse async_walkdir::{DirEntry, WalkDir};\nuse futures_lite::stream::StreamExt;\nuse std::{\n    os:"
  },
  {
    "path": "crates/omnix-common/src/lib.rs",
    "chars": 125,
    "preview": "//! Omnix library crate\n#![warn(missing_docs)]\npub mod check;\npub mod config;\npub mod fs;\npub mod logging;\npub mod markd"
  },
  {
    "path": "crates/omnix-common/src/logging.rs",
    "chars": 3432,
    "preview": "//! Logging setup for omnix\n\nuse clap_verbosity_flag::{InfoLevel, Level, Verbosity};\nuse std::fmt;\nuse tracing::{Event, "
  },
  {
    "path": "crates/omnix-common/src/markdown.rs",
    "chars": 1962,
    "preview": "//! Markdown rendering using `mdcat`\nuse anyhow::Context;\nuse lazy_static::lazy_static;\nuse pulldown_cmark::{Options, Pa"
  },
  {
    "path": "crates/omnix-develop/Cargo.toml",
    "chars": 906,
    "preview": "[package]\nauthors = [\"Sridhar Ratnakumar <srid@srid.ca>\"]\nedition = \"2021\"\n# If you change the name here, you must also "
  },
  {
    "path": "crates/omnix-develop/crate.nix",
    "chars": 42,
    "preview": "{\n  autoWire = [ ];\n  crane.args = { };\n}\n"
  },
  {
    "path": "crates/omnix-develop/src/config.rs",
    "chars": 502,
    "preview": "use serde::Deserialize;\n\nuse omnix_common::config::OmConfig;\n\nuse crate::readme::Readme;\n\n#[derive(Debug, Deserialize, C"
  },
  {
    "path": "crates/omnix-develop/src/core.rs",
    "chars": 3924,
    "preview": "use anyhow::Context;\nuse std::{env::current_dir, path::PathBuf};\n\nuse nix_rs::{flake::url::FlakeUrl, info::NixInfo};\nuse"
  },
  {
    "path": "crates/omnix-develop/src/lib.rs",
    "chars": 46,
    "preview": "pub mod config;\npub mod core;\npub mod readme;\n"
  },
  {
    "path": "crates/omnix-develop/src/readme.rs",
    "chars": 526,
    "preview": "use serde::Deserialize;\n\nconst DEFAULT: &str = r#\"🍾 Welcome to the project\n\n*(Want to show custom instructions here? Add"
  },
  {
    "path": "crates/omnix-gui/Cargo.toml",
    "chars": 1327,
    "preview": "[package]\nedition = \"2021\"\nlicense = \"AGPL-3.0-only\"\nrepository = \"https://github.com/juspay/omnix\"\n# If you change the "
  },
  {
    "path": "crates/omnix-gui/Dioxus.toml",
    "chars": 1276,
    "preview": "[application]\nname = \"omnix-gui\"\ndefault_platform = \"desktop\"\nout_dir = \"dist\"\nasset_dir = \"assets\"\n\n[web.app]\ntitle = \""
  },
  {
    "path": "crates/omnix-gui/assets/tailwind.css",
    "chars": 11524,
    "preview": "/*! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:bord"
  },
  {
    "path": "crates/omnix-gui/build.rs",
    "chars": 490,
    "preview": "use std::process::Command;\n\nconst INPUT_CSS_PATH: &str = \"./css/input.css\";\nconst PUBLIC_DIR: &str = \"./assets/\";\n\nfn ma"
  },
  {
    "path": "crates/omnix-gui/crate.nix",
    "chars": 519,
    "preview": "{ flake\n, pkgs\n, lib\n, rust-project\n, ...\n}:\n\nlet\n  inherit (flake) inputs;\nin\n{\n  autoWire = [ ];\n  crane = {\n    args "
  },
  {
    "path": "crates/omnix-gui/css/input.css",
    "chars": 59,
    "preview": "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n"
  },
  {
    "path": "crates/omnix-gui/src/app/flake.rs",
    "chars": 8092,
    "preview": "//! UI for /flake segment of the app\n\nuse std::{collections::BTreeMap, path::PathBuf};\n\nuse dioxus::prelude::*;\nuse diox"
  },
  {
    "path": "crates/omnix-gui/src/app/health.rs",
    "chars": 2443,
    "preview": "//! Nix health check UI\n\nuse dioxus::prelude::*;\nuse omnix_health::traits::{Check, CheckResult};\n\nuse crate::{app::state"
  },
  {
    "path": "crates/omnix-gui/src/app/info.rs",
    "chars": 3846,
    "preview": "//! Nix info UI\n\nuse std::fmt::Display;\n\nuse dioxus::prelude::*;\nuse nix_rs::{config::NixConfig, env::NixEnv, info::NixI"
  },
  {
    "path": "crates/omnix-gui/src/app/mod.rs",
    "chars": 5469,
    "preview": "//! Frontend UI entry point\n\n// Workaround for https://github.com/rust-lang/rust-analyzer/issues/15344\n#![allow(non_snak"
  },
  {
    "path": "crates/omnix-gui/src/app/state/datum.rs",
    "chars": 3702,
    "preview": "use std::{fmt::Display, future::Future};\n\nuse dioxus::prelude::*;\nuse dioxus_signals::{CopyValue, Signal};\nuse tokio::ta"
  },
  {
    "path": "crates/omnix-gui/src/app/state/db.rs",
    "chars": 2159,
    "preview": "//! A database of [Flake] intended to be cached in dioxus [Signal] and persisted to disk.\n//!\n//! This is purposefully d"
  },
  {
    "path": "crates/omnix-gui/src/app/state/error.rs",
    "chars": 422,
    "preview": "use std::fmt::Display;\n\n/// Catch all error to use in UI components\n#[derive(Debug, Clone, PartialEq, Eq, Hash)]\npub str"
  },
  {
    "path": "crates/omnix-gui/src/app/state/mod.rs",
    "chars": 7607,
    "preview": "//! Application state\n\nmod datum;\nmod db;\nmod error;\nmod refresh;\n\nuse dioxus::prelude::*;\nuse dioxus_signals::{Readable"
  },
  {
    "path": "crates/omnix-gui/src/app/state/refresh.rs",
    "chars": 494,
    "preview": "use std::fmt::Display;\n\n/// Represents an user request to update some thing (a dioxus Signal)\n#[derive(Debug, Default, C"
  },
  {
    "path": "crates/omnix-gui/src/app/widget.rs",
    "chars": 3517,
    "preview": "//! Various widgets\n\nuse std::path::PathBuf;\n\nuse dioxus::prelude::*;\n\n/// A refresh button with a busy indicator\npub fn"
  },
  {
    "path": "crates/omnix-gui/src/cli.rs",
    "chars": 205,
    "preview": "//! Command-line interface\nuse clap::Parser;\nuse clap_verbosity_flag::{InfoLevel, Verbosity};\n\n#[derive(Parser, Debug)]\n"
  },
  {
    "path": "crates/omnix-gui/src/main.rs",
    "chars": 777,
    "preview": "#![feature(let_chains)]\nuse dioxus::prelude::*;\nuse dioxus_desktop::{LogicalSize, WindowBuilder};\n\nmod app;\nmod cli;\n\nfn"
  },
  {
    "path": "crates/omnix-gui/tailwind.config.js",
    "chars": 626,
    "preview": "const colors = require('tailwindcss/colors')\nconst defaultTheme = require('tailwindcss/defaultTheme')\n\nmodule.exports = "
  },
  {
    "path": "crates/omnix-health/CHANGELOG.md",
    "chars": 1511,
    "preview": "# Changelog\n\n## Unreleased\n\n- Crate renamed to `omnix-health`\n- Remove unused `logging` module\n- Display Nix installer u"
  },
  {
    "path": "crates/omnix-health/Cargo.toml",
    "chars": 962,
    "preview": "[package]\nname = \"omnix-health\"\nversion = \"1.3.2\"\nlicense = \"Apache-2.0\"\nrepository = \"https://github.com/juspay/omnix\"\n"
  },
  {
    "path": "crates/omnix-health/README.md",
    "chars": 204,
    "preview": "# `omnix-health`\n\n[![Crates.io](https://img.shields.io/crates/v/omnix-health.svg)](https://crates.io/crates/omnix-health"
  },
  {
    "path": "crates/omnix-health/crate.nix",
    "chars": 131,
    "preview": "{\n  autoWire = [ ];\n  crane = {\n    args = {\n      nativeBuildInputs = [\n        # nix # Tests need nix cli\n      ];\n   "
  },
  {
    "path": "crates/omnix-health/failing/.envrc",
    "chars": 58,
    "preview": "# Just a dummy .envrc for testing flake.nix checks\ninvalid"
  },
  {
    "path": "crates/omnix-health/failing/flake.nix",
    "chars": 446,
    "preview": "# Just a flake.nix to configure omnix-health to fail all possible checks\n#\n# Used for testing purposes; run as:\n#   carg"
  },
  {
    "path": "crates/omnix-health/module/flake-module.nix",
    "chars": 780,
    "preview": "{ self, lib, flake-parts-lib, ... }:\n\nlet\n  inherit (flake-parts-lib)\n    mkPerSystemOption;\nin\n{\n  options = {\n    perS"
  },
  {
    "path": "crates/omnix-health/module/flake.nix",
    "chars": 64,
    "preview": "{\n  outputs = _: {\n    flakeModule = ./flake-module.nix;\n  };\n}\n"
  },
  {
    "path": "crates/omnix-health/src/check/caches.rs",
    "chars": 3278,
    "preview": "use nix_rs::info;\nuse serde::{Deserialize, Serialize};\nuse url::Url;\n\nuse crate::traits::*;\n\n/// Check that [nix_rs::con"
  },
  {
    "path": "crates/omnix-health/src/check/direnv.rs",
    "chars": 4354,
    "preview": "use nix_rs::{flake::url::FlakeUrl, info};\nuse serde::{Deserialize, Serialize};\n\nuse crate::traits::{Check, CheckResult, "
  },
  {
    "path": "crates/omnix-health/src/check/flake_enabled.rs",
    "chars": 1171,
    "preview": "use nix_rs::info;\nuse serde::{Deserialize, Serialize};\n\nuse crate::traits::*;\n\n/// Check that [nix_rs::config::NixConfig"
  },
  {
    "path": "crates/omnix-health/src/check/homebrew.rs",
    "chars": 2862,
    "preview": "use nix_rs::{flake::url::FlakeUrl, info::NixInfo};\nuse omnix_common::check::which_strict;\nuse serde::{Deserialize, Seria"
  },
  {
    "path": "crates/omnix-health/src/check/max_jobs.rs",
    "chars": 1124,
    "preview": "use nix_rs::info;\nuse serde::{Deserialize, Serialize};\n\nuse crate::traits::*;\n\n/// Check that [nix_rs::config::NixConfig"
  },
  {
    "path": "crates/omnix-health/src/check/mod.rs",
    "chars": 193,
    "preview": "//! Individual Nix checks\npub mod caches;\npub mod direnv;\npub mod flake_enabled;\npub mod homebrew;\npub mod max_jobs;\npub"
  },
  {
    "path": "crates/omnix-health/src/check/nix_version.rs",
    "chars": 1648,
    "preview": "use std::str::FromStr;\n\nuse nix_rs::version_spec::NixVersionReq;\n\nuse nix_rs::info;\nuse serde::{Deserialize, Serialize};"
  },
  {
    "path": "crates/omnix-health/src/check/rosetta.rs",
    "chars": 2222,
    "preview": "use nix_rs::{env::OS, info};\nuse serde::{Deserialize, Serialize};\n\nuse crate::traits::{Check, CheckResult, Checkable};\n\n"
  },
  {
    "path": "crates/omnix-health/src/check/shell.rs",
    "chars": 6349,
    "preview": "use nix_rs::env::OS;\nuse serde::{Deserialize, Serialize};\nuse std::{\n    collections::HashMap,\n    hash::Hash,\n    path:"
  },
  {
    "path": "crates/omnix-health/src/check/trusted_users.rs",
    "chars": 2577,
    "preview": "use std::collections::HashSet;\n\nuse nix_rs::config::TrustedUserValue;\nuse serde::{Deserialize, Serialize};\n\nuse crate::t"
  },
  {
    "path": "crates/omnix-health/src/json.rs",
    "chars": 1700,
    "preview": "//! JSON output schema for health checks\nuse crate::traits::Check;\nuse anyhow::Context;\nuse bytesize::ByteSize;\nuse nix_"
  },
  {
    "path": "crates/omnix-health/src/lib.rs",
    "chars": 7890,
    "preview": "//! Health checks for the user's Nix install\n\npub mod check;\npub mod json;\npub mod report;\npub mod traits;\n\nuse anyhow::"
  },
  {
    "path": "crates/omnix-health/src/report.rs",
    "chars": 1678,
    "preview": "use serde::{Deserialize, Serialize};\n\n/// Health report\n///\n/// If you just want the binary indicator, use `Report<NoDet"
  },
  {
    "path": "crates/omnix-health/src/traits.rs",
    "chars": 3188,
    "preview": "use colored::Colorize;\nuse serde::{Deserialize, Serialize};\n\n/// Types that can do specific \"health check\" for Nix\npub t"
  },
  {
    "path": "crates/omnix-init/Cargo.toml",
    "chars": 975,
    "preview": "[package]\nauthors = [\"Sridhar Ratnakumar <srid@srid.ca>\"]\nedition = \"2021\"\n# If you change the name here, you must also "
  },
  {
    "path": "crates/omnix-init/crate.nix",
    "chars": 42,
    "preview": "{\n  autoWire = [ ];\n  crane.args = { };\n}\n"
  },
  {
    "path": "crates/omnix-init/registry/flake.nix",
    "chars": 656,
    "preview": "# `om init` registry's canonical source\n#\n# Get JSON using:\n# nix eval --json .#registry | jq\n{\n  inputs = {\n    haskell"
  },
  {
    "path": "crates/omnix-init/src/action.rs",
    "chars": 5745,
    "preview": "use anyhow::Context;\nuse globset::{Glob, GlobSetBuilder};\nuse itertools::Itertools;\nuse serde::Deserialize;\nuse std::cmp"
  },
  {
    "path": "crates/omnix-init/src/config.rs",
    "chars": 1400,
    "preview": "use std::fmt::{self, Display, Formatter};\n\nuse colored::Colorize;\nuse nix_rs::{command::NixCmd, flake::url::FlakeUrl};\nu"
  },
  {
    "path": "crates/omnix-init/src/core.rs",
    "chars": 4486,
    "preview": "use std::{collections::HashMap, path::Path};\n\nuse crate::config::{load_templates, FlakeTemplate};\nuse anyhow::Context;\nu"
  },
  {
    "path": "crates/omnix-init/src/lib.rs",
    "chars": 153,
    "preview": "#[macro_use]\nextern crate assert_matches;\npub mod action;\npub mod config;\npub mod core;\npub mod param;\npub mod registry;"
  },
  {
    "path": "crates/omnix-init/src/param.rs",
    "chars": 1771,
    "preview": "use std::fmt::{self, Display, Formatter};\n\nuse serde::Deserialize;\nuse serde_json::Value;\n\nuse crate::action::Action;\n\n/"
  },
  {
    "path": "crates/omnix-init/src/registry.rs",
    "chars": 1009,
    "preview": "use lazy_static::lazy_static;\nuse std::{collections::HashMap, path::Path};\n\nuse nix_rs::{\n    command::{NixCmd, NixCmdEr"
  },
  {
    "path": "crates/omnix-init/src/template.rs",
    "chars": 2393,
    "preview": "use std::{\n    collections::{BTreeMap, HashMap},\n    path::{Path, PathBuf},\n};\n\nuse anyhow::Context;\nuse itertools::Iter"
  },
  {
    "path": "crates/omnix-init/src/test.rs",
    "chars": 4256,
    "preview": "use std::{\n    collections::HashMap,\n    path::{Path, PathBuf},\n};\n\nuse anyhow::Context;\nuse nix_rs::{\n    command::NixC"
  },
  {
    "path": "doc/.gitignore",
    "chars": 5,
    "preview": "/book"
  },
  {
    "path": "doc/config.md",
    "chars": 457,
    "preview": "---\nshort-title: Configuration\n---\n\n# Omnix Configuration\n\nYou can configure Omnix's behaviour on your repository by cre"
  },
  {
    "path": "doc/flake.nix",
    "chars": 695,
    "preview": "{\n  inputs = {\n    emanote.url = \"github:srid/emanote\";\n    emanote.inputs.emanote-template.follows = \"\";\n    nixpkgs.fo"
  },
  {
    "path": "doc/history.md",
    "chars": 2935,
    "preview": "---\norder: 100\n---\n\n# Release history\n\n## 1.3.2 (2026-01-06) {#1.3.2}\n\n### Bumps\n\n- `syntect`: `5.3.2` -> `5.3.3`\n\n## 1."
  },
  {
    "path": "doc/index.md",
    "chars": 960,
    "preview": "# Omnix\n\n**Omnix** aims to supplement the [Nix](https://nixos.asia/en/nix) CLI to improve developer experience. The proj"
  },
  {
    "path": "doc/index.yaml",
    "chars": 719,
    "preview": "# Emanote configuration for Omnix documentation\n# Ref: https://github.com/srid/emanote/blob/master/emanote/default/index"
  },
  {
    "path": "doc/mod.just",
    "chars": 127,
    "preview": "default:\n  @just --list doc\n\n# Run emanote live server\nrun:\n  nix run\n\n# Do link checks on docs\ncheck:\n    nix run .#lin"
  },
  {
    "path": "doc/om/ci.md",
    "chars": 9220,
    "preview": "# `om ci`\n\n`om ci` runs continuous integration (CI)-friendly builds for your project. It builds all outputs in the flake"
  },
  {
    "path": "doc/om/develop/omnixrc/v1",
    "chars": 1139,
    "preview": "# -*- mode: sh -*-\n# shellcheck shell=bash\n\n# A flag to control whether to use omnix from latest github repo or from nix"
  },
  {
    "path": "doc/om/develop.md",
    "chars": 1737,
    "preview": "# `om develop`\n\nThe `om develop` command should be used indirectly in direnv, via the `use omnix` directive in your `.en"
  },
  {
    "path": "doc/om/health.md",
    "chars": 3122,
    "preview": "# `om health`\n\nThe `om health` command checks the health of your Nix install. Furthermore, individual projects can confi"
  },
  {
    "path": "doc/om/init.md",
    "chars": 4085,
    "preview": "# `om init`\n\nThe `om init` command provides a better [`nix flake init`](https://nix.dev/manual/nix/2.18/command-ref/new-"
  },
  {
    "path": "doc/om/show.md",
    "chars": 2292,
    "preview": "# `om show`\n\nThe `om show` command seeks to provide a better `nix flake show` experience.\n\n> [!WARNING]\n> Currently, `om"
  },
  {
    "path": "doc/om.md",
    "chars": 320,
    "preview": "\n# The `om` CLI\n\nThe Omnix CLI currently provides a fully-functioning [[ci]] and [[health]] commands. The [[show]] comma"
  },
  {
    "path": "flake.nix",
    "chars": 1588,
    "preview": "{\n  nixConfig = {\n    extra-substituters = \"https://cache.nixos.asia/oss\";\n    extra-trusted-public-keys = \"oss:KO872wNJ"
  },
  {
    "path": "justfile",
    "chars": 1010,
    "preview": "# Documentation targets\nmod doc\n\ndefault:\n    @just --list\n\n# Run all pre-commit hooks on all files\npca:\n    pre-commit "
  },
  {
    "path": "nix/envs/default.nix",
    "chars": 2342,
    "preview": "{ src, lib, cachix, fetchFromGitHub }:\nlib.mapAttrs (_: v: builtins.toString v) {\n  OMNIX_SOURCE = src;\n  CACHIX_BIN = l"
  },
  {
    "path": "nix/flake-schemas/flake.nix",
    "chars": 3320,
    "preview": "{\n  inputs = {\n    flake-schemas.url = \"github:DeterminateSystems/flake-schemas\";\n  };\n  outputs = { flake-schemas, ... "
  },
  {
    "path": "nix/modules/flake/closure-size.nix",
    "chars": 1073,
    "preview": "{ ... }:\n\nlet\n\n  maxSize = 1000000 * maxSizeInMB.total;\n  maxSizeInMB = rec {\n    total = omnix + cachix;\n    omnix = 60"
  },
  {
    "path": "nix/modules/flake/devshell.nix",
    "chars": 897,
    "preview": "let\n  root = ../../..;\nin\n{\n  imports = [\n    (root + /crates/omnix-health/module/flake-module.nix)\n  ];\n\n  perSystem = "
  },
  {
    "path": "nix/modules/flake/nixpkgs.nix",
    "chars": 985,
    "preview": "{ inputs, ... }:\n{\n  imports = [\n    inputs.rust-flake.flakeModules.nixpkgs\n  ];\n  perSystem = { inputs', config, self',"
  },
  {
    "path": "nix/modules/flake/pre-commit.nix",
    "chars": 231,
    "preview": "{ inputs, ... }:\n{\n  imports = [\n    (inputs.git-hooks + /flake-module.nix)\n  ];\n\n  perSystem = {\n    pre-commit.setting"
  },
  {
    "path": "nix/modules/flake/rust.nix",
    "chars": 3393,
    "preview": "{ inputs, ... }:\n# Nix module for the Rust part of the project\n#\n# This uses Crane, via https://github.com/juspay/rust-f"
  },
  {
    "path": "om.yaml",
    "chars": 1947,
    "preview": "ci:\n  default:\n    omnix:\n      dir: .\n      steps:\n        custom:\n          om-show:\n            type: app\n           "
  },
  {
    "path": "rust-toolchain.toml",
    "chars": 101,
    "preview": "[toolchain]\nchannel = \"stable\"\ntargets = [\"x86_64-unknown-linux-musl\", \"aarch64-unknown-linux-musl\"]\n"
  }
]

About this extraction

This page contains the full source code of the juspay/omnix GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 188 files (444.3 KB), approximately 119.7k tokens, and a symbol index with 573 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!