From 8a39311db2691d5e12d2aacb1045f0783d796d1d Mon Sep 17 00:00:00 2001 From: amatrelan Date: Sun, 9 Jun 2024 15:51:06 +0300 Subject: [PATCH 1/4] fix(nix): Set nix setup - Workflow to build nix on commits and pushes - Take nyaa `version` from `Cargo.toml` to simpler version management --- .github/workflows/nix.yml | 14 ++++++++++++++ .gitignore | 1 + default.nix | 16 +++++++--------- flake.nix | 1 + 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/nix.yml diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 0000000..9443140 --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,14 @@ +name: "Test build nix" + +on: + pull_request: + push: +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix-path: nixpkgs=channel:nixos-unstable + - run: nix-build diff --git a/.gitignore b/.gitignore index 469b0bc..fc1e4d7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ assets/*.ttf assets/*.ttf:Zone.Identifier assets/*.cast /release +/result **/*.deb diff --git a/default.nix b/default.nix index 23c5af3..915ea65 100644 --- a/default.nix +++ b/default.nix @@ -1,14 +1,12 @@ {pkgs ? import {}}: -pkgs.rustPlatform.buildRustPackage rec { +pkgs.rustPlatform.buildRustPackage { pname = "nyaa"; - version = "0.9.0"; - - # src = fetchFromGitHub { - # owner = "Beastwick18"; - # repo = "nyaa"; - # rev = "v${version}"; - # hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; - # }; + version = + (builtins.fromTOML ( + builtins.readFile ./Cargo.toml + )) + .package + .version; cargoLock.lockFile = ./Cargo.lock; src = pkgs.lib.cleanSource ./.; diff --git a/flake.nix b/flake.nix index 4b525a9..5f4802d 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ packages = forAllSystems (system: { default = pkgsFor.${system}.callPackage ./default.nix {}; }); + devShells = forAllSystems (system: { default = pkgsFor.${system}.callPackage ./shell.nix {}; }); From 9e9b2f24e22ee212652fa17acbbfdc8654a5fc31 Mon Sep 17 00:00:00 2001 From: amatrelan Date: Sun, 9 Jun 2024 16:12:13 +0300 Subject: [PATCH 2/4] check(action): why nixpkgs not found? --- .github/workflows/nix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 9443140..122fc85 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -11,4 +11,5 @@ jobs: - uses: cachix/install-nix-action@v27 with: nix-path: nixpkgs=channel:nixos-unstable + - run: nix-instantiate --eval -E '(import {}).lib.version' - run: nix-build From 521f4b37c6d09ea5b0d13c65520f36c176e7156d Mon Sep 17 00:00:00 2001 From: amatrelan Date: Sun, 9 Jun 2024 16:20:50 +0300 Subject: [PATCH 3/4] fix(action): should work now --- .github/workflows/nix.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 122fc85..fb51442 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -1,5 +1,4 @@ name: "Test build nix" - on: pull_request: push: @@ -7,9 +6,9 @@ jobs: tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v27 - with: - nix-path: nixpkgs=channel:nixos-unstable - - run: nix-instantiate --eval -E '(import {}).lib.version' - - run: nix-build + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - run: nix-instantiate --eval -E '(import {}).lib.version' + - run: nix build From c410ca8a6f7d6b9da9d2449dcf7a488f2ac8237b Mon Sep 17 00:00:00 2001 From: amatrelan Date: Sun, 9 Jun 2024 16:22:14 +0300 Subject: [PATCH 4/4] fix(action): remove extra run --- .github/workflows/nix.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index fb51442..c4fec0d 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -10,5 +10,4 @@ jobs: - uses: cachix/install-nix-action@v27 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} - - run: nix-instantiate --eval -E '(import {}).lib.version' - run: nix build