LnL7 / nix-darwin

nix modules for darwin
MIT License
2.82k stars 431 forks source link

programs.nh: init module #942

Open alanpearce opened 5 months ago

alanpearce commented 5 months ago

Based on the NixOS module of the same name.

I used the same checks that nix.gc uses, as it performs exactly that function.

skykanin commented 4 months ago

Does the nh CLI even support nix-darwin?

alanpearce commented 4 months ago

Does the nh CLI even support nix-darwin?

Yes? I wouldn't have worked on this otherwise. Only the os subcommand doesn't work

viperML commented 4 months ago

nh doesn't wrap nix-darwin. And I don't use macOs, so thought has not been put into making sure the rest works there.

alanpearce commented 4 months ago

nh doesn't wrap nix-darwin. And I don't use macOs, so thought has not been put into making sure the rest works there.

Could you explain why you said that? I'm not sure what point you're trying to make.

viperML commented 4 months ago

I don't know what is to explain, nh doesn't support nix-darwin in the sense that it doesn't have anything to do with nix-darwin, not nix on darwin.

ToyVo commented 4 months ago

The nh os switch does not support Darwin due to differences between nixos-rebuild and darwin-rebuild. I have a fork that adds support for darwin. https://github.com/ToyVo/nh

The nh clean command does work on Darwin on the original and my fork.

alanpearce commented 4 months ago

I don't know what is to explain, nh doesn't support nix-darwin in the sense that it doesn't have anything to do with nix-darwin, not nix on darwin.

I think perhaps the meaning of "support" here is overloaded. I'll try to clarify, please correct me if I'm wrong:

As nh has more functionality than the os subcommand, it is reasonable to include in nix-darwin. All the functionality of nh exposed as options for nix-darwin in this PR work—that is, there is no functionality here that relies on the os subcommand.

bestlem commented 4 months ago

@alanpearce

My understanding is that nh was written by @viperML and this version does not support darwin as @viperML does not have a Mac to be able to test. @ToyVo has produced a fork of the original nh and this does support darwin ie os switch works. (I have used this and it does work).

The nh module here can be made to use @ToyVo s fork and so is fully functional on macOS. By setting programs.nh.package

viperML commented 4 months ago

To add the comment from @bestlem, there are 2 side of the "not supported":

A) Not supporting darwin as the run-time platform for nh home or nh clean. I guess they work fine but I also don't know any of the corner cases for darwin. B) Not having a nix-darwin wrapper, which is done in the fork.

alanpearce commented 4 months ago

@viperML I'm still not sure what the point is you're trying to make. What is the reason for you saying that darwin isn't supported? What do you hope to achieve? Is there something that you think I should do with regard to this PR?

bestlem commented 4 months ago

@alanpearce What @ViperML is saying that his code might or might not run on darwin and if you find an issue with his original on darwin he can't investigate so can't fix it.

You run his executable at your own risk and the author can't answer anything about issues.

@viperML is not being awkward here they are just saying that they can't deal with darwin issues. This is fair as they can't test,

To test things you have to have all the different hardware and operating systems that your customers use. You can do this if you are reasonably sized organisation but no-one can expect single person FOSS developers to do this. This is no doubt one of the reason nix-darwin exists it can deal with issues that are different to nixes.

SolidRhino commented 3 months ago

@LnL7 when will you merge this? This is a great edition.

ToyVo commented 3 months ago

@SolidRhino the nh-darwin fork does have a Darwin module that defines the same options if you are impatient for this pr.

I have also recently closed an issue that pointed out that there was indeed a bug with nh os clean on macos that I have since fixed. That bug was macos uids start at 501 so the original nh would clean xdg directories for users 1000-1100, now on nh-dawrin the appropriate users 501-601 are cleaned.

kamushadenes commented 4 weeks ago

Hey, can we get this merged? Thanks!