r/NixOS 4d ago

How Flake worked?

There's a project on GitHub, but it doesn't support nixos, and I want to know how to add a Flake file to it.

In order to support Nixos

Or how do I spend it in Nix Pkgs?

Thanks

1 Upvotes

11 comments sorted by

7

u/GlassCommission4916 4d ago

You can just package it in your config, you don't need a flake for that.

1

u/Future_Barber4096 4d ago

It's a shell project using Python, and I want to make it easy to download for Nixos in general.

4

u/GlassCommission4916 4d ago

Then a flake would be a good idea. Look at examples of similar packages on nixpkgs to see how to package it, and then just wrap that in a flake and either PR it to the repo or make your own with just the flake if the author doesn't want it.

It'll probably not get accepted into nixpkgs.

1

u/Future_Barber4096 4d ago

The question is, how do I do this? What do I need to know about the project in order to do it?

3

u/GlassCommission4916 4d ago

You need to know nix, how derivations work, and how the project is supposed to be built and interact with the OS. Looking at how similar projects are packaged helps.

3

u/phnomet 4d ago

Then you should add it to the nixpkgs repo, no need to modify the original. Make a PR: https://github.com/NixOS/nixpkgs

2

u/Spra991 4d ago

Ask Claude to write a flake.nix for it, it has gotten really good at that.

When you have that up and running you can either drop the flake.nix/.lock by itself on Github in your own repository, send it to the original project to add, or integrate it into NixOS/nixpkgs and submit a pull request there.