diff --git a/flake.lock b/flake.lock index 9c6be7ccb..ca2bd8462 100644 --- a/flake.lock +++ b/flake.lock @@ -1,59 +1,59 @@ { "nodes": { - "flake-utils": { + "flake-parts": { "inputs": { - "systems": "systems" + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1711497579, - "narHash": "sha256-H6/9jraWg7e6pxFGEArpyXwQ/5dy/u5Un67WiLsuPGA=", + "lastModified": 1747825515, + "narHash": "sha256-BWpMQymVI73QoKZdcVCxUCCK3GNvr/xa2Dc4DM1o2BE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e80d1b630036fe33badbc168dfcd071d463b92cf", + "rev": "cd2812de55cf87df88a9e09bf3be1ce63d50c1a6", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixos-25.05", "repo": "nixpkgs", - "rev": "e80d1b630036fe33badbc168dfcd071d463b92cf", "type": "github" } }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - }, - "systems": { + "nixpkgs-lib": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1743296961, + "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "nix-community", + "repo": "nixpkgs.lib", "type": "github" } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 1b23c15cf..259e75b29 100644 --- a/flake.nix +++ b/flake.nix @@ -3,49 +3,61 @@ { inputs = { - # Whenever an upstream change is merged, update this to - # the relevant commit and remove the packages from the - # ...ToUpstream lists below - nixpkgs.url = "github:NixOS/nixpkgs/e80d1b630036fe33badbc168dfcd071d463b92cf"; - flake-utils.url = "github:numtide/flake-utils"; + # Whenever an upstream change is merged, update this and + # remove the packages from the ...ToUpstream lists below + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - - devTools = with pkgs; [ - # Tools that are required in order to develop with Monado, but that are not required to build Monado itself - # These cannot be upstreamed into nixpkgs, as they are not required to build Monado - # See https://github.com/NixOS/nix/issues/7501 for a discussion on this - clang - cmake-format - git - gradle - gradle-completion + outputs = + inputs@{ nixpkgs, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" ]; - - nativeBuildInputsToUpstream = with pkgs; [ - # If there are any nativeBuildInputs that are not in nixpkgs, add them here - # nativeBuildInputs are packages that are needed to develop and/or build the project (i.e. tooling) - ]; - - buildInputsToUpstream = with pkgs; [ - # If there are any buildInputs that are not in nixpkgs, add them here - # buildInputs are any packages that are needed at runtime (i.e. dependencies) - ]; - - package = pkgs.monado.overrideAttrs (oldAttrs: { - src = ./.; - - nativeBuildInputs = oldAttrs.nativeBuildInputs ++ nativeBuildInputsToUpstream ++ devTools; - buildInputs = oldAttrs.buildInputs ++ buildInputsToUpstream; - - patches = []; - }); - in { - packages.default = package; - devShells.default = package; - } - ); + perSystem = + { pkgs, lib, ... }: + let + devTools = with pkgs; [ + # Tools that are required in order to develop with Monado + # but are not required to build Monado itself + clang-tools + cmake-format + git + gradle + gradle-completion + ]; + + nativeBuildInputsToUpstream = with pkgs; [ + # If there are any nativeBuildInputs that are not in nixpkgs, add them here + # nativeBuildInputs are packages that are needed to develop and/or build the project (i.e. tooling) + ]; + + buildInputsToUpstream = with pkgs; [ + # If there are any buildInputs that are not in nixpkgs, add them here + # buildInputs are any packages that are needed at runtime (i.e. dependencies) + ]; + + package = pkgs.monado.overrideAttrs (oldAttrs: { + src = ./.; + + nativeBuildInputs = oldAttrs.nativeBuildInputs ++ nativeBuildInputsToUpstream; + buildInputs = oldAttrs.buildInputs ++ buildInputsToUpstream; + cmakeFlags = lib.remove "-DXRT_HAVE_STEAM:BOOL=TRUE" oldAttrs.cmakeFlags; + + patches = [ ]; + }); + in + { + packages.default = package; + devShells.default = package.overrideAttrs (oldAttrs: { + nativeBuildInputs = oldAttrs.nativeBuildInputs ++ devTools; + }); + + formatter = pkgs.nixfmt-rfc-style; + }; + }; }