Skip to content

Commit

Permalink
Install shell completions in Nix Flake (kamiyaa#421)
Browse files Browse the repository at this point in the history
* update `flake.lock`

Flake lock file updates:

• Updated input 'devenv':
    'github:cachix/devenv/8d6d129b666778538b76bcb069ab82f813094e5c' (2023-05-30)
  → 'github:cachix/devenv/3654eb5d47218cfa2d12280ba5ac1ace0a9dd225' (2023-08-30)
• Updated input 'devenv/pre-commit-hooks':
    'github:cachix/pre-commit-hooks.nix/fb58866e20af98779017134319b5663b8215d912' (2023-04-27)
  → 'github:cachix/pre-commit-hooks.nix/5843cf069272d92b60c3ed9e55b7a8989c01d4c7' (2023-06-29)
• Updated input 'devenv/pre-commit-hooks/flake-utils':
    'github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f' (2022-11-02)
  → 'github:numtide/flake-utils/a1720a10a6cfe8234c0e93907ffe81be440f4cef' (2023-05-31)
• Added input 'devenv/pre-commit-hooks/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'devenv/pre-commit-hooks/nixpkgs-stable':
    'github:NixOS/nixpkgs/9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8' (2023-03-15)
  → 'github:NixOS/nixpkgs/c37ca420157f4abc31e26f436c1145f8951ff373' (2023-06-03)
• Updated input 'fenix':
    'github:nix-community/fenix/9ea56d5de762971f6a7319711bae0532ca454dc9' (2023-05-30)
  → 'github:nix-community/fenix/76e468cd74a08edcbabb14ce1698ebd2f5fad9d2' (2023-08-29)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/bc8295255c5bcc293251d47590dcbfd320eaab87' (2023-05-29)
  → 'github:rust-lang/rust-analyzer/62268e474e9165de0cdb08d3794eec4b6ef1c6cd' (2023-08-28)
• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/80717d11615b6f42d1ad2e18ead51193fc15de69' (2023-05-30)
  → 'github:hercules-ci/flake-parts/59cf3f1447cfc75087e7273b04b31e689a8599fb' (2023-08-01)
• Updated input 'flake-parts/nixpkgs-lib':
    'github:NixOS/nixpkgs/da45bf6ec7bbcc5d1e14d3795c025199f28e0de0?dir=lib' (2023-04-30)
  → 'github:NixOS/nixpkgs/9e1960bc196baf6881340d53dccb203a951745a2?dir=lib' (2023-08-01)
• Updated input 'flake-root':
    'github:srid/flake-root/f1c0b93d05bdbea6c011136ba1a135c80c5b326c' (2023-04-08)
  → 'github:srid/flake-root/d9a70d9c7a5fd7f3258ccf48da9335e9b47c3937' (2023-08-22)
• Updated input 'mission-control':
    'github:Platonic-Systems/mission-control/a0c93bd764a3c25e6999397e9f5f119c1b124e38' (2023-05-09)
  → 'github:Platonic-Systems/mission-control/9d25d9f8d610916fc144f6afc1f064392fbeec1c' (2023-07-28)
• Updated input 'nix2container':
    'github:nlewo/nix2container/2e0a633344489b3171afe136b820b4602f9d1807' (2023-05-16)
  → 'github:nlewo/nix2container/ab381a7d714ebf96a83882264245dbd34f0a7ec8' (2023-07-09)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5e871d8aa6f57cc8e0dc087d1c5013f6e212b4ce' (2023-05-29)
  → 'github:NixOS/nixpkgs/3efb0f6f404ec8dae31bdb1a9b17705ce0d6986e' (2023-08-28)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/3d352b2b1a46164443aa114bd29d8d208d8a9bd0' (2023-05-30)
  → 'github:numtide/treefmt-nix/6befd3b6b8544952e0261f054cf16769294bacba' (2023-08-28)
• Updated input 'treefmt-nix/nixpkgs':
    'github:nixos/nixpkgs/d9f759f2ea8d265d974a6e1259bd510ac5844c5d' (2023-04-08)
  → 'github:nixos/nixpkgs/ce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e' (2023-08-10)

* install shell completions in `Nix Flake`

* add GitHub Actions workflow for checking `Nix Flake`
  • Loading branch information
xrelkd authored Aug 30, 2023
1 parent cec05cb commit 4c2f3ac
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 43 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Nix Flakes"

on:
push:
branches: [dev, main]

pull_request:
branches: [dev, main]

jobs:
build-nix-flake:
name: Build Nix Flake
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v22

- name: Build Nix Flake
run: nix build

- name: Test executable
run: ./result/bin/joshuto version
104 changes: 61 additions & 43 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, rustPlatform
, installShellFiles
, darwin
, version ? "git"
}:
Expand All @@ -22,6 +23,15 @@ rustPlatform.buildRustPackage rec {
darwin.apple_sdk.frameworks.Foundation
];

nativeBuildInputs = [ installShellFiles ];

postInstall = ''
installShellCompletion --cmd joshuto \
--bash <($out/bin/joshuto completions bash) \
--zsh <($out/bin/joshuto completions zsh) \
--fish <($out/bin/joshuto completions fish)
'';

patchPhase = ''
sed -i 's/env!("CARGO_PKG_VERSION")/\"${version}\"/g' src/main.rs
'';
Expand Down

0 comments on commit 4c2f3ac

Please sign in to comment.