-
Notifications
You must be signed in to change notification settings - Fork 12
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
Revamp nix flake #215
base: main
Are you sure you want to change the base?
Revamp nix flake #215
Conversation
…rth the complication
tests currently try and modify state, which is a big no go for nix. There's probably a way around it, I'd have to look into it though
not sure what this is
mostly adding libs to LD_LIBRARY_PATH
Alright this should be unblocked, if it's ready then rebase/merge with main and request a review |
do we want to merge with the lua api complete or have that as a separate pull? |
Probably best to do it in a different pull considering the hell you're going through trying to make that work lol |
Alright, we now have functional nix builds! I think the |
Missed a slash omegalul I'll try to review the parts I can figure out sometime this week, got a lot of stuff to do currently. |
@@ -13,7 +13,7 @@ require("pinnacle").setup(function(Pinnacle) | |||
---@type Modifier | |||
local mod_key = "ctrl" | |||
|
|||
local terminal = "alacritty" | |||
local terminal = "kitty" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna need a very good reason why this has been changed to kitty because I like alacritty better and I will die on that hill
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, see, the reason is because I'm a creature of habit who forgot to remove that change before commiting. V easy remove lol. It also looks like I forgot to remove some other changes I made in that file for testing purposes.
@@ -73,7 +73,7 @@ install-protos-root: | |||
proto_dir="{{root_xdg_data_dir}}/protobuf" | |||
rm -rf "${proto_dir}" | |||
mkdir -p "{{root_xdg_data_dir}}" | |||
cp -r "{{rootdir}}/api/protocol" "${proto_dir}" | |||
cp -r "{{rootdir}}pinnacle-api-defs/protocol" "${proto_dir}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp -r "{{rootdir}}pinnacle-api-defs/protocol" "${proto_dir}" | |
cp -r "{{rootdir}}/pinnacle-api-defs/protocol" "${proto_dir}" |
Also line 35 hasn't been updated
@LogicalOverflow Seeing as you're the other Nix person here, do you have anything to comment on regarding all this Nix stuff I'm not familiar with? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I didn't look much into the lua stuff, because I don't know lua)
Overall, I think most of the hard stuff is done, i.e building pinnacle and the config. Only how the two are merged together, and how the metaconfig.toml
is handled throughout, to produce a pinnacle-with-config
looks incomplete to me.
@@ -1,42 +1,58 @@ | |||
{ | |||
description = | |||
"A WIP Smithay-based Wayland compositor, inspired by AwesomeWM and configured in Lua or Rust"; | |||
description = "Build a cargo workspace"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is a copy-paste error :)
runtimeDependencies = with pkgs; [ | ||
wayland | ||
mesa | ||
libglvnd # libEGL | ||
]; | ||
|
||
LD_LIBRARY_PATH = | ||
"${pkgs.wayland}/lib:${pkgs.libGL}/lib:${pkgs.libxkbcommon}/lib"; | ||
"${pkgs.wayland}/lib:${pkgs.libGL}/lib:${pkgs.libxkbcommon}/${pkgs.libglvnd}/lib:${pkgs.mesa.drivers}/lib"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${pkgs.libxkbcommon}/${pkgs.libglvnd}/lib
should probably be ${pkgs.libxkbcommon}/lib:${pkgs.libglvnd}/lib
devShells.default = craneLib.devShell { | ||
# Inherit inputs from checks. | ||
checks = self.checks.${system}; | ||
|
||
runtimeDependencies = with pkgs; [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the wlcs
wrapper script and cargo-outdated
got lost along the way, I think
lib = pinnacleLib; | ||
packages = { | ||
inherit pinnacle protobuffs; | ||
inherit (pinnacleLib) pinnacleWithRust pinnacleWithLua; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having these two functions directly in packages, breaks nix flake check
, because that expects all the packages to be derivations. Maybe we can move them to pinnacle.withRust
and pinnacle.withLua
using passthru
.
|
||
fenix = { | ||
url = "github:nix-community/fenix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
inputs.rust-analyzer-src.follows = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? (I've never seen a follows set to ""
)
}; | ||
#provide a default Toml, just in case. It may be more desireable to use | ||
|
||
# NOTE: as of now I can't figure out a way to check if a file exists in another derivaion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably not really possible at the nix level, i.e. in nix code, but you can probably use some bash in the postBuild
on the symlinkJoin
to select the correct metaconfig.toml
.
pinnacle-unwrapped | ||
pinnacle-config | ||
protobuffs # protobuffs | ||
#(manifestDerivation) # currently treated as a function rather than a derivation, should be fixable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the passed manifest
just isn't used. Also, symlinkJoin
might just fails, if there is a collision between the joined derivations (which would be the case if both manifests are there).
mkdir $out/bin | ||
mv target/release/${pname} $out/bin/ | ||
mv metaconfig.toml $out/share/pinnacle/config/ | ||
ln $out/bin/${pname} $out/share/pinnacle/config/${pname}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do find this structure in the derivation a bit weird, with the config being in both share/pinnacle/config/pinnacle-config
and bin/pinnacle-config
. I would expected only next to the metaconfig.toml
.
Pinnacle-with-config is partially working. For now it manages to get them all in the same closure and set up protobuf stuff, the main issue is that I can't figure out how to write from the toml generator to where I want correctly. It probably needs to be out of the symlink and linked in with ln manually if I had to guess, for now it uses the |
I think |
Hi guys, any way I can help in this PR? |
Feel free to, I have been a little busy so the help is appreciated. If you also want to rework much of what I've done feel free. My solution relies on some wacky IFD that i've since learned is not great practice, but I really don't have a better way to conceive of this beyond having a directory to link to the configuration spot for Lia and 0 ideas on how to manage this without IFD for Rust. Thanks for pitching in! |
Happy to help |
The tl;Dr is we need to wait for the lua or rust derivation to build flake-side, then wait for the user's configuration derivation to build, then finish building their config in place. I've learned since building this that this is generally considered bad practice, but it works for now. I think it was mostly style stuff that I never got around to fixing. |
I decided to go with crane instead, it apparently has better caching capabilities. The check capabilities are nice as well if you ever want to add some stuff to gh actions, for example. If you ever add another cargo subprjoct or some random directory stuff it might need some extra work but it should mostly be fine. Happy to explain, at least at a high level, whatever is going on.
Also given how I did the commits it might be a good idea to just squash this down during the pull request, at least I think you can.
Currently this PR is waiting on #214, it works if you remove the
Build.rs
script locally.