Skip to content

Commit

Permalink
Synchronize Nix configuration with other Witchcraft projects
Browse files Browse the repository at this point in the history
These changes had already been applied to the other
projects within the Witchcraft suite, and add support
for working with the project on apple silicon.
  • Loading branch information
jechol authored Jan 29, 2022
1 parent cf536b4 commit a539d83
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 356 deletions.
5 changes: 4 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
eval "$(lorri direnv)"
use nix

export MIX_HOME=$(pwd)/.mix
export PATH=$PATH:$(pwd)/.mix/escripts
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ erl_crash.dump
*.beam
.DS_Store
mix.lock
.mix
87 changes: 0 additions & 87 deletions nix/commands.nix

This file was deleted.

50 changes: 0 additions & 50 deletions nix/sources.json

This file was deleted.

174 changes: 0 additions & 174 deletions nix/sources.nix

This file was deleted.

64 changes: 20 additions & 44 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,45 +1,21 @@
let
sources = import ./nix/sources.nix;
commands = import ./nix/commands.nix;

nixos = import sources.nixpkgs {};
darwin = import sources.darwin {};
unstable = import sources.unstable {};

pkgs = if darwin.stdenv.isDarwin then darwin else nixos;
tasks = commands {
inherit pkgs;
inherit unstable;
};

deps = {
common =
[ pkgs.niv
];

elixir =
[ unstable.elixir
];

platform =
if pkgs.stdenv.isDarwin then
[ unstable.darwin.apple_sdk.frameworks.CoreServices
unstable.darwin.apple_sdk.frameworks.Foundation
]
else if pkgs.stdenv.isLinux then
[ pkgs.inotify-tools
]
else
[];
};
in

pkgs.mkShell {
name = "Algae";
nativeBuildInputs = builtins.concatLists [
deps.common
deps.elixir
deps.platform
tasks
];
let
nixpkgs = import (fetchTarball {
# Run `cachix use jechol` to use compiled binary cache.
url = "https://github.com/jechol/nixpkgs/archive/21.11-otp24-no-jit.tar.gz";
sha256 = "sha256:1lka707hrnkp70vny99m9fmp4a8136vl7addmpfsdvkwb81d1jk9";
}) { };
platform = if nixpkgs.stdenv.isDarwin then [
nixpkgs.darwin.apple_sdk.frameworks.CoreServices
nixpkgs.darwin.apple_sdk.frameworks.Foundation
] else if nixpkgs.stdenv.isLinux then
[ nixpkgs.inotify-tools ]
else
[ ];
in nixpkgs.mkShell {
buildInputs = with nixpkgs;
[
# OTP
erlang
elixir
] ++ platform;
}

0 comments on commit a539d83

Please sign in to comment.