oppiliappan / statix

lints and suggestions for the nix programming language
https://git.peppe.rs/languages/statix/about
MIT License
552 stars 21 forks source link

flake: avoid ifd #70

Closed figsoda closed 1 year ago

figsoda commented 1 year ago

fixes https://github.com/nerdypepper/statix/issues/52

the ifd was caused by the channel pin, now we are using the latest complete toolchain for fenix. It is still pinned as long as we don't update fenix (with nix flake update)

also removed the gitignore input since it is unused: https://github.com/nerdypepper/statix/pull/45

oppiliappan commented 1 year ago

ah i see, thanks for this. is there any way to enforce a certain rust version (maybe using a toolchain.toml file)? i would like to have an explicit rust version setting rather than an implicit one.

NobbZ commented 1 year ago

I do not know anything about fenix, though with the oxalica overlay it is definitely possible to specify explicit tool-chain versions.

It can be either done by accessing it by attr-path, some function calls with some arguments that specify the version, pretty similar to how it was done here already or IIRC it can even read from the same toolchain.toml that would be maintained by rustup.

figsoda commented 1 year ago

The same things can be done for fenix too with IFD, oxalica's overlay can do this without IFD by including all the rust versions in the repository, but it makes the tarball much larger which needs to be downloaded even if you are just using the most basic features

892K    fenix.tar.gz
23M oxalica.tar.gz
figsoda commented 1 year ago

I just realized version pinning it actually possible with fenix without IFD utilizing flake inputs, I added an example to the fenix readme

{
  inputs = {
    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nixpkgs.url = "nixpkgs/nixos-unstable";
    rust-manifest = {
      url = "https://static.rust-lang.org/dist/2022-02-06/channel-rust.toml";
      flake = false;
    };
  };

  outputs = { self, fenix, nixpkgs, rust-manifest }: {
    packages.x86_64-linux.default =
      (fenix.packages.x86_64-linux.fromManifestFile rust-manifest).minimalToolchain;
  };
}

But in this case the current solution should do, since the flake is not updated very often