Skip to content

Commit

Permalink
init: devshell for hands-on onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
David Arnold committed Apr 20, 2021
1 parent da67777 commit 7c08d64
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
19 changes: 19 additions & 0 deletions devshell.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[devshell]
name = "nixpkgs"
packages = [
"fd",
"nixpkgs-fmt",
]

[[commands]]
name = "fmt"
help = "Check Nix formatting"
category = "folder tree checks"
command = "nixpkgs-fmt ${@} ."

[[commands]]
name = "evalnix"
help = "Check Nix parsing"
category = "folder tree checks"
command = "fd --extension nix --exec nix-instantiate --parse --quiet {} >/dev/null"

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
});

checks.x86_64-linux.tarball = jobs.tarball;
devShell = {
x86_64-linux = import ./shell.nix { system = "x86_64-linux"; };
x86_64-darwin = import ./shell.nix { system = "x86_64-darwin"; };
aarch64-linux = import ./shell.nix { system = "aarch64-linux"; };
};

htmlDocs = {
nixpkgsManual = jobs.manual;
Expand Down
17 changes: 17 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ system ? builtins.currentSystem }:
let
# nixpkgs / devshell is only used for development. Don't add it to the flake.lock.
devshellGitRev = "709fe4d04a9101c9d224ad83f73416dce71baf21";

nixpkgsSrc = ./.;

devshellSrc = fetchTarball {
url = "https://github.com/numtide/devshell/archive/${devshellGitRev}.tar.gz";
sha256 = "1px9cqfshfqs1b7ypyxch3s3ymr4xgycy1krrcg7b97rmmszvsqr";
};

pkgs = import nixpkgsSrc { inherit system; };
devshell = import devshellSrc { inherit system pkgs; };

in
devshell.fromTOML ./devshell.toml

0 comments on commit 7c08d64

Please sign in to comment.