From 3bc3f55d8bc8a9e178bb1f8f9e372a47f502f463 Mon Sep 17 00:00:00 2001 From: Bad Date: Tue, 8 Jun 2021 21:05:07 +0200 Subject: [PATCH] Add rust --- flake.lock | 76 ++++++++++++++++++++++++++++++++++++++- flake.nix | 12 ++++--- profiles/rust/default.nix | 12 +++++++ 3 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 profiles/rust/default.nix diff --git a/flake.lock b/flake.lock index b56c2ba..4820d96 100644 --- a/flake.lock +++ b/flake.lock @@ -106,6 +106,26 @@ "type": "github" } }, + "fenix": { + "inputs": { + "naersk": "naersk_2", + "nixpkgs": "nixpkgs_3", + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1623037639, + "narHash": "sha256-JzblstxJmWo6gfQ9+HGroidGTHIk+tJstgsrxUmq6Ho=", + "owner": "nix-community", + "repo": "fenix", + "rev": "6fe14f8752d5b9fe4bc71bbeafa4916961b39975", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -209,6 +229,26 @@ } }, "naersk_2": { + "inputs": { + "nixpkgs": [ + "latest" + ] + }, + "locked": { + "lastModified": 1622810282, + "narHash": "sha256-4wmvM3/xfD0hCdNDIXVzRMfL4yB1J+DjH6Zte2xbAxk=", + "owner": "nmattia", + "repo": "naersk", + "rev": "e8061169e1495871b56be97c5c51d310fae01374", + "type": "github" + }, + "original": { + "owner": "nmattia", + "repo": "naersk", + "type": "github" + } + }, + "naersk_3": { "inputs": { "nixpkgs": [ "latest" @@ -304,6 +344,22 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1622797669, + "narHash": "sha256-xIyWeoYExzF0KNaKcqfxEX58fN4JTIQxTJWbsAujllc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1ca6b0a0cc38dbba0441202535c92841dd39d1ae", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nur": { "locked": { "lastModified": 1622714715, @@ -355,15 +411,33 @@ "ci-agent": "ci-agent", "darwin": "darwin", "digga": "digga", + "fenix": "fenix", "home": "home", "latest": "latest", - "naersk": "naersk_2", + "naersk": "naersk_3", "nixos": "nixos", "nixos-hardware": "nixos-hardware", "nur": "nur", "pkgs": "pkgs" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1622991006, + "narHash": "sha256-f8jdBL42+bU8KKchkW4fF6+kDBjgpoOZyP5yOYsebBk=", + "owner": "rust-analyzer", + "repo": "rust-analyzer", + "rev": "13da28cc2bc1b59f7af817eca36927a71edb023c", + "type": "github" + }, + "original": { + "owner": "rust-analyzer", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1610051610, diff --git a/flake.nix b/flake.nix index 377986f..7317a3f 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,7 @@ nixos.url = "nixpkgs/nixos-unstable"; latest.url = "nixpkgs"; digga.url = "github:divnix/digga"; + fenix.url = "github:nix-community/fenix"; ci-agent = { url = "github:hercules-ci/hercules-ci-agent"; @@ -23,7 +24,7 @@ pkgs.inputs.nixpkgs.follows = "nixos"; }; - outputs = inputs@{ self, pkgs, digga, nixos, ci-agent, home, nixos-hardware, nur, ... }: + outputs = inputs@{ self, pkgs, digga, nixos, ci-agent, home, nixos-hardware, nur, fenix, ... }: digga.lib.mkFlake { inherit self inputs; @@ -36,6 +37,7 @@ ./pkgs/default.nix pkgs.overlay # for `srcs` nur.overlay + fenix.overlay ]; }; latest = { }; @@ -71,10 +73,10 @@ }; profiles = [ ./profiles ./users ]; suites = { profiles, users, ... }: with profiles; rec { - base = [ core users.root ]; - workstation = [ base sway develop game profiles.workstation ssh flatpak torrents pwn tor ]; - desktop = workstation ++ [ users.mae-desk amd school three_dee ]; - lap = workstation ++ [ users.mae-lap laptop bluetooth print networkmanager androidev ]; + base = [ core users.root ]; + workstation = [ base sway develop game profiles.workstation ssh flatpak torrents pwn tor rust ]; + desktop = workstation ++ [ users.mae-desk amd school three_dee ]; + lap = workstation ++ [ users.mae-lap laptop bluetooth print networkmanager androidev ]; }; }; diff --git a/profiles/rust/default.nix b/profiles/rust/default.nix new file mode 100644 index 0000000..cc01791 --- /dev/null +++ b/profiles/rust/default.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +let + fenix = pkgs.fenix; +in +{ + environment.systemPackages = [ + fenix.stable.defaultToolchain + fenix.rust-analyzer + pkgs.cargo-edit + ]; + environment.variables.RUST_SRC_PATH = "${fenix.stable.rust-src}/lib/rustlib/src/rust/library/"; +}