Merge pull request #222 from xDarksome/nix-dev-shell
nix: setup dev shell
This commit is contained in:
commit
d051d14197
4 changed files with 29 additions and 141 deletions
149
flake.lock
generated
149
flake.lock
generated
|
|
@ -2,17 +2,16 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"crane": {
|
"crane": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"nixpkgs": [
|
||||||
"flake-utils": "flake-utils",
|
"nixpkgs"
|
||||||
"nixpkgs": "nixpkgs",
|
]
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1688425221,
|
"lastModified": 1699548976,
|
||||||
"narHash": "sha256-DhZnju72DuX9GhOnCOBIE94aCGKC2BOaF+kGxbnP/K0=",
|
"narHash": "sha256-xnpxms0koM8mQpxIup9JnT0F7GrKdvv0QvtxvRuOYR4=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "fc6a236548b31aef0be3b0a0377c4459bb39d923",
|
"rev": "6849911446e18e520970cc6b7a691e64ee90d649",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -21,44 +20,10 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"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": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
|
||||||
"lastModified": 1687709756,
|
|
||||||
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_2": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681202837,
|
"lastModified": 1681202837,
|
||||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||||
|
|
@ -89,40 +54,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1688221086,
|
|
||||||
"narHash": "sha256-cdW6qUL71cNWhHCpMPOJjlw0wzSRP0pVlRn2vqX/VVg=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "cd99c2b3c9f160cd004318e0697f90bbd5960825",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs-lib": {
|
|
||||||
"locked": {
|
|
||||||
"dir": "lib",
|
|
||||||
"lastModified": 1688049487,
|
|
||||||
"narHash": "sha256-100g4iaKC9MalDjUW9iN6Jl/OocTDtXdeAj7pEGIRh4=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "4bc72cae107788bf3f24f30db2e2f685c9298dc9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"dir": "lib",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1685591878,
|
"lastModified": 1685591878,
|
||||||
"narHash": "sha256-Ib3apaLqIFkZb94q6Q214DXrz0FnJq5C7usywTv63og=",
|
"narHash": "sha256-Ib3apaLqIFkZb94q6Q214DXrz0FnJq5C7usywTv63og=",
|
||||||
|
|
@ -138,25 +69,11 @@
|
||||||
"type": "github"
|
"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"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parts": {
|
"parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1688466019,
|
"lastModified": 1688466019,
|
||||||
|
|
@ -176,15 +93,17 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
"nix-filter": "nix-filter",
|
"nix-filter": "nix-filter",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs",
|
||||||
"parts": "parts",
|
"parts": "parts",
|
||||||
"rust": "rust"
|
"rust": "rust"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust": {
|
"rust": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs_3"
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1688438033,
|
"lastModified": 1688438033,
|
||||||
|
|
@ -200,31 +119,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": [
|
|
||||||
"crane",
|
|
||||||
"flake-utils"
|
|
||||||
],
|
|
||||||
"nixpkgs": [
|
|
||||||
"crane",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1688351637,
|
|
||||||
"narHash": "sha256-CLTufJ29VxNOIZ8UTg0lepsn3X03AmopmaLTTeHDCL4=",
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"rev": "f9b92316727af9e6c7fee4a761242f7f46880329",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
|
|
@ -239,21 +133,6 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"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",
|
"root": "root",
|
||||||
|
|
|
||||||
13
flake.nix
13
flake.nix
|
|
@ -3,9 +3,16 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
parts.url = "github:hercules-ci/flake-parts";
|
parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||||
|
|
||||||
crane.url = "github:ipetkov/crane";
|
crane.url = "github:ipetkov/crane";
|
||||||
|
crane.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
rust.url = "github:oxalica/rust-overlay";
|
rust.url = "github:oxalica/rust-overlay";
|
||||||
|
rust.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
nix-filter.url = "github:numtide/nix-filter";
|
nix-filter.url = "github:numtide/nix-filter";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -68,9 +75,11 @@
|
||||||
checks.cosmic-comp = cosmic-comp;
|
checks.cosmic-comp = cosmic-comp;
|
||||||
packages.default = cosmic-comp;
|
packages.default = cosmic-comp;
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = craneLib.devShell {
|
||||||
# Should there be packages here or use Nix purely for CI?
|
|
||||||
LD_LIBRARY_PATH = lib.makeLibraryPath (__concatMap (d: d.runtimeDependencies) (__attrValues self'.checks));
|
LD_LIBRARY_PATH = lib.makeLibraryPath (__concatMap (d: d.runtimeDependencies) (__attrValues self'.checks));
|
||||||
|
|
||||||
|
# include build inputs
|
||||||
|
inputsFrom = [cosmic-comp];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,8 @@ pub fn init_backend(
|
||||||
state: &mut State,
|
state: &mut State,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let (mut backend, mut input) =
|
let (mut backend, mut input) =
|
||||||
winit::init().map_err(|_| anyhow!("Failed to initilize winit backend"))?;
|
winit::init().map_err(|e| anyhow!("Failed to initilize winit backend: {e:?}"))?;
|
||||||
init_shaders(backend.renderer()).expect("Failed to initialize renderer");
|
init_shaders(backend.renderer()).context("Failed to initialize renderer")?;
|
||||||
|
|
||||||
init_egl_client_side(dh, state, &mut backend)?;
|
init_egl_client_side(dh, state, &mut backend)?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -356,14 +356,14 @@ pub fn init_backend(
|
||||||
let mut renderer =
|
let mut renderer =
|
||||||
unsafe { GlowRenderer::new(context) }.with_context(|| "Failed to initialize 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)?;
|
init_egl_client_side(dh, state, &drm_node, &mut renderer)?;
|
||||||
|
|
||||||
state.backend = BackendData::X11(X11State {
|
state.backend = BackendData::X11(X11State {
|
||||||
handle,
|
handle,
|
||||||
allocator: try_vulkan_allocator(&drm_node)
|
allocator: try_vulkan_allocator(&drm_node)
|
||||||
.or_else(|| try_gbm_allocator(fd))
|
.or_else(|| try_gbm_allocator(fd))
|
||||||
.expect("Failed to create allocator for x11"),
|
.context("Failed to create allocator for x11")?,
|
||||||
_egl: egl,
|
_egl: egl,
|
||||||
renderer,
|
renderer,
|
||||||
surfaces: Vec::new(),
|
surfaces: Vec::new(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue