From 28c26fdba3ff9633c2869e7293cff5804fa83954 Mon Sep 17 00:00:00 2001 From: Mark Keller <8452750+keller00@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:16:34 -0700 Subject: [PATCH] chore: switch to using a nix develop instead of nix-shell --- .envrc | 2 +- .github/workflows/build-and-release.yml | 5 +- .github/workflows/coverage.yml | 5 +- .github/workflows/hooky.yml | 5 +- .gitignore | 1 + .hooky.kdl | 7 +++ flake.lock | 61 +++++++++++++++++++++++++ flake.nix | 40 ++++++++++++++++ shell.nix | 23 ---------- 9 files changed, 122 insertions(+), 27 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/.envrc b/.envrc index 1d953f4..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 7d16cb5..e3ea7eb 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -26,9 +26,12 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v31 + with: + extra_nix_config: | + experimental-features = nix-command flakes - name: Build - run: nix-shell --command "cargo build --verbose --release --target ${{ matrix.target }}" + run: nix develop --command cargo build --verbose --release --target ${{ matrix.target }} - name: Strip binaries (Linux) if: matrix.target == 'x86_64-unknown-linux-gnu' diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ec52980..4ae4bb9 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,8 +13,11 @@ jobs: - uses: actions/checkout@v4 - name: Install Nix uses: cachix/install-nix-action@v31 + with: + extra_nix_config: | + experimental-features = nix-command flakes - name: Generate code coverage - run: nix-shell --command "cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info" + run: nix develop --command cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/hooky.yml b/.github/workflows/hooky.yml index 881c717..1998171 100644 --- a/.github/workflows/hooky.yml +++ b/.github/workflows/hooky.yml @@ -15,7 +15,10 @@ jobs: uses: actions/checkout@v4 - name: Install Nix uses: cachix/install-nix-action@v31 + with: + extra_nix_config: | + experimental-features = nix-command flakes - name: Execute hooks - run: nix-shell --command "hooky run --all --format=verbose" + run: nix develop --command hooky run --all --format=verbose env: SKIP: no_commit_to_branch diff --git a/.gitignore b/.gitignore index ea8c4bf..6abfe1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +/.direnv diff --git a/.hooky.kdl b/.hooky.kdl index aa7bedf..52d766f 100644 --- a/.hooky.kdl +++ b/.hooky.kdl @@ -14,6 +14,13 @@ hook cargo_fmt { files *.rs } +hook nixpkgs_fmt { + command nixpkgs-fmt { + check_args --check + } + files *.nix +} + lint_rules { - check_broken_symlinks - check_case_conflict diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e6e406d --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1775464765, + "narHash": "sha256-nex6TL2x1/sVHCyDWcvl1t/dbTedb9bAGC4DLf/pmYk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "83e29f2b8791f6dec20804382fcd9a666d744c07", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "83e29f2b8791f6dec20804382fcd9a666d744c07", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d0fa644 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "workingon - A Rust CLI for tracking what you're working on"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/83e29f2b8791f6dec20804382fcd9a666d744c07"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + config = { }; + overlays = [ ]; + }; + in + { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + cargo + cargo-llvm-cov + clippy + hooky + nixpkgs-fmt + rust-analyzer + rustc + rustc.llvmPackages.llvm + rustfmt + sqlite + ]; + + shellHook = '' + export LLVM_COV=${pkgs.llvm}/bin/llvm-cov + export LLVM_PROFDATA=${pkgs.llvm}/bin/llvm-profdata + ''; + }; + } + ); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index b1eaa86..0000000 --- a/shell.nix +++ /dev/null @@ -1,23 +0,0 @@ -let - nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/83e29f2b8791f6dec20804382fcd9a666d744c07.tar.gz"; - pkgs = import nixpkgs { config = {}; overlays = []; }; -in - -pkgs.mkShell { - packages = with pkgs; [ - hooky - cargo - cargo-llvm-cov - rustc - rustc.llvmPackages.llvm - rustfmt - clippy - rust-analyzer - sqlite - ]; - - shellHook = '' - export LLVM_COV=${pkgs.llvm}/bin/llvm-cov - export LLVM_PROFDATA=${pkgs.llvm}/bin/llvm-profdata - ''; -}