-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
40 lines (38 loc) · 1.2 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
description = "resh is a shell that only allows the execution of previously whitelisted commands.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, rust-overlay }:
let
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
overlays = [ (import rust-overlay) ];
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system overlays; });
in
{
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.stable.latest.default;
rustc = pkgs.rust-bin.stable.latest.default;
};
in
{
default = pkgs.mkShell {
buildInputs = with pkgs; [
gcc
rust-bin.stable.latest.default
];
shellHook = ''
echo "Welcome to the resh development shell."
user_shell=$(getent passwd "$(whoami)" |cut -d: -f 7)
exec "$user_shell"
'';
};
}
);
};
}