Skip to content

Commit

Permalink
Set up a development shell with Nix.
Browse files Browse the repository at this point in the history
Just for local development; no one's shipping anything with this thing.
  • Loading branch information
SamirTalwar committed Sep 11, 2023
1 parent dc82a99 commit 467f48b
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

source_env_if_exists ./.envrc.local
5 changes: 5 additions & 0 deletions .envrc.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

use flake

source_env ../.envrc
20 changes: 20 additions & 0 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: test Nix support

on: push

jobs:
evaluate-nix-shell:
name: Evaluate the Nix shell
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install Nix ❄
uses: DeterminateSystems/nix-installer-action@v4

- name: Run the Magic Nix Cache 🔌
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Evaluate the Nix shell
run: nix develop -c "true"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Rust
/target

# direnv
/.direnv
61 changes: 61 additions & 0 deletions flake.lock

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

39 changes: 39 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
description = "ndc-sdk";

inputs = {
flake-utils.url = github:numtide/flake-utils;
nixpkgs.url = github:NixOS/nixpkgs/master;
};

outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.cargo
pkgs.cargo-edit
pkgs.cargo-machete
pkgs.clippy
pkgs.rust-analyzer
pkgs.rustPlatform.rustcSrc
pkgs.rustc
pkgs.rustfmt
];

buildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.libiconv
];
};

formatter = pkgs.nixpkgs-fmt;
});
}

0 comments on commit 467f48b

Please sign in to comment.