summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 0d94ad0fefefbf7019426d1d7076b57d915d2152 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
  description = "Rust development";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  };

  outputs =
    { self, nixpkgs }:
    let
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
    in
    {
      devShells.x86_64-linux.default = pkgs.mkShell {
        packages = with pkgs; [
          gcc
          bashInteractive
          rustc
          clippy
          cargo
          rustfmt
          rust-analyzer
        ];

        shellHook = ''
          export SHELL=${pkgs.bashInteractive}/bin/bash
          export NIX_SHELL_NAME="Rust development"
          if [[ -n "$PS1" ]]; then
            PS1="\[\e[38;5;45m\][nix:$NIX_SHELL_NAME]\[\e[0m\] $PS1"
          fi
        '';
      };
    };
}