mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
update-scripts/version-info: init
Writes a version-info.toml file.
This commit is contained in:
parent
bfee503e0f
commit
7a4c70c55f
2 changed files with 37 additions and 0 deletions
|
@ -17,4 +17,5 @@ lib.fix (self: {
|
|||
none-ls-builtins = pkgs.callPackage ./none-ls.nix { };
|
||||
rust-analyzer-options = pkgs.callPackage ./rust-analyzer { };
|
||||
lspconfig-servers = pkgs.callPackage ./nvim-lspconfig { };
|
||||
version-info = pkgs.callPackage ./version-info { };
|
||||
})
|
||||
|
|
36
update-scripts/version-info/default.nix
Normal file
36
update-scripts/version-info/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
lib,
|
||||
writers,
|
||||
runCommand,
|
||||
}:
|
||||
let
|
||||
inherit (builtins)
|
||||
all
|
||||
match
|
||||
attrNames
|
||||
;
|
||||
inherit (lib)
|
||||
importJSON
|
||||
;
|
||||
|
||||
lockFile = importJSON ../../flake.lock;
|
||||
nixpkgsLock =
|
||||
# Assert there is only one nixpkgs node
|
||||
assert all (node: match "nixpkgs_[0-9]+" node == null) (attrNames lockFile.nodes);
|
||||
lockFile.nodes.nixpkgs.original;
|
||||
|
||||
info = {
|
||||
inherit (lib.trivial) release;
|
||||
nixpkgs_rev = lib.trivial.revisionWithDefault (throw "nixpkgs revision not available");
|
||||
unstable = lib.strings.hasSuffix "-unstable" nixpkgsLock.ref;
|
||||
};
|
||||
in
|
||||
runCommand "version-info.toml" { } ''
|
||||
(
|
||||
echo "# DO NOT MODIFY!"
|
||||
echo "# This file was generated by ${
|
||||
lib.strings.removePrefix (toString ../.. + "/") (toString ./default.nix)
|
||||
}"
|
||||
cat ${writers.writeTOML "version-info.toml" info}
|
||||
) > $out
|
||||
''
|
Loading…
Add table
Add a link
Reference in a new issue