refactor: rename vars.user to vars.mainUser
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-01-09 13:13:04 -05:00
parent b0542f4f2d
commit 77643378cc
27 changed files with 127 additions and 88 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
'';

View file

@ -1,6 +1,6 @@
{pkgs, ...}: {
vars = {
user = "nix-on-droid";
mainUser = "nix-on-droid";
hostName = "localhost";
neovimIde = false;
};

View file

@ -1,4 +1,6 @@
{config, ...}: {
{config, ...}: let
inherit (config.vars) mainUser hostName;
in {
imports = [
./hardware-configuration.nix
@ -17,14 +19,14 @@
];
vars = {
user = "matt";
mainUser = "matt";
hostName = "binto";
mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D";
greetdDupe = false;
fontSize = 12.5;
};
users.users.${config.vars.user} = {
users.users.${mainUser} = {
isNormalUser = true;
extraGroups = [
"wheel"
@ -40,7 +42,7 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJGbLu+Gb7PiyNgNXMHemaQLnKixebx1/4cdJGna9OQp matt@wim"
];
};
home-manager.users.${config.vars.user} = {
home-manager.users.${mainUser} = {
imports = [
../../home/firefox
@ -52,7 +54,7 @@
};
networking = {
inherit (config.vars) hostName;
inherit hostName;
networkmanager.enable = true;
firewall.enable = false;
};

View file

@ -5,6 +5,8 @@
gpu-screen-recorder-src,
...
}: let
inherit (config.vars) mainUser;
gsr = pkgs.stdenv.mkDerivation {
name = "gpu-screen-recorder";
version = gpu-screen-recorder-src.rev;
@ -74,7 +76,7 @@ in {
};
};
home-manager.users.${config.vars.user} = {
home-manager.users.${mainUser} = {
# TODO: add mic sound
xdg.configFile."gsr.sh" = {
executable = true;

View file

@ -1,4 +1,6 @@
{config, ...}: {
{config, ...}: let
inherit (config.vars) mainUser hostName;
in {
imports = [
./hardware-configuration.nix
@ -13,12 +15,12 @@
];
vars = {
user = "matt";
mainUser = "matt";
hostName = "oksys";
neovimIde = false;
};
users.users.${config.vars.user} = {
users.users.${mainUser} = {
isNormalUser = true;
extraGroups = [
"wheel"
@ -31,7 +33,7 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJGbLu+Gb7PiyNgNXMHemaQLnKixebx1/4cdJGna9OQp matt@wim"
];
};
home-manager.users.${config.vars.user} = {
home-manager.users.${mainUser} = {
imports = [];
# No touchy
@ -39,7 +41,7 @@
};
networking = {
inherit (config.vars) hostName;
inherit hostName;
resolvconf = {
enable = true;
extraConfig = ''

View file

@ -4,12 +4,14 @@
config,
...
}: let
inherit (config.vars) mainUser;
inherit (config.sops) secrets;
caddy = caddy-plugins.packages.${pkgs.system}.default;
secrets = config.sops.secrets;
in {
imports = [caddy-plugins.nixosModules.default];
environment.systemPackages = [caddy];
users.users.${config.vars.user}.extraGroups = ["caddy"];
users.users.${mainUser}.extraGroups = ["caddy"];
systemd.services.caddy.serviceConfig = {
EnvironmentFile = secrets.caddy-cloudflare.path;

View file

@ -4,10 +4,11 @@
config,
...
}: let
inherit (config.vars) mainUser;
headscale-flake = headscale.packages.${pkgs.system}.headscale;
in {
environment.systemPackages = [headscale-flake];
users.users.${config.vars.user}.extraGroups = ["headscale"];
users.users.${mainUser}.extraGroups = ["headscale"];
services.headscale = {
enable = true;

View file

@ -1,8 +1,10 @@
{config, ...}: {
{config, ...}: let
inherit (config.vars) mainUser;
in {
# https://github.com/MatthewVance/unbound-docker-rpi/issues/4#issuecomment-1001879602
boot.kernel.sysctl."net.core.rmem_max" = 1048576;
users.users.${config.vars.user}.extraGroups = ["unbound"];
users.users.${mainUser}.extraGroups = ["unbound"];
services.unbound = {
enable = true;

View file

@ -1,4 +1,6 @@
{config, ...}: {
{config, ...}: let
inherit (config.vars) mainUser hostName;
in {
imports = [
./hardware-configuration.nix
@ -13,12 +15,12 @@
];
vars = {
user = "matt";
mainUser = "matt";
hostName = "servivi";
};
users.users = {
${config.vars.user} = {
${mainUser} = {
isNormalUser = true;
extraGroups = [
"wheel"
@ -45,7 +47,7 @@
};
};
home-manager.users.${config.vars.user} = {
home-manager.users.${mainUser} = {
imports = [];
# No touchy
@ -53,7 +55,7 @@
};
networking = {
inherit (config.vars) hostName;
inherit hostName;
resolvconf.enable = true;
firewall.enable = false;
};

View file

@ -7,12 +7,13 @@
} @ inputs:
with lib;
with builtins; let
user = config.vars.user;
inherit (config.vars) mainUser;
configPath = "/var/lib/arion";
in {
imports = [arion.nixosModules.arion];
users.extraUsers.${user}.extraGroups = ["docker"];
users.extraUsers.${mainUser}.extraGroups = ["docker"];
services.borgbackup.configs.arion = {
paths = [configPath];

View file

@ -3,8 +3,8 @@
pkgs,
...
}: let
secrets = config.sops.secrets;
vars = config.vars;
inherit (config.vars) mainUser;
inherit (config.sops) secrets;
in {
services.nix-serve = {
enable = true;
@ -16,8 +16,8 @@ in {
services.buildAll = {
serviceConfig = {
Type = "oneshot";
User = vars.user;
Group = config.users.users.${vars.user}.group;
User = mainUser;
Group = config.users.users.${mainUser}.group;
};
path = with pkgs; [

View file

@ -3,7 +3,9 @@
nms,
pkgs,
...
}: {
}: let
inherit (config.vars) mainUser;
in {
imports = [nms.nixosModules.default];
services = {
@ -13,7 +15,7 @@
modded-minecraft-servers = {
eula = true;
user = config.vars.user;
user = mainUser;
instances = let
jre8 = pkgs.temurin-bin-8;

View file

@ -1,4 +1,6 @@
{config, ...}: {
{config, ...}: let
inherit (config.vars) mainUser hostName;
in {
imports = [
./hardware-configuration.nix
@ -15,13 +17,13 @@
];
vars = {
user = "matt";
mainUser = "matt";
hostName = "wim";
fontSize = 12.5;
mainMonitor = "eDP-1";
};
users.users.${config.vars.user} = {
users.users.${mainUser} = {
isNormalUser = true;
extraGroups = [
"wheel"
@ -32,7 +34,7 @@
"libvirtd"
];
};
home-manager.users .${config.vars.user} = {
home-manager.users.${mainUser} = {
imports = [
../../home/firefox
@ -45,7 +47,7 @@
};
networking = {
inherit (config.vars) hostName;
inherit hostName;
networkmanager = {
enable = true;
wifi.backend = "wpa_supplicant";

View file

@ -1,5 +1,5 @@
{config, ...}: let
configDir = config.vars.configDir;
inherit (config.vars) configDir;
symlink = config.lib.file.mkOutOfStoreSymlink;
in {
xdg.configFile = {

Binary file not shown.

BIN
flake.nix

Binary file not shown.

View file

@ -1,4 +1,6 @@
{config, ...}: {
{config, ...}: let
inherit (config.vars) fontSize;
in {
programs.alacritty = {
enable = true;
settings = {
@ -37,7 +39,7 @@
family = "JetBrainsMono Nerd Font";
style = "Italic";
};
size = config.vars.fontSize;
size = fontSize;
};
# https://github.com/dracula/alacritty/blob/05faff15c0158712be87d200081633d9f4850a7d/dracula.yml

View file

@ -3,7 +3,9 @@
lib,
config,
...
}: {
}: let
inherit (config.vars) fontSize;
in {
home.pointerCursor = {
name = "Dracula-cursors";
package = pkgs.dracula-theme;
@ -31,7 +33,7 @@
font = {
name = "Sans Serif";
size = config.vars.fontSize;
size = fontSize;
};
};
@ -49,15 +51,15 @@
"${pkgs.dracula-theme}/xres";
xdg.configFile = let
fontSize = lib.strings.floatToString config.vars.fontSize;
floatFont = lib.strings.floatToString fontSize;
qtconf =
/*
ini
*/
''
[Fonts]
fixed="Sans Serif,${fontSize},-1,5,50,0,0,0,0,0"
general="Sans Serif,${fontSize},-1,5,50,0,0,0,0,0"
fixed="Sans Serif,${floatFont},-1,5,50,0,0,0,0,0"
general="Sans Serif,${floatFont},-1,5,50,0,0,0,0,0"
[Appearance]
icon_theme=Flat-Remix-Violet-Dark

View file

@ -4,11 +4,12 @@
pkgs,
...
}: let
inherit (config.vars) configDir mainUser;
isTouchscreen = config.hardware.sensor.iio.enable;
in {
services.upower.enable = true;
home-manager.users.${config.vars.user}.imports = [
home-manager.users.${mainUser}.imports = [
ags.homeManagerModules.default
({
@ -21,7 +22,7 @@ in {
in {
programs.ags = {
enable = true;
configDir = symlink "${config.vars.configDir}/ags";
configDir = symlink "${configDir}/ags";
package = ags.packages.${pkgs.system}.default;
extraPackages = with pkgs; [
libgudev

View file

@ -2,12 +2,14 @@
config,
pkgs,
...
}: {
}: let
inherit (config.vars) mainUser;
in {
environment.systemPackages = with pkgs; [
plasma5Packages.kio-admin
];
home-manager.users.${config.vars.user}.home.packages = with pkgs;
home-manager.users.${mainUser}.home.packages = with pkgs;
[]
++ (with pkgs.plasma5Packages; [
ark

View file

@ -5,6 +5,8 @@
...
}:
with lib; let
inherit (config.vars) mainUser greetdDupe mainMonitor;
# Nix stuff
isNvidia = config.hardware.nvidia.modesetting.enable;
isTouchscreen = config.hardware.sensor.iio.enable;
@ -13,7 +15,7 @@ with lib; let
config
.home-manager
.users
.${config.vars.user}
.${mainUser}
.wayland
.windowManager
.hyprland
@ -24,7 +26,7 @@ with lib; let
# Show Regreet on all monitors
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
main="${config.vars.mainMonitor}"
main="${mainMonitor}"
names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .description'))
if [[ "$main" == "null" ]]; then
@ -44,8 +46,8 @@ with lib; let
# Check if user wants Regreet only on main monitor
setupMonitors =
if (config.vars.mainMonitor != "null" && !config.vars.greetdDupe)
then "${hyprBin}/hyprctl dispatch focusmonitor ${config.vars.mainMonitor}"
if (mainMonitor != "null" && !greetdDupe)
then "${hyprBin}/hyprctl dispatch focusmonitor ${mainMonitor}"
else "${dupeMonitors}/bin/dupeMonitors";
# Get css for regreet
@ -117,7 +119,7 @@ in {
initial_session = {
command = "${hyprBin}/Hyprland";
user = config.vars.user;
user = mainUser;
};
};
};

View file

@ -8,6 +8,7 @@
}:
with lib; let
# Config stuff
inherit (config.vars) configDir mainUser mainMonitor;
isNvidia = config.hardware.nvidia.modesetting.enable;
isTouchscreen = config.hardware.sensor.iio.enable;
in {
@ -39,7 +40,7 @@ in {
};
# HOME-MANAGER CONFIG
home-manager.users.${config.vars.user} = {
home-manager.users.${mainUser} = {
imports = [
../../home/alacritty.nix
../../home/dconf.nix
@ -105,7 +106,7 @@ in {
];
input = let
xserver = config.services.xserver;
inherit (config.services) xserver;
in {
kb_layout = xserver.layout;
kb_variant = xserver.xkbVariant;
@ -124,8 +125,8 @@ in {
"kdeconnect-indicator"
"gnome-keyring-daemon --start --components=secrets"
]
++ optionals (! isNull config.vars.mainMonitor)
["hyprctl dispatch focusmonitor ${config.vars.mainMonitor}"];
++ optionals (! isNull mainMonitor)
["hyprctl dispatch focusmonitor ${mainMonitor}"];
windowrule = [
"noborder,^(wofi)$"
@ -209,7 +210,7 @@ in {
special_scale_factor = 0.8;
};
source = ["${config.vars.configDir}/hypr/main.conf"];
source = ["${configDir}/hypr/main.conf"];
};
};

View file

@ -1,4 +1,6 @@
{config, ...}: {
{config, ...}: let
inherit (config.vars) hostName mainUser;
in {
services = {
tailscale = {
enable = true;
@ -10,9 +12,7 @@
};
};
home-manager.users.${config.vars.user} = let
hostName = config.vars.hostName;
in {
home-manager.users.${mainUser} = {
programs.bash.shellAliases = {
tup = "tailscale up --login-server https://headscale.nelim.org";

View file

@ -1,5 +1,11 @@
#!/usr/bin/env bash
# Deps:
# - nurl
# - jq
# - mozilla-addons-to-nix
# - alejandra
parseNurl() {
REV=$(nurl -j "$1" | jq '.["args"].["rev"]')
HASH=$(nurl -j "$1" | jq '.["args"].["hash"]')
@ -22,7 +28,7 @@ parseFetchurl() {
}
updateFFZ() {
FILE="/home/matt/.nix/home/firefox/addons/default.nix"
FILE="$FLAKE/home/firefox/addons/default.nix"
URL="https://cdn.frankerfacez.com/script/frankerfacez-4.0-an+fx.xpi"
parseFetchurl "$URL" "$FILE"
@ -31,7 +37,8 @@ updateFFZ() {
updateFirefoxAddons() {
echo "Updating firefox addons using mozilla-addons-to-nix"
(cd /home/matt/.nix/home/firefox/addons || return;
(
cd "$FLAKE/home/firefox/addons" || return;
file=generated-firefox-addons.nix
if [[ -f $file ]]; then
@ -44,7 +51,8 @@ updateFirefoxAddons() {
printf "\nNew versions: \n"
fi
mozilla-addons-to-nix addons.json generated-firefox-addons.nix)
mozilla-addons-to-nix addons.json generated-firefox-addons.nix
)
}
@ -58,4 +66,4 @@ doAll() {
[[ "$1" == "-f" || "$1" == "--firefox" ]] && updateFirefoxAddons
[[ "$1" == "-ffz" || "$1" == "--frankerfacez" ]] && updateFFZ
alejandra /home/matt/.nix
alejandra "$FLAKE"