diff --git a/flake.nix b/flake.nix index 9d70c00d1..a4dff78fc 100644 --- a/flake.nix +++ b/flake.nix @@ -6,9 +6,17 @@ master.url = "nixpkgs/master"; nixos.url = "nixpkgs/release-20.09"; home.url = "github:nix-community/home-manager/release-20.09"; + + # DevShells + # Use the nixpkgs master for access to latest tooling. + devshell.url = "github:numtide/devshell/master"; + devshell.inputs.nixpkgs.follows = "master"; # TODO: How does this compare with pkgImport below? + naersk.url = "github:nmattia/naersk"; + naersk.inputs.nixpkgs.follows = "master"; + mozilla-overlay = { url = "github:mozilla/mozilla-nixpkgs"; flake = false; }; # TODO: How does this compare with ./overlay? }; - outputs = inputs@{ self, home, nixos, master }: + outputs = inputs@{ self, home, nixos, master, devshell, naersk, mozilla-overlay }: let inherit (builtins) attrNames attrValues readDir; inherit (nixos) lib; @@ -52,7 +60,11 @@ fullPath = name: overlayDir + "/${name}"; overlayPaths = map fullPath (attrNames (readDir overlayDir)); in - pathsToImportedAttrs overlayPaths; + pathsToImportedAttrs overlayPaths ++ [ + (import mozilla-overlay) + devshell.overlay + naersk.overlay + ]; packages."${system}" = let @@ -79,10 +91,17 @@ profilesList = import ./profiles/list.nix; profilesAttrs = { profiles = pathsToImportedAttrs profilesList; }; + # shells + shellsList = import ./shells/list.nix; + shellsAttrs = { shells = pathsToImportedAttrs shellsList; }; + in recursiveUpdate - (recursiveUpdate cachixAttrs modulesAttrs) - profilesAttrs; + recursiveUpdate ( + (recursiveUpdate cachixAttrs modulesAttrs) + profilesAttrs + ) + shellsAttrs; templates.flk.path = ./.; templates.flk.description = "flk template"; diff --git a/shells/list.nix b/shells/list.nix new file mode 100644 index 000000000..2c5161c55 --- /dev/null +++ b/shells/list.nix @@ -0,0 +1,3 @@ +[ + ./rust +] diff --git a/shells/rust/default.nix b/shells/rust/default.nix new file mode 100644 index 000000000..a7ac27749 --- /dev/null +++ b/shells/rust/default.nix @@ -0,0 +1,27 @@ +with pkgs; + +mkDevShell { + name = "Personal Rust DevShell"; + + packages = [ + latest.rustChannels.stable.rust + wasm-bindgen-cli + binaryen + + ncurses + pkgconfig + openssl + openssl.dev + ]; + + env.RUST_BACKTRACE = "1"; + + commands = [ + { + name = "hello"; + help = "say hello"; + category = "fun"; + command = "echo '''hello''' "; + } + ]; +}