refactor: get rid of vars and move common to modules

This commit is contained in:
matt1432 2024-11-22 23:15:13 -05:00
parent e8fff0bbd3
commit c43560ff95
35 changed files with 411 additions and 427 deletions
nixosModules/base/common-nix

View file

@ -0,0 +1,31 @@
self: {
config,
lib,
...
}: let
inherit (lib) hasAttr mkIf optionalString;
inherit (self.inputs) nixpkgs;
inherit (config.sops.secrets) access-token;
cfg = config.roles.base;
in {
config = mkIf cfg.enable {
# Minimize dowloads of indirect nixpkgs flakes
nix = {
registry.nixpkgs.flake = nixpkgs;
nixPath = ["nixpkgs=${nixpkgs}"];
extraOptions =
optionalString (hasAttr "sops" config)
"!include ${access-token.path}";
};
# Global hm settings
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
};
# For accurate stack trace
_file = ./default.nix;
}