DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

ref: 6d0ea7fb1612a15ad31efbe938785afa078e90bd deck-builder/client/flake.nix -rw-r--r-- 1.7 KiB
6d0ea7fbJonni Liljamo fix(shared): my_games and all_forming take &String instead of String 1 year, 9 months ago
                                                                                
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
{
  description = "Laurelin Client";

  inputs = {
    naersk.url = "github:nix-community/naersk/master";
    nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
    flake-utils.url = "github:numtide/flake-utils";
    flake-compat = {
      url = "github:edolstra/flake-compat";
      flake = false;
    };
    rust-overlay.url = "github:oxalica/rust-overlay";
  };

  outputs = inputs@{ self, nixpkgs, flake-utils, naersk, rust-overlay, ... }:
  flake-utils.lib.eachDefaultSystem (system: 
  let
    overlays = [ (import rust-overlay) ];
    pkgs = import nixpkgs { inherit system overlays; };
    rustVersion = "1.67.1";
    rust = pkgs.rust-bin.stable.${rustVersion}.default.override {
      extensions = [
        "rust-src"
      ];
    };
    naersk-lib = pkgs.callPackage naersk { };
    libPath = with pkgs; lib.makeLibraryPath [
      alsa-lib
      libxkbcommon
      openssl
      udev
      vulkan-loader
      wayland
    ];
    in {
      defaultPackage = naersk-lib.buildPackage {
        src = ./.;
        doCheck = true;
        pname = "client";
        nativeBuildInputs = [ pkgs.makeWrapper ];
        buildInputs = with pkgs; [
          
        ];
        postInstall = ''
          wrapProgram "$out/bin/client" --prefix LD_LIBRARY_PATH : "${libPath}"
        '';
      };

      apps.default = flake-utils.lib.mkApp {
        drv = self.defaultPackage."${system}";
      };


      devShell = with pkgs; pkgs.mkShell {
        buildInputs = [
          rust

          pkg-config
          clang
          mold

          alsa-lib
          libxkbcommon
          openssl
          udev
          wayland
        ];
        RUST_SRC_PATH = rustPlatform.rustLibSrc;
        LD_LIBRARY_PATH = libPath;
      };
    });
}