From a0c19025dd902662a6db886ae38575cbe7b264ba Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Sat, 12 Nov 2022 20:41:42 +0530 Subject: [PATCH] Fix nix build --- .github/workflows/nix-cache.yml | 22 +++++++++++----------- flake.lock | 16 ++++++++++++++++ flake.nix | 29 +++++++++++++++++------------ 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/.github/workflows/nix-cache.yml b/.github/workflows/nix-cache.yml index aca1938..405828b 100644 --- a/.github/workflows/nix-cache.yml +++ b/.github/workflows/nix-cache.yml @@ -3,16 +3,16 @@ on: pull_request: push: jobs: - tests: + build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v17 - with: - nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v11 - with: - name: xplr - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix-build - - run: nix-shell --run "xplr --version" + - uses: actions/checkout@v3 + - uses: nixbuild/nix-quick-install-action@v19 + with: + nix_conf: experimental-features = nix-command flakes + - uses: cachix/cachix-action@v11 + with: + name: xplr + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + - run: nix-build + - run: nix-shell --run "xplr --version" diff --git a/flake.lock b/flake.lock index c5f5d4d..6727cdd 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1668199800, @@ -17,6 +32,7 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 6336a8d..feba818 100644 --- a/flake.nix +++ b/flake.nix @@ -2,20 +2,25 @@ description = "xplr - A hackable, minimal, fast TUI file explorer"; inputs = { + flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "github:nixos/nixpkgs"; }; - outputs = { self, nixpkgs }: - { - packages.x86_64-linux.default = - with import nixpkgs { system = "x86_64-linux"; }; - - rustPlatform.buildRustPackage rec { - name = "xplr"; - src = ./.; - cargoLock = { - lockFile = ./Cargo.lock; + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let pkgs = nixpkgs.legacyPackages.${system}; in + rec { + packages = flake-utils.lib.flattenTree { + xplr = pkgs.rustPlatform.buildRustPackage rec { + name = "xplr"; + src = ./.; + cargoLock = { + lockFile = ./Cargo.lock; + }; + }; }; - }; - }; + defaultPackage = packages.xplr; + } + ); }