added flake for reproducible builds on NixOS

This commit is contained in:
Morgane 2026-03-03 05:55:42 +01:00
parent 1003ed9cd3
commit 2a600bfca2
2 changed files with 71 additions and 0 deletions

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1772433332,
"narHash": "sha256-izhTDFKsg6KeVBxJS9EblGeQ8y+O8eCa6RcW874vxEc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cf59864ef8aa2e178cccedbe2c178185b0365705",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

44
flake.nix Normal file
View file

@ -0,0 +1,44 @@
{
description = "4jcraft-nix dev shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { nixpkgs, ... }:
let
allSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forAllSystems ({ pkgs }:
let
libs = with pkgs; [
openssl.dev
libGL
glfw
];
packages = with pkgs; [
gcc
cmake
gnumake
];
in
{
default = pkgs.mkShell {
LD_LIBRARY_PATH = "/run/opengl-driver/lib";
buildInputs = libs;
nativeBuildInputs = packages;
};
}
);
};
}