mirror of
https://github.com/gburd/nix-config.git
synced 2024-11-20 10:36:25 +00:00
78 lines
2.6 KiB
Nix
78 lines
2.6 KiB
Nix
{ config, desktop, hostname, inputs, lib, outputs, pkgs, stateVersion, username, ... }:
|
|
let
|
|
inherit (pkgs.stdenv) isDarwin;
|
|
in
|
|
{
|
|
# Only import desktop configuration if the host is desktop enabled
|
|
# Only import user specific configuration if they have bespoke settings
|
|
imports = [
|
|
# If you want to use modules your own flake exports (from modules/home-manager):
|
|
outputs.homeManagerModules.pass-secret-service
|
|
|
|
# Or modules exported from other flakes (such as nix-colors):
|
|
# inputs.nix-colors.homeManagerModules.default
|
|
|
|
# You can also split up your configuration and import pieces of it here:
|
|
./_mixins/console
|
|
]
|
|
++ lib.optional (builtins.isPath (./. + "/_mixins/users/${username}")) ./_mixins/users/${username}
|
|
++ lib.optional (builtins.pathExists (./. + "/_mixins/users/${username}/hosts/${hostname}.nix")) ./_mixins/users/${username}/hosts/${hostname}.nix
|
|
++ lib.optional (desktop != null) ./_mixins/desktop;
|
|
|
|
home = {
|
|
activation.report-changes = config.lib.dag.entryAnywhere ''
|
|
${pkgs.nvd}/bin/nvd diff $oldGenPath $newGenPath
|
|
'';
|
|
homeDirectory = if isDarwin then "/Users/${username}" else "/home/${username}";
|
|
sessionPath = [ "$HOME/.local/bin" ];
|
|
sessionVariables = {
|
|
FLAKE = "$HOME/ws/nix-config";
|
|
};
|
|
inherit stateVersion;
|
|
inherit username;
|
|
};
|
|
|
|
nixpkgs = {
|
|
# You can add overlays here
|
|
overlays = [
|
|
# Add overlays your own flake exports (from overlays and pkgs dir):
|
|
outputs.overlays.additions
|
|
outputs.overlays.modifications
|
|
outputs.overlays.unstable-packages
|
|
|
|
# You can also add overlays exported from other flakes:
|
|
inputs.agenix.overlays.default
|
|
|
|
# Or define it inline, for example:
|
|
# (final: prev: {
|
|
# hi = final.hello.overrideAttrs (oldAttrs: {
|
|
# patches = [ ./change-hello-to-hi.patch ];
|
|
# });
|
|
# })
|
|
];
|
|
# Configure your nixpkgs instance
|
|
config = {
|
|
# Disable if you don't want unfree packages
|
|
allowUnfree = true;
|
|
# Workaround for https://github.com/nix-community/home-manager/issues/2942
|
|
allowUnfreePredicate = _: true;
|
|
};
|
|
};
|
|
|
|
nix = {
|
|
# This will add each flake input as a registry
|
|
# To make nix3 commands consistent with your flake
|
|
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
|
|
|
|
package = pkgs.unstable.nix;
|
|
settings = {
|
|
auto-optimise-store = true;
|
|
experimental-features = [ "nix-command" "flakes" ];
|
|
# Avoid unwanted garbage collection when using nix-direnv
|
|
keep-outputs = true;
|
|
keep-derivations = true;
|
|
warn-dirty = false;
|
|
};
|
|
};
|
|
}
|
|
|