Skip to content
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

Merged
merged 4 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Test build nix"
Copy link
Contributor Author

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

on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ assets/*.ttf
assets/*.ttf:Zone.Identifier
assets/*.cast
/release
/result
**/*.deb
16 changes: 7 additions & 9 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.rustPlatform.buildRustPackage rec {
Copy link
Contributor Author

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

pkgs.rustPlatform.buildRustPackage {
pname = "nyaa";
version = "0.9.0";

# src = fetchFromGitHub {
amatrelan marked this conversation as resolved.
Show resolved Hide resolved
# owner = "Beastwick18";
# repo = "nyaa";
# rev = "v${version}";
# hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
# };
Comment on lines -6 to -11
Copy link
Contributor Author

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).

version =
amatrelan marked this conversation as resolved.
Show resolved Hide resolved
(builtins.fromTOML (
builtins.readFile ./Cargo.toml
))
.package
.version;
Comment on lines +4 to +9
Copy link
Contributor Author

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


cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
packages = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./default.nix {};
});

devShells = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./shell.nix {};
});
Expand Down