From 7c50234101b3f608affdcc561a7a8d21377c9b95 Mon Sep 17 00:00:00 2001 From: Jan-Bulthuis Date: Sun, 19 Jul 2026 22:44:21 +0200 Subject: [PATCH] feat: shrink container size --- flake.lock | 22 ++++------------------ flake.nix | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/flake.lock b/flake.lock index 5be1077..ee8b9b6 100644 --- a/flake.lock +++ b/flake.lock @@ -20,7 +20,9 @@ }, "helix": { "inputs": { - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "nixpkgs" + ], "rust-overlay": "rust-overlay" }, "locked": { @@ -38,22 +40,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1775036866, - "narHash": "sha256-ZojAnPuCdy657PbTq5V0Y+AHKhZAIwSIT2cb8UgAz/U=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "6201e203d09599479a3b3450ed24fa81537ebc4e", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1784120854, "narHash": "sha256-KesHgItiZPgGX740axSiQLcIQ8D24MDqNpkKYWIek8k=", @@ -73,7 +59,7 @@ "inputs": { "flake-utils": "flake-utils", "helix": "helix", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" } }, "rust-overlay": { diff --git a/flake.nix b/flake.nix index 82cf832..5603151 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; helix.url = "github:helix-editor/helix"; + helix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = @@ -27,23 +28,27 @@ in pkgs.stdenv.mkDerivation { name = "syntax"; + nativeBuildInputs = [ pkgs.patchelf ]; phases = [ "buildPhase" "installPhase" ]; buildPhase = '' - cp -r ${helix}/runtime/queries/* ./ - chmod u+w ./* -R + mkdir -p build + cp -r ${helix}/runtime/queries/* ./build/ + chmod u+w ./build -R for so in ${grammars}/*.so; do name=$(basename "$so" .so) - if [ -d "./$name" ]; then - cp "$so" "./$name/$name.so" + if [ -d "./build/$name" ]; then + cp "$so" "./build/$name/$name.so" + chmod u+w "./build/$name/$name.so" + patchelf --shrink-rpath "./build/$name/$name.so" fi done ''; installPhase = '' mkdir -p $out - cp -r ./* $out/ + cp -r ./build/* $out/ ''; }; packages.themes = pkgs.stdenv.mkDerivation { @@ -57,7 +62,14 @@ packages.karnaugh = pkgs.rustPlatform.buildRustPackage (final: { pname = "karnaugh"; version = "0.1.5"; - src = self; + src = pkgs.lib.fileset.toSource { + root = ./.; + fileset = pkgs.lib.fileset.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; cargoLock.lockFile = ./Cargo.lock; }); packages.container = pkgs.dockerTools.buildImage {