Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 13 additions & 40 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
{
description = "Wayshot devel";
description = "Development environment for wayshot";

inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; };
inputs = {
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, ... }:
let
pkgsFor = system:
import nixpkgs {
inherit system;
overlays = [ ];
};

targetSystems = [ "aarch64-linux" "x86_64-linux" ];
in {
devShells = nixpkgs.lib.genAttrs targetSystems (system:
let pkgs = pkgsFor system;
in {
default = pkgs.mkShell {
name = "Wayshot-devel";
nativeBuildInputs = with pkgs; [
# Compilers
cargo
rustc
scdoc

# Libs
wayland-protocols
wayland

# Tools
wayland-scanner
clippy
gdb
gnumake
rust-analyzer
rustfmt
strace
valgrind
];
};
});
};
outputs =
{
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system:
{
devShells.default = import ./shell.nix;
});
}
45 changes: 45 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# shell.nix

with (import <nixpkgs> { });

let
libPath =
with pkgs;
lib.makeLibraryPath [
libgbm
wayland
# You can load external libraries that you need in your rust project here
];
moz_overlay = import (builtins.fetchTarball "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz");
# Here I have used pkgs-mozilla overlays for my use case however you can use any other method you prefer!!

nixpkgs = import <nixpkgs> {
overlays = [
moz_overlay
];
};

in
mkShell {
name = "moz_overlay_shell";
buildInputs = [
libGL.dev
libgbm
pkg-config
wayland.dev
nixpkgs.latest.rustChannels.nightly.rust
];
LD_LIBRARY_PATH = libPath;
RUST_BACKTRACE = 1;
shellHook = ''
# Set the RUST_SRC_PATH environment variable to the rust-src location if required
export RUST_SRC_PATH="${nixpkgs.latest.rustChannels.nightly.rust-src}/lib/rustlib/src/rust/library"
'';
BINDGEN_EXTRA_CLANG_ARGS =
(builtins.map (a: ''-I"${a}/include"'') [
# Add include paths for other libraries here
])
++ [
# Special directories
];
}