flake.nix: update default host config

This commit is contained in:
Gabriel Arazas 2022-09-19 10:55:31 +08:00
parent 976b85e198
commit beec619819

View File

@ -128,6 +128,9 @@
# The default configuration for our NixOS systems. # The default configuration for our NixOS systems.
hostDefaultConfig = { lib, pkgs, system, ... }: { hostDefaultConfig = { lib, pkgs, system, ... }: {
# Some defaults for evaluating modules.
_module.check = true;
# Only use imports as minimally as possible with the absolute # Only use imports as minimally as possible with the absolute
# requirements of a host. On second thought, only on flakes with # requirements of a host. On second thought, only on flakes with
# optional NixOS modules. # optional NixOS modules.
@ -139,7 +142,7 @@
inputs.guix-overlay.nixosModules.guix inputs.guix-overlay.nixosModules.guix
]; ];
environment.extraOutputsToInstall = [ "doc" "devdoc" "info" ]; environment.extraOutputsToInstall = lib.mkDefault [ "doc" "devdoc" "info" ];
# Bleeding edge, baybee! # Bleeding edge, baybee!
nix.package = lib.mkDefault pkgs.nixUnstable; nix.package = lib.mkDefault pkgs.nixUnstable;
@ -203,34 +206,34 @@
++ [ inputs.nix-alien.overlay inputs.guix-overlay.overlays.default ]; ++ [ inputs.nix-alien.overlay inputs.guix-overlay.overlays.default ];
# Please clean your temporary crap. # Please clean your temporary crap.
boot.cleanTmpDir = true; boot.cleanTmpDir = lib.mkDefault true;
# We live in a Unicode world and dominantly English in technical fields so we'll # We live in a Unicode world and dominantly English in technical fields so we'll
# have to go with it. # have to go with it.
i18n.defaultLocale = lib.mkDefault "en_US.UTF-8"; i18n.defaultLocale = lib.mkDefault "en_US.UTF-8";
# The global configuration for the home-manager module. # The global configuration for the home-manager module.
home-manager.useUserPackages = true; home-manager.useUserPackages = lib.mkDefault true;
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = lib.mkDefault true;
home-manager.sharedModules = home-manager.sharedModules =
lib.modulesToList (lib.filesToAttr ./modules/home-manager) lib.modulesToList (lib.filesToAttr ./modules/home-manager)
++ [ userDefaultConfig ]; ++ [ userDefaultConfig ];
home-manager.extraSpecialArgs = extraArgs; home-manager.extraSpecialArgs = extraArgs;
# Enabling some things for sops. # Enabling some things for sops.
programs.gnupg.agent = { programs.gnupg.agent = lib.mkDefault {
enable = true; enable = true;
enableSSHSupport = true; enableSSHSupport = true;
}; };
services.sshd.enable = true; services.sshd.enable = lib.mkDefault true;
services.openssh.enable = true; services.openssh.enable = lib.mkDefault true;
}; };
mkUser = { system ? defaultSystem, extraModules ? [ ] }: mkUser = { system ? defaultSystem, extraModules ? [ ] }:
inputs.home-manager.lib.homeManagerConfiguration { inputs.home-manager.lib.homeManagerConfiguration {
extraSpecialArgs = extraArgs; extraSpecialArgs = extraArgs;
lib = lib'; lib = lib';
pkgs = nixpkgs.legacyPackages.${builtins.currentSystem}; pkgs = import nixpkgs { inherit system overlays; };
modules = modules =
# Importing our custom home-manager modules. # Importing our custom home-manager modules.
(lib'.modulesToList (lib'.filesToAttr ./modules/home-manager)) (lib'.modulesToList (lib'.filesToAttr ./modules/home-manager))
@ -249,6 +252,16 @@
# the hell. For other users, they would have to do set these manually. # the hell. For other users, they would have to do set these manually.
xdg.userDirs = xdg.userDirs =
let let
# The home directory-related options should be already taken care
# of at this point. It is an ABSOLUTE MUST that it is set properly
# since other parts of the home-manager config relies on it being
# set properly.
#
# Here are some of the common cases for setting the home directory options.
#
# * For exporting home-manager configurations, this is done in this flake definition.
# * For NixOS configs, this is set in `mapHomeManagerUser` from the private library.
# * Otherwise, you'll have to manually set them.
appendToHomeDir = path: "${config.home.homeDirectory}/${path}"; appendToHomeDir = path: "${config.home.homeDirectory}/${path}";
in in
{ {