aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: 5307db5937aef08f97682a4cadd57ce2425028a8 (plain) (blame)
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
{
  description = "Endless honeypot for web crawlers";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
    flake-utils.url = "github:numtide/flake-utils";
    crane.url = "github:ipetkov/crane";
  };
  outputs = {
    self,
    nixpkgs,
    crane,
    flake-utils,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = nixpkgs.legacyPackages.${system};
      craneLib = crane.mkLib pkgs;
      commonArgs = {
        src = craneLib.cleanCargoSource ./.;
        strictDeps = true;
        buildInputs = [] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [];
      };
      dictionaryFile = import ./dictionary.nix {pkgs = pkgs;};
      pitch-lake = craneLib.buildPackage (commonArgs
        // {
          cargoArtifacts = craneLib.buildDepsOnly commonArgs;
          DICTIONARY_FILE_PATH = dictionaryFile;
        });
    in {
      checks = {
        inherit pitch-lake;
      };
      packages.default = pitch-lake;
      apps.default = flake-utils.lib.mkApp {
        drv = pitch-lake;
      };
      devShells.default = craneLib.devShell {
        checks = self.checks.${system};
        inputsFrom = [pitch-lake];
        DICTIONARY_FILE_PATH = dictionaryFile;
        packages = [pkgs.rust-analyzer];
      };
    });
}