From ee94f16884c32b1d57fabd2ef32277158a26d260 Mon Sep 17 00:00:00 2001 From: algorithmiker <104317939+algorithmiker@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:26:41 +0100 Subject: [PATCH] Flake refactor, update --- flake.lock | 30 +++++++------- flake.nix | 113 +++++++++++++++++++++++++++-------------------------- 2 files changed, 73 insertions(+), 70 deletions(-) diff --git a/flake.lock b/flake.lock index 6d7271b..0904311 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1762538466, - "narHash": "sha256-8zrIPl6J+wLm9MH5ksHcW7BUHo7jSNOu0/hA0ohOOaM=", + "lastModified": 1767744144, + "narHash": "sha256-9/9ntI0D+HbN4G0TrK3KmHbTvwgswz7p8IEJsWyef8Q=", "owner": "ipetkov", "repo": "crane", - "rev": "0cea393fffb39575c46b7a0318386467272182fe", + "rev": "2fb033290bf6b23f226d4c8b32f7f7a16b043d7e", "type": "github" }, "original": { @@ -21,11 +21,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1761979010, - "narHash": "sha256-isqMvjTk3jdTHN6KA/BWQvOSVe7O35OQKAZNtLK76OY=", + "lastModified": 1767250179, + "narHash": "sha256-PnQdWvPZqHp+7yaHWDFX3NYSKaOy0fjkwpR+rIQC7AY=", "owner": "nix-community", "repo": "fenix", - "rev": "3107255abfe4f2d1c3eee7a3e2f5a5eb6f2200fe", + "rev": "a3eaf682db8800962943a77ab77c0aae966f9825", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1761672384, - "narHash": "sha256-o9KF3DJL7g7iYMZq9SWgfS1BFlNbsm6xplRjVlOCkXI=", + "lastModified": 1766902085, + "narHash": "sha256-coBu0ONtFzlwwVBzmjacUQwj3G+lybcZ1oeNSQkgC0M=", "owner": "nixos", "repo": "nixpkgs", - "rev": "08dacfca559e1d7da38f3cf05f1f45ee9bfd213c", + "rev": "c0b0e0fddf73fd517c3471e546c0df87a42d53f4", "type": "github" }, "original": { @@ -53,11 +53,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1762596750, - "narHash": "sha256-rXXuz51Bq7DHBlfIjN7jO8Bu3du5TV+3DSADBX7/9YQ=", + "lastModified": 1767892417, + "narHash": "sha256-dhhvQY67aboBk8b0/u0XB6vwHdgbROZT3fJAjyNh5Ww=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b6a8526db03f735b89dd5ff348f53f752e7ddc8e", + "rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba", "type": "github" }, "original": { @@ -77,11 +77,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1761894503, - "narHash": "sha256-SreGV62DEv7kLJEcOBrw2V6Kup0siT4wS3Ye8PlFTdE=", + "lastModified": 1767191410, + "narHash": "sha256-cCZGjubgDWmstvFkS6eAw2qk2ihgWkycw55u2dtLd70=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "2e2e3ebec91215078de9b754363fc9a7b0fdef13", + "rev": "a9026e6d5068172bf5a0d52a260bb290961d1cb4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7a91d3e..f150eee 100644 --- a/flake.nix +++ b/flake.nix @@ -15,61 +15,64 @@ crane, }: let - systems = nixpkgs.lib.systems.flakeExposed; - forAllSystems = f: builtins.foldl' nixpkgs.lib.recursiveUpdate { } (builtins.map f systems); + forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; in - forAllSystems ( - system: - let - pkgs = nixpkgs.legacyPackages.${system}; - rustfmt-nightly = fenix.packages.${system}.default.rustfmt; - craneLib = crane.mkLib pkgs; - rpath-libs = [ - pkgs.libGL - pkgs.libxkbcommon - pkgs.wayland - pkgs.luajit - ]; - craneCommonArgs = { - pname = "entrace"; - version = "0.1.1"; - src = pkgs.lib.fileset.toSource { - root = ./.; - fileset = pkgs.lib.fileset.unions [ - (craneLib.fileset.commonCargoSources ./.) - (pkgs.lib.fileset.fileFilter (file: file.hasExt "md") ./.) - (pkgs.lib.fileset.maybeMissing ./gui/vendor) - (pkgs.lib.fileset.maybeMissing ./docs) + { + devShells = forAllSystems (system: { + default = import ./shell.nix { + pkgs = nixpkgs.legacyPackages.${system}; + rustfmt-nightly = fenix.packages.${system}.default.rustfmt; + }; + }); + packages = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + craneLib = crane.mkLib pkgs; + rpath-libs = [ + pkgs.libGL + pkgs.libxkbcommon + pkgs.wayland + pkgs.luajit + ]; + craneCommonArgs = { + version = "0.1.2"; + pname = "entrace-deps"; + src = pkgs.lib.fileset.toSource { + root = ./.; + fileset = pkgs.lib.fileset.unions [ + (craneLib.fileset.commonCargoSources ./.) + (pkgs.lib.fileset.fileFilter (file: file.hasExt "md") ./.) + (pkgs.lib.fileset.maybeMissing ./gui/vendor) + (pkgs.lib.fileset.maybeMissing ./docs) + ]; + }; + cargoCheckExtraArgs = ""; + buildInputs = [ ] ++ rpath-libs; + nativeBuildInputs = [ + pkgs.mold-wrapped + pkgs.patchelf + pkgs.pkg-config ]; }; - buildInputs = [ ] ++ rpath-libs; - nativeBuildInputs = [ - pkgs.breakpointHook - pkgs.mold-wrapped - pkgs.patchelf - pkgs.pkg-config - ]; - }; - cargoArtifacts = craneLib.buildDepsOnly craneCommonArgs; - craneWithCommonArgs = - x: craneLib.buildPackage (craneCommonArgs // { inherit cargoArtifacts; } // x); - entraceApp = craneWithCommonArgs { - pname = "entrace"; - cargoExtraArgs = "-p entrace_gui"; - postFixup = '' - ENTRACE_BIN="$out/bin/entrace" - patchelf --add-rpath ${pkgs.lib.makeLibraryPath rpath-libs} "$ENTRACE_BIN" - patchelf \ - --add-needed libwayland-client.so \ - --add-needed libxkbcommon.so \ - --add-needed libEGL.so \ - --add-needed libluajit-5.1.so "$ENTRACE_BIN" - ''; - }; - in - { - devShells.${system}.default = import ./shell.nix { inherit pkgs rustfmt-nightly; }; - packages.${system} = { + cargoArtifacts = craneLib.buildDepsOnly craneCommonArgs; + craneWithCommonArgs = + x: craneLib.buildPackage (craneCommonArgs // { inherit cargoArtifacts; } // x); + entraceApp = craneWithCommonArgs { + pname = "entrace"; + cargoExtraArgs = "-p entrace_gui"; + postFixup = '' + ENTRACE_BIN="$out/bin/entrace" + patchelf --add-rpath ${pkgs.lib.makeLibraryPath rpath-libs} "$ENTRACE_BIN" + patchelf \ + --add-needed libwayland-client.so \ + --add-needed libxkbcommon.so \ + --add-needed libEGL.so \ + --add-needed libluajit-5.1.so "$ENTRACE_BIN" + ''; + }; + in + { default = entraceApp; entrace = entraceApp; entrace_core = craneWithCommonArgs { @@ -84,7 +87,7 @@ pname = "entrace-script"; cargoExtraArgs = "-p entrace_script"; }; - }; - } - ); + } + ); + }; }