refactor: rename vars.user to vars.mainUser

This commit is contained in:
matt1432 2024-01-09 13:13:04 -05:00
parent b0542f4f2d
commit 77643378cc
27 changed files with 141 additions and 102 deletions

View file

@ -57,7 +57,7 @@
};
home-manager.users = let
mainUser = config.vars.user;
inherit (config.vars) mainUser;
mainUserConf = config.home-manager.users.${mainUser};
default = {

View file

@ -7,13 +7,13 @@
...
}:
with lib; let
nvimIde = config.vars.neovimIde;
inherit (config.vars) neovimIde;
javaSdk = pkgs.temurin-bin-17;
nvim-treesitter-hyprlang = tree-sitter-hyprlang-flake.packages.${pkgs.system}.default;
coc-stylelintplus = coc-stylelintplus-flake.packages.${pkgs.system}.default;
in {
home = optionalAttrs nvimIde {
home = optionalAttrs neovimIde {
packages = with pkgs; [
gradle
gradle-completion # FIXME: not working
@ -21,14 +21,14 @@ in {
];
};
xdg.dataFile = optionalAttrs nvimIde {
xdg.dataFile = optionalAttrs neovimIde {
".gradle/gradle.properties".text = ''
org.gradle.java.home = ${javaSdk}
'';
};
programs = {
java = optionalAttrs nvimIde {
java = optionalAttrs neovimIde {
enable = true;
package = javaSdk;
};
@ -54,7 +54,7 @@ in {
bat
gcc
]
++ optionals nvimIde [
++ optionals neovimIde [
nodejs_latest
nodePackages.npm
nodePackages.neovim
@ -63,11 +63,11 @@ in {
]);
extraPython3Packages = ps:
optionals nvimIde [
optionals neovimIde [
ps.pylint
];
coc = optionalAttrs nvimIde {
coc = optionalAttrs neovimIde {
enable = true;
settings = {
# General
@ -186,7 +186,7 @@ in {
config = fileContents ./plugins/mini.lua;
}
]
++ optionals nvimIde [
++ optionals neovimIde [
# Coc configured
coc-css
coc-eslint

View file

@ -4,6 +4,7 @@
lib,
...
}: let
inherit (config.vars) mainUser;
cfg = config.services.locate;
locateGroup = lib.getName cfg.package.name;
@ -21,7 +22,7 @@
--prunepaths "${prunePaths}" --prunenames "${pruneNames}"
'';
in {
users.users.${config.vars.user}.extraGroups = [
users.users.${mainUser}.extraGroups = [
locateGroup
];
@ -29,7 +30,7 @@ in {
systemd.services.locate = {
wantedBy = ["default.target"];
serviceConfig = {
User = config.vars.user;
User = mainUser;
Group = locateGroup;
StateDirectory = "locate";
StateDirectoryMode = "0770";
@ -37,7 +38,7 @@ in {
};
};
home-manager.users.${config.vars.user}.programs.bash.shellAliases = {
home-manager.users.${mainUser}.programs.bash.shellAliases = {
locate = "${pkgs.writeShellScriptBin "lct" ''
exec ${locate} -d ${database} "$@" 2> >(grep -v "/var/cache/locatedb")
''}/bin/lct";

View file

@ -3,8 +3,10 @@
lib,
...
}: {
options.vars = with lib; {
user = mkOption {
options.vars = with lib; let
inherit (config.vars) mainUser hostName;
in {
mainUser = mkOption {
type = types.str;
description = ''
Username that was defined at the initial setup process
@ -20,7 +22,7 @@
configDir = mkOption {
type = types.str;
default = "/home/${config.vars.user}/.nix/devices/${config.vars.hostName}/config";
default = "/home/${mainUser}/.nix/devices/${hostName}/config";
description = ''
The path to where most of the devices' configs are in the .nix folder
'';