From 77643378cc28311f14ebf13bb6cebcecd0d4478a Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 9 Jan 2024 13:13:04 -0500 Subject: [PATCH] refactor: rename vars.user to vars.mainUser --- common/default.nix | 2 +- common/home/neovim/default.nix | 16 +++++------ common/modules/locate.nix | 7 +++-- common/vars.nix | 8 ++++-- devices/android/default.nix | 2 +- devices/binto/default.nix | 12 ++++---- devices/binto/modules/gpu-replay.nix | 4 ++- devices/oksys/default.nix | 12 ++++---- devices/oksys/modules/caddy.nix | 6 ++-- devices/oksys/modules/headscale.nix | 3 +- devices/oksys/modules/unbound.nix | 6 ++-- devices/servivi/default.nix | 12 ++++---- devices/servivi/modules/arion/default.nix | 5 ++-- devices/servivi/modules/binary-cache.nix | 8 +++--- devices/servivi/modules/minecraft.nix | 6 ++-- devices/wim/default.nix | 12 ++++---- devices/wim/home/dotfiles.nix | 2 +- flake.lock | Bin 43611 -> 43611 bytes flake.nix | Bin 7799 -> 7803 bytes home/alacritty.nix | 6 ++-- home/theme.nix | 12 ++++---- modules/ags/default.nix | 5 ++-- modules/dolphin.nix | 6 ++-- modules/greetd/default.nix | 12 ++++---- modules/hyprland/default.nix | 11 ++++---- modules/tailscale.nix | 8 +++--- updateSha.sh | 32 ++++++++++++++-------- 27 files changed, 127 insertions(+), 88 deletions(-) diff --git a/common/default.nix b/common/default.nix index 00a835a4..5f0850db 100644 --- a/common/default.nix +++ b/common/default.nix @@ -57,7 +57,7 @@ }; home-manager.users = let - mainUser = config.vars.user; + inherit (config.vars) mainUser; mainUserConf = config.home-manager.users.${mainUser}; default = { diff --git a/common/home/neovim/default.nix b/common/home/neovim/default.nix index 8432a543..32a4bc01 100644 --- a/common/home/neovim/default.nix +++ b/common/home/neovim/default.nix @@ -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 diff --git a/common/modules/locate.nix b/common/modules/locate.nix index 8b4e9f37..7c24ddf2 100644 --- a/common/modules/locate.nix +++ b/common/modules/locate.nix @@ -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"; diff --git a/common/vars.nix b/common/vars.nix index c1c621b1..3b602025 100644 --- a/common/vars.nix +++ b/common/vars.nix @@ -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 ''; diff --git a/devices/android/default.nix b/devices/android/default.nix index 73d42abd..aec23d51 100644 --- a/devices/android/default.nix +++ b/devices/android/default.nix @@ -1,6 +1,6 @@ {pkgs, ...}: { vars = { - user = "nix-on-droid"; + mainUser = "nix-on-droid"; hostName = "localhost"; neovimIde = false; }; diff --git a/devices/binto/default.nix b/devices/binto/default.nix index 500b23fa..02def669 100644 --- a/devices/binto/default.nix +++ b/devices/binto/default.nix @@ -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; }; diff --git a/devices/binto/modules/gpu-replay.nix b/devices/binto/modules/gpu-replay.nix index 21bbf407..d4e45789 100644 --- a/devices/binto/modules/gpu-replay.nix +++ b/devices/binto/modules/gpu-replay.nix @@ -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; diff --git a/devices/oksys/default.nix b/devices/oksys/default.nix index 79a12f8a..1a9cf6e9 100644 --- a/devices/oksys/default.nix +++ b/devices/oksys/default.nix @@ -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 = '' diff --git a/devices/oksys/modules/caddy.nix b/devices/oksys/modules/caddy.nix index b8105ec4..737daeb9 100644 --- a/devices/oksys/modules/caddy.nix +++ b/devices/oksys/modules/caddy.nix @@ -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; diff --git a/devices/oksys/modules/headscale.nix b/devices/oksys/modules/headscale.nix index 6bc310ca..c174c49c 100644 --- a/devices/oksys/modules/headscale.nix +++ b/devices/oksys/modules/headscale.nix @@ -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; diff --git a/devices/oksys/modules/unbound.nix b/devices/oksys/modules/unbound.nix index 2ad2945c..90729e2e 100644 --- a/devices/oksys/modules/unbound.nix +++ b/devices/oksys/modules/unbound.nix @@ -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; diff --git a/devices/servivi/default.nix b/devices/servivi/default.nix index 185d5f19..67ebdf72 100644 --- a/devices/servivi/default.nix +++ b/devices/servivi/default.nix @@ -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; }; diff --git a/devices/servivi/modules/arion/default.nix b/devices/servivi/modules/arion/default.nix index 03176009..8db53f50 100644 --- a/devices/servivi/modules/arion/default.nix +++ b/devices/servivi/modules/arion/default.nix @@ -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]; diff --git a/devices/servivi/modules/binary-cache.nix b/devices/servivi/modules/binary-cache.nix index 60f8f4bc..c224e438 100644 --- a/devices/servivi/modules/binary-cache.nix +++ b/devices/servivi/modules/binary-cache.nix @@ -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; [ diff --git a/devices/servivi/modules/minecraft.nix b/devices/servivi/modules/minecraft.nix index b0ed6ee2..fc03eb92 100644 --- a/devices/servivi/modules/minecraft.nix +++ b/devices/servivi/modules/minecraft.nix @@ -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; diff --git a/devices/wim/default.nix b/devices/wim/default.nix index 42aa167a..d2d33e18 100644 --- a/devices/wim/default.nix +++ b/devices/wim/default.nix @@ -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"; diff --git a/devices/wim/home/dotfiles.nix b/devices/wim/home/dotfiles.nix index 85edd09f..5db1471b 100644 --- a/devices/wim/home/dotfiles.nix +++ b/devices/wim/home/dotfiles.nix @@ -1,5 +1,5 @@ {config, ...}: let - configDir = config.vars.configDir; + inherit (config.vars) configDir; symlink = config.lib.file.mkOutOfStoreSymlink; in { xdg.configFile = { diff --git a/flake.lock b/flake.lock index e18c98ecefdd256abc3be4bb8b70e893f159b3a8..bbf9021d56870a6b72ddbba3c0e309ec022df9eb 100644 GIT binary patch delta 499 zcmX|+O=}ZD06?Ke0v;4Zje-p|2mvE@=X*v7Xts$)5;v(aCMzg2J2OpewwpB{Yx)~{ zQ05PK){B}y;-R;ma_z~Vpn~}B@4-7e-8wtn`t}1|UOOdYl>{xOSWU*19VC z)f|M7yH9V66~Eq>X={HXS7Z?5EVkV^oF|g0<+Dl{{7LweMcM+Z;CS|bwUFH?Yb6Qv z2p|S}!Xjm$jS%OE;fOLo5ivkw#@!}=*ZsQObcO87`e(L%Ee8=IZqqJSI;Q?=cRGcE zUbPotZ#r2vb(RP_8|;x}-1DuJ;b^{??!}q=TE636pIm?Jc_z|INEQ)e6eR>JYm~;6 lX-FBRI*K9$EGpfi609OVx9{o0b8)_OalZ8R8)T>yRM_F_T4`Qu_+jUu zI!+J6o_CN;OCxj)```*dlf!n>(baI$ZOnZY+fjVaK7G4pFX>&oOS46W4W$Z$3XI}d zgF`4YLWd&Yp=Mx^0^?v~e`fF7UpH!tOIp2_LB!$Aj#hJ}q}@-O-Dyhz0ACEVn0-t?WTNWKk96eFrt()L8L%4ZZzV85X`v}Is)w= zsiKHuY=7K(zIYh%0Hyn*dEpE6VEqQ-r8zxyN^rza}8<#MCd^;Feigo-hjou zmzB!@w=1*d2Tr7Ps3>B_(aI2oB_WOwKm;hlI8g+U;hNdAPjx$N=IzSt=HmM-cRPb5 zL-Mcf&tv`K_;m|AlcasrPWqj_sdTI50Zeu5qR{24LR;f`uiv#_itF~x>76o!#)$$7 vI+BqR5*wn8BO#0k2%=bEA^@$BDLlNM|F^=}Ot+HBAT4a{0urFh diff --git a/flake.nix b/flake.nix index 58136de54a0fa37388152dbb103076460adb6ea4..cfac793611b09250d83b0bdb0735240408c55bb5 100644 GIT binary patch delta 18 acmexv^V?>_1{T)b#LT?V%^O*cNdf>i^#+gt diff --git a/home/alacritty.nix b/home/alacritty.nix index 1dfc3947..8d9a800c 100644 --- a/home/alacritty.nix +++ b/home/alacritty.nix @@ -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 diff --git a/home/theme.nix b/home/theme.nix index 113f6282..9b50556b 100644 --- a/home/theme.nix +++ b/home/theme.nix @@ -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 diff --git a/modules/ags/default.nix b/modules/ags/default.nix index 8e7248be..222195c3 100644 --- a/modules/ags/default.nix +++ b/modules/ags/default.nix @@ -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 diff --git a/modules/dolphin.nix b/modules/dolphin.nix index 933719e4..a5a65fad 100644 --- a/modules/dolphin.nix +++ b/modules/dolphin.nix @@ -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 diff --git a/modules/greetd/default.nix b/modules/greetd/default.nix index 40e301b2..963fa296 100644 --- a/modules/greetd/default.nix +++ b/modules/greetd/default.nix @@ -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; }; }; }; diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index 4c6a88e2..338e79df 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -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"]; }; }; diff --git a/modules/tailscale.nix b/modules/tailscale.nix index 9da372f5..66e55524 100644 --- a/modules/tailscale.nix +++ b/modules/tailscale.nix @@ -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"; diff --git a/updateSha.sh b/updateSha.sh index dbcad4e6..7a230277 100755 --- a/updateSha.sh +++ b/updateSha.sh @@ -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,20 +37,22 @@ 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 - printf "\nOld versions: \n" + file=generated-firefox-addons.nix + if [[ -f $file ]]; then + printf "\nOld versions: \n" - grep -A 1 --no-group-separator 'pname' "$file" | - awk '{ gsub(/"/, ""); gsub(/;/, ""); print $3 }' | - awk 'NR%2{printf $0" version ";next;}1' | paste -sd'\n' - + grep -A 1 --no-group-separator 'pname' "$file" | + awk '{ gsub(/"/, ""); gsub(/;/, ""); print $3 }' | + awk 'NR%2{printf $0" version ";next;}1' | paste -sd'\n' - - printf "\nNew versions: \n" - fi + 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"