feat: shrink container size

This commit is contained in:
Jan-Bulthuis 2026-07-19 22:44:21 +02:00
parent 085ddaa0bf
commit 7c50234101
2 changed files with 22 additions and 24 deletions

22
flake.lock generated
View File

@ -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": {

View File

@ -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 {