From 6850933db74834216b706fe7f2ec1d067e08b4d6 Mon Sep 17 00:00:00 2001 From: user Date: Mon, 23 Dec 2024 06:04:17 +0300 Subject: [PATCH] Git submodules fix --- build.nix | 7 ++----- flake.lock | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 29 +++++++++++++++++++++++++++-- 3 files changed, 81 insertions(+), 8 deletions(-) diff --git a/build.nix b/build.nix index c4058c1c..f9d2fcb8 100644 --- a/build.nix +++ b/build.nix @@ -1,12 +1,9 @@ { callPackage , symlinkJoin +, hl2-unwrapped ? callPackage ./hl2-unwrapped.nix { } +, hl2-wrapper ? callPackage ./hl2-wrapper.nix { inherit hl2-unwrapped; } }: -let - # Strangely, these are overridable - hl2-unwrapped = callPackage ./hl2-unwrapped.nix { }; - hl2-wrapper = callPackage ./hl2-wrapper.nix { inherit hl2-unwrapped; }; -in symlinkJoin { name = "hl2"; diff --git a/flake.lock b/flake.lock index cf9e0127..68dab629 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,37 @@ { "nodes": { + "ivp-submodule": { + "flake": false, + "locked": { + "lastModified": 1703378318, + "narHash": "sha256-FA5NrzumsKADWmC2JeUiYShHE7LoEWH8E92R5IEana0=", + "owner": "nillerusr", + "repo": "source-physics", + "rev": "47533475e01cbff05fbc3bbe8b4edc485f292cea", + "type": "github" + }, + "original": { + "owner": "nillerusr", + "repo": "source-physics", + "type": "github" + } + }, + "lib-submodule": { + "flake": false, + "locked": { + "lastModified": 1663437616, + "narHash": "sha256-tpK15gJOvFpjDqFAIQ1lyaCW81R1Sxd39sX2xHsWX3o=", + "owner": "nillerusr", + "repo": "source-engine-libs", + "rev": "86a66ee92d9fda0a09f54a435e850faa7ab5d0fa", + "type": "github" + }, + "original": { + "owner": "nillerusr", + "repo": "source-engine-libs", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1734566935, @@ -17,7 +49,26 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "ivp-submodule": "ivp-submodule", + "lib-submodule": "lib-submodule", + "nixpkgs": "nixpkgs", + "thirdparty-submodule": "thirdparty-submodule" + } + }, + "thirdparty-submodule": { + "flake": false, + "locked": { + "lastModified": 1694693388, + "narHash": "sha256-d/vKz9gCwXd2fyxCxU4xE/3hb7A7mCO5AUyAD1vCIuY=", + "owner": "nillerusr", + "repo": "source-thirdparty", + "rev": "3b2f5275072a0acdbac410f14f750b690b9b4c13", + "type": "github" + }, + "original": { + "owner": "nillerusr", + "repo": "source-thirdparty", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index eb722573..bf07a17a 100644 --- a/flake.nix +++ b/flake.nix @@ -1,15 +1,40 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs"; + + ivp-submodule = { + url = "github:nillerusr/source-physics"; + flake = false; + }; + + lib-submodule = { + url = "github:nillerusr/source-engine-libs"; + flake = false; + }; + + thirdparty-submodule = { + url = "github:nillerusr/source-thirdparty"; + flake = false; + }; }; - outputs = { self, nixpkgs }: + outputs = { self, nixpkgs, ... }@inputs: let pkgs = nixpkgs.legacyPackages.x86_64-linux; + + # Fix for git submodules + hl2-unwrapped = (pkgs.callPackage ./hl2-unwrapped.nix { }).overrideAttrs { + postPatch = '' + rm -rf ./{ivp,lib,thirdparty} + ln -s ${inputs.ivp-submodule} ./ivp + ln -s ${inputs.lib-submodule} ./lib + ln -s ${inputs.thirdparty-submodule} ./thirdparty + ''; + }; in { packages.x86_64-linux = { - hl2 = pkgs.callPackage ./build.nix { }; + hl2 = pkgs.callPackage ./build.nix { inherit hl2-unwrapped; }; default = self.packages.x86_64-linux.hl2; }; };