instantOS / instantNIX

instantOS tools packaged for the Nix package manager (and NixOS)
MIT License
32 stars 7 forks source link

flake: initial support #28

Closed MaxCan-Code closed 2 years ago

MaxCan-Code commented 2 years ago

test with nix build .#packages.instantnix

con-f-use commented 2 years ago

Cool, thanks! I'll test it as soon as I get back from vacation. Much appreciated.

Edit: Or not, because life :cry:

con-f-use commented 2 years ago

Also, as this package is meant to be used by people on both the stable channel and the unstable channel, we probably should avoid providing the flake.lock, but have it in .gitignore instead. That's what Home Manager people do.

The point of providing the lock file is to have a version of the dependencies that is tested against and known to work. So I think we should include it.

MaxCan-Code commented 2 years ago

https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/top-level/aliases.nix#L305-L309 https://github.com/instantOS/instantNIX/blob/81dad6e7f02262eae8acf696c8e766080f8354d8/pkgs/instantUtils/default.nix#L118-L122 Without the deleted lock file nix build fails on unstable since disper was removed. This would also be the case for the NixOS 22.05 release

ShamrockLee commented 2 years ago

I see. Maybe we should add it back. Users can still override it with .follows inside their flake.nix.

ShamrockLee commented 2 years ago
outputs.nixosModules = import ./modules.nix;

is only valid when modules.nix is a set of name-value pairs of the modules, which is the case in the NUR README and these two NURs: https://github.com/cwyc/nur-packages/blob/master/modules/default.nix https://github.com/dawidsowa/nur-packages/blob/master/modules/default.nix

I think we should either change modules/default.nix to

{
  instantlock = ./instantlock.nix;
  instantwm = ./insntantwm.nix;
}

or change the corresponding flake output to

  nixosModules = (import ./modules.nix).modules;
ShamrockLee commented 2 years ago

Thank you for all your work!

The point of providing the lock file is to have a version of the dependencies that is tested against and known to work. So I think we should include it.

Without the deleted lock file nix build fails on unstable since disper was removed. This would also be the case for the NixOS 22.05 release

Should we specify the "officially supported" channel (Nixpkgs branch) then?

It could be implemented by specifying the flake inputs:

{
  # ...

  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";

  outputs = ... ;
}

After that, just run

nix flake lock

and nix will modify flake.lock according to the flake.nix content.

con-f-use commented 2 years ago

Just for the record, I'm very happy that you two nix-savy people are on board here. :heart:

MaxCan-Code commented 2 years ago

Happy to help!

ShamrockLee commented 2 years ago

Thanks a lot for your time and effort!

AFAIK, most people would squash those PR modifications into one commit to make the history cleaner.

To squash the extra 7 commits into the first one, you can run the following commands:

git checkout flake
# Base----A----B----C----D----E----F----G----H
# ^--dev                                     ^--HEAD
git reset --soft flake~7
# Base----A----Staged changes (contains changes in B, ..., H)
# ^--dev  ^--HEAD
git commit --amend --no-edit
# Base----A'
# ^--dev  ^--HEAD
#         ^ (contains changes in A, ..., H)

and then force-push to your fork repository.

MaxCan-Code commented 2 years ago

Done. Thanks for all the tips!