diff --git a/common/home/bash/default.nix b/common/home/bash/default.nix index 3624b7ff..33880c4b 100644 --- a/common/home/bash/default.nix +++ b/common/home/bash/default.nix @@ -1,15 +1,17 @@ -{lib, ...}: { +{lib, ...}: let + inherit (lib) fileContents; + + # TODO: have different colors depending on host + textColor = "#e3e5e5"; + firstColor = "#bd93f9"; + secondColor = "#715895"; + thirdColor = "#382c4a"; + fourthColor = "#120e18"; +in { imports = [./programs.nix]; programs = { - starship = let - # TODO: have different colors depending on host - textColor = "#e3e5e5"; - firstColor = "#bd93f9"; - secondColor = "#715895"; - thirdColor = "#382c4a"; - fourthColor = "#120e18"; - in { + starship = { enable = true; enableBashIntegration = true; settings = { @@ -143,11 +145,11 @@ # Check if shell is interactive [[ $- == *i* ]] || return 0 - ${lib.strings.fileContents ./config/dracula/less.sh} - ${lib.strings.fileContents ./config/dracula/fzf.sh} + ${fileContents ./config/dracula/less.sh} + ${fileContents ./config/dracula/fzf.sh} - ${lib.strings.fileContents ./config/colorgrid.sh} - ${lib.strings.fileContents ./config/bashrc} + ${fileContents ./config/colorgrid.sh} + ${fileContents ./config/bashrc} ''; #initExtra = '' #''; diff --git a/common/home/default.nix b/common/home/default.nix index b1921af3..978cfb12 100644 --- a/common/home/default.nix +++ b/common/home/default.nix @@ -1,4 +1,4 @@ -{ +{...}: { imports = [ ./bash ./git diff --git a/common/home/neovim/default.nix b/common/home/neovim/default.nix index a6bd1cde..4495fe03 100644 --- a/common/home/neovim/default.nix +++ b/common/home/neovim/default.nix @@ -5,9 +5,9 @@ coc-stylelintplus-flake, tree-sitter-hyprlang-flake, ... -}: -with lib; let +}: let inherit (config.vars) neovimIde; + inherit (lib) fileContents optionalAttrs optionals; javaSdk = pkgs.temurin-bin-17; nvim-treesitter-hyprlang = tree-sitter-hyprlang-flake.packages.${pkgs.system}.default; diff --git a/common/modules/default.nix b/common/modules/default.nix index 54497dc5..47f6f85e 100644 --- a/common/modules/default.nix +++ b/common/modules/default.nix @@ -1,4 +1,4 @@ -{ +{...}: { imports = [ ./cachix.nix ./locale.nix diff --git a/common/modules/global.nix b/common/modules/global.nix index 822b7218..e736b519 100644 --- a/common/modules/global.nix +++ b/common/modules/global.nix @@ -3,18 +3,18 @@ lib, nixpkgs, ... -}: -with lib; let +}: let inherit (config.sops.secrets) access-token; + inherit (lib) hasAttr optionalString; in { # Minimize dowloads of indirect nixpkgs flakes nix = { registry.nixpkgs.flake = nixpkgs; nixPath = ["nixpkgs=${nixpkgs}"]; + extraOptions = - if (hasAttr "sops" config) - then "!include ${access-token.path}" - else ""; + optionalString (hasAttr "sops" config) + "!include ${access-token.path}"; }; # Global hm settings diff --git a/common/pkgs/default.nix b/common/pkgs/default.nix index d17acb4b..d37e05b8 100644 --- a/common/pkgs/default.nix +++ b/common/pkgs/default.nix @@ -3,7 +3,9 @@ pkgs, ... } @ inputs: -with lib; let +let + inherit (lib) concatMapAttrs filterAttrs mkOption pathExists types; + mkPackage = name: v: { ${name} = pkgs.callPackage ./${name} inputs; }; diff --git a/common/vars.nix b/common/vars.nix index 3b602025..b4eb3afd 100644 --- a/common/vars.nix +++ b/common/vars.nix @@ -3,8 +3,9 @@ lib, ... }: { - options.vars = with lib; let - inherit (config.vars) mainUser hostName; + options.vars = let + inherit (lib) mkOption types; + cfg = config.vars; in { mainUser = mkOption { type = types.str; @@ -22,7 +23,7 @@ configDir = mkOption { type = types.str; - default = "/home/${mainUser}/.nix/devices/${hostName}/config"; + default = "/home/${cfg.mainUser}/.nix/devices/${cfg.hostName}/config"; description = '' The path to where most of the devices' configs are in the .nix folder ''; diff --git a/devices/oksys/default.nix b/devices/oksys/default.nix index 5bd8833a..6ceaf699 100644 --- a/devices/oksys/default.nix +++ b/devices/oksys/default.nix @@ -1,5 +1,12 @@ {config, ...}: let inherit (config.vars) mainUser hostName; + tailscaleNameservers = + config + .services + .headscale + .settings + .dns_config + .nameservers; in { imports = [ ./hardware-configuration.nix @@ -37,7 +44,7 @@ in { networking = { inherit hostName; resolvconf.enable = true; - nameservers = config.services.headscale.settings.dns_config.nameservers ++ ["1.0.0.1"]; + nameservers = tailscaleNameservers ++ ["1.0.0.1"]; firewall.enable = false; }; diff --git a/devices/oksys/modules/headscale/default.nix b/devices/oksys/modules/headscale/default.nix index e564f26a..eb474565 100644 --- a/devices/oksys/modules/headscale/default.nix +++ b/devices/oksys/modules/headscale/default.nix @@ -5,6 +5,7 @@ pkgs, ... }: let + inherit (builtins) readFile; inherit (config.vars) mainUser; headscale-flake = headscale.packages.${pkgs.system}.headscale; in { @@ -12,7 +13,7 @@ in { users.users.${mainUser}.extraGroups = ["headscale"]; home-manager.users.${mainUser} - .programs.bash.bashrcExtra = lib.mkAfter (builtins.readFile ./completion.bash); + .programs.bash.bashrcExtra = lib.mkAfter (readFile ./completion.bash); services.headscale = { enable = true; diff --git a/devices/oksys/modules/remote-builder.nix b/devices/oksys/modules/remote-builder.nix index be7b0e51..4e810129 100644 --- a/devices/oksys/modules/remote-builder.nix +++ b/devices/oksys/modules/remote-builder.nix @@ -13,7 +13,8 @@ in { IdentitiesOnly yes IdentityFile ${config.sops.secrets.nixremote.path} - # The weakly privileged user on the remote builder – if not set, 'root' is used – which will hopefully fail + # The weakly privileged user on the remote builder – if not set, + # 'root' is used – which will hopefully fail User nixremote ''; }; diff --git a/devices/servivi/modules/arion/default.nix b/devices/servivi/modules/arion/default.nix index 9511ec5e..4cc3657d 100644 --- a/devices/servivi/modules/arion/default.nix +++ b/devices/servivi/modules/arion/default.nix @@ -5,10 +5,24 @@ pkgs, self, ... -} @ inputs: -with lib; -with builtins; let +} @ inputs: let + inherit + (lib) + filter + hasSuffix + filesystem + hasAttr + mapAttrs + filterAttrs + listToAttrs + elemAt + match + removePrefix + optionalAttrs + mkForce + ; inherit (config.vars) mainUser hostName; + configPath = "/var/lib/arion"; in { imports = [arion.nixosModules.arion]; diff --git a/devices/servivi/modules/borgbackup.nix b/devices/servivi/modules/borgbackup.nix index 85f86070..47a6162b 100644 --- a/devices/servivi/modules/borgbackup.nix +++ b/devices/servivi/modules/borgbackup.nix @@ -3,8 +3,9 @@ lib, pkgs, ... -}: -with lib; let +}: let + inherit (lib) filterAttrs mapAttrs mkDefault mkOption types; + cfg = config.services.borgbackup; secrets = config.sops.secrets; in { diff --git a/home/firefox/default.nix b/home/firefox/default.nix index 7100494a..d8a6a6bc 100644 --- a/home/firefox/default.nix +++ b/home/firefox/default.nix @@ -3,6 +3,7 @@ pkgs, ... }: let + inherit (builtins) readFile; firefox-addons = pkgs.recurseIntoAttrs (pkgs.callPackage ./addons {}); sound-volume = firefox-addons."600-sound-volume"; @@ -22,10 +23,10 @@ in { id = 0; userChrome = '' - ${builtins.readFile "${firefox-gx}/chrome/userChrome.css"} - ${builtins.readFile ./custom.css} + ${readFile "${firefox-gx}/chrome/userChrome.css"} + ${readFile ./custom.css} ''; - extraConfig = builtins.readFile "${firefox-gx}/user.js"; + extraConfig = readFile "${firefox-gx}/user.js"; settings = { # Theme @@ -123,7 +124,7 @@ in { "Noogle" = { urls = [ { - template = "https://noogle.dev/?term={searchTerms}"; + template = "https://noogle.dev/q?term={searchTerms}"; } ]; iconUpdateURL = "https://noogle.dev/favicon.ico"; diff --git a/home/wofi/default.nix b/home/wofi/default.nix index 18657850..03838d16 100644 --- a/home/wofi/default.nix +++ b/home/wofi/default.nix @@ -1,13 +1,7 @@ -{ - nixpkgs, - pkgs, - ... -}: { +{...}: { programs = { wofi = { enable = true; - # FIXME: remove when overlay gets fixed - package = pkgs.callPackage "${nixpkgs}/pkgs/applications/misc/wofi/default.nix" {}; settings = { prompt = ""; allow_images = true; diff --git a/modules/greetd/default.nix b/modules/greetd/default.nix index 963fa296..8b80bfc1 100644 --- a/modules/greetd/default.nix +++ b/modules/greetd/default.nix @@ -3,8 +3,8 @@ pkgs, config, ... -}: -with lib; let +}: let + inherit (lib) getExe optionals readFile; inherit (config.vars) mainUser greetdDupe mainMonitor; # Nix stuff diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index c6cb766d..6971f924 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -5,10 +5,10 @@ pkgs, lib, ... -}: -with lib; let - # Config stuff +}: let + inherit (lib) concatStringsSep optionals; inherit (config.vars) configDir mainUser mainMonitor; + isNvidia = config.hardware.nvidia.modesetting.enable; isTouchscreen = config.hardware.sensor.iio.enable; in {