From 127fc38c22c00151f06a25414a0b718ee6ab0e28 Mon Sep 17 00:00:00 2001 From: Seven Of Aces Date: Sun, 4 Aug 2024 12:05:20 -0700 Subject: [PATCH] modified: flake.lock modified: flake.nix modified: hosts/blackstar/nixos/configuration.nix deleted: hosts/blackstar/nixos/rust-toolchain.toml deleted: hosts/blackstar/nixos/shell.nix deleted: modules/nixos/default.nix new file: modules/nixos/rust-toolchain.nix --- flake.lock | 23 ++++++++++++- flake.nix | 5 +++ hosts/blackstar/nixos/configuration.nix | 5 +-- hosts/blackstar/nixos/rust-toolchain.toml | 2 -- hosts/blackstar/nixos/shell.nix | 40 ----------------------- modules/nixos/default.nix | 30 ----------------- modules/nixos/rust-toolchain.nix | 11 +++++++ 7 files changed, 41 insertions(+), 75 deletions(-) delete mode 100644 hosts/blackstar/nixos/rust-toolchain.toml delete mode 100644 hosts/blackstar/nixos/shell.nix delete mode 100644 modules/nixos/default.nix create mode 100644 modules/nixos/rust-toolchain.nix diff --git a/flake.lock b/flake.lock index bf5a246..1701a93 100644 --- a/flake.lock +++ b/flake.lock @@ -57,7 +57,28 @@ "inputs": { "home-manager": "home-manager", "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgs-unstable": "nixpkgs-unstable", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722738111, + "narHash": "sha256-cWD5pCs9AYb+512/yCx9D0Pl5KcmyuXHeJpsDw/D1vs=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "27ec296d93cb4b2d03e8cbd019b1b4cde8c34280", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index ed1d5f3..71c843b 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,10 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; #nur.url = "github:nix-community/NUR"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { @@ -60,6 +64,7 @@ modules = [ # > Our main nixos configuration file < ./hosts/blackstar/nixos/configuration.nix + ./modules/nixos/rust-toolchain.nix ]; }; rogue = nixpkgs.lib.nixosSystem { diff --git a/hosts/blackstar/nixos/configuration.nix b/hosts/blackstar/nixos/configuration.nix index b83af6b..48b27f2 100644 --- a/hosts/blackstar/nixos/configuration.nix +++ b/hosts/blackstar/nixos/configuration.nix @@ -25,7 +25,6 @@ # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix - ./shell.nix # Shared config ../../shared/nixos/shared_config.nix @@ -196,7 +195,9 @@ krita # code - cargo rustc rustup # Rust + cargo rustc rustup# Rust + # pkgs.rust-bin.stable.latest.default + jetbrains.rust-rover jetbrains.rider jetbrains.clion diff --git a/hosts/blackstar/nixos/rust-toolchain.toml b/hosts/blackstar/nixos/rust-toolchain.toml deleted file mode 100644 index 31578d3..0000000 --- a/hosts/blackstar/nixos/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "stable" \ No newline at end of file diff --git a/hosts/blackstar/nixos/shell.nix b/hosts/blackstar/nixos/shell.nix deleted file mode 100644 index 6840683..0000000 --- a/hosts/blackstar/nixos/shell.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ pkgs ? import {} }: - let - overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)); - libPath = with pkgs; lib.makeLibraryPath [ - # load external libraries that you need in your rust project here - ]; -in - pkgs.mkShell rec { - buildInputs = with pkgs; [ - clang - # Replace llvmPackages with llvmPackages_X, where X is the latest LLVM version (at the time of writing, 16) - llvmPackages.bintools - rustup - ]; - RUSTC_VERSION = overrides.toolchain.channel; - # https://github.com/rust-lang/rust-bindgen#environment-variables - LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ]; - shellHook = '' - export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin - export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ - ''; - # Add precompiled library to rustc search path - RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [ - # add libraries here (e.g. pkgs.libvmi) - ]); - LD_LIBRARY_PATH = libPath; - # Add glibc, clang, glib, and other headers to bindgen search path - BINDGEN_EXTRA_CLANG_ARGS = - # Includes normal include path - (builtins.map (a: ''-I"${a}/include"'') [ - # add dev libraries here (e.g. pkgs.libvmi.dev) - pkgs.glibc.dev - ]) - # Includes with special directory paths - ++ [ - ''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"'' - ''-I"${pkgs.glib.dev}/include/glib-2.0"'' - ''-I${pkgs.glib.out}/lib/glib-2.0/include/'' - ]; - } \ No newline at end of file diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix deleted file mode 100644 index dcfa039..0000000 --- a/modules/nixos/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). -# These should be stuff you would like to share with others, not your personal configurations. -{ - # List your module files here - # my-module = import ./my-module.nix; - - #art - aseprite = import ./aseprite.nix; - krita = import ./krita.nix; - - #cad - freecad = import ./freecad.nix; - blender = import ./blender.nix; - prusa-slicer = import ./prusa-slicer.nix; - - #game - steam = import ./steam.nix; - xivlauncher = import ./xivlauncher.nix; - - #code - rust = import ./rust.nix; - vscode = import ./vscode.nix; - git = import ./git.nix; - nvim = import ./nvim.nix; - - #other - discord = import ./discord.nix; - firefox = import ./firefox.nix; - jetbrains = import ./jetbrains.nix; -} \ No newline at end of file diff --git a/modules/nixos/rust-toolchain.nix b/modules/nixos/rust-toolchain.nix new file mode 100644 index 0000000..8d27bb2 --- /dev/null +++ b/modules/nixos/rust-toolchain.nix @@ -0,0 +1,11 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + nixpkgs.overlays = [ rust-overlay.overlays.default ]; + environment.systemPackages = [ pkgs.rust-bin.stable.latest.default ]; +} \ No newline at end of file