feat(vars): add hostName and big refactors
This commit is contained in:
parent
1fe3920c50
commit
66e3a03d7d
20 changed files with 150 additions and 126 deletions
|
@ -3,14 +3,14 @@
|
|||
lib,
|
||||
nixpkgs,
|
||||
nh,
|
||||
nur,
|
||||
nix-melt,
|
||||
nur,
|
||||
nurl,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./device-vars.nix
|
||||
./vars.nix
|
||||
|
||||
./modules
|
||||
./overlays
|
||||
|
@ -56,22 +56,18 @@
|
|||
layout = "ca";
|
||||
xkbVariant = "multix";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
home-manager.users = let
|
||||
user = config.services.device-vars.username;
|
||||
|
||||
default = {
|
||||
imports = [
|
||||
nur.hmModules.nur
|
||||
|
||||
./home
|
||||
|
||||
./device-vars.nix
|
||||
({osConfig, ...}: {
|
||||
services.device-vars = osConfig.services.device-vars;
|
||||
})
|
||||
# Make the vars be the same on Nix and HM
|
||||
./vars.nix
|
||||
({osConfig, ...}: {vars = osConfig.vars;})
|
||||
];
|
||||
|
||||
home.packages =
|
||||
|
@ -102,6 +98,6 @@
|
|||
in {
|
||||
root = default;
|
||||
# TODO: make user an array?
|
||||
${user} = default;
|
||||
${config.vars.user} = default;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{pkgs, config, ...}: {
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
programs = {
|
||||
fzf = {
|
||||
enable = true;
|
||||
|
|
|
@ -4,30 +4,31 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
vars = config.services.device-vars;
|
||||
locateGroup = lib.getName config.services.locate.package.name;
|
||||
cfg = config.services.locate;
|
||||
|
||||
locate = "${config.services.locate.package}/bin/locate";
|
||||
updatedb = "${config.services.locate.package}/bin/updatedb";
|
||||
locateGroup = lib.getName cfg.package.name;
|
||||
|
||||
locate = "${cfg.package}/bin/locate";
|
||||
updatedb = "${cfg.package}/bin/updatedb";
|
||||
|
||||
database = "/var/lib/locate/locatedb";
|
||||
pruneFS = builtins.concatStringsSep " " config.services.locate.pruneFS;
|
||||
pruneNames = builtins.concatStringsSep " " config.services.locate.pruneNames;
|
||||
prunePaths = builtins.concatStringsSep " " config.services.locate.prunePaths;
|
||||
pruneFS = builtins.concatStringsSep " " cfg.pruneFS;
|
||||
pruneNames = builtins.concatStringsSep " " cfg.pruneNames;
|
||||
prunePaths = builtins.concatStringsSep " " cfg.prunePaths;
|
||||
|
||||
updatedbBin = ''
|
||||
${updatedb} -o ${database} --prunefs "${pruneFS}" \
|
||||
--prunepaths "${prunePaths}" --prunenames "${pruneNames}"
|
||||
'';
|
||||
in {
|
||||
users.users.${vars.username}.extraGroups = [
|
||||
users.users.${config.vars.user}.extraGroups = [
|
||||
locateGroup
|
||||
];
|
||||
|
||||
systemd.services.locate = {
|
||||
wantedBy = ["default.target"];
|
||||
serviceConfig = {
|
||||
User = vars.username;
|
||||
User = config.vars.user;
|
||||
Group = locateGroup;
|
||||
StateDirectory = "locate";
|
||||
StateDirectoryMode = "0770";
|
||||
|
@ -35,17 +36,13 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
home-manager.users.${vars.username}.imports = [
|
||||
{
|
||||
programs.bash.shellAliases = {
|
||||
locate = "${pkgs.writeShellScriptBin "lct" ''
|
||||
exec ${locate} -d ${database} "$@" 2> >(grep -v "/var/cache/locatedb")
|
||||
''}/bin/lct";
|
||||
home-manager.users.${config.vars.user}.programs.bash.shellAliases = {
|
||||
locate = "${pkgs.writeShellScriptBin "lct" ''
|
||||
exec ${locate} -d ${database} "$@" 2> >(grep -v "/var/cache/locatedb")
|
||||
''}/bin/lct";
|
||||
|
||||
updatedb = updatedbBin;
|
||||
};
|
||||
}
|
||||
];
|
||||
updatedb = updatedbBin;
|
||||
};
|
||||
|
||||
services.locate = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{neovim-flake, nixpkgs-wayland, ...}: {
|
||||
{
|
||||
neovim-flake,
|
||||
nixpkgs-wayland,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./dracula-theme
|
||||
./regreet
|
||||
|
|
|
@ -1,33 +1,45 @@
|
|||
{lib, ...}: {
|
||||
options.services.device-vars = with lib; {
|
||||
username = mkOption {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options.vars = with lib; {
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Username that was defined at the initial setup process
|
||||
'';
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Hostname that was defined at the initial setup process
|
||||
'';
|
||||
};
|
||||
|
||||
configDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/home/${config.vars.user}/.nix/devices/${config.vars.hostName}/config";
|
||||
description = ''
|
||||
The path to where most of the devices' configs are in the .nix folder
|
||||
'';
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
mainMonitor = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The name of the main monitor used for Hyprland and Regreet
|
||||
'';
|
||||
default = "null";
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
greetdDupe = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
description = ''
|
||||
If we should duplicate regreet on all monitors
|
||||
'';
|
||||
default = true;
|
||||
type = types.nullOr types.bool;
|
||||
};
|
||||
|
||||
fontSize = mkOption {
|
|
@ -1,4 +1,4 @@
|
|||
{...}: {
|
||||
{config, ...}: {
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
|
||||
|
@ -16,15 +16,15 @@
|
|||
./modules/nvidia.nix
|
||||
];
|
||||
|
||||
services.device-vars = {
|
||||
username = "matt";
|
||||
configDir = "/home/matt/.nix/devices/binto/config";
|
||||
vars = {
|
||||
user = "matt";
|
||||
hostName = "binto";
|
||||
mainMonitor = "DP-5";
|
||||
greetdDupe = false;
|
||||
fontSize = 12.5;
|
||||
};
|
||||
|
||||
users.users.matt = {
|
||||
users.users.${config.vars.user} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
|
@ -35,23 +35,21 @@
|
|||
"libvirtd"
|
||||
];
|
||||
};
|
||||
home-manager.users = {
|
||||
matt = {
|
||||
imports = [
|
||||
../../home/dconf.nix
|
||||
../../home/firefox
|
||||
../../home/hyprland
|
||||
home-manager.users.${config.vars.user} = {
|
||||
imports = [
|
||||
../../home/dconf.nix
|
||||
../../home/firefox
|
||||
../../home/hyprland
|
||||
|
||||
./home/packages.nix
|
||||
];
|
||||
./home/packages.nix
|
||||
];
|
||||
|
||||
# No touchy
|
||||
home.stateVersion = "23.11";
|
||||
};
|
||||
# No touchy
|
||||
home.stateVersion = "23.11";
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "binto";
|
||||
inherit (config.vars) hostName;
|
||||
networkmanager.enable = true;
|
||||
firewall.enable = false;
|
||||
};
|
||||
|
|
|
@ -3,8 +3,15 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
user = config.services.device-vars.username;
|
||||
hyprland = config.home-manager.users.${user}.wayland.windowManager.hyprland.finalPackage;
|
||||
hyprland =
|
||||
config
|
||||
.home-manager
|
||||
.users
|
||||
.${config.vars.user}
|
||||
.wayland
|
||||
.windowManager
|
||||
.hyprland
|
||||
.finalPackage;
|
||||
in {
|
||||
programs.dconf.enable = true;
|
||||
|
||||
|
@ -21,7 +28,7 @@ in {
|
|||
settings = {
|
||||
initial_session = {
|
||||
command = "${hyprland}/bin/Hyprland";
|
||||
user = user;
|
||||
user = config.vars.user;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{...}: {
|
||||
{config, ...}: {
|
||||
imports = [
|
||||
#./hardware-configuration.nix
|
||||
|
||||
|
@ -7,29 +7,28 @@
|
|||
./modules/headscale.nix
|
||||
];
|
||||
|
||||
services.device-vars = {
|
||||
username = "matt";
|
||||
vars = {
|
||||
user = "matt";
|
||||
hostName = "oksys";
|
||||
};
|
||||
|
||||
users.users.matt = {
|
||||
users.users.${config.vars.user} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"adm"
|
||||
];
|
||||
};
|
||||
home-manager.users = {
|
||||
matt = {
|
||||
imports = [];
|
||||
home-manager.users.${config.vars.user} = {
|
||||
imports = [];
|
||||
|
||||
# No touchy
|
||||
home.stateVersion = "24.05";
|
||||
};
|
||||
# No touchy
|
||||
home.stateVersion = "24.05";
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "oksys";
|
||||
networkmanager = {
|
||||
inherit (config.vars) hostName;
|
||||
enable = true;
|
||||
wifi.backend = "wpa_supplicant";
|
||||
};
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
user = config.services.device-vars.username;
|
||||
|
||||
caddy = caddy-plugins.packages.${pkgs.system}.default;
|
||||
|
||||
# TODO: use agenix?
|
||||
|
@ -13,7 +11,7 @@
|
|||
in {
|
||||
imports = [caddy-plugins.nixosModules.default];
|
||||
environment.systemPackages = [caddy];
|
||||
users.users.${user}.extraGroups = ["caddy"];
|
||||
users.users.${config.vars.user}.extraGroups = ["caddy"];
|
||||
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
...
|
||||
}: let
|
||||
headscale-flake = headscale.packages.${pkgs.system}.headscale;
|
||||
user = config.services.device-vars.username;
|
||||
in {
|
||||
environment.systemPackages = [headscale-flake];
|
||||
users.users.${user}.extraGroups = ["headscale"];
|
||||
users.users.${config.vars.user}.extraGroups = ["headscale"];
|
||||
|
||||
services.headscale = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
{config, ...}: let
|
||||
user = config.services.device-vars.username;
|
||||
in {
|
||||
{config, ...}: {
|
||||
# https://github.com/MatthewVance/unbound-docker-rpi/issues/4#issuecomment-1001879602
|
||||
boot.kernel.sysctl."net.core.rmem_max" = 1048576;
|
||||
|
||||
users.users.${user}.extraGroups = ["unbound"];
|
||||
users.users.${config.vars.user}.extraGroups = ["unbound"];
|
||||
|
||||
services.unbound = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{...}: {
|
||||
{config, ...}: {
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
|
||||
|
@ -15,13 +15,13 @@
|
|||
./modules/security.nix
|
||||
];
|
||||
|
||||
services.device-vars = {
|
||||
username = "matt";
|
||||
configDir = "/home/matt/.nix/devices/wim/config";
|
||||
vars = {
|
||||
user = "matt";
|
||||
hostName = "wim";
|
||||
fontSize = 12.5;
|
||||
};
|
||||
|
||||
users.users.matt = {
|
||||
users.users.${config.vars.user} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
|
@ -32,24 +32,22 @@
|
|||
"libvirtd"
|
||||
];
|
||||
};
|
||||
home-manager.users = {
|
||||
matt = {
|
||||
imports = [
|
||||
../../home/dconf.nix
|
||||
../../home/firefox
|
||||
../../home/hyprland
|
||||
home-manager.users .${config.vars.user} = {
|
||||
imports = [
|
||||
../../home/dconf.nix
|
||||
../../home/firefox
|
||||
../../home/hyprland
|
||||
|
||||
./home/dotfiles.nix
|
||||
./home/packages.nix
|
||||
];
|
||||
./home/dotfiles.nix
|
||||
./home/packages.nix
|
||||
];
|
||||
|
||||
# No touchy
|
||||
home.stateVersion = "23.05";
|
||||
};
|
||||
# No touchy
|
||||
home.stateVersion = "23.05";
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "wim";
|
||||
inherit (config.vars) hostName;
|
||||
networkmanager = {
|
||||
enable = true;
|
||||
wifi.backend = "wpa_supplicant";
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
configDir = config.services.device-vars.configDir;
|
||||
configDir = config.vars.configDir;
|
||||
symlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
in {
|
||||
wayland.windowManager.hyprland = {
|
||||
|
@ -17,7 +17,7 @@ in {
|
|||
};
|
||||
|
||||
xdg.configFile = {
|
||||
"gtklock/config.ini".text = ''
|
||||
"gtklock/config.ini".text = ''
|
||||
[main]
|
||||
modules=${builtins.concatStringsSep ";" [
|
||||
"${pkgs.gtklock-powerbar-module}/lib/gtklock/powerbar-module.so"
|
||||
|
|
|
@ -3,8 +3,15 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
user = config.services.device-vars.username;
|
||||
hyprland = config.home-manager.users.${user}.wayland.windowManager.hyprland.finalPackage;
|
||||
hyprland =
|
||||
config
|
||||
.home-manager
|
||||
.users
|
||||
.${config.vars.user}
|
||||
.wayland
|
||||
.windowManager
|
||||
.hyprland
|
||||
.finalPackage;
|
||||
in {
|
||||
programs.dconf.enable = true;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
family = "JetBrainsMono Nerd Font";
|
||||
style = "Italic";
|
||||
};
|
||||
size = config.services.device-vars.fontSize;
|
||||
size = config.vars.fontSize;
|
||||
};
|
||||
|
||||
# https://github.com/dracula/alacritty/blob/05faff15c0158712be87d200081633d9f4850a7d/dracula.yml
|
||||
|
|
|
@ -7,11 +7,15 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
configDir = config.services.device-vars.configDir;
|
||||
# Nix utils
|
||||
symlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
optionals = lib.lists.optionals;
|
||||
|
||||
# Config stuff
|
||||
isNvidia = osConfig.hardware.nvidia.modesetting.enable;
|
||||
isTouchscreen = osConfig.hardware.sensor.iio.enable;
|
||||
confPath = "${config.vars.configDir}/hypr/main.conf";
|
||||
kdeconnect = osConfig.programs.kdeconnect;
|
||||
|
||||
gset = pkgs.gsettings-desktop-schemas;
|
||||
polkit = pkgs.plasma5Packages.polkit-kde-agent;
|
||||
|
@ -22,9 +26,10 @@ in {
|
|||
../wofi
|
||||
];
|
||||
|
||||
xdg.configFile = lib.mkIf (configDir != null) {
|
||||
"hypr/main.conf".source = symlink "${configDir}/hypr/main.conf";
|
||||
};
|
||||
xdg.configFile = with lib;
|
||||
mkIf (pathExists confPath) {
|
||||
"hypr/main.conf".source = symlink confPath;
|
||||
};
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
|
@ -32,7 +37,7 @@ in {
|
|||
|
||||
plugins =
|
||||
[]
|
||||
++ (optionals (isTouchscreen) [
|
||||
++ (optionals isTouchscreen [
|
||||
hyprgrass.packages.${pkgs.system}.default
|
||||
]);
|
||||
|
||||
|
@ -93,8 +98,8 @@ in {
|
|||
"swww init --no-cache && swww img -t none ${pkgs.dracula-theme}/wallpapers/waves.png"
|
||||
"wl-paste --watch cliphist store"
|
||||
]
|
||||
++ (optionals (osConfig.programs.kdeconnect.enable) [
|
||||
"${osConfig.programs.kdeconnect.package}/libexec/kdeconnectd"
|
||||
++ (optionals (kdeconnect.enable) [
|
||||
"${kdeconnect.package}/libexec/kdeconnectd"
|
||||
"kdeconnect-indicator"
|
||||
])
|
||||
++ (optionals (osConfig.services.gnome.gnome-keyring.enable) [
|
||||
|
@ -179,7 +184,7 @@ in {
|
|||
|
||||
source =
|
||||
[]
|
||||
++ optionals (configDir != null) [
|
||||
++ optionals (lib.pathExists confPath) [
|
||||
"~/.config/hypr/main.conf"
|
||||
];
|
||||
};
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
fontSize = config.services.device-vars.fontSize;
|
||||
dracula-xresources = pkgs.fetchFromGitHub {
|
||||
owner = "dracula";
|
||||
repo = "xresources";
|
||||
|
@ -39,7 +38,7 @@ in {
|
|||
|
||||
font = {
|
||||
name = "Sans Serif";
|
||||
size = fontSize;
|
||||
size = config.vars.fontSize;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -57,8 +56,8 @@ in {
|
|||
xdg.configFile = let
|
||||
qtconf = ''
|
||||
[Fonts]
|
||||
fixed="Sans Serif,${lib.strings.floatToString fontSize},-1,5,50,0,0,0,0,0"
|
||||
general="Sans Serif,${lib.strings.floatToString fontSize},-1,5,50,0,0,0,0,0"
|
||||
fixed="Sans Serif,${lib.strings.floatToString config.vars.fontSize},-1,5,50,0,0,0,0,0"
|
||||
general="Sans Serif,${lib.strings.floatToString config.vars.fontSize},-1,5,50,0,0,0,0,0"
|
||||
|
||||
[Appearance]
|
||||
icon_theme=Flat-Remix-Violet-Dark
|
||||
|
|
|
@ -4,13 +4,12 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
vars = config.services.device-vars;
|
||||
isNvidia = config.hardware.nvidia.modesetting.enable;
|
||||
isTouchscreen = config.hardware.sensor.iio.enable;
|
||||
in {
|
||||
services.upower.enable = true;
|
||||
|
||||
home-manager.users.${vars.username}.imports = [
|
||||
home-manager.users.${config.vars.user}.imports = [
|
||||
ags.homeManagerModules.default
|
||||
|
||||
({
|
||||
|
@ -23,7 +22,7 @@ in {
|
|||
in {
|
||||
programs.ags = {
|
||||
enable = true;
|
||||
configDir = symlink "${vars.configDir}/ags";
|
||||
configDir = symlink "${config.vars.configDir}/ags";
|
||||
package = ags.packages.x86_64-linux.default;
|
||||
extraPackages = [pkgs.libgudev];
|
||||
};
|
||||
|
|
|
@ -7,17 +7,22 @@
|
|||
# Nix stuff
|
||||
optionals = lib.lists.optionals;
|
||||
isNvidia = config.hardware.nvidia.modesetting.enable;
|
||||
vars = config.services.device-vars;
|
||||
|
||||
# Executables' paths
|
||||
regreetBin = "${lib.getExe config.programs.regreet.package}";
|
||||
hyprBin = "${config.home-manager.users.${vars.username}
|
||||
.wayland.windowManager.hyprland.finalPackage}/bin";
|
||||
hyprBin = "${config
|
||||
.home-manager
|
||||
.users
|
||||
.${config.vars.user}
|
||||
.wayland
|
||||
.windowManager
|
||||
.hyprland
|
||||
.finalPackage}/bin";
|
||||
|
||||
# Show Regreet on all monitors
|
||||
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
|
||||
names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .name'))
|
||||
main="${vars.mainMonitor}"
|
||||
main="${config.vars.mainMonitor}"
|
||||
|
||||
if [[ $(echo "$main") == "null" ]]; then
|
||||
main="''${names[0]}"
|
||||
|
@ -31,8 +36,9 @@
|
|||
'';
|
||||
|
||||
# Check if user wants Regreet only on main monitor
|
||||
setupMonitors = if vars.mainMonitor != null && !vars.greetdDupe
|
||||
then "${hyprBin}/hyprctl dispatch focusmonitor ${vars.mainMonitor}"
|
||||
setupMonitors =
|
||||
if (config.vars.mainMonitor != null && !config.vars.greetdDupe)
|
||||
then "${hyprBin}/hyprctl dispatch focusmonitor ${config.vars.mainMonitor}"
|
||||
else "${dupeMonitors}/bin/dupeMonitors";
|
||||
|
||||
# Get css for regreet
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
{config, ...}: let
|
||||
vars = config.services.device-vars;
|
||||
in {
|
||||
{config, ...}: {
|
||||
services = {
|
||||
tailscale = {
|
||||
enable = true;
|
||||
|
@ -11,7 +9,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
home-manager.users.${vars.username}.programs.bash.shellAliases = {
|
||||
home-manager.users.${config.vars.user}.programs.bash.shellAliases = {
|
||||
tup = "tailscale up --login-server https://headscale.nelim.org";
|
||||
|
||||
pc = "mosh matt@binto -- tmux -2u new -At laptop";
|
||||
|
|
Loading…
Reference in a new issue