Skip to content

Commit

Permalink
Nix flake for developing in NixOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ChocolateLoverRaj authored and jackpot51 committed May 14, 2024
1 parent 4dfd915 commit ec58819
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
/target/
/vendor.tar
/vendor/
/.direnv/
/.idea/
130 changes: 130 additions & 0 deletions flake.lock

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

51 changes: 51 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
in
with pkgs;
{
formatter = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
devShells.default = mkShell {
buildInputs = [
rust-bin.stable.latest.default
fontconfig
freetype
libglvnd
libinput
libxkbcommon
vulkan-loader
wayland
xorg.libX11
];

RUSTFLAGS = map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lwayland-client"
"-Wl,--pop-state"
];

LD_LIBRARY_PATH = lib.makeLibraryPath [
libxkbcommon
mesa.drivers
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
];
};
}
);
}

0 comments on commit ec58819

Please sign in to comment.