summary refs log tree commit diff
path: root/flake.nix
blob: 0d4ce201d81bca988deba34918ceb44caf833097 (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
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
82
83
{
  inputs = {
    flake-utils = {
      type = "github";
      owner = "numtide";
      repo = "flake-utils";
      ref = "main";
    };
    crane = {
      url = "github:ipetkov/crane";
    };
    nixpkgs = {
      type = "github";
      owner = "nixos";
      repo = "nixpkgs";
      ref = "nixos-unstable";
    };
  };
  outputs = { self, nixpkgs, flake-utils, crane }: let
    supportedSystems = ["aarch64-linux" "x86_64-linux"];
    forAllSystems = f: flake-utils.lib.eachSystem supportedSystems f;
  in forAllSystems (system: let
    pkgs = nixpkgs.legacyPackages.${system};
    crane' = crane.mkLib pkgs;

    bowl = pkgs.callPackage ./default.nix {
      # XXX may break cross-compilation
      craneLib = crane';
    };
  in {
    packages = {
      bowl = bowl;
      bowl-no-llm = bowl.override {
        withLLMEnhancements = false;
      };
      default = self.packages.${system}.bowl;
      # Needed for translations
      xtr = pkgs.callPackage ./pkgs/xtr {};
    };

    overlays.default = final: prev: {
      bowl = final.callPackage ./default.nix {
        craneLib = crane.mkLib final;
      };
    };

    checks = {
      bowl = self.packages.${system}.bowl;
      bowl-no-llm = self.packages.${system}.bowl-no-llm;

      deps = self.packages.${system}.bowl.cargoArtifacts;
      clippy = self.packages.${system}.bowl.clippy;
    };

    apps.default = flake-utils.lib.mkApp {
      drv = bowl;
    };

    devShells.default = crane'.devShell {
      # Inherit inputs from checks.
      checks = self.checks.${system};

      # Additional dev-shell environment variables can be set directly
      # MY_CUSTOM_DEVELOPMENT_VAR = "something else";

      # Extra inputs can be added here; cargo and rustc are provided by default.
      packages = [
        pkgs.rust-analyzer
        self.packages.${system}.xtr

        pkgs.desktop-file-utils
        # for Gir to work its magic; not needed for Bowl itself but rather for its dependencies
        pkgs.python3 pkgs.gobject-introspection pkgs.libsecret
      ];

      # Add gettext manuals to the manpath
      shellHook = ''
        export MANPATH=${pkgs.gettext.man}/share/man''${MANPATH:+:$MANPATH}''${PATH:+:''${PATH//\/bin/\/share\/man}}
      '';

    };
  }); 
}