Configured nix-darwin to write shell configuration to .local variants (/etc/bash.local, /etc/zshrc.local, /etc/zshenv.local) instead of managing the main shell files. This allows Salt (corporate laptop management) to manage /etc/bashrc, /etc/zshrc, and /etc/zshenv while nix-darwin provides the Nix environment setup through the .local files that Salt already sources.
84 lines
2.1 KiB
Nix
84 lines
2.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
# Extract the set-environment path that nix-darwin generates
|
|
setEnvironmentPath = "${config.system.build.setEnvironment}";
|
|
in
|
|
{
|
|
config = {
|
|
# Salt manages /etc/bashrc, /etc/zshrc, /etc/zshenv
|
|
# nix-darwin writes to .local variants for nix-specific configuration
|
|
|
|
# Disable nix-darwin from managing the main shell files
|
|
environment.etc."bashrc".enable = false;
|
|
environment.etc."zshrc".enable = false;
|
|
environment.etc."zshenv".enable = false;
|
|
|
|
# Create .local files with nix environment setup
|
|
environment.etc."bash.local".text = ''
|
|
# Nix environment setup
|
|
if [ -z "$__NIX_DARWIN_SET_ENVIRONMENT_DONE" ]; then
|
|
. ${setEnvironmentPath}
|
|
fi
|
|
'';
|
|
|
|
environment.etc."zshrc.local".text = ''
|
|
# Nix environment setup (already done in zshenv.local)
|
|
'';
|
|
|
|
environment.etc."zshenv.local".text = ''
|
|
# Nix environment setup
|
|
if [[ -o rcs ]]; then
|
|
if [ -z "''${__NIX_DARWIN_SET_ENVIRONMENT_DONE-}" ]; then
|
|
. ${setEnvironmentPath}
|
|
fi
|
|
|
|
# Tell zsh how to find installed completions
|
|
for p in ''${(z)NIX_PROFILES}; do
|
|
fpath=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions $fpath)
|
|
done
|
|
fi
|
|
'';
|
|
|
|
time.timeZone = "America/Los_Angeles";
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
glances
|
|
pciutils
|
|
tree
|
|
usbutils
|
|
vim
|
|
];
|
|
|
|
nix = {
|
|
package = pkgs.nix;
|
|
# distributedBuilds = true;
|
|
# buildMachines = [{
|
|
# hostName = "z790prors.oglehome";
|
|
# system = "x86_64-linux";
|
|
# protocol = "ssh-ng";
|
|
# sshUser = "johno";
|
|
# sshKey = "/root/.ssh/id_ed25519";
|
|
# maxJobs = 3;
|
|
# speedFactor = 2;
|
|
# }];
|
|
settings = {
|
|
experimental-features = [ "nix-command" "flakes" ];
|
|
max-jobs = "auto";
|
|
trusted-users = [ "johno" ];
|
|
substituters = [
|
|
];
|
|
};
|
|
|
|
gc = {
|
|
automatic = true;
|
|
options = "--delete-older-than 10d";
|
|
};
|
|
};
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
};
|
|
} |