Skip to content

Commit

Permalink
Merge pull request #23 from hasura/samirtalwar/nix-config
Browse files Browse the repository at this point in the history
Set up a development shell with Nix.
  • Loading branch information
SamirTalwar authored Sep 11, 2023
2 parents dc82a99 + 80fceaf commit 2e65df3
Show file tree
Hide file tree
Showing 6 changed files with 145 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.

52 changes: 52 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This is used to create a local development shell with Nix, containing all the
# packages used for development.
#
# To use it, install Nix and run `nix develop`.
#
# You can use it with direnv by creating a file called .envrc.local and adding
# the line, `use flake`.

{
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
]

++ pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.pkg-config
pkgs.openssl
];
};

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

0 comments on commit 2e65df3

Please sign in to comment.