aboutsummaryrefslogtreecommitdiffhomepage
path: root/flake.nix
blob: 5b51672eb030381c141e5b3b67ab3fc0dd8a3520 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
  description = "Port of Composer, the dependency manager for PHP, written in Rust";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    systems.url = "github:nix-systems/default";

    flake-utils = {
      url = "github:numtide/flake-utils";
      inputs.systems.follows = "systems";
    };

    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    treefmt-nix = {
      url = "github:numtide/treefmt-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    {
      nixpkgs,
      flake-utils,
      rust-overlay,
      treefmt-nix,
      ...
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ rust-overlay.overlays.default ];
        };
        rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
        treefmt = treefmt-nix.lib.evalModule pkgs {
          imports = [ ./treefmt.nix ];
          programs.rustfmt.package = rustToolchain;
        };
      in
      {
        formatter = treefmt.config.build.wrapper;

        devShells.default = pkgs.mkShell {
          packages = [
            rustToolchain
            pkgs.php85
            pkgs.php85Packages.composer
            pkgs.just

            # The following softwares are used for testing:

            # VCSs
            pkgs.git
            # VCSs (optional)
            #   Neither Composer's test suite nor Shirabe's uses a real binary
            #   for these commands: all tests for them mock a process executor.
            #   They only slow the tests down.
            #   Please uncomment to run those code paths by hand.
            # pkgs.fossil
            # pkgs.mercurial
            # pkgs.subversion

            # Archivers
            pkgs.bzip2
            pkgs.gnutar
            pkgs.gzip
            pkgs.p7zip
            pkgs.unzip
            pkgs.xz
            pkgs.zip
          ];
        };
      }
    );
}