Infinidoge / nix-minecraft

An attempt to better support Minecraft-related content for the Nix ecosystem
MIT License
174 stars 18 forks source link

Move away from using digga #3

Closed soupglasses closed 1 year ago

soupglasses commented 1 year ago

While digga is a nice all-whistles-included library, its absolutely huge. It is designed for managing your own NixOS dotfiles ant not so much for creating importable flake modules. So when you are creating a flake that is designed to be imported, you are indirectly putting this huge library on everyone who will import your library.

The non-digga solution would be to use nix flake's native outputs section to create a nixosModules and packages parts. If i get some time i may try to PR in this change myself.

This change would remove a whole 16 inputs ``` • Added input 'nix-minecraft': 'github:Infinidoge/nix-minecraft/67d394fba0b7d4e04f12389bcff99abd51fa2b00' (2022-07-12) • Added input 'nix-minecraft/digga': 'github:divnix/digga/e2bb8ea28c5bbc7bb46ac91df3ac846ce9a3964c' (2022-04-06) • Added input 'nix-minecraft/digga/blank': 'github:divnix/blank/5a5d2684073d9f563072ed07c871d577a6c614a8' (2021-07-06) • Added input 'nix-minecraft/digga/deploy': 'github:serokell/deploy-rs/9a02de4373e0ec272d08a417b269a28ac8b961b4' (2021-09-28) • Added input 'nix-minecraft/digga/deploy/flake-compat': 'github:edolstra/flake-compat/12c64ca55c1014cdc1b16ed5a804aa8576601ff2' (2021-08-02) • Added input 'nix-minecraft/digga/deploy/nixpkgs': follows 'nix-minecraft/digga/latest' • Added input 'nix-minecraft/digga/deploy/utils': 'github:numtide/flake-utils/74f7e4319258e287b0f9cb95426c9853b282730b' (2021-11-28) • Added input 'nix-minecraft/digga/devshell': 'github:numtide/devshell/0e56ef21ba1a717169953122c7415fa6a8cd2618' (2021-11-22) • Added input 'nix-minecraft/digga/flake-compat': 'github:edolstra/flake-compat/b7547d3eed6f32d06102ead8991ec52ab0a4f1a7' (2022-01-03) • Added input 'nix-minecraft/digga/flake-utils-plus': 'github:gytis-ivaskevicius/flake-utils-plus/be1be083af014720c14f3b574f57b6173b4915d0' (2021-12-13) • Added input 'nix-minecraft/digga/flake-utils-plus/flake-utils': 'github:numtide/flake-utils/74f7e4319258e287b0f9cb95426c9853b282730b' (2021-11-28) • Added input 'nix-minecraft/digga/home-manager': 'github:nix-community/home-manager/4daff26495ca9ac67476cba8cf15c3e36d91ab18' (2021-11-26) • Added input 'nix-minecraft/digga/home-manager/nixpkgs': follows 'nix-minecraft/digga/nixlib' • Added input 'nix-minecraft/digga/latest': 'github:nixos/nixpkgs/8a308775674e178495767df90c419425474582a1' (2021-11-29) • Added input 'nix-minecraft/digga/nixlib': follows 'nix-minecraft/nixpkgs' • Added input 'nix-minecraft/digga/nixpkgs': follows 'nix-minecraft/nixpkgs' • Added input 'nix-minecraft/nixpkgs': follows 'nixpkgs' • Added input 'nix-minecraft/packwiz': 'github:packwiz/packwiz/0d8c1762a373f9da9b14cb4b8156082bbbe14de8' (2022-06-20) ```
Infinidoge commented 1 year ago

Hmm, good point, I used digga since I was familiar with it. I'll likely switch to instead using flake utils or flake utils plus, since I prefer their structure over raw flakes, and they don't have the same dependencies.

Infinidoge commented 1 year ago

I've gone ahead and moved to flake utils plus locally, just going to test it out first before pushing to master.

Infinidoge commented 1 year ago

Going to test in my server setup first, but feel free to look over this commit: https://github.com/Infinidoge/nix-minecraft/commit/06051dbe42595971422387df6aab010f1317e698

soupglasses commented 1 year ago

I see no issue with it personally from a quick skim, other than the use of fup.lib.mkFlake. But it is a nice improvement overall from digga.

Infinidoge commented 1 year ago

What would the issue with fup.lib.mkFlake be?

(I chose to switch to fup since it has everything I wanted from digga without the excess) (I suppose I could implement it without any dependencies)

soupglasses commented 1 year ago

Its mostly due to the absurd abstraction its doing on an already simple system. Where a similar amount of code could be used to create the relevant outputs that mkFlake would generate (output.nixosModules and output.packages).

While mkFlake's seemingly major strength is actually one of its greatest weakness, it completely redefines flakes to use its own handling of output definition. Much different from the standard and quite sane layout of output.<option>.<system_arch>.<name>.

Some examples of a standard flake.nix file include naersk and poetry2nix.

If you would like, i could probably set off some time to create a PR of this when i get time.

Infinidoge commented 1 year ago

Hmm, fair enough, I suppose. I can rewrite it away from the mkFlake.

Infinidoge commented 1 year ago

I think this is an improvement: https://github.com/Infinidoge/nix-minecraft/commit/2ad67c6f4e175c36068e1679192a9f8d704b6017

soupglasses commented 1 year ago

This is looking great. I put a comment on the commit.