-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(nix): Set nix setup #18
Conversation
- Workflow to build nix on commits and pushes - Take nyaa `version` from `Cargo.toml` to simpler version management
@@ -0,0 +1,14 @@ | |||
name: "Test build nix" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow simply runs nix build
so if there comes a error it can be caught
@@ -1,14 +1,12 @@ | |||
{pkgs ? import <nixpkgs> {}}: | |||
pkgs.rustPlatform.buildRustPackage rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rec
is needed when you reference same scope variable multiple times, in here it's not needed
version = | ||
(builtins.fromTOML ( | ||
builtins.readFile ./Cargo.toml | ||
)) | ||
.package | ||
.version; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You seemed to put it manually but it can be done like this too so it takes from Cargo.toml
version variable
# src = fetchFromGitHub { | ||
# owner = "Beastwick18"; | ||
# repo = "nyaa"; | ||
# rev = "v${version}"; | ||
# hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; | ||
# }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is needed only in nixpkgs when you publish it there, so in https://github.com/NixOS/nixpkgs
(I wasn't clear enough in previous issue discussion).
So basically if you publish your package to nixpkgs then most of these nix files can be removed if you don't use it yourself for development. Flakes are new declaration "model" for nix and they can be used directly in other For example my system configuration is made with But I recommend to keep flake setup still in this repository so people can use "latest and greatest" nyaa even if it's not updated to nixpkgs, if they use flakes. |
Changes look good to me 😄 Thanks for helping with the nix configuration, I think I understand it much better now. Next version should be done soon once I'm done with documentation. After that, I'll get everything ready for adding to nixpkgs. Now there should be less accidental bricking of the nix build too 😅 |
Looks like the action works just fine, I'll go ahead and merge it Thanks again :) |
Ok something I might have to do though is add caching. Seems to take about 8 min to complete. I was hoping after the first action it might've cached itself. magic-nix-cache-action seems suitable so I'll try that out first. |
Yeah that was weirdly slow. Here nix.dev caching is good example, and seems to be exactly same what you pointed out. nix.dev is good website when getting hang of nix development. |
version
fromCargo.toml
to simpler version managementwas some problem with action but now seems to work.