feschber / lan-mouse

mouse & keyboard sharing via LAN
GNU General Public License v3.0
2.62k stars 84 forks source link

Add default.nix file to main and update readme #211

Closed emileakbarzadeh closed 4 weeks ago

emileakbarzadeh commented 1 month ago

Adding a default.nix file to the base project so it can be built with nix-build for easy building. Also updated readme for documentation.

feschber commented 1 month ago

Could someone more knowledgeable in nix comment on this? Does it have anything to do with nix/default.nix @meck @ICE-GB @hannesschulze ?

hannesschulze commented 1 month ago

This is change useful when building the package with the non-flake nix-build tool. When using flakes, it is already possible to simply build the package using nix build from the root of the repository. This is the approach currently supported by the repo; it ensures a reproducible build environment because the dependency on nixpkgs is managed explicitly and pinned in flake.lock. While I would personally prefer mentioning this method in the README instead, I do understand there is a bit of a controversy around flakes and officially they are still considered "experimental" even though a lot of people (including me) use them.

feschber commented 1 month ago

Considering the nix directory only contains two files, I guess it would make sense to just move the contents to the root of the repository? (flake.nix is there already)

ICE-GB commented 1 month ago

I have hardly ever used non-flake. However, the default.nix of this pr should be different from the current nix/default.nix file. flake.nix is ​​the entry point built using the flake method. default.nix in this pr is the entry point built using the non-flake method.

emileakbarzadeh commented 1 month ago

Due to the experimental status of flakes I prefer to use regular nix, and the nix-build tool. I'm not sure what the nix community thinks of this approach but if the project consensus is to be only compatible with flakes then perhaps we could update the readme?

I would vote for supporting both though.

feschber commented 1 month ago

I have hardly ever used non-flake. However, the default.nix of this pr should be different from the current nix/default.nix file. flake.nix is ​​the entry point built using the flake method. default.nix in this pr is the entry point built using the non-flake method.

I think I understand now: flake.nix refers to nix/default.nix with the callPackage ./nix {}; line and default.nix can refer to the same nix/default.nix, building it the traditional way instead. I was just confused by default.nix and nix/default.nix having the same name here.

I have no problem supporting the normal nix-build command, just wanted to understand whats going on here!

I would however prefer, if you could merge the sections in the README instead of making it a new section.

Like

Nix

or something along the lines

ICE-GB commented 1 month ago

When the file name is default.nix, you can just write the full path to the directory instead of the full path to the file.