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
spacevim: init at v1.5.0 #93365
spacevim: init at v1.5.0 #93365
Conversation
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 don't use vim so I can't comment on that aspect, but I've left some comments regarding the nix expression
src = fetchFromGitHub { | ||
owner = "SpaceVim"; | ||
repo = "SpaceVim"; | ||
rev = "c937c0e2fd37207c36c8c5e53b36c41d7222fee6"; |
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.
You should be using the latest release of spacevim (1.4.0 of writing this) and not a random commit. You would also need to add the version
field, switch from name
to pname
and update the PR to match the version.
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.
@skykanin their install script installs it off of master.
I don't think they are making releases that often.
What's guidance here ?
Looks like the commit SHA is more appropriate.
I tried setting pname but it didn't work (maybe only works when version present?)
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 not completely sure what the standard practice is for versioning, but personally I would use the latest official release and if you want the bleeding edge version from the master branch override the package build locally. Indeed pname
does require a version
because it combines them into "${pname}-${version}"
, from the manual.
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.
name
should indeed not be used anymore. When using a commit (rather than a release tag), there are still diverging conventions, but they all seem to share that the version should contain the commit date in the form YYYY-MM-DD
and that unstable
should be used somewhere. My preferred flavor:
pname = "spacevim";
version = "unstable-YYYY-MM-DD"
(where you fill YYYY-MM-DD
).
I also agree with @skykanin that, unless the latest release is very old, using a tagged version is highly preferred.
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.
Thanks -- I've changed to match your suggestions.
The tagged version is really old; so i've opted to change to unstable methodology you've prescribed.
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.
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.
Looks like it hasn't been decided yet @Ma27 ; hoping we can just come back to this afterwards.
It will be a small fixup.
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.
my argument was that changing the pname essentially "changes the package" as far as repology is concerned, which is weird to have packages move in and out of unique categorization. Having the version contain unstable
at least keeps the package name the same.
Then again, this convention was first used when name = "pkg-${version}";
was still very common, and there wasn't a clear delineation between pname and version established.
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.
As an outsider: I'm in favor as a user of having pname
be the package name; unstable feels itself like a version moniker.
Thanks -- I rebased & added a commit for the maintainers list |
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.
Thanks for doing this!
Apart from the comments below, a few more notes:
- Your second commit doesn't match our contribution guidelines. You may want to rename it to e.g.
maintainers: add fzakaria
- When pressing
<C-p>
in Vim, I get the error thatfzf
is not found when testing this in a pure shell-env. It would make sense IMHO to add those external dependencies as a wrapper to the package.
sha256 = "141fl5g6i2h72dk5121v3mc0bwb812hd8qa5qw83jyz9q20jcsgn"; | ||
}; | ||
|
||
buildInputs = [ vim-customized makeWrapper ]; |
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.
At least makeWrapper
belongs to nativeBuildInputs
. However we should probably disable cross-compilation here.
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.
Can you help me understand the difference ?
Happy to make the change but also willing to learn.
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.
Moved to nativeBuildInputs
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.
Now that I think of it, vim-customized
should probably be in nativeBuildInputs
as well.
Happy to make the change but also willing to learn.
In nativeBuildInputs
are all dependencies that are used during the derivation's build. When performing a cross-build, this is needed to make sure that only packages for the host's architecture are used for the build while all runtime dependencies (e.g. libraries in buildInputs
) are built against the target's architecture.
A more detailed explanation is in the link I posted above (https://nixos.org/nixpkgs/manual/#ssec-stdenv-dependencies).
config = if builtins.stringLength spacevim_toml == 0 then | ||
"${builtins.readFile ./init.toml}" | ||
else | ||
spacevim_toml; |
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.
How about merging spacevim_toml
and init.toml
together so that a user doesn't have to rewrite the entire config when having to change a few details.
Also, I'm wondering if it might be better to accept an attr-set and generate TOML-config from that. Bonus points for writing some docs (in doc/builders/packages
).
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.
Well i'm not sure about a merge since that sounds like making deletes challening.
I would love to use something like nix2toml
but I couldn't find a good solution.
(maybe remarshal ?)
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.
Is there any reason against converting init.toml
into a Nix attr-set? Then you can merge it together with another attr-set using lib.recursiveUpdate
.
In the end you'd only have to render a single attr-set to toml
. Sth. like this seem to be implemented in nixos/modules/virtualisation/containers.nix
already.
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.
Done in latest rebase
@Ma27 can you let me know what's the best way to test a derivation in nixpkg in a pure shell?
|
Thanks for the feedback @Ma27 I ended up hacking with nix-shell -I nixpkgs=/home/fmzakari/Development/nixpkgs -p spacevim --pure not sure if that's the best workflow but at least better than going through the builder manually! I added the additional binaries fzf, git & ripgrep like you've mentioned by running it in pure. |
Whoops. accidental close thanks. |
let &helplang = 'jp' | ||
endif | ||
"" | ||
- " generate tags for SpaceVim |
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.
Why this patch is needed? the tags should be generate when spacevim is installed.
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.
@wsdjeg -- The way in which Nix operates is that the applications are stored in /nix/store which is a read-only directory structure that is CAS (content addressable storage).
SpaceVim I found wants to generate the helptags in the same directory as the SpaceVim git directory which is read-only & would fail (_spacevim_root_dir) the way in which it is structured here.
At the moment I've disabled the help tag generation but maybe a better solution would be to generate the helptag docs in global_dir (i.e. SPACEVIM_DIR) which is read+write
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.
are stored in /nix/store which is a read-only directory structure that is CAS (content addressable storage).
While the reasoning about your patch is correct, I'd like to point out that /nix/store
is actually not entirely content-addressable: this is true for fixed-output derivations
, but not for package-definitions since the hash is generated using the derivation's source.
Efforts towards more content-addressability (i.e. hashing a derivation's output) are proposed here: NixOS/rfcs#62
|
# Once https://github.com/NixOS/nixpkgs/pull/75584 is merged we can use the TOML generator | ||
toTOML = name: value: runCommandNoCC name { | ||
nativeBuildInputs = [ remarshal ]; | ||
value = builtins.toJSON value; | ||
passAsFile = [ "value" ]; | ||
} '' | ||
mkdir $out | ||
json2toml "$valuePath" "$out/${name}" | ||
''; |
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.
@Ma27 This generates the TOML from the Nix attrset now.
I default the value in the function definition above.
spacevim_config ? import ./init.nix
Ping. Anyone care to approve, comment or update ? |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
@happysalada @SuperSandro2000 i've rebased, fixed merge conflict & used the new TOML stuff |
Result of 1 package built:
|
Result of 1 package built:
|
The specified SpaceVim commit ( |
But then we finally merge it. |
Longest PR to get it in 🥇 |
Result of 1 package built:
|
Spacevim is a fully loaded vim/neovim installation in the spirit of https://www.spacemacs.org/ It's configured with a TOML file rather than vimscript and includes a wide array of configuration found at https://spacevim.org/ Update pkgs/applications/editors/spacevim/default.nix Co-authored-by: Sandro <sandro.jaeckel@gmail.com> Update pkgs/applications/editors/spacevim/init.nix Co-authored-by: Sandro <sandro.jaeckel@gmail.com> Update pkgs/applications/editors/spacevim/default.nix Co-authored-by: risson <18313093+rissson@users.noreply.github.com>
Result of 1 package built:
|
@SuperSandro2000 I think we can merge this now |
Result of 1 package built:
|
Result of 1 package built:
|
Thank you guys for the hard work! |
Just tried on macos
Just leaving it here for information purpose. |
Spacevim is a fully loaded vim/neovim installation in the spirit
of https://www.spacemacs.org/
It's configured with a TOML file rather than vimscript and includes
a wide array of configuration found at https://spacevim.org/.
I tested this by running:
nix-build --no-out-link -E 'with import <nixpkgs> {}; callPackage ./pkgs/applications/editors/spacevim {}' /nix/store/nbxjak1cll8m1rm90cbkld5qpahx3gb2-spacevim/bin/spacevim
Motivation for this change
I hate configuring my vim & neovim files with plugins or vimrc files.
I like a very curated & hyper opinionated experience which is what spacevim brings to the table.
It's extremely sensible & has a lot of "layers" for almost anything.
I decided to rename the binary "spacevim" so that it doesn't conflict with other installations of vim.
I will say that at the moment this is one of my first few derivations & it's not fully nix compliant.
I would appreciate help to get it over the finish line.
SpaceVim downloads any missing plugins via the specific TOML file to ~/.cache/vimfiles
I would like to make use of vimPlugins instead
It would be better to have users customize the spacevim installation via a nix attrset that gets converted to TOML.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)