about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-08-22 19:12:06 -0700
committerFranck Cuny <franck@fcuny.net>2022-08-22 19:12:06 -0700
commitb919a1592580af487eade8eb00b8e459810c52fd (patch)
treed4720d5d6a29944d341d638015f2c5f87470bab5
parentref(modules/backup): only keep 4 weeks worth of backups (diff)
downloadworld-b919a1592580af487eade8eb00b8e459810c52fd.tar.gz
feat(rust): add an overlay to install rust
Installing the rust overlay to get the various tools installed. This is
done by a new module for home-manager, and is installed only on my
laptop at the moment.

Change-Id: I80c1633ca04da82f4321a0687a05d1df7c523702
-rw-r--r--flake.lock39
-rw-r--r--flake.nix5
-rw-r--r--home/default.nix1
-rw-r--r--home/rust/default.nix17
-rw-r--r--hosts/aptos/home.nix1
-rw-r--r--nix/mkSystem.nix1
6 files changed, 63 insertions, 1 deletions
diff --git a/flake.lock b/flake.lock
index e9791b2..3d07120 100644
--- a/flake.lock
+++ b/flake.lock
@@ -54,6 +54,21 @@
         "type": "github"
       }
     },
+    "flake-utils_2": {
+      "locked": {
+        "lastModified": 1656928814,
+        "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
     "futils": {
       "locked": {
         "lastModified": 1656065134,
@@ -182,7 +197,29 @@
         "nixpkgs": "nixpkgs_2",
         "nixpkgs-unstable": "nixpkgs-unstable",
         "nur": "nur",
-        "pre-commit-hooks": "pre-commit-hooks"
+        "pre-commit-hooks": "pre-commit-hooks",
+        "rust": "rust"
+      }
+    },
+    "rust": {
+      "inputs": {
+        "flake-utils": "flake-utils_2",
+        "nixpkgs": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1661136859,
+        "narHash": "sha256-o3y1elFGRs/9kqaIeziAnTy9lIWA6VHtQfq0ARRVO2A=",
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "rev": "6d1418192be90968acfa25e7d7b089e246eb15c4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "type": "github"
       }
     }
   },
diff --git a/flake.nix b/flake.nix
index d10c736..5d2d595 100644
--- a/flake.nix
+++ b/flake.nix
@@ -25,6 +25,11 @@
       inputs.nixpkgs.follows = "nixpkgs";
     };
 
+    rust = {
+      url = "github:oxalica/rust-overlay";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+
     pre-commit-hooks = {
       type = "github";
       owner = "cachix";
diff --git a/home/default.nix b/home/default.nix
index 7972470..f7eca99 100644
--- a/home/default.nix
+++ b/home/default.nix
@@ -24,6 +24,7 @@
     ./pass
     ./pcmanfm
     ./python
+    ./rust
     ./scanner
     ./seahorse
     ./shell
diff --git a/home/rust/default.nix b/home/rust/default.nix
new file mode 100644
index 0000000..2fe5053
--- /dev/null
+++ b/home/rust/default.nix
@@ -0,0 +1,17 @@
+{ lib, config, pkgs, ... }:
+let cfg = config.my.home.rust;
+in
+{
+  options.my.home.rust = with lib; {
+    enable = mkEnableOption "rust configuration";
+  };
+
+  config = lib.mkIf cfg.enable {
+    home.packages = with pkgs; [
+      rust-bin.beta.latest.default
+      rust-analyzer
+    ];
+    home.sessionVariables.CARGO_HOME = "${config.xdg.dataHome}/cargo";
+    home.sessionPath = [ "$CARGO_HOME/bin" ];
+  };
+}
diff --git a/hosts/aptos/home.nix b/hosts/aptos/home.nix
index 7fedd9d..e390ac3 100644
--- a/hosts/aptos/home.nix
+++ b/hosts/aptos/home.nix
@@ -35,6 +35,7 @@
     git.enable = true;
     go.enable = true;
     python.enable = true;
+    rust.enable = true;
 
     # web
     firefox.enable = true;
diff --git a/nix/mkSystem.nix b/nix/mkSystem.nix
index a411a98..1f7ccaf 100644
--- a/nix/mkSystem.nix
+++ b/nix/mkSystem.nix
@@ -14,6 +14,7 @@ inputs.nixpkgs.lib.nixosSystem {
         overlays = [
           inputs.emacs-overlay.overlay
           inputs.nur.overlay
+          inputs.rust.overlay
           (final: prev: {
             tools = import "${self}/tools" { pkgs = prev; };
           })