All Projects → nix-community → Fenix

nix-community / Fenix

Licence: mpl-2.0
Rust nightly toolchains and rust analyzer nightly for nix [[email protected]]

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Fenix

triton
Triton Operating System
Stars: ✭ 56 (+93.1%)
Mutual labels:  nix, packages, nixos
tix
[WIP] A type system for nix
Stars: ✭ 59 (+103.45%)
Mutual labels:  nix, nixos
Nixops
NixOps is a tool for deploying to NixOS machines in a network or cloud.
Stars: ✭ 838 (+2789.66%)
Mutual labels:  nixos, nix
Cachix
Command line client for Nix binary cache hosting:
Stars: ✭ 322 (+1010.34%)
Mutual labels:  nixos, nix
Kevin Nix
NixOS for the Samsung Chromebook Plus (kevin)
Stars: ✭ 18 (-37.93%)
Mutual labels:  nixos, nix
system
Declarative NixOS system configuration for all my machines
Stars: ✭ 14 (-51.72%)
Mutual labels:  nix, nixos
Morph
NixOS deployment tool
Stars: ✭ 303 (+944.83%)
Mutual labels:  nixos, nix
microvm.nix
NixOS MicroVMs
Stars: ✭ 136 (+368.97%)
Mutual labels:  nix, nixos
Nixos Generators
Collection of image builders [[email protected]]
Stars: ✭ 355 (+1124.14%)
Mutual labels:  nixos, nix
Dotfiles
And I say hey, what's going on?
Stars: ✭ 348 (+1100%)
Mutual labels:  nixos, nix
Awesome Nix
😎 A curated list of the best resources in the Nix community [[email protected]]
Stars: ✭ 388 (+1237.93%)
Mutual labels:  nixos, nix
dotnix
Shackled within an elaborate prison of my own design.
Stars: ✭ 35 (+20.69%)
Mutual labels:  nix, nixos
dotfiles
My NixOS dotfiles
Stars: ✭ 21 (-27.59%)
Mutual labels:  nix, nixos
dconf2nix
🐾 Convert Dconf files (e.g. Gnome Shell) to Nix, as expected by Home Manager
Stars: ✭ 51 (+75.86%)
Mutual labels:  nix, nixos
nixexprs
nix stuff
Stars: ✭ 13 (-55.17%)
Mutual labels:  nix, nixos
Nix.dev
An opinionated guide for developers wanting to get things done with Nix.
Stars: ✭ 300 (+934.48%)
Mutual labels:  nixos, nix
Nixsap
Stars: ✭ 23 (-20.69%)
Mutual labels:  nixos, nix
nix-bash-completions
Bash completion for the Nix command line tools
Stars: ✭ 39 (+34.48%)
Mutual labels:  nix, nixos
django-nixos
NixOS/NixOps configuration for Django
Stars: ✭ 21 (-27.59%)
Mutual labels:  nix, nixos
Devos
NixOS Framework
Stars: ✭ 338 (+1065.52%)
Mutual labels:  nixos, nix

fenix

Fenix provides the minimal, default, complete, and latest profile of rust nightly toolchains, nightly version of rust analyzer and its vscode extension with all components. It intends to be an alternative to rustup and the rust overlay provided by nixpkgs-mozilla.

Binary cache is available for x86_64-linux on cachix

cachix use nix-community

Usage

As a flake (recommended)

# flake.nix
{
  inputs = {
    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nixpkgs.url = "nixpkgs/nixpkgs-unstable";
  };

  outputs = { self, fenix, nixpkgs }: {
    ## as a set of packages
    # fenix.x86_64-linux.default.toolchain
    # fenix.x86_64-linux.rust-analyzer
    # fenix.x86_64-linux.rust-analyzer-vscode-extension

    ## as an overlay (in your nixos configuration)
    # nixpkgs.overlays = [ fenix.overlay ];
    # environment.systemPackages = with pkgs; [
    #   (rust-nightly.latest.withComponents [
    #     "cargo"
    #     "clippy-preview"
    #     "rust-src"
    #     "rust-std"
    #     "rustc"
    #     "rustfmt-preview"
    #   ])
    #   (vscode-with-extensions.override {
    #     vscodeExtensions = [
    #       vscode-extensions.matklad.rust-analyzer-nightly
    #     ];
    #   })
    # ];
  };
}

As an overlay

# configuration.nix
{
  nixpkgs.overlays = [
    (import (fetchTarball
      https://github.com/nix-community/fenix/archive/main.tar.gz))
  ];
  environment.systemPackages = [ pkgs.rust-nightly.default.toolchain ];
}

As a set of packages

{ callPackage }:

let
  fenix = callPackage "${
      fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz"
    }/packages.nix" { };
in fenix.default.rustc

Supported platforms and targets

all profiles (minimal, default, complete, and latest)

platform target
aarch64-linux aarch64-unknown-linux-gnu
i686-linux i686-unknown-linux-gnu
x86_64-darwin x86_64-apple-darwin
x86_64-linux x86_64-unknown-linux-gnu
only rust-std (for cross compiling)
  • aarch64-apple-darwin
  • aarch64-apple-ios
  • aarch64-linux-android
  • aarch64-pc-windows-msvc
  • aarch64-unknown-fuchsia
  • aarch64-unknown-linux-musl
  • arm-linux-androideabi
  • arm-unknown-linux-gnueabi
  • arm-unknown-linux-gnueabihf
  • arm-unknown-linux-musleabi
  • arm-unknown-linux-musleabihf
  • armv5te-unknown-linux-gnueabi
  • armv7-linux-androideabi
  • armv7-unknown-linux-gnueabihf
  • armv7-unknown-linux-musleabihf
  • asmjs-unknown-emscripten
  • i586-pc-windows-msvc
  • i586-unknown-linux-gnu
  • i586-unknown-linux-musl
  • i686-linux-android
  • i686-pc-windows-gnu
  • i686-pc-windows-msvc
  • i686-unknown-freebsd
  • i686-unknown-linux-musl
  • mips-unknown-linux-gnu
  • mips-unknown-linux-musl
  • mips64-unknown-linux-gnuabi64
  • mips64el-unknown-linux-gnuabi64
  • mipsel-unknown-linux-gnu
  • mipsel-unknown-linux-musl
  • powerpc-unknown-linux-gnu
  • powerpc64-unknown-linux-gnu
  • powerpc64le-unknown-linux-gnu
  • s390x-unknown-linux-gnu
  • sparc64-unknown-linux-gnu
  • sparcv9-sun-solaris
  • wasm32-unknown-emscripten
  • wasm32-unknown-unknown
  • x86_64-apple-ios
  • x86_64-linux-android
  • x86_64-pc-windows-gnu
  • x86_64-pc-windows-msvc
  • x86_64-rumprun-netbsd
  • x86_64-sun-solaris
  • x86_64-unknown-freebsd
  • x86_64-unknown-fuchsia
  • x86_64-unknown-illumos
  • x86_64-unknown-linux-gnux32
  • x86_64-unknown-linux-musl
  • x86_64-unknown-netbsd
  • x86_64-unknown-redox

The latest profile

The latest profile is a custom profile that contains all the components from the complete profile but not from necessarily the same date. Components from this profile are more bleeding edge, but there is also a larger chance of incompatibility.

Examples

Examples to build rust programs with flake-utils and naersk

building with makeRustPlatform
# flake.nix
{
  inputs = {
    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    flake-utils.url = "github:numtide/flake-utils";
    nixpkgs.url = "nixpkgs/nixpkgs-unstable";
  };

  outputs = { self, fenix, flake-utils, nixpkgs }:
    flake-utils.lib.eachDefaultSystem (system:
      let pkgs = nixpkgs.legacyPackages.${system};
      in {
        defaultPackage = (pkgs.makeRustPlatform {
          inherit (fenix.packages.${system}.minimal) cargo rustc;
        }).buildRustPackage {
          pname = "hello";
          version = "0.1.0";
          src = ./.;
          cargoSha256 = nixpkgs.lib.fakeSha256;
        };
     });
}
building with naersk
# flake.nix
{
  inputs = {
    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    flake-utils.url = "github:numtide/flake-utils";
    naersk = {
      url = "github:nmattia/naersk";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nixpkgs.url = "nixpkgs/nixpkgs-unstable";
  };

  outputs = { self, fenix, flake-utils, naersk, nixpkgs }:
    flake-utils.lib.eachDefaultSystem (system: {
      defaultPackage = (naersk.lib.${system}.override {
        inherit (fenix.packages.${system}.minimal) cargo rustc;
      }).buildPackage { src = ./.; };
    });
}
cross compiling with naersk
# flake.nix
{
  inputs = {
    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    flake-utils.url = "github:numtide/flake-utils";
    naersk = {
      url = "github:nmattia/naersk";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nixpkgs.url = "nixpkgs/nixpkgs-unstable";
  };

  outputs = { self, fenix, flake-utils, naersk, nixpkgs }:
    flake-utils.lib.eachDefaultSystem (system: {
      defaultPackage = let
        pkgs = nixpkgs.legacyPackages.${system};
        target = "aarch64-unknown-linux-gnu";
        toolchain = with fenix.packages.${system};
          combine [
            minimal.rustc
            minimal.cargo
            targets.${target}.latest.rust-std
          ];
      in (naersk.lib.${system}.override {
        cargo = toolchain;
        rustc = toolchain;
      }).buildPackage {
        src = ./.;
        CARGO_BUILD_TARGET = target;
        CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER =
          "${pkgs.pkgsCross.aarch64-multiplatform.stdenv.cc}/bin/${target}-gcc";
      };
    });
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].