add home manager module
This commit is contained in:
48
flake.nix
48
flake.nix
@@ -3,23 +3,26 @@
|
||||
|
||||
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 =
|
||||
{ nixvim, flake-parts, ... }@inputs:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
{ self, nixvim, flake-parts, ... }@inputs:
|
||||
flake-parts.lib.mkFlake { inherit self; inherit inputs; } {
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
|
||||
perSystem =
|
||||
{ pkgs, system, ... }:
|
||||
let
|
||||
imports = [
|
||||
inputs.home-manager.flakeModules.home-manager
|
||||
];
|
||||
|
||||
perSystem = { pkgs, system, ... }: let
|
||||
nixvimLib = nixvim.lib.${system};
|
||||
nixvim' = nixvim.legacyPackages.${system};
|
||||
nixvimModule = { opts }: {
|
||||
@@ -32,8 +35,7 @@
|
||||
};
|
||||
};
|
||||
nvim = { opts }: nixvim'.makeNixvimWithModule (nixvimModule { inherit opts; });
|
||||
in
|
||||
{
|
||||
in {
|
||||
checks = {
|
||||
# Run `nix flake check .` to verify that your config is not broken
|
||||
default = nixvimLib.check.mkTestDerivationFromNixvimModule (nixvimModule { opts = { pywal = false; }; });
|
||||
@@ -54,5 +56,25 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user