Skip to content

add a nix development flake and black theme#103

Draft
Elec3137 wants to merge 3 commits into
mlm-games:mainfrom
Elec3137:nix-flake-and-black-theme
Draft

add a nix development flake and black theme#103
Elec3137 wants to merge 3 commits into
mlm-games:mainfrom
Elec3137:nix-flake-and-black-theme

Conversation

@Elec3137

@Elec3137 Elec3137 commented Jun 2, 2026

Copy link
Copy Markdown

In the PR I add a flake that simplifies developing this app on nixos, plus a black/OLED/high-contrast-dark theme to the app itself which is something I personally want to use.

This is a draft since I'm likely missing something with my addition of the theme (not experienced at all with working with this sort of app) and I've been unable to compile it due to the following error(s):

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared:cargoBuildDesktop' (registered in build file 'shared/build.gradle.kts').
> A problem occurred starting process 'command 'cargo''

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared:cargoBuildAndroid' (registered in build file 'shared/build.gradle.kts').
> A problem occurred starting process 'command 'cargo''

Some guidance would be appreciated, as I've looked through shared/build.gradle.kts and haven't found any possible problem with cargo.

note: for now the only thing different in the BlackColorScheme compared to the DarkColorScheme is the background value, since I wanted to try it out first before modifying the colors extensively.

@mlm-games

Copy link
Copy Markdown
Owner

I haven't really used nix in the past, so this might be wrong, but it seems like cargo is not a command in your system? If you have cargo installed and runnable via your terminal, then id assume this shouldn't require any extra configuration (but from what ive seen online, it seems like Android Studio is very hard to setup in nix? So am not sure if this might need any extra cfg)

Also can the build tools version and target api be taken from the release-android.yml or the build files directly?looking at the flake.nix file, it could become hard to maintain if there are multiple places were bumps have to be made for the same reason?

Maybe after this builds, we could discuss about splitting the pr and about the kotlin changes..

@Elec3137

Elec3137 commented Jun 3, 2026

Copy link
Copy Markdown
Author

I haven't really used nix in the past, so this might be wrong, but it seems like cargo is not a command in your system?

That's what I thought of first, which is why both cargo and rustc are specified within the flake; they are avaliable as commands, unless something in the build clears $PATH?

If you have cargo installed and runnable via your terminal, then id assume this shouldn't require any extra configuration

I would think so too...

(but from what ive seen online, it seems like Android Studio is very hard to setup in nix? So am not sure if this might need any extra cfg)

To clarify, I'm just trying to run ./gradlew :androidApp:assembleRelease, not all of android studio. I don't think it's actually hard to setup android studio at all though. It should just be adding (android-studio.withSdk androidSdk) to packages. Actually, I'll try building it through android-studio right now just in case it works that way.

Also can the build tools version and target api be taken from the release-android.yml or the build files directly?looking at the flake.nix file, it could become hard to maintain if there are multiple places were bumps have to be made for the same reason?

Yes, I believe I can do that from release-android.yml.

Maybe after this builds, we could discuss about splitting the pr and about the kotlin changes..

Oh, sorry about that. In hindsight this should have been two small PRs.

@Elec3137

Elec3137 commented Jun 3, 2026

Copy link
Copy Markdown
Author

Also can the build tools version and target api be taken from the release-android.yml or the build files directly?looking at the flake.nix file, it could become hard to maintain if there are multiple places were bumps have to be made for the same reason?

Yes, I believe I can do that from release-android.yml.

It's not as simple as I thought actually, since the ANDROID_API listed there does not match the target sdk listed in gradle/libs.versions.toml, so gradle tries to fetch version 37 rather than the version 36 provided, failing due to it being immutable. (is there something I'm missing?)

I can of course take the sdk version from gradle/libs.versions.toml and the build tools version from release-android.yml but it starts to seem no less fragile than hardcoding the values in the flake. I'm second guessing whether it's worth having one here at this point...

@mlm-games

mlm-games commented Jun 3, 2026

Copy link
Copy Markdown
Owner

It's not as simple as I thought actually, since the ANDROID_API listed there does not match the target sdk listed in gradle/libs.versions.toml, so gradle tries to fetch version 37 rather than the version 36 provided, failing due to it being immutable. (is there something I'm missing?)

This is a mistake, will fix it now, both should actually be 37

I can of course take the sdk version from gradle/libs.versions.toml and the build tools version from release-android.yml but it starts to seem no less fragile than hardcoding the values in the flake. I'm second guessing whether it's worth having one here at this point...

Um, maybe if there is another nixpkg which is similar to this, that can be referred for getting it to build, else maybe delaying it until maybe rust integration is easier, could be better?

Oh, sorry about that. In hindsight this should have been two small PRs.

No worries, was just mentioning it (can tell its mostly for fixing the build atm), for when i look back (am kinda forgetful due to repo juggling)

@Elec3137

Elec3137 commented Jun 3, 2026

Copy link
Copy Markdown
Author

This is a mistake, will fix it now, both should actually be 37

Okay, you can disregard my previous comment then; getting android versions from release-android.yml works then.

@Elec3137

Elec3137 commented Jun 3, 2026

Copy link
Copy Markdown
Author

In terms of getting it to build, I'm trying to manually execute cargo to find out what is actually going wrong, since somehow, running gradle with --debug doesn't give me any more information. There is probably some extra program I'm missing or something; like cargo-ndk, although adding just that didn't solve the problem.

@mlm-games

mlm-games commented Jun 3, 2026

Copy link
Copy Markdown
Owner

In terms of getting it to build, I'm trying to manually execute cargo to find out what is actually going wrong, since somehow, running gradle with --debug doesn't give me any more information. There is probably some extra program I'm missing or something; like cargo-ndk, although adding just that didn't solve the problem.

Maybe compile targets? Have you added all 4 android targets (ndk requires all even when you are compiling for only one aarch). Normally, cargo logs appear on clicking the topmost entry in the build tab to the left, and directly when running, so maybe scrolling up a little further could help (don't know the reason for the issue, so am just providing random suggestions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants