diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8acdd82 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.1 diff --git a/flake.nix b/flake.nix index 44f47dd..cde7fff 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,13 @@ utils, alejandra, ... - } @ inputs: + } @ inputs: let + versionFile = builtins.replaceStrings ["\n"] [""] (builtins.readFile ./VERSION); + + version = if self.sourceInfo ? dirtyShortRev + then "${versionFile}-${self.sourceInfo.dirtyShortRev}" + else versionFile; + in utils.lib.mkFlake { inherit self inputs; outputsBuilder = channel: let @@ -30,6 +36,6 @@ }; }; - lib = import ./lib.nix; + lib = import ./lib.nix {inherit version;}; }; } diff --git a/lib.nix b/lib.nix index e47ad88..f01a062 100644 --- a/lib.nix +++ b/lib.nix @@ -1,4 +1,4 @@ -{ +{version}: { mkNeovimPkg = { pkgs, package ? pkgs.neovim-unwrapped, @@ -13,7 +13,7 @@ inherit (pkgs) lib vimUtils; callPackage = lib.callPackageWith (pkgs // dependenciesExtraArgs); inherit (lib.lists) concatMap filter foldl' map optional reverseList; - inherit (lib.attrsets) attrNames; + inherit (lib.attrsets) attrNames optionalAttrs; inherit (lib.strings) concatStringsSep fileContents hasSuffix removePrefix removeSuffix replaceStrings; inherit (lib.sources) sourceByRegex; # inherit (lib.debug) traceIf traceSeq traceVal traceValSeq traceValFn; @@ -77,9 +77,9 @@ concatStringsSep "\n" (concatMap (getLua type) plugins); - neoflake.plugin = vimUtils.buildVimPlugin rec { - name = "neoflake"; - pname = name; + neoflake.plugin = vimUtils.buildVimPlugin { + inherit version; + pname = "neoflake"; src = ./lua/neoflake; buildPhase = '' dir=lua/neoflake @@ -100,10 +100,16 @@ ''; }; - runtimePlugin.plugin = { - name = "runtime"; - src = runtime.src; - }; + runtimePlugin.plugin = vimUtils.buildVimPlugin ({ + inherit (runtime) src; + } + // (optionalAttrs (isNull runtime.version) { + name = "runtime"; + }) + // (optionalAttrs (! isNull runtime.version) { + inherit (runtime) version; + pname = "runtime"; + })); plugins = normalizePlugins (dependencies ++ [runtimePlugin neoflake]);