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": { "helix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
@ -38,22 +40,6 @@
} }
}, },
"nixpkgs": { "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": { "locked": {
"lastModified": 1784120854, "lastModified": 1784120854,
"narHash": "sha256-KesHgItiZPgGX740axSiQLcIQ8D24MDqNpkKYWIek8k=", "narHash": "sha256-KesHgItiZPgGX740axSiQLcIQ8D24MDqNpkKYWIek8k=",
@ -73,7 +59,7 @@
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"helix": "helix", "helix": "helix",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs"
} }
}, },
"rust-overlay": { "rust-overlay": {

View File

@ -3,6 +3,7 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
helix.url = "github:helix-editor/helix"; helix.url = "github:helix-editor/helix";
helix.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = outputs =
@ -27,23 +28,27 @@
in in
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {
name = "syntax"; name = "syntax";
nativeBuildInputs = [ pkgs.patchelf ];
phases = [ phases = [
"buildPhase" "buildPhase"
"installPhase" "installPhase"
]; ];
buildPhase = '' buildPhase = ''
cp -r ${helix}/runtime/queries/* ./ mkdir -p build
chmod u+w ./* -R cp -r ${helix}/runtime/queries/* ./build/
chmod u+w ./build -R
for so in ${grammars}/*.so; do for so in ${grammars}/*.so; do
name=$(basename "$so" .so) name=$(basename "$so" .so)
if [ -d "./$name" ]; then if [ -d "./build/$name" ]; then
cp "$so" "./$name/$name.so" cp "$so" "./build/$name/$name.so"
chmod u+w "./build/$name/$name.so"
patchelf --shrink-rpath "./build/$name/$name.so"
fi fi
done done
''; '';
installPhase = '' installPhase = ''
mkdir -p $out mkdir -p $out
cp -r ./* $out/ cp -r ./build/* $out/
''; '';
}; };
packages.themes = pkgs.stdenv.mkDerivation { packages.themes = pkgs.stdenv.mkDerivation {
@ -57,7 +62,14 @@
packages.karnaugh = pkgs.rustPlatform.buildRustPackage (final: { packages.karnaugh = pkgs.rustPlatform.buildRustPackage (final: {
pname = "karnaugh"; pname = "karnaugh";
version = "0.1.5"; 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; cargoLock.lockFile = ./Cargo.lock;
}); });
packages.container = pkgs.dockerTools.buildImage { packages.container = pkgs.dockerTools.buildImage {