Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite the microsoft/surface linuxPackage function to make it simpler to use #851

Merged
merged 17 commits into from
Feb 2, 2024

Conversation

mexisme
Copy link
Contributor

@mexisme mexisme commented Jan 30, 2024

Description of changes

The original linuxPackage function required passing-in more metadata / params than necessary (apologies for my code!).
I rewrote it some months ago, based on a similar set of functions I use in a private repo to (hopefully) make it simpler to use.

Things done
  • Tested the changes in your own NixOS Configuration
  • Tested the changes end-to-end by using your fork of nixos-hardware and
    importing it via <nixos-hardware> or Flake input

@mexisme mexisme marked this pull request as ready for review January 30, 2024 23:05
@mexisme
Copy link
Contributor Author

mexisme commented Jan 30, 2024

@mexisme mexisme marked this pull request as draft January 30, 2024 23:34
@damianoognissanti
Copy link
Contributor

I had to manually set microsoft-surface.kernelVersion="6.6.13"; in my configuration.nix for it to build. Previously you could leave it unset for the default value.
I am building it now to see if everything works as expected. Will write again later today.

@damianoognissanti
Copy link
Contributor

Btw, are there plans to cache the builds somehow? Either in the regular cache or the nix-community one? To avoid the frequent recompilations?

@damianoognissanti
Copy link
Contributor

Everything seems to work on my machine. Batteries are detected (but they are with stock kernel too), the camera works (using v4l2loopback), and touchscreen too.

@mexisme
Copy link
Contributor Author

mexisme commented Jan 31, 2024

I had to manually set microsoft-surface.kernelVersion="6.6.13"; in my configuration.nix for it to build. Previously you could leave it unset for the default value. I am building it now to see if everything works as expected. Will write again later today.

Yes, I ran out of time to find this, and just found + fixed it:

Thanks for testing it!

@mexisme mexisme marked this pull request as ready for review January 31, 2024 07:46
@mexisme
Copy link
Contributor Author

mexisme commented Jan 31, 2024

I had to manually set microsoft-surface.kernelVersion="6.6.13"; in my configuration.nix for it to build. Previously you could leave it unset for the default value. I am building it now to see if everything works as expected. Will write again later today.

Ah, I see how that code was intended, now; I misinterpreted the intention.
Let me fix this, now...

@mexisme mexisme force-pushed the microsoft/surface/kernel-6.6 branch from 98e04a5 to 85a2b55 Compare January 31, 2024 08:33
@mexisme
Copy link
Contributor Author

mexisme commented Jan 31, 2024

I had to manually set microsoft-surface.kernelVersion="6.6.13"; in my configuration.nix for it to build. Previously you could leave it unset for the default value. I am building it now to see if everything works as expected. Will write again later today.

Ah, I see how that code was intended, now; I misinterpreted the intention. Let me fix this, now...

I think I've fixed it — i.e. restored the functionality — so you can set the major.minor version as the default kernel-version.

@mexisme
Copy link
Contributor Author

mexisme commented Jan 31, 2024

Btw, are there plans to cache the builds somehow? Either in the regular cache or the nix-community one? To avoid the frequent recompilations?

IDK if the nixos-hardware repo is cached anywhere by default?
However, it seems to come-up every so often.

Partly perhaps because I've been told that some people would prefer the hardware-specific fixes were rolled-into the main nixpkgs repo — except that moves pretty slow c.f. how quickly some hardware gets support...

@damianoognissanti
Copy link
Contributor

I had to manually set microsoft-surface.kernelVersion="6.6.13"; in my configuration.nix for it to build. Previously you could leave it unset for the default value. I am building it now to see if everything works as expected. Will write again later today.

Ah, I see how that code was intended, now; I misinterpreted the intention. Let me fix this, now...

I think I've fixed it — i.e. restored the functionality — so you can set the major.minor version as the default kernel-version.

After a flake update I could unset the kernelVersion and it didn't complain and didn't try to build a different version, so it's probably fixed.

@damianoognissanti
Copy link
Contributor

damianoognissanti commented Jan 31, 2024

Btw, are there plans to cache the builds somehow? Either in the regular cache or the nix-community one? To avoid the frequent recompilations?

IDK if the nixos-hardware repo is cached anywhere by default? However, it seems to come-up every so often.

Partly perhaps because I've been told that some people would prefer the hardware-specific fixes were rolled-into the main nixpkgs repo — except that moves pretty slow c.f. how quickly some hardware gets support...

But one also cache just the microsoft part of nixos-hardware. This is done by someone with a powerful machine (or some build system somewhere), and uploaded to the binary cache.
Here are the instructions for the nix-community cache (but I am not sure how to get an authorized account though): https://app.cachix.org/cache/nix-community#push

And sorry that this is off topic...

@mexisme
Copy link
Contributor Author

mexisme commented Feb 1, 2024

But one also cache just the microsoft part of nixos-hardware. This is done by someone with a powerful machine (or some build system somewhere), and uploaded to the binary cache. Here are the instructions for the nix-community cache (but I am not sure how to get an authorized account though): https://app.cachix.org/cache/nix-community#push

And sorry that this is off topic...

Afraid I'm not sure what the right thing to say, here, would be?

Perhaps looking into creating your own small build-cluster might help?

Desktop-style machines are almost always more performant than laptops, primarily because they can provide much better power and cooling, and even some of the very small 2nd-hand office-style machines can be surprisingly quick for the cost.

@Mic92
Copy link
Member

Mic92 commented Feb 2, 2024

Btw, are there plans to cache the builds somehow? Either in the regular cache or the nix-community one? To avoid the frequent recompilations?

If you can help me to add a hydra jobset to this repository, we can enable hydra.nixos.org for this repository. Than everything would land in the official binary cache.

@Mic92
Copy link
Member

Mic92 commented Feb 2, 2024

@mergify queue

Copy link
Contributor

mergify bot commented Feb 2, 2024

queue

❌ Pull request must be rebased manually

The pull request can't be rebased without conflict and must be rebased manually

@Mic92
Copy link
Member

Mic92 commented Feb 2, 2024

@mergify rebase

Copy link
Contributor

mergify bot commented Feb 2, 2024

rebase

❌ Base branch update has failed

Git reported the following error:

Rebasing (1/10)
CONFLICT (modify/delete): microsoft/surface/common/kernel/linux-6.1.x/patches.nix deleted in HEAD and modified in 8605f35 (Use a new linuxPackage function).  Version 8605f35 (Use a new linuxPackage function) of microsoft/surface/common/kernel/linux-6.1.x/patches.nix left in tree.
CONFLICT (modify/delete): microsoft/surface/common/kernel/linux-6.5.x/default.nix deleted in HEAD and modified in 8605f35 (Use a new linuxPackage function).  Version 8605f35 (Use a new linuxPackage function) of microsoft/surface/common/kernel/linux-6.5.x/default.nix left in tree.
Auto-merging microsoft/surface/common/kernel/linux-6.6.x/default.nix
CONFLICT (content): Merge conflict in microsoft/surface/common/kernel/linux-6.6.x/default.nix
Auto-merging microsoft/surface/common/kernel/linux-6.6.x/patches.nix
error: could not apply 8605f35... Use a new linuxPackage function
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 8605f35... Use a new linuxPackage function

@NixOS NixOS deleted a comment from mergify bot Feb 2, 2024
@Mic92
Copy link
Member

Mic92 commented Feb 2, 2024

@mergify update

Copy link
Contributor

mergify bot commented Feb 2, 2024

update

✅ Branch has been successfully updated

@Mic92
Copy link
Member

Mic92 commented Feb 2, 2024

@mergify queue

Copy link
Contributor

mergify bot commented Feb 2, 2024

queue

❌ Pull request must be rebased manually

The pull request can't be rebased without conflict and must be rebased manually

@Mic92 Mic92 merged commit 83e571b into NixOS:master Feb 2, 2024
2 checks passed
@mexisme mexisme deleted the microsoft/surface/kernel-6.6 branch February 2, 2024 05:53
@damianoognissanti
Copy link
Contributor

damianoognissanti commented Feb 2, 2024

Btw, are there plans to cache the builds somehow? Either in the regular cache or the nix-community one? To avoid the frequent recompilations?

If you can help me to add a hydra jobset to this repository, we can enable hydra.nixos.org for this repository. Than everything would land in the official binary cache.

I have created a new Issue to discuss this here:
#854

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.

None yet

3 participants