File: flake.nix

package info (click to toggle)
rust-imap-codec 2.0.0~alpha5%2B20250307-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,716 kB
  • sloc: makefile: 2; sh: 1
file content (53 lines) | stat: -rw-r--r-- 1,298 bytes parent folder | download | duplicates (2)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

    # The rustup equivalent for Nix.
    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Allows non-flakes users to still be able to `nix-shell` based on
    # `shell.nix` instead of this `flake.nix`.
    flake-compat = {
      url = "github:edolstra/flake-compat";
      flake = false;
    };
  };

  outputs = { self, nixpkgs, fenix, ... }:
    let
      inherit (nixpkgs) lib;

      eachSupportedSystem = lib.genAttrs supportedSystems;
      supportedSystems = [
        "x86_64-linux"
        "aarch64-linux"
        "x86_64-darwin"
        "aarch64-darwin"
      ];

      mkDevShells = system:
        let
          pkgs = import nixpkgs { inherit system; };

          # get the rust toolchain from the rustup
          # `rust-toolchain.toml` configuration file
          rust-toolchain = fenix.packages.${system}.fromToolchainFile {
            file = ./rust-toolchain.toml;
            sha256 = "opUgs6ckUQCyDxcB9Wy51pqhd0MPGHUVbwRKKPGiwZU=";
          };

        in
        {
          default = pkgs.mkShell {
            buildInputs = [ rust-toolchain ];
          };
        };

    in
    {
      devShells = eachSupportedSystem mkDevShells;
    };
}