81 lines
2.5 KiB
Nix
81 lines
2.5 KiB
Nix
{
|
|
description = "A nixvim configuration";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
home-manager.url = "github:nix-community/home-manager";
|
|
nixvim.url = "github:nix-community/nixvim";
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
};
|
|
|
|
outputs =
|
|
{ self, nixvim, flake-parts, ... }@inputs:
|
|
flake-parts.lib.mkFlake { inherit self; inherit inputs; } {
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
];
|
|
|
|
imports = [
|
|
inputs.home-manager.flakeModules.home-manager
|
|
];
|
|
|
|
perSystem = { pkgs, system, ... }: let
|
|
nixvimLib = nixvim.lib.${system};
|
|
nixvim' = nixvim.legacyPackages.${system};
|
|
nixvimModule = { opts }: {
|
|
inherit pkgs;
|
|
module = import ./config; # import the module directly
|
|
# You can use `extraSpecialArgs` to pass additional arguments to your module files
|
|
extraSpecialArgs = {
|
|
inherit pkgs;
|
|
inherit opts;
|
|
};
|
|
};
|
|
nvim = { opts }: nixvim'.makeNixvimWithModule (nixvimModule { inherit opts; });
|
|
in {
|
|
checks = {
|
|
# Run `nix flake check .` to verify that your config is not broken
|
|
default = nixvimLib.check.mkTestDerivationFromNixvimModule (nixvimModule { opts = { pywal = false; }; });
|
|
};
|
|
|
|
packages = {
|
|
# Lets you run `nix run .` to start nixvim
|
|
default = nvim {
|
|
opts = {
|
|
pywal = false;
|
|
};
|
|
};
|
|
|
|
pywal = nvim {
|
|
opts = {
|
|
pywal = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
flake.homeModules.default = { config, lib, pkgs, ... }: {
|
|
|
|
options.programs.moirai = {
|
|
enable = lib.mkEnableOption "Moirai";
|
|
defaultEditor = lib.mkEnableOption "default editor";
|
|
pywal = lib.mkEnableOption "pywal support";
|
|
};
|
|
|
|
config = lib.mkIf config.programs.moirai.enable {
|
|
|
|
home.packages = with self.packages.${pkgs.stdenv.hostPlatform.system}; lib.mkMerge [
|
|
(lib.mkIf config.programs.moirai.pywal [ pywal ])
|
|
(lib.mkIf (!config.programs.moirai.pywal) [ default ])
|
|
];
|
|
|
|
home.sessionVariables.EDITOR = lib.mkIf config.programs.moirai.defaultEditor "nvim";
|
|
};
|
|
};
|
|
|
|
};
|
|
}
|