From 2a600bfca255365da69a564fb9827b65a8484df7 Mon Sep 17 00:00:00 2001 From: Morgane Date: Tue, 3 Mar 2026 05:55:42 +0100 Subject: [PATCH] added flake for reproducible builds on NixOS --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..5261a7a19 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..c143911aa --- /dev/null +++ b/flake.nix @@ -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; + }; + } + ); + }; +}