DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

7b4ac4afcdb80e800e1c1982054aeadbf7bcac5d — skye 1 year, 8 months ago 7210bf3
feat: add flake.nix for client
3 files changed, 254 insertions(+), 0 deletions(-)

A client/Cargo.lock
A client/flake.lock
A client/flake.nix
A client/Cargo.lock => client/Cargo.lock +1 -0
@@ 0,0 1,1 @@
../Cargo.lock
\ No newline at end of file

A client/flake.lock => client/flake.lock +181 -0
@@ 0,0 1,181 @@
{
  "nodes": {
    "flake-compat": {
      "flake": false,
      "locked": {
        "lastModified": 1673956053,
        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
        "owner": "edolstra",
        "repo": "flake-compat",
        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
        "type": "github"
      },
      "original": {
        "owner": "edolstra",
        "repo": "flake-compat",
        "type": "github"
      }
    },
    "flake-utils": {
      "inputs": {
        "systems": "systems"
      },
      "locked": {
        "lastModified": 1681202837,
        "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "flake-utils_2": {
      "inputs": {
        "systems": "systems_2"
      },
      "locked": {
        "lastModified": 1681202837,
        "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "naersk": {
      "inputs": {
        "nixpkgs": "nixpkgs"
      },
      "locked": {
        "lastModified": 1679567394,
        "narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=",
        "owner": "nix-community",
        "repo": "naersk",
        "rev": "88cd22380154a2c36799fe8098888f0f59861a15",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "ref": "master",
        "repo": "naersk",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1682109806,
        "narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "2362848adf8def2866fabbffc50462e929d7fffb",
        "type": "github"
      },
      "original": {
        "id": "nixpkgs",
        "type": "indirect"
      }
    },
    "nixpkgs_2": {
      "locked": {
        "lastModified": 1682173319,
        "narHash": "sha256-tPhOpJJ+wrWIusvGgIB2+x6ILfDkEgQMX0BTtM5vd/4=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "ee7ec1c71adc47d2e3c2d5eb0d6b8fbbd42a8d1c",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "nixos-22.11",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs_3": {
      "locked": {
        "lastModified": 1681358109,
        "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixpkgs-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "flake-compat": "flake-compat",
        "flake-utils": "flake-utils",
        "naersk": "naersk",
        "nixpkgs": "nixpkgs_2",
        "rust-overlay": "rust-overlay"
      }
    },
    "rust-overlay": {
      "inputs": {
        "flake-utils": "flake-utils_2",
        "nixpkgs": "nixpkgs_3"
      },
      "locked": {
        "lastModified": 1682302828,
        "narHash": "sha256-5uKDELNLWozRhv02ynzvGf8rx30b0m8DhPTT63IFVHo=",
        "owner": "oxalica",
        "repo": "rust-overlay",
        "rev": "55de807250dd207007a0697e6e06d9fcba578d81",
        "type": "github"
      },
      "original": {
        "owner": "oxalica",
        "repo": "rust-overlay",
        "type": "github"
      }
    },
    "systems": {
      "locked": {
        "lastModified": 1681028828,
        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
        "owner": "nix-systems",
        "repo": "default",
        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
        "type": "github"
      },
      "original": {
        "owner": "nix-systems",
        "repo": "default",
        "type": "github"
      }
    },
    "systems_2": {
      "locked": {
        "lastModified": 1681028828,
        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
        "owner": "nix-systems",
        "repo": "default",
        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
        "type": "github"
      },
      "original": {
        "owner": "nix-systems",
        "repo": "default",
        "type": "github"
      }
    }
  },
  "root": "root",
  "version": 7
}

A client/flake.nix => client/flake.nix +72 -0
@@ 0,0 1,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.69.0";
    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;
      };
    });
}