From c69e5c07be52468bf6e96aaf84d29cf3d0dfba6a Mon Sep 17 00:00:00 2001 From: Riley Apeldoorn Date: Mon, 19 Jun 2023 22:14:22 +0200 Subject: [PATCH] Add rust toolchain --- flake.lock | 71 ++++++++++++++++++++++++++++++++++++++++- flake.nix | 7 ++-- shared/home/default.nix | 1 + shared/home/rust.nix | 14 ++++++++ system/lime/core.nix | 8 +++-- 5 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 shared/home/rust.nix diff --git a/flake.lock b/flake.lock index 4af2e0d..b29f5d5 100644 --- a/flake.lock +++ b/flake.lock @@ -43,6 +43,24 @@ } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { "locked": { "lastModified": 1667395993, "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", @@ -175,9 +193,44 @@ "type": "github" } }, - "pwnix": { + "nixpkgs_4": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "oxalica": { "inputs": { "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1687141659, + "narHash": "sha256-ckvEuxejYmFTyFF0u9CWV8h5u+ubuxA7vYrOw/GXRXg=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "86302751ef371597d48951983e1a2f04fe78d4ff", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "pwnix": { + "inputs": { + "flake-utils": "flake-utils_2", "jwt-tool": "jwt-tool", "nixpkgs": [ "nixpkgs" @@ -220,8 +273,24 @@ "home-manager": "home-manager_2", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_3", + "oxalica": "oxalica", "pwnix": "pwnix" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 0635993..5322dc3 100644 --- a/flake.nix +++ b/flake.nix @@ -9,9 +9,10 @@ }; agenix.url = github:ryantm/agenix; nixos-hardware.url = github:NixOS/nixos-hardware; + oxalica.url = github:oxalica/rust-overlay; }; - outputs = args@{ home-manager, nixpkgs, agenix, nixos-hardware, ... }: with nixpkgs; { + outputs = args@{ home-manager, nixpkgs, agenix, nixos-hardware, oxalica, ... }: with nixpkgs; { # Configurations for NixOS machines. nixosConfigurations = @@ -19,6 +20,8 @@ imports = [ home-manager.nixosModules.home-manager ]; config = { home-manager.users."riley" = (import "${path}/home.nix"); + home-manager.extraSpecialArgs = args; + home-manager.useGlobalPkgs = true; }; }; in { @@ -42,8 +45,6 @@ modules = [ (mkUserConfig ./system/lime) agenix.nixosModules.default - nixos-hardware.nixosModules.lenovo-thinkpad-x390 - nixos-hardware.nixosModules.common-gpu-nvidia-disable ./system/lime/core.nix ./shared/core ./shared/secrets.nix diff --git a/shared/home/default.nix b/shared/home/default.nix index 1abdad2..2a01b90 100644 --- a/shared/home/default.nix +++ b/shared/home/default.nix @@ -4,6 +4,7 @@ imports = [ ./bash.nix + ./rust.nix ./git.nix ./mpd.nix ./xdg.nix diff --git a/shared/home/rust.nix b/shared/home/rust.nix new file mode 100644 index 0000000..8fe9926 --- /dev/null +++ b/shared/home/rust.nix @@ -0,0 +1,14 @@ +{ oxalica, nixpkgs, ... }: { + + home.packages = let + pkgs = import nixpkgs { overlays = [ oxalica.overlays.default ]; }; + # We want an up-to-date nightly but also we need there to be stdlib and stuff + rust = pkgs.rust-bin.selectLatestNightlyWith (tc: tc.default.override { + extensions = [ "rust-src" ]; + }); + in [ + rust + pkgs.rust-analyzer + ]; + +} \ No newline at end of file diff --git a/system/lime/core.nix b/system/lime/core.nix index d4af059..90e01ee 100644 --- a/system/lime/core.nix +++ b/system/lime/core.nix @@ -1,6 +1,10 @@ -{ lib, modulesPath, ... }: { +{ lib, nixos-hardware, ... }: { - imports = [./hardware-configuration.nix]; + imports = [ + nixos-hardware.nixosModules.lenovo-thinkpad-x390 + nixos-hardware.nixosModules.common-gpu-nvidia-disable + ./hardware-configuration.nix + ]; custom = { gui.enable = true;