Merge pull request #200 from LogicalOverflow/nix-flake

Replace shell.nix with a updated flake.nix
This commit is contained in:
Ottatop 2024-04-12 07:11:11 -05:00 committed by GitHub
commit 6053dd8ee4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 162 additions and 29 deletions

View file

@ -63,8 +63,9 @@ You will need:
```sh
sudo apt install libwayland-dev libxkbcommon-dev libudev-dev libinput-dev libgdm-dev libseat-dev xwayland
```
- NixOS: There is ~~a really old~~ an ancient [`shell.nix`](shell.nix) that ~~may or may~~ absolutely does not work :skull:
If you happen to know some Nix any PRs are welcome!
- NixOS: There is flake [`flake.nix`](flake.nix) with a devShell. It also
includes the other tools needed for the build and sets up the
`LD_LIBRARY_PATH` so the dynamically loaded libraries are found.
- [protoc](https://grpc.io/docs/protoc-installation/), the Protocol Buffer Compiler, for configuration
- Arch:
```sh

100
flake.lock Normal file
View file

@ -0,0 +1,100 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1712816664,
"narHash": "sha256-kPIVs2ATag+gm1CiWCJ+qcVQVR89w2eh/Cg4g1Xph70=",
"owner": "nix-community",
"repo": "fenix",
"rev": "94f8df6a8e52447af72a1a0008eccf4a099b6d25",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1712741485,
"narHash": "sha256-bCs0+MSTra80oXAsnM6Oq62WsirOIaijQ/BbUY59tR4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b2cf36f43f9ef2ded5711b30b1f393ac423d8f72",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"fenix": "fenix",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1712663608,
"narHash": "sha256-tN9ZL6kGppmHg84lxlpAlaN+kXWNctKK7Yitq/iXDEw=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "a5feb4f05f09adca661c869b1bf2324898cbaa43",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": {
"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",
"version": 7
}

59
flake.nix Normal file
View file

@ -0,0 +1,59 @@
{
description = " A WIP Smithay-based Wayland compositor, inspired by AwesomeWM and configured in Lua or Rust";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
flake-utils,
fenix,
...
}:
flake-utils.lib.eachSystem
[
"x86_64-linux"
"aarch64-linux"
]
(
system:
let
pkgs = nixpkgs.legacyPackages.${system};
fenixPkgs = fenix.packages.${system};
toolchain = fenixPkgs.stable;
combinedToolchain = toolchain.completeToolchain;
in
{
devShell = pkgs.mkShell {
buildInputs = [
# rust devel tools
combinedToolchain
pkgs.rust-analyzer
pkgs.cargo-outdated
# build time stuff
pkgs.pkg-config
pkgs.protobuf
pkgs.luarocks
# libs
pkgs.seatd.dev
pkgs.systemdLibs.dev
pkgs.libxkbcommon
pkgs.libinput
pkgs.mesa
];
LD_LIBRARY_PATH = "${pkgs.wayland}/lib:${pkgs.libGL}/lib";
};
}
);
}

View file

@ -1,27 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [
pkgs.gcc
pkgs.pkg-config
pkgs.systemd
pkgs.seatd
pkgs.wayland
pkgs.libxkbcommon
pkgs.mesa
pkgs.libinput
pkgs.xorg.libX11
pkgs.xorg.libXcursor
pkgs.xorg.libXrandr
pkgs.xorg.libXi
pkgs.libglvnd
pkgs.libGL
pkgs.libGL.dev
pkgs.egl-wayland
pkgs.xwayland
];
shellHook = ''
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.wayland}/lib:${pkgs.libxkbcommon}/lib:${pkgs.libGL}/lib
export LUA_PATH="$LUA_PATH"
export LUA_CPATH="$LUA_CPATH"
'';
}