Skip to content

Instantly share code, notes, and snippets.

@haller33
Last active January 10, 2024 01:15
Show Gist options
  • Save haller33/0d87338cb002bb3215472f0b1496ca01 to your computer and use it in GitHub Desktop.
Save haller33/0d87338cb002bb3215472f0b1496ca01 to your computer and use it in GitHub Desktop.

Revisions

  1. haller33 revised this gist Jan 10, 2024. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,13 @@
    # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    # SOFTWARE.

    # Go To New Repo in Flakes!
    # the is now a new version of this shell using Flakes, that made this shell kind obsolete and major of development will move tho this new repo
    #
    # https://github.com/haller33/Odin-Flake
    #


    let
    unstableTarball =
    fetchTarball
  2. haller33 revised this gist Dec 4, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shell.nix
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # MIT License
    #
    # Copyright (c) 2023 Any
    # Copyright (c) 2023 haller33
    #
    # Permission is hereby granted, free of charge, to any person obtaining a copy
    # of this software and associated documentation files (the "Software"), to deal
  3. haller33 revised this gist Dec 4, 2023. 1 changed file with 22 additions and 0 deletions.
    22 changes: 22 additions & 0 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,25 @@
    # MIT License
    #
    # Copyright (c) 2023 Any
    #
    # Permission is hereby granted, free of charge, to any person obtaining a copy
    # of this software and associated documentation files (the "Software"), to deal
    # in the Software without restriction, including without limitation the rights
    # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    # copies of the Software, and to permit persons to whom the Software is
    # furnished to do so, subject to the following conditions:
    #
    # The above copyright notice and this permission notice shall be included in all
    # copies or substantial portions of the Software.
    #
    # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    # SOFTWARE.

    let
    unstableTarball =
    fetchTarball
  4. haller33 revised this gist Dec 2, 2023. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -31,8 +31,6 @@ mkShell {

    LLVM_CONFIG = "${llvmPackages.llvm.dev}/bin/llvm-config";

    LDFLAGS="-L${pkgs.stb}/lib";

    postPatch = lib.optionalString stdenv.isDarwin ''
    sed -i src/main.cpp \
    -e 's|-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk|-syslibroot ${MacOSX-SDK}|'
  5. haller33 revised this gist Dec 2, 2023. 1 changed file with 12 additions and 7 deletions.
    19 changes: 12 additions & 7 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -42,18 +42,22 @@ mkShell {
    -e 's/LLVM-C/LLVM/' \
    -e 's/framework System/lSystem/'
    echo "# for use of STB libraries"
    cd vendor/stb/src
    make
    cd ../../..
    patchShebangs build_odin.sh
    '';

    dontConfigure = true;

    buildFlags = [ "release" ];

    preBuild = ''
    echo "# for use of STB libraries"
    cd vendor/stb/src
    make
    cd ../../..
    '';

    installPhase = ''
    runHook preInstall
    @@ -99,8 +103,9 @@ mkShell {
    xorg.libXinerama
    libGL

    stb
    lua
    ## not need because of vendor
    # stb
    # lua

    valgrind
    rr
  6. haller33 revised this gist Dec 2, 2023. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -43,8 +43,10 @@ mkShell {
    -e 's/framework System/lSystem/'
    echo "# for use of STB libraries"
    make vendor/stb/src
    cd vendor/stb/src
    make
    cd ../../..
    patchShebangs build_odin.sh
    '';

  7. haller33 revised this gist Dec 2, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shell.nix
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ mkShell {
    owner = "odin-lang";
    repo = "Odin";
    rev = finalAttrs.version;
    hash = "sha256-3juwOM/Ib9aiUpGCprIxh7lTL7YrtO3Y9M/csVRXTqQ=";
    hash = "sha256-nBq/R2BYqSpuo8H0DBE4cgkV5OxyK5zSnhzRTpAp/FQ=";
    # name = "${finalAttrs.pname}-${finalAttrs.version}"; # not gona work .
    };

  8. haller33 revised this gist Dec 2, 2023. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -43,9 +43,7 @@ mkShell {
    -e 's/framework System/lSystem/'
    echo "# for use of STB libraries"
    cd vendor/stb/src
    make
    cd ../../../
    make vendor/stb/src
    patchShebangs build_odin.sh
    '';
  9. haller33 revised this gist Dec 2, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shell.nix
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ mkShell {

    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
    with pkgs;
    pkgs.lib.makeLibraryPath [ libGL xorg.libX11 xorg.libXi SDL2 SDL vulkan-loader stb ]
    pkgs.lib.makeLibraryPath [ libGL xorg.libX11 xorg.libXi SDL2 SDL vulkan-loader glfw ]
    }";
    nativeBuildInputs = let
    odin_neo = pkgs.odin.overrideAttrs (finalAttrs: previousAttrs: {
  10. haller33 revised this gist Dec 2, 2023. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -41,6 +41,12 @@ mkShell {
    -e 's/^GIT_SHA=.*$/GIT_SHA=/' \
    -e 's/LLVM-C/LLVM/' \
    -e 's/framework System/lSystem/'
    echo "# for use of STB libraries"
    cd vendor/stb/src
    make
    cd ../../../
    patchShebangs build_odin.sh
    '';

    @@ -75,6 +81,9 @@ mkShell {
    SDL2
    SDL

    # GLFW
    glfw

    # vulkan
    vulkan-headers
    vulkan-loader
  11. haller33 revised this gist Nov 30, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,8 @@ mkShell {

    LLVM_CONFIG = "${llvmPackages.llvm.dev}/bin/llvm-config";

    LDFLAGS="-L${pkgs.stb}/lib";

    postPatch = lib.optionalString stdenv.isDarwin ''
    sed -i src/main.cpp \
    -e 's|-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk|-syslibroot ${MacOSX-SDK}|'
  12. haller33 revised this gist Nov 30, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shell.nix
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ mkShell {

    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
    with pkgs;
    pkgs.lib.makeLibraryPath [ libGL xorg.libX11 xorg.libXi SDL2 SDL vulkan-loader ]
    pkgs.lib.makeLibraryPath [ libGL xorg.libX11 xorg.libXi SDL2 SDL vulkan-loader stb ]
    }";
    nativeBuildInputs = let
    odin_neo = pkgs.odin.overrideAttrs (finalAttrs: previousAttrs: {
  13. haller33 revised this gist Nov 30, 2023. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -88,6 +88,9 @@ mkShell {
    xorg.libXinerama
    libGL

    stb
    lua

    valgrind
    rr

  14. haller33 revised this gist Nov 5, 2023. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -87,6 +87,9 @@ mkShell {
    xorg.libXi
    xorg.libXinerama
    libGL

    valgrind
    rr

    # needed for raylib
    xorg.libXcursor
  15. haller33 created this gist Nov 5, 2023.
    96 changes: 96 additions & 0 deletions shell.nix
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,96 @@
    let
    unstableTarball =
    fetchTarball
    https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz;
    pkgs = import <nixpkgs> { };
    unstable = import unstableTarball {};
    in
    with pkgs;
    mkShell {

    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
    with pkgs;
    pkgs.lib.makeLibraryPath [ libGL xorg.libX11 xorg.libXi SDL2 SDL vulkan-loader ]
    }";
    nativeBuildInputs = let
    odin_neo = pkgs.odin.overrideAttrs (finalAttrs: previousAttrs: {
    pname = "odin_neo";
    version = "master";

    src = fetchFromGitHub {
    owner = "odin-lang";
    repo = "Odin";
    rev = finalAttrs.version;
    hash = "sha256-3juwOM/Ib9aiUpGCprIxh7lTL7YrtO3Y9M/csVRXTqQ=";
    # name = "${finalAttrs.pname}-${finalAttrs.version}"; # not gona work .
    };

    nativeBuildInputs = [ makeBinaryWrapper which ];

    buildInputs = lib.optional stdenv.isDarwin libiconv;

    LLVM_CONFIG = "${llvmPackages.llvm.dev}/bin/llvm-config";

    postPatch = lib.optionalString stdenv.isDarwin ''
    sed -i src/main.cpp \
    -e 's|-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk|-syslibroot ${MacOSX-SDK}|'
    '' + ''
    sed -i build_odin.sh \
    -e 's/^GIT_SHA=.*$/GIT_SHA=/' \
    -e 's/LLVM-C/LLVM/' \
    -e 's/framework System/lSystem/'
    patchShebangs build_odin.sh
    '';

    dontConfigure = true;

    buildFlags = [ "release" ];

    installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp odin $out/bin/odin
    mkdir -p $out/share
    cp -r core $out/share/core
    cp -r vendor $out/share/vendor
    wrapProgram $out/bin/odin \
    --prefix PATH : ${
    lib.makeBinPath (with llvmPackages; [ bintools llvm clang lld ])
    } \
    --set-default ODIN_ROOT $out/share
    runHook postInstall
    '';

    });
    in [ odin_neo ] ++ [
    unstable.ols

    # SDL
    SDL2
    SDL

    # vulkan
    vulkan-headers
    vulkan-loader
    vulkan-tools

    glxinfo
    lld
    gnumake
    xorg.libX11.dev
    xorg.libX11
    xorg.libXft
    xorg.libXi
    xorg.libXinerama
    libGL

    # needed for raylib
    xorg.libXcursor
    xorg.libXrandr
    xorg.libXinerama
    ];
    }