From 73f3255741e5ad81ce45e7a974e22debc8afe901 Mon Sep 17 00:00:00 2001
From: Vinzenz Schroeter <vinzenz.f.s@gmail.com>
Date: Sat, 9 Nov 2024 20:04:44 +0100
Subject: [PATCH] flake nix-filter for src

---
 flake.lock | 16 ++++++++++++++++
 flake.nix  | 25 ++++++++++++++++---------
 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/flake.lock b/flake.lock
index b30ce1c..7f148c2 100644
--- a/flake.lock
+++ b/flake.lock
@@ -20,6 +20,21 @@
         "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": {
       "locked": {
         "lastModified": 1730883749,
@@ -39,6 +54,7 @@
     "root": {
       "inputs": {
         "naersk": "naersk",
+        "nix-filter": "nix-filter",
         "nixpkgs": "nixpkgs"
       }
     }
diff --git a/flake.nix b/flake.nix
index 35f3ce5..d59aa55 100644
--- a/flake.nix
+++ b/flake.nix
@@ -7,6 +7,10 @@
       url = "github:nix-community/naersk";
       inputs.nixpkgs.follows = "nixpkgs";
     };
+    nix-filter = {
+      url = "github:numtide/nix-filter";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
   };
 
   outputs =
@@ -14,6 +18,7 @@
       self,
       nixpkgs,
       naersk,
+      nix-filter,
     }:
     let
       lib = nixpkgs.lib;
@@ -37,7 +42,17 @@
         in
         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; [
               pkg-config
               makeWrapper
@@ -71,14 +86,6 @@
               wrapProgram $out/bin/servicepoint-simulator \
                 --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;