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