diff --git a/flake.nix b/flake.nix
index 7b7e36b90249625fad2123e1b1cb7ecf5369ea5a..c1d34d8baaa9b323bbd4e2d2121bd62b123a9d04 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,54 +1,62 @@
 {
- description = "docman is a document management tool";
+  description = "docman is a document management tool";
 
   inputs = {
-    nixpkgs.url = "nixpkgs/nixos-23.05";    
+    nixpkgs.url = "nixpkgs/nixos-23.05";
   };
 
-  outputs = { self, nixpkgs,  ... }:
+  outputs = { self, nixpkgs, ... }:
     let
+      # Extract the version from version.json
+      versionData = builtins.fromJSON (builtins.readFile ./version.json);
+      version = versionData.version;
 
+      # Convert the last modified date to ISO format
       lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";
+      isoDate = builtins.concatStringsSep "" [
+        (builtins.substring 0 4 lastModifiedDate) 
+        (builtins.substring 4 2 lastModifiedDate)
+        (builtins.substring 6 2 lastModifiedDate)
+      ];
+
       supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
 
       forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
 
       nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
       pkgs = import nixpkgs { system = "x86_64-linux"; };
-      
-    in {
 
+    in
+    {
       packages = forAllSystems (system:
         let
-           pkgs = nixpkgsFor.${system};
-  
-        in {
+          pkgs = nixpkgsFor.${system};
+        in
+        {
           docman = pkgs.buildGoModule {
-          
+
             name = "docman";
-            version = "${self.ref}";
-            
+            version = version;
+
             src = ././source;
 
             vendorSha256 = "sha256-81IBG8H1jsYKD+tmFeCpAWFdz6cuQDt9r+FV56xboBU=";
-            
+
             ldflags = [
-                 "-X 'gitlab.schukai.com/oss/utilities/documentation-manager/release.version=${self.ref}' -X 'gitlab.schukai.com/oss/utilities/documentation-manager/release.build=${self.lastModified}'"
-                      ];
-             
+              "-X 'gitlab.schukai.com/oss/utilities/documentation-manager/release.version=${version}' -X 'gitlab.schukai.com/oss/utilities/documentation-manager/release.build=${isoDate}'"
+            ];
 
             meta = with nixpkgs.legacyPackages.${system}.lib; {
-                description = "docman is a document management tool";
-                homepage = "https://gitlab.schukai.com/oss/utilities/documentation-manager";
-                license = licenses.mit;
-                maintainers = with maintainers; [ "schukai GmbH" ];
-              };    
-
+              description = "docman is a document management tool";
+              homepage = "https://gitlab.schukai.com/oss/utilities/documentation-manager";
+              license = licenses.mit;
+              maintainers = with maintainers; [ "schukai GmbH" ];
+            };
           };
         });
-      
+
       devShells = forAllSystems (system:
-        let 
+        let
           pkgs = nixpkgsFor.${system};
         in
         {
@@ -57,7 +65,6 @@
           };
         });
 
-
       defaultPackage = forAllSystems (system: self.packages.${system}.docman);
     };
 }