Skip to content

Commit

Permalink
Merge pull request #222 from xDarksome/nix-dev-shell
Browse files Browse the repository at this point in the history
nix: setup dev shell
  • Loading branch information
Drakulix authored Nov 13, 2023
2 parents 9a04fa2 + 62b8134 commit d051d14
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 141 deletions.
149 changes: 14 additions & 135 deletions flake.lock

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

13 changes: 11 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

parts.url = "github:hercules-ci/flake-parts";
parts.inputs.nixpkgs-lib.follows = "nixpkgs";

crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";

rust.url = "github:oxalica/rust-overlay";
rust.inputs.nixpkgs.follows = "nixpkgs";

nix-filter.url = "github:numtide/nix-filter";
};

Expand Down Expand Up @@ -68,9 +75,11 @@
checks.cosmic-comp = cosmic-comp;
packages.default = cosmic-comp;

devShells.default = pkgs.mkShell {
# Should there be packages here or use Nix purely for CI?
devShells.default = craneLib.devShell {
LD_LIBRARY_PATH = lib.makeLibraryPath (__concatMap (d: d.runtimeDependencies) (__attrValues self'.checks));

# include build inputs
inputsFrom = [cosmic-comp];
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions src/backend/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ pub fn init_backend(
state: &mut State,
) -> Result<()> {
let (mut backend, mut input) =
winit::init().map_err(|_| anyhow!("Failed to initilize winit backend"))?;
init_shaders(backend.renderer()).expect("Failed to initialize renderer");
winit::init().map_err(|e| anyhow!("Failed to initilize winit backend: {e:?}"))?;
init_shaders(backend.renderer()).context("Failed to initialize renderer")?;

init_egl_client_side(dh, state, &mut backend)?;

Expand Down
4 changes: 2 additions & 2 deletions src/backend/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,14 @@ pub fn init_backend(
let mut renderer =
unsafe { GlowRenderer::new(context) }.with_context(|| "Failed to initialize renderer")?;

init_shaders(&mut renderer).expect("Failed to initialize renderer");
init_shaders(&mut renderer).context("Failed to initialize renderer")?;
init_egl_client_side(dh, state, &drm_node, &mut renderer)?;

state.backend = BackendData::X11(X11State {
handle,
allocator: try_vulkan_allocator(&drm_node)
.or_else(|| try_gbm_allocator(fd))
.expect("Failed to create allocator for x11"),
.context("Failed to create allocator for x11")?,
_egl: egl,
renderer,
surfaces: Vec::new(),
Expand Down

0 comments on commit d051d14

Please sign in to comment.