Merge #1481: Use a flake instead of shell nix

bd6e6f456b04b1ffb2a78e6232a3de34afb5ae4e Use a flake instead of shell nix (edouardparis)

Pull request description:

  A flake makes more sense for development with nix declarative systems.
  To launch the shell: do `nix develop`

ACKs for top commit:
  edouardparis:
    Self-ACK bd6e6f456b04b1ffb2a78e6232a3de34afb5ae4e

Tree-SHA512: e9d81ee2e7e6e08a7ea6eca3ae8c5b5d58de517dd5615d6c73578832bd1d2e1e9a9c99781079d48683268fd93647b8a95f70cfafabf818f08321410961ee38f0
This commit is contained in:
edouardparis 2024-11-21 12:06:01 +01:00
commit e246305273
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
3 changed files with 98 additions and 32 deletions

61
flake.lock generated Normal file
View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1732014248,
"narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "23e89b7da85c3640bbc2173fe04f4bd114342367",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"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
}

37
flake.nix Normal file
View File

@ -0,0 +1,37 @@
{
description = "Dev shell to help contributing to liana";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
devShell = pkgs.mkShell rec {
buildInputs = with pkgs; [
expat
fontconfig
freetype
freetype.dev
libGL
pkg-config
udev
wayland
libxkbcommon
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
];
LD_LIBRARY_PATH =
builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
};
}
);
}

View File

@ -1,32 +0,0 @@
# Nixos 23.11 comes with libc 2.38, this version of libc may not be compatible
# with some drivers. For now the hack found is to user a community wrapper that
# detects the requirements and do the link (https://github.com/guibou/nixGL).
# usage:
# nixGL cargo run
let
nixgl = import (fetchTarball "https://github.com/guibou/nixGL/archive/master.tar.gz") {};
pkgs = import <nixpkgs> {};
in
pkgs.mkShell rec {
buildInputs = with pkgs; [
pkgs.expat
pkgs.fontconfig
pkgs.freetype
pkgs.freetype.dev
pkgs.libGL
pkgs.pkg-config
pkgs.udev
pkgs.wayland
pkgs.libxkbcommon
pkgs.xorg.libX11
pkgs.xorg.libXcursor
pkgs.xorg.libXi
pkgs.xorg.libXrandr
nixgl.auto.nixGLDefault
];
LD_LIBRARY_PATH =
builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
}