flake nix-filter for src

This commit is contained in:
Vinzenz Schroeter 2024-11-09 20:04:44 +01:00
parent 36d0daba05
commit 73f3255741
2 changed files with 32 additions and 9 deletions

View file

@ -20,6 +20,21 @@
"type": "github" "type": "github"
} }
}, },
"nix-filter": {
"locked": {
"lastModified": 1730207686,
"narHash": "sha256-SCHiL+1f7q9TAnxpasriP6fMarWE5H43t25F5/9e28I=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "776e68c1d014c3adde193a18db9d738458cd2ba4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-filter",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1730883749, "lastModified": 1730883749,
@ -39,6 +54,7 @@
"root": { "root": {
"inputs": { "inputs": {
"naersk": "naersk", "naersk": "naersk",
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View file

@ -7,6 +7,10 @@
url = "github:nix-community/naersk"; url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-filter = {
url = "github:numtide/nix-filter";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
@ -14,6 +18,7 @@
self, self,
nixpkgs, nixpkgs,
naersk, naersk,
nix-filter,
}: }:
let let
lib = nixpkgs.lib; lib = nixpkgs.lib;
@ -37,7 +42,17 @@
in in
rec { rec {
servicepoint-simulator = naersk'.buildPackage rec { servicepoint-simulator = naersk'.buildPackage rec {
src = ./.; src = nix-filter.lib.filter {
root = ./.;
include = [
./Cargo.toml
./Cargo.lock
./src
./Web437_IBM_BIOS.woff
./README.md
./LICENSE
];
};
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
makeWrapper makeWrapper
@ -71,14 +86,6 @@
wrapProgram $out/bin/servicepoint-simulator \ wrapProgram $out/bin/servicepoint-simulator \
--suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} --suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs}
''; '';
#postFixup = ''
# patchelf $out/bin/servicepoint-simulator --add-rpath ${pkgs.lib.makeLibraryPath buildInputs}
#'';
#postInstall = ''
# patchelf $out/bin/servicepoint-simulator --add-rpath ${pkgs.lib.makeLibraryPath buildInputs}
#'';
}; };
default = servicepoint-simulator; default = servicepoint-simulator;