diff --git a/targets/laptop/flake-module.nix b/targets/laptop/flake-module.nix index 743826516..1bab180d6 100644 --- a/targets/laptop/flake-module.nix +++ b/targets/laptop/flake-module.nix @@ -11,6 +11,8 @@ let system = "x86_64-linux"; + pkgs = import inputs.nixpkgs { inherit system; }; + laptop-configuration = import ./laptop-configuration-builder.nix { inherit lib self inputs; }; targets = [ @@ -108,12 +110,28 @@ let } ]) ]; + + flashScript = pkgs.callPackage ../../packages/flash { }; + genPkgWithFlashScript = + pkg: + pkgs.linkFarm "ghaf-image" [ + { + name = "image"; + path = pkg; + } + { + name = "flash-script"; + path = flashScript; + } + ]; in { flake = { nixosConfigurations = builtins.listToAttrs ( map (t: lib.nameValuePair t.name t.hostConfiguration) targets ); - packages.${system} = builtins.listToAttrs (map (t: lib.nameValuePair t.name t.package) targets); + packages.${system} = builtins.listToAttrs ( + map (t: lib.nameValuePair t.name (genPkgWithFlashScript t.package)) targets + ); }; } diff --git a/targets/lenovo-x1-installer/flake-module.nix b/targets/lenovo-x1-installer/flake-module.nix index 27cd39d5f..c1cdfa9a5 100644 --- a/targets/lenovo-x1-installer/flake-module.nix +++ b/targets/lenovo-x1-installer/flake-module.nix @@ -6,10 +6,11 @@ let name = "lenovo-x1-carbon"; system = "x86_64-linux"; + pkgs = import self.inputs.nixpkgs { inherit system; }; installer = generation: variant: let - imagePath = self.packages.x86_64-linux."${name}-${generation}-${variant}" + "/disk1.raw.zst"; + imagePath = self.packages.x86_64-linux."${name}-${generation}-${variant}" + "/image/disk1.raw.zst"; hostConfiguration = lib.nixosSystem { inherit system; modules = [ @@ -72,12 +73,25 @@ let (installer "gen10" "release") (installer "gen11" "release") ]; + flashScript = pkgs.callPackage ../../packages/flash { }; + genPkgWithFlashScript = + pkg: + pkgs.linkFarm "ghaf-image" [ + { + name = "image"; + path = pkg; + } + { + name = "flash-script";ni + path = flashScript; + } + ]; in { flake = { nixosConfigurations = builtins.listToAttrs ( map (t: lib.nameValuePair t.name t.hostConfiguration) targets ); - packages.${system} = builtins.listToAttrs (map (t: lib.nameValuePair t.name t.package) targets); + packages.${system} = builtins.listToAttrs (map (t: lib.nameValuePair t.name (genPkgWithFlashScript t.package)) targets); }; } diff --git a/targets/nvidia-jetson-orin/flake-module.nix b/targets/nvidia-jetson-orin/flake-module.nix index b98b244f8..78df7c441 100644 --- a/targets/nvidia-jetson-orin/flake-module.nix +++ b/targets/nvidia-jetson-orin/flake-module.nix @@ -174,6 +174,23 @@ let inherit jetpack-nixos; inherit flash-tools-system; }; + + genPkgWithFlashScripts = + t: system: + (import nixpkgs { inherit system; }).linkFarm "ghaf-image" [ + { + name = "image"; + path = t.package; + } + { + name = "${t.name}-flash-script"; + path = generate-flash-script t system; + } + { + name = "${t.name}-flash-qspi"; + path = generate-flash-qspi t system; + } + ]; in { flake = { @@ -183,7 +200,9 @@ in packages = { aarch64-linux = - builtins.listToAttrs (map (t: lib.nameValuePair t.name t.package) targets) + builtins.listToAttrs ( + map (t: lib.nameValuePair t.name (genPkgWithFlashScripts t "aarch64-linux")) targets + ) # EXPERIMENTAL: The aarch64-linux hosted flashing support is experimental # and it simply might not work. Providing the script anyway // builtins.listToAttrs ( @@ -195,7 +214,9 @@ in map (t: lib.nameValuePair "${t.name}-flash-qspi" (generate-flash-qspi t "aarch64-linux")) targets ); x86_64-linux = - builtins.listToAttrs (map (t: lib.nameValuePair t.name t.package) crossTargets) + builtins.listToAttrs ( + map (t: lib.nameValuePair t.name (genPkgWithFlashScripts t "x86_64-linux")) crossTargets + ) // builtins.listToAttrs ( map (t: lib.nameValuePair "${t.name}-flash-script" (generate-flash-script t "x86_64-linux")) ( targets ++ crossTargets