Created
November 27, 2021 18:14
-
-
Save rsms/760629442a5b87d7562332bc7e931fa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
pkgs ? (import <nixpkgs> {}).pkgsMusl | |
}: | |
let | |
inherit (pkgs) lib; | |
llvmPkgs = pkgs.llvmPackages_13; | |
stdenv = llvmPkgs.stdenv; | |
# stdenv = llvmPkgs.libcxxStdenv; | |
mkShell = pkgs.mkShell.override { inherit stdenv; }; | |
hello_c = pkgs.writeText "hello.c" '' | |
#include <stdio.h> | |
int main() { printf("hello\n"); return 0; } | |
''; | |
hello_cc = pkgs.writeText "hello.cc" '' | |
#include <iostream> | |
int main() { std::cout << "hello\n"; return 0; } | |
''; | |
in | |
mkShell { | |
name = "playsys"; | |
buildInputs = with pkgs; [ | |
cmake | |
nano | |
ninja | |
python3 | |
x11 | |
git | |
xorg.libX11 | |
xorg.libXext | |
xorg.libXinerama | |
xorg.libXrandr | |
xorg.libXcursor | |
xorg.libXi | |
]; | |
nativeBuildInputs = with pkgs; [ | |
pkg-config | |
]; | |
shellHook = '' | |
#PROMPT_COMMAND='if [ $? = 0 ]; then PS1a="\e[42;1m"; else PS1a="\e[41;1m"; fi' | |
#PS1='$(echo -ne $PS1a);\[\e[0m\] ' | |
export EDITOR=nano | |
PROMPT_COMMAND='if [ $? = 0 ]; then PS1a="\e[32;1m"; else PS1a="\e[31;1m"; fi' | |
PS1='$(echo -ne $PS1a)[nix \W]\[\e[0m\] ' | |
alias l='ls --color=auto --group-directories-first -lAhpo' | |
ln ${hello_c} hello.c | |
ln ${hello_cc} hello.cc | |
echo "clang -Wall -std=c17 -O2 -static -o hello_sc hello.c && ./hello_sc" | |
clang -Wall -std=c17 -O2 -static -o hello_sc hello.c && ./hello_sc | |
echo "clang -Wall -std=c17 -O2 -o hello_dc hello.c && ./hello_dc" | |
clang -Wall -std=c17 -O2 -o hello_dc hello.c && ./hello_dc | |
echo "clang++ -Wall -std=gnu++17 -O2 -static -o hello_scc hello.cc && ./hello_scc" | |
clang++ -Wall -std=gnu++17 -O2 -static -o hello_scc hello.cc && ./hello_scc | |
echo "clang++ -Wall -std=gnu++17 -O2 -o hello_dcc hello.cc && ./hello_dcc" | |
clang++ -Wall -std=gnu++17 -O2 -o hello_dcc hello.cc && ./hello_dcc | |
''; | |
} |
did:3:kjzl6cwe1jw147ckqaac76pphyonucspv15nhrna3y49rhla9zz86drygs9ai8r
``did:3:kjzl6cwe1jw147ckqaac76pphyonucspv15nhrna3y49rhla9zz86drygs9ai8r
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nix-shell --pure llvm13-clang-musl.nix