`shell.nix` file
tryoxiss opened this issue · comments
I noticed the project has a flake.nix
in its root, which is great to see some NixOS love! However I was looking at the setup guide and theres a lot of steps, so you should also add a shell.nix
to aid in developement. With it, contributers with nix
(package manager) or nixos
would be able to simply clone the project and run nix-shell
or nix develop
and get all the 3rd party SO dependencies.
I spent a while trying to get it, and I got pretty close -- the following is able to build the crate. However, it panics because it cant find libwayland
, which I am unable to find a nixpkgs for after about 20m of searching. Im putting this here incase someone else starts on this we don't duplicate work.
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShellNoCC {
packages = with pkgs; [
# Dependencies I found on nixpkgs
# before realising they are all
# in magmawm.nix ...
# systemdLibs
wayland-protocols
# libinput
# libxkbcommon
# libglvnd
# seatd
# dbus-glib
# mesa
wayland
# from magmawm.nix
libdrm
libglvnd
libinput
libseat
libxkbcommon
mesa
pkg-config
systemdLibs # Contains libudev. DON'T PANIC: it won't install the whole init system
wayland
wayland-scanner
xorg.libX11 # Needed for xwayland to work
xorg.libXcursor
xorg.libXi
# Toolchain
cargo
gcc9 # "cc"
rustc
];
}
is there a benefit of a shell.nix
over just a flake? flakes have a devShells
output that does the same thing.
is there a benefit of a
shell.nix
over just a flake? flakes have adevShells
output that does the same thing.
Currently shell.nix
is considered stable but flake.nix
is unstable (although thats not saying much considering flakes are basically stable). Theres also the benefit more people know about nix-shell, I certinly didn't know about devshells until you mentioned it.
Those aren't really good reasons though, so there very well may not be. I am pretty new to nix, I only started with it a month or so ago on my laptop which I don't use a ton so I am still not very familliar with it 😅
is there a benefit of a
shell.nix
over just a flake? flakes have adevShells
output that does the same thing.Currently
shell.nix
is considered stable butflake.nix
is unstable (although thats not saying much considering flakes are basically stable). Theres also the benefit more people know about nix-shell, I certinly didn't know about devshells until you mentioned it.Those aren't really good reasons though, so there very well may not be. I am pretty new to nix, I only started with it a month or so ago on my laptop which I don't use a ton so I am still not very familliar with it 😅
good luck on your Nix journey :D
good luck on your Nix journey :D
Thanks! :D
This project's flake already has a dev shell, so I don't believe there's a reason to add a shell.nix
. As it stands you can run
nix develop
cargo build
and the build should succeed (it's working for me anyway).
This project's flake already has a dev shell, so I don't believe there's a reason to add a
shell.nix
. As it stands you can runnix develop cargo buildand the build should succeed (it's working for me anyway).
Yeah, doing that it builds correctly (though panics but I assume thats a diffrent issue). I think I will close this now then, someone can re-open it should there be a reason for it.