Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init nix flakes #208

Draft
wants to merge 60 commits into
base: master
Choose a base branch
from
Draft

Init nix flakes #208

wants to merge 60 commits into from

Conversation

haruki7049
Copy link

@haruki7049 haruki7049 commented Nov 18, 2024

This PR creates /flake.nix and /flake.lock files.

Changes

  • Create /flake.nix and /flake.lock
    • This PR allow this following commands to be run:
nix build .?submodules=1#releaseBuild-onNixOS
nix build .?submodules=1#devBuild-onNixOS
nix build .?submodules=1#releaseBuild-onNonNixOS
nix build .?submodules=1#devBuild-onNonNixOS
  • Initialize nixGL Overlay on our Nix flakes
  • Delete /pinned-nixpkgs.nix
  • Delete externalSrc attribute and localSrc declaration. Use override function to override src attribute.
  • Delete unused submodule, godot_headers
  • Update wlroots and godot submodule

My environment

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.62, NixOS, 25.05 (Warbler), 25.05beta710087.23e89b7da85c`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.10`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

@haruki7049 haruki7049 marked this pull request as ready for review November 21, 2024 02:10
@haruki7049 haruki7049 marked this pull request as draft November 21, 2024 02:11
@haruki7049
Copy link
Author

I made a mistake. For now this PR should be draft

@haruki7049
Copy link
Author

Commit hash: 3c58c0c

I build Simula with below diff and nix-build -E 'with import <nixpkgs> { }; callPackage ./. { onNixOS = true; devBuild = true; }', then this build successed.

diff --git a/.gitmodules b/.gitmodules
index 2cb9882..271bbcd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,8 +4,8 @@
        shallow = true
 [submodule "submodules/wlroots"]
        path = submodules/wlroots
-       url = https://github.com/SimulaVR/wlroots
-       branch = simula
+       url = https://github.com/haruki7049/wlroots-simula
+       branch = edit-nix-files
        shallow = true
 [submodule "submodules/godot"]
        path = submodules/godot
@@ -41,4 +41,4 @@
 [submodule "submodules/monado"]
        path = submodules/monado
        url = https://github.com/SimulaVR/monado-xv.git
-       branch = xr50
\ No newline at end of file
+       branch = xr50
diff --git a/Simula.nix b/Simula.nix
index 5166a0f..b62b1c0 100644
--- a/Simula.nix
+++ b/Simula.nix
@@ -23,7 +23,7 @@ let
     wayland-protocols-dev = wayland-protocols.overrideAttrs (oldAttrs: {
       stdenv = stdenvRes;
     });
-    wlroots-dev = callPackage ./submodules/wlroots/wlroots.nix { stdenv = stdenvRes; };
+    wlroots-dev = callPackage ./submodules/wlroots { stdenv = stdenvRes; };
     vulkan-loader-custom = if onNixOS then vulkan-loader else (callPackage ./nix/vulkan-loader.nix { });
     glibc-locales = glibcLocales;
     godot = callPackage ./submodules/godot/godot.nix { devBuild = devBuild; onNixOS = onNixOS; };
diff --git a/submodules/wlroots b/submodules/wlroots
index 017c7ca..7a3d488 160000
--- a/submodules/wlroots
+++ b/submodules/wlroots
@@ -1 +1 @@
-Subproject commit 017c7ca435e2198fab6fde16db918b64aa0d6232
+Subproject commit 7a3d48833ad58a19fed81f87744a0e69f505f3f5

@haruki7049
Copy link
Author

Commit hash: 3c58c0c

I build Simula with below diff and nix-build -E 'with import <nixpkgs> { }; callPackage ./. { onNixOS = true; devBuild = true; }', then this build successed.

This means that SimulaVR can be built with Nix flakes if SimulaVR/wlroots#1 merged into SimulaVR/wlroots

@haruki7049
Copy link
Author

haruki7049 commented Nov 21, 2024

Commit hash: b539685

I am so sad, because I understand that we cannot use Git submodules in checks attrset... We can still use Git submodules by nix build command, by:

nix build .?submodules=1#devBuild-onNixOS

@haruki7049
Copy link
Author

haruki7049 commented Nov 24, 2024

I can do these things but I cannot judge whether I should do in this PR or not:

  • As /.github/workflows/nix-checker, Create an Action to check whether Simula can be built with nix build command.
  • In the flakes, Create devShells.${system}.default for developing

I also can do these things but I don't think that I should do in this PR:

  • Move /Simula.nix to /default.nix in order to build with nix-build -E 'with import <nixpkgs> { }; callPackage ./. { }
  • Refactoring the Derivation in /Simula.nix, such as organize buildInputs and installPhase attributes

@haruki7049 haruki7049 marked this pull request as ready for review November 25, 2024 20:11
@haruki7049
Copy link
Author

haruki7049 commented Nov 26, 2024

TODO:

  • Delete Shell scripts
  • Delete devBuild
  • Delete onNixOS
  • Initialize /.github/workflows/nix-checker.yml
  • Refactoring Simula.nix and default.nix

@haruki7049 haruki7049 marked this pull request as draft November 26, 2024 05:31
@haruki7049
Copy link
Author

I'll do some more work...

@haruki7049
Copy link
Author

haruki7049 commented Dec 2, 2024

  • switchToNix
  • switchToLocal
  • nsBuildMonado -> nix run '.?submodules=1#build-monado'
  • nsCleanMonado -> nix run '.?submodules=1#clean-monado'
  • nsBuildGodot -> nix run '.?submodules=1#build-godot'
  • nsCleanGodot -> nix run '.?submodules=1#clean-godot'
  • nsBuildGodotHaskell -> nix run '.?submodules=1#build-godot-haskell'
  • nsBuildGodotHaskellPlugin -> nix run '.?submodules=1#build-godot-haskell-plugin'
  • nsREPLGodotHaskellPlugin -> nix run '.?submodules=1#repl-godot-haskell-plugin'
  • nsBuildSimulaLocal
  • installSimula -> /utils/installSimula.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant