-
|
I would like to use nixCats with snowfall-lib to create my config, snowfall-lib uses a directory based package definition system. flake.nix {
description = "Snowvim";
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
snowfall-lib = {
url = "https://flakehub.com/f/snowfallorg/lib/3.0.3";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs:
inputs.snowfall-lib.mkFlake {
inherit inputs;
src = ./.;
snowfall = {
root = ./nix;
namespace = "snowvim";
meta = {
name = "snowvim";
title = "Snowvim";
};
};
alias.packages.default = "neovim";
outputs-builder = channels: {
formatter = channels.nixpkgs.nixfmt-rfc-style;
checks.pre-commit-check = inputs.pre-commit-hooks.lib.${channels.nixpkgs.system}.run {
src = ./.;
hooks = {
nixfmt = {
enable = true;
entry = "${channels.nixpkgs.nixfmt-rfc-style}/bin/nixfmt";
extraPackages = [ channels.nixpkgs.nixfmt-rfc-style ];
};
};
};
};
};
}packages/neovim/default.nix: {
# Snowfall Lib provides a customized `lib` instance with access to your flake's library
# as well as the libraries available from your flake's inputs.
lib,
# You also have access to your flake's inputs.
inputs,
# The namespace used for your flake, defaulting to "internal" if not set.
namespace,
# All other arguments come from NixPkgs. You can use `pkgs` to pull packages or helpers
# programmatically or you may add the named attributes as arguments here.
pkgs,
stdenv,
...
}:
stdenv.mkDerivation {
# Create your package
}I want to make the nixCats config all in the packages/neovim/default.nix, can you help? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
You mean a file you can use callPackage on and receive a derivation? https://github.com/BirdeeHub/nixCats-nvim/tree/main/templates/flakeless or one with a config in it https://github.com/BirdeeHub/nixCats-nvim/tree/main/templates/simple You will need to modify the arguments or find some way to get your inputs in there to get the nixCats library, I don't know how snowfall passes those in. When you do callPackage you can Edit: I see they do allow you to pass in inputs. So, yeah, just swap the nixCats grabbed from the arg for inputs, and then grab it from that, hopefully that instruction makes sense after looking at the top of the template. The templates I just linked have this for args {
pkgs ? import <nixpkgs> {}
, nixCats ? builtins.fetchGit {
url = "https://github.com/BirdeeHub/nixCats-nvim";
}
, ...
}: let
# get the nixCats library with the builder function (and everything else) in it
utils = import nixCats;You can just swap that to {
pkgs
, inputs # don't forget to add nixCats to your inputs!
, ...
}: let
# get the nixCats library with the builder function (and everything else) in it
utils = import inputs.nixCats; # or just `inputs.nixCats.utils`Those templates are nix files which when called return a derivation, which is what you are asking for I think. The templates just show you how to call the nixCats builder function correctly, which returns a derivation. The flake templates then also show you how to set up your outputs using the output of that function. Since the file only returns the 1 package, should you have more than 1 neovim package defined, the package it returns can be used to build all the other packages. You can use |
Beta Was this translation helpful? Give feedback.
-
|
@BirdeeHub Thanks! |
Beta Was this translation helpful? Give feedback.
You mean a file you can use callPackage on and receive a derivation?
https://github.com/BirdeeHub/nixCats-nvim/tree/main/templates/flakeless
or one with a config in it
https://github.com/BirdeeHub/nixCats-nvim/tree/main/templates/simple
You will need to modify the arguments or find some way to get your inputs in there to get the nixCats library, I don't know how snowfall passes those in. When you do callPackage you can
callPackage thefile { nixCats = inputs.nixCats; }but since snowfall is the one calling callPackage for you, I am assuming they have some way for you to supply your flake inputs.Edit: I see they do allow you to pass in inputs. So, yeah, just swap the nixCats grabbed from t…