add rust, rust-overlay

This commit is contained in:
Daniel Langbein 2024-11-11 14:06:54 +01:00
parent fb755bde83
commit f3e4248633
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
4 changed files with 50 additions and 2 deletions

View File

@ -14,6 +14,12 @@ in
# - .env run configuration: https://github.com/NixOS/nix-idea/issues/1#issuecomment-590851686
# - nix-shell IDE-wide: https://github.com/NixOS/nix-idea/issues/1#issuecomment-734997521
imports =
[
# Rust programming lang
./rust.nix
];
allowUnfree = [
version
];

View File

@ -1,4 +1,7 @@
{ config, pkgs, lib, ... }:
let
sources = import ../nix/sources.nix;
in
{
# How NUR (or unstable) can be imported without `niv`.
#nixpkgs.config.packageOverrides = pkgs: {
@ -9,11 +12,11 @@
nixpkgs.config.packageOverrides = pkgs: {
# Import NUR with niv.
nur = import (import ../nix/sources.nix).NUR {
nur = import sources.NUR {
inherit pkgs;
};
# Import unstable with niv.
unstable = import (import ../nix/sources.nix).unstable {
unstable = import sources.unstable {
inherit pkgs;
# "unstable" `nixpkgs.config` has to be configured here where we import it.
@ -33,6 +36,11 @@
};
};
nixpkgs.overlays = [
# Import rust-overlay with niv.
(import sources.rust-overlay)
];
#environment.systemPackages = with pkgs; [
# # Example NUR usage:
# nur.repos.mic92.hello-nur

22
modules/rust.nix Normal file
View File

@ -0,0 +1,22 @@
{ config, pkgs, ... }:
let
#rustVersion = pkgs.rust-bin.stable."1.81.0".default.override {
rustVersion = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
#targets = [
# "x86_64-unknown-linux-musl"
# #"arm-unknown-linux-gnueabihf"
# #"wasm32-wasi"
# #"wasm32-unknown-unknown"
#];
};
rustPlatform = pkgs.makeRustPlatform {
cargo = rustVersion;
rustc = rustVersion;
};
in
{
environment.systemPackages = with pkgs; [
rustPlatform.rust.cargo
];
}

View File

@ -35,6 +35,18 @@
"url": "https://github.com/NixOS/nixpkgs/archive/83fb6c028368e465cd19bb127b86f971a5e41ebc.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"rust-overlay": {
"branch": "master",
"description": "Pure and reproducible nix overlay of binary distributed rust toolchains",
"homepage": "",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "7c4cd99ed7604b79e8cb721099ac99c66f656b3a",
"sha256": "00h0j10d1zxg03gjzzfj22s14fs0apmd2cvxmk7dcsaj9d8ni1bx",
"type": "tarball",
"url": "https://github.com/oxalica/rust-overlay/archive/7c4cd99ed7604b79e8cb721099ac99c66f656b3a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"unstable": {
"branch": "nixpkgs-unstable",
"description": "Nix Packages collection & NixOS",