From 06f9229623ceaf954fb35dcadbd7752ccc8be5ed Mon Sep 17 00:00:00 2001 From: user Date: Thu, 26 Dec 2024 16:34:19 +0300 Subject: [PATCH] Add support for all default systems --- flake.lock | 34 +++++++++++++++++++++++ flake.nix | 81 ++++++++++++++++++++++++++++-------------------------- 2 files changed, 76 insertions(+), 39 deletions(-) diff --git a/flake.lock b/flake.lock index 68dab629..abd27c51 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "ivp-submodule": { "flake": false, "locked": { @@ -49,12 +67,28 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "ivp-submodule": "ivp-submodule", "lib-submodule": "lib-submodule", "nixpkgs": "nixpkgs", "thirdparty-submodule": "thirdparty-submodule" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "thirdparty-submodule": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index f467fcdb..78c01075 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,7 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; ivp-submodule = { url = "github:nillerusr/source-physics"; @@ -18,45 +19,47 @@ }; }; - outputs = { self, nixpkgs, ... }@inputs: - let - pkgs = nixpkgs.legacyPackages.x86_64-linux; + outputs = { self, nixpkgs, flake-utils, ... }@inputs: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; - # 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 - { - # Install the game on your own computer - packages.x86_64-linux = { - hl2 = pkgs.callPackage ./build.nix { inherit hl2-unwrapped; }; - default = self.packages.x86_64-linux.hl2; - }; + # 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 + { + # Install the game on your own computer + packages = { + hl2 = pkgs.callPackage ./build.nix { inherit hl2-unwrapped; }; + default = self.packages.${system}.hl2; + }; - # Build the game for others - devShells.default = pkgs.mkShell rec { - nativeBuildInputs = with pkgs; [ - makeWrapper - SDL2 - freetype - fontconfig - zlib - bzip2 - libjpeg - libpng - curl - openal - libopus - pkg-config - gcc - python3 - ]; - }; - }; + # Build the game for others + devShells.default = pkgs.mkShell rec { + nativeBuildInputs = with pkgs; [ + makeWrapper + SDL2 + freetype + fontconfig + zlib + bzip2 + libjpeg + libpng + curl + openal + libopus + pkg-config + gcc + python3 + ]; + }; + } + ); }