diff --git a/.envrc b/.envrc index 3550a30f2..0fdc096fc 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,3 @@ -use flake +if has nix_direnv_version; then + use flake +fi diff --git a/README.md b/README.md index ff9447651..7992069c9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Programming language that compiles to Bash. It's a high level programming langua Amber compiler currently works on: - Linux x86 and ARM - macOS x86 and ARM (Apple Silicon) -- Nix (NixOs) +- Nix (NixOS) ### macOS / Linux Make sure that the operating system meets the following prerequisites @@ -46,18 +46,17 @@ The package is already containing all the required install scripts and dependenc { inputs = { # ... - amber.url = "github:brumik/ytsum"; + amber.url = "github:Ph0enixKM/Amber"; }; - # outputs somewhere - amber = inputs.amber.defaultPackage."${pkgs.system}"; - # then later with home manager for example - home.packages = [ amber ]; + home.packages = [ inputs.amber.packages.${pkgs.system}.default ]; } ``` -While developing on Nixos the flake also defines all dependencies for `nix develop` (or `direnv` if used). +The package is avaiable as `amber-lang` on [nixpkgs](https://github.com/NixOS/nixpkgs/pull/313774). + +While developing with Nix, the flake defines all dependencies for `nix develop` (or `direnv` if used). ### Windows support As windows does not come with bash installed it makes no sense to support it. Please install WSL 2 on your windows machine and install Linux version of Amber compiler inside. diff --git a/default.nix b/default.nix deleted file mode 100644 index 39bacff61..000000000 --- a/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -(import ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } -) { - src = ./.; -}).defaultNix diff --git a/flake.nix b/flake.nix index 32252b1db..184722eda 100644 --- a/flake.nix +++ b/flake.nix @@ -12,17 +12,16 @@ naersk-lib = pkgs.callPackage naersk { }; in { - defaultPackage = naersk-lib.buildPackage { + packages.default = naersk-lib.buildPackage { src = ./.; postInsall = '' wrapProgram "$out/bin/amber" --set PATH ${nixpkgs.lib.makeBinPath [ - pkgs.bash pkgs.bc ]} ''; }; - devShell = with pkgs; mkShell { - buildInputs = [ bc bash cargo rustc rustfmt pre-commit rustPackages.clippy ]; + devShells.default = with pkgs; mkShell { + buildInputs = [ bc cargo rustc rustfmt pre-commit rustPackages.clippy ]; RUST_SRC_PATH = rustPlatform.rustLibSrc; }; } diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 77db547fb..000000000 --- a/shell.nix +++ /dev/null @@ -1,7 +0,0 @@ -(import ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } -) { - src = ./.; -}).shellNix diff --git a/src/compiler.rs b/src/compiler.rs index 50ed9419a..866456b07 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -125,7 +125,7 @@ impl AmberCompiler { #[allow(dead_code)] pub fn test_eval(&mut self) -> Result { self.compile().map_or_else(Err, |(_, code)| { - let child = Command::new("/bin/bash") + let child = Command::new("/usr/bin/env").arg("bash") .arg("-c").arg::<&str>(code.as_ref()) .output().unwrap(); Ok(String::from_utf8_lossy(&child.stdout).to_string())