From 0a209f7d39e62c888ecbf6fbfe723e4690eb28ea Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sat, 24 May 2025 09:37:35 +0200 Subject: [PATCH] flake.*: upgrade to nixpkgs 25.05, use nixpkgs android SDK Signed-off-by: Elias Naur --- flake.lock | 91 ++++++++++++++---------------------------------------- flake.nix | 77 ++++++++++++++++++++++----------------------- 2 files changed, 61 insertions(+), 107 deletions(-) diff --git a/flake.lock b/flake.lock index 51c3e4ef..c27e97ab 100644 --- a/flake.lock +++ b/flake.lock @@ -1,86 +1,25 @@ { "nodes": { - "android": { - "inputs": { - "devshell": "devshell", - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1733430059, - "narHash": "sha256-o3O5tjrMMebRLuHQt7BbEw3jZgWRW5vnOptNXv8WdO4=", - "owner": "tadfisher", - "repo": "android-nixpkgs", - "rev": "d2f3c1ea99c0bea9d28a0e59daeb482f50d4cd35", - "type": "github" - }, - "original": { - "owner": "tadfisher", - "repo": "android-nixpkgs", - "type": "github" - } - }, - "devshell": { - "inputs": { - "nixpkgs": [ - "android", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1728330715, - "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", - "owner": "numtide", - "repo": "devshell", - "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "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" - } - }, "nixpkgs": { "locked": { - "lastModified": 1733261153, - "narHash": "sha256-eq51hyiaIwtWo19fPEeE0Zr2s83DYMKJoukNLgGGpek=", + "lastModified": 1747953325, + "narHash": "sha256-y2ZtlIlNTuVJUZCqzZAhIw5rrKP4DOSklev6c8PyCkQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b681065d0919f7eb5309a93cea2cfa84dec9aa88", + "rev": "55d1f923c480dadce40f5231feb472e81b0bab48", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.11", + "ref": "nixos-25.05", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "android": "android", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "utils": "utils" } }, "systems": { @@ -97,6 +36,24 @@ "repo": "default", "type": "github" } + }, + "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" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index af3f7a5d..a7dee57c 100644 --- a/flake.nix +++ b/flake.nix @@ -3,42 +3,38 @@ description = "Gio build environment"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; - android.url = "github:tadfisher/android-nixpkgs"; - android.inputs.nixpkgs.follows = "nixpkgs"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, android }: - let - supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; - forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); - in - { - devShells = forAllSystems - (system: - let - pkgs = import nixpkgs { - inherit system; + outputs = { self, nixpkgs, utils }: + utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + + # allow unfree Android packages. + config.allowUnfree = true; + # accept the Android SDK license. + config.android_sdk.accept_license = true; + }; + in { + devShells = let + android-sdk = let + androidComposition = pkgs.androidenv.composeAndroidPackages { + platformVersions = [ "latest" ]; + abiVersions = [ "armeabi-v7a" "arm64-v8a" ]; + # Omit the deprecated tools package. + toolsVersion = null; + includeNDK = true; }; - android-sdk = android.sdk.${system} (sdkPkgs: with sdkPkgs; - [ - build-tools-31-0-0 - cmdline-tools-latest - platform-tools - platforms-android-31 - ndk-bundle - ]); - in - { - default = with pkgs; mkShell - ({ - ANDROID_SDK_ROOT = "${android-sdk}/share/android-sdk"; - JAVA_HOME = jdk17.home; - packages = [ - android-sdk - jdk17 - clang - ] ++ (if stdenv.isLinux then [ + in androidComposition.androidsdk; + in { + default = with pkgs; + mkShell (rec { + ANDROID_HOME = "${android-sdk}/libexec/android-sdk"; + packages = [ android-sdk jdk clang ] + ++ (if stdenv.isLinux then [ vulkan-headers libxkbcommon wayland @@ -47,11 +43,12 @@ xorg.libXfixes libGL pkg-config - ] else [ ]); - } // (if stdenv.isLinux then { - LD_LIBRARY_PATH = "${vulkan-loader}/lib"; - } else { })); - } - ); - }; + ] else + [ ]); + } // (if stdenv.isLinux then { + LD_LIBRARY_PATH = "${vulkan-loader}/lib"; + } else + { })); + }; + }); }