Adding rust

This commit is contained in:
Miguel Palhas
2024-10-04 18:05:33 +01:00
parent a2c7984916
commit 4cfd6b9c08
10 changed files with 51 additions and 107 deletions
-6
View File
@@ -29,12 +29,6 @@
programs.kitty.settings.font_size = 8;
programs = {
home-manager.enable = true;
git.enable = true;
fzf.enable = true;
};
home = {
username = lib.mkDefault "naps62";
stateVersion = lib.mkDefault "24.05";
+7 -2
View File
@@ -1,7 +1,12 @@
{ lib, config, ... }: {
imports = [ ./zsh.nix ./neovim ./solidity.nix ];
imports = [ ./zsh.nix ./neovim ./rust ./solidity.nix ];
programs.gh.enable = true;
programs = {
home-manager.enable = true;
git.enable = true;
fzf.enable = true;
gh.enable = true;
};
home = {
homeDirectory = lib.mkDefault "/home/${config.home.username}";
+42
View File
@@ -0,0 +1,42 @@
{ pkgs ? import <nixpkgs> { } }:
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/"
];
}
-20
View File
@@ -1,20 +0,0 @@
{ inputs, lib, pkgs, config, outputs, ... }: {
imports = [
inputs.nix-colors.homeManagerModule
inputs.nixvim.homeManagerModules.nixvim
../common/programs/default.nix
];
colorscheme = inputs.nix-colors.colorSchemes.catppuccin-frappe;
programs = {
home-manager.enable = true;
git.enable = true;
fzf.enable = true;
};
home = {
username = lib.mkDefault "naps62";
stateVersion = lib.mkDefault "24.05";
};
}
+1 -1
View File
@@ -10,7 +10,7 @@ in {
../common/features/hyprland.nix
../common/features/pipewire.nix
../common/features/docker.nix
../common/features/desktop-apps.nix
../common/features/fonts.nix
../common/features/syncthing.nix
];
+1 -1
View File
@@ -5,6 +5,6 @@
../common/global
../common/features/hyprland.nix
../common/features/docker.nix
../common/features/desktop-apps.nix
../common/features/fonts.nix
];
}
-46
View File
@@ -1,46 +0,0 @@
{ inputs, pkgs, ... }:
let
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
hyprland-session = "${pkgs.hyprland}/share/wayland-sessions";
in {
imports = [
./hardware-configuration.nix
../common/global
../common/features/networking.nix
../common/features/hyprland.nix
../common/features/docker.nix
../common/features/desktop-apps.nix
../common/features/syncthing.nix
];
networking.hostName = "nixos-test";
boot = {
loader = {
grub = {
enable = true;
device = "/dev/vda";
useOSProber = true;
};
};
};
system.stateVersion = "24.05";
programs.zsh.enable = true;
users.users.naps62 = {
isNormalUser = true;
description = "Miguel Palhas";
extraGroups = [ "networkmanager" "input" "wheel" "docker" ];
shell = pkgs.zsh;
hashedPassword =
"$y$j9T$0p/ZYQsSA/FroVjV59pI/0$LKyzass6W9GjJR0GLWI6xhVrLi0b5AYYMR3MvQKNK11";
};
fileSystems."mnt/nfs" = {
device = "192.168.122.1:/home/naps62/projects/nixos";
fsType = "nfs";
options = [ "rw" "soft" ];
};
}
-31
View File
@@ -1,31 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/f351eb61-2a35-416c-bad6-f49400917b2e";
fsType = "ext4";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}