Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

provide a command to check schema definitions #14

Open
sellout opened this issue Nov 27, 2023 · 3 comments
Open

provide a command to check schema definitions #14

sellout opened this issue Nov 27, 2023 · 3 comments

Comments

@sellout
Copy link
Contributor

sellout commented Nov 27, 2023

I tried nix run github:DeterminateSystems/nix/flake-schemas -- flake show, but that fails in the check phase. I got it integrated in my flake with a bit of jiggering:

inputs.nix-schema.url = "github:DeterminateSystems/nix/flake-schemas";
pkgs = import nixpkgs {
  inherit system;
  overlays = [
    (final: prev: {
      nix-schema =
        nix-schema.packages.${system}.nix.overrideAttrs (old: {
          doCheck = false;
          postInstall = old.postInstall + ''
            mv $out/bin/nix $out/bin/nix-schema
          '';
          doInstallCheck = false;
        });
    })
  ];
$ nix-schema flake show
nix-schema flake show
git+file:///…/project-manager
⋮
├───projectConfigurations
│   ├───aarch64-darwin: Project Manager configuration for this flake’s project [project-manager-generation-for-project-manager]
│   ├───aarch64-linux omitted (use '--all-systems' to show)
│   ├───x86_64-darwin omitted (use '--all-systems' to show)
│   └───x86_64-linux omitted (use '--all-systems' to show)
├───projectModules
│   ├───direnv: Project Manager module
│   ├───editorconfig: Project Manager module
│   ├───files: Project Manager module
│   ├───flakehub: Project Manager module
│   ├───flakestry: Project Manager module
│   ├───garnix: Project Manager module
│   ├───git: Project Manager module
│   ├───github: Project Manager module
│   ├───just: Project Manager module
│   ├───mercurial: Project Manager module
│   ├───news: Project Manager module
│   ├───project-environment: Project Manager module
│   ├───project-manager: Project Manager module
│   ├───renovate: Project Manager module
│   ├───shellcheck: Project Manager module
│   ├───submodule-support: Project Manager module
│   ├───treefmt: Project Manager module
│   ├───vale: Project Manager module
│   ├───version: Project Manager module
│   └───xdg: Project Manager module
└───schemas
    ⋮
    ├───projectConfigurations: flake schema
    ├───projectModules: flake schema
    └───schemas: flake schema

But that seems like more work than a user should have to do. Maybe it's as simple as fixing the PR and mentioning nix run … in the README, but something where users can trust their schemas are reasonable before pushing to FlakeHub would be great.

@sellout
Copy link
Contributor Author

sellout commented Nov 27, 2023

This is just using the branch for NixOS/nix#8892. Merging that would make this issue redundant (once a new nix is released).

@sellout sellout mentioned this issue Apr 11, 2024
8 tasks
@drupol
Copy link

drupol commented Apr 11, 2024

Yeah that's elegant, for sure. However, having various versions of Nix is, IMHO, not the most practical ways of using it.

@sellout
Copy link
Contributor Author

sellout commented Apr 11, 2024

Yeah that's elegant, for sure. However, having various versions of Nix is, IMHO, not the most practical ways of using it.

Absolutely – this is just a workaround until 🤞🏼 NixOS/nix#8892 is merged. If there’s a better workaround, I’m open to it. I wanted to avoid using that branch as my default nix to avoid any compatibility issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants