diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index 6f2fe2f..20ca019 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -41,6 +41,7 @@ ./roles/python ./roles/docker ./roles/kubernetes + ./roles/rust ]; nix.settings.experimental-features = [ diff --git a/nix/configuration/roles/rust/default.nix b/nix/configuration/roles/rust/default.nix new file mode 100644 index 0000000..8f9c922 --- /dev/null +++ b/nix/configuration/roles/rust/default.nix @@ -0,0 +1,39 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ]; + + environment.systemPackages = with pkgs; [ + rustup + lldb # for lldb-vscode + musl # for building static binaries + rust-analyzer + cargo-semver-checks + # ? cargo-bloat + # ? cargo-outdated + # ? cargo-public-api + ]; + + home-manager.users.talexander = + { pkgs, ... }: + { + home.file = { + ".cargo/config.toml" = { + source = ./files/cargo_config.toml; + }; + # # TODO: Figure out what to do with credentials. + # ".cargo/credentials.toml" = { + # source = ./files/cargo_credentials.toml; + # }; + }; + }; + +} + +# TODO: Install clippy, cranelift, rust-src +# TODO: Install rust targets x86_64-unknown-linux-musl and wasm32-unknown-unknown diff --git a/nix/configuration/roles/rust/files/cargo_config.toml b/nix/configuration/roles/rust/files/cargo_config.toml new file mode 100644 index 0000000..aca07b7 --- /dev/null +++ b/nix/configuration/roles/rust/files/cargo_config.toml @@ -0,0 +1,12 @@ +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "target-cpu=native", "-Zthreads=0"] + +[unstable] +codegen-backend = true + +[profile.dev] +codegen-backend = "cranelift" + +[profile.dev.package."*"] +codegen-backend = "llvm" +opt-level = 3