mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
add initial support for system defaults
This commit is contained in:
parent
5f7381fb7b
commit
d82c472ab0
3 changed files with 47 additions and 11 deletions
20
config.nix
20
config.nix
|
@ -9,6 +9,7 @@ let
|
||||||
[ config
|
[ config
|
||||||
./modules/system
|
./modules/system
|
||||||
./modules/system/activation-scripts.nix
|
./modules/system/activation-scripts.nix
|
||||||
|
./modules/system/defaults
|
||||||
./modules/system/etc.nix
|
./modules/system/etc.nix
|
||||||
./modules/environment
|
./modules/environment
|
||||||
./modules/launchd
|
./modules/launchd
|
||||||
|
@ -38,15 +39,18 @@ let
|
||||||
{ serviceConfig.Program = "${pkgs.nix}/bin/nix-daemon";
|
{ serviceConfig.Program = "${pkgs.nix}/bin/nix-daemon";
|
||||||
serviceConfig.KeepAlive = true;
|
serviceConfig.KeepAlive = true;
|
||||||
serviceConfig.RunAtLoad = true;
|
serviceConfig.RunAtLoad = true;
|
||||||
|
serviceConfig.ProcessType = "Background";
|
||||||
|
serviceConfig.SoftResourceLimits.NumberOfFiles = 4096;
|
||||||
|
serviceConfig.EnvironmentVariables.NIX_BUILD_HOOK="/nix/var/nix/profiles/default/libexec/nix/build-remote.pl";
|
||||||
|
serviceConfig.EnvironmentVariables.NIX_CURRENT_LOAD="/nix/tmp/current-load";
|
||||||
|
serviceConfig.EnvironmentVariables.NIX_REMOTE_SYSTEMS="/etc/nix/machines";
|
||||||
serviceConfig.EnvironmentVariables.SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
serviceConfig.EnvironmentVariables.SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||||
serviceConfig.EnvironmentVariables.TMPDIR = "/nix/tmp";
|
serviceConfig.EnvironmentVariables.TMPDIR = "/nix/tmp";
|
||||||
serviceConfig.EnvironmentVariables.NIX_BUILD_HOOK="/nix/var/nix/profiles/default/libexec/nix/build-remote.pl";
|
|
||||||
serviceConfig.EnvironmentVariables.NIX_REMOTE_SYSTEMS="/etc/nix/machines";
|
|
||||||
serviceConfig.EnvironmentVariables.NIX_CURRENT_LOAD="/nix/tmp/current-load";
|
|
||||||
serviceConfig.SoftResourceLimits.NumberOfFiles = 4096;
|
|
||||||
serviceConfig.ProcessType = "Background";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
system.defaults.global.InitialKeyRepeat = 10;
|
||||||
|
system.defaults.global.KeyRepeat = 1;
|
||||||
|
|
||||||
programs.tmux.loginShell = "${pkgs.lnl.zsh}/bin/zsh -l";
|
programs.tmux.loginShell = "${pkgs.lnl.zsh}/bin/zsh -l";
|
||||||
programs.tmux.enableSensible = true;
|
programs.tmux.enableSensible = true;
|
||||||
programs.tmux.enableMouse = true;
|
programs.tmux.enableMouse = true;
|
||||||
|
@ -228,12 +232,6 @@ in {
|
||||||
|
|
||||||
set clipboard=unnamed
|
set clipboard=unnamed
|
||||||
|
|
||||||
cmap <C-g> <Esc>
|
|
||||||
imap <C-g> <Esc>
|
|
||||||
nmap <C-g> <Esc>
|
|
||||||
omap <C-g> <Esc>
|
|
||||||
vmap <C-g> <Esc>
|
|
||||||
|
|
||||||
vmap s S
|
vmap s S
|
||||||
|
|
||||||
cnoremap %% <C-r>=expand('%:h') . '/'<CR>
|
cnoremap %% <C-r>=expand('%:h') . '/'<CR>
|
||||||
|
|
|
@ -54,6 +54,7 @@ in
|
||||||
# Prevent the current configuration from being garbage-collected.
|
# Prevent the current configuration from being garbage-collected.
|
||||||
ln -sfn /run/current-system /nix/var/nix/gcroots/current-system
|
ln -sfn /run/current-system /nix/var/nix/gcroots/current-system
|
||||||
|
|
||||||
|
${cfg.activationScripts.defaults.text}
|
||||||
${cfg.activationScripts.etc.text}
|
${cfg.activationScripts.etc.text}
|
||||||
${cfg.activationScripts.launchd.text}
|
${cfg.activationScripts.launchd.text}
|
||||||
|
|
||||||
|
|
37
modules/system/defaults/default.nix
Normal file
37
modules/system/defaults/default.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.system.defaults;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
|
||||||
|
system.defaults.global.InitialKeyRepeat = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
system.defaults.global.KeyRepeat = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
system.activationScripts.defaults.text = ''
|
||||||
|
# Set defaults
|
||||||
|
echo "writing defaults..." >&2
|
||||||
|
|
||||||
|
'' + optionalString (cfg.global.InitialKeyRepeat != null) ''
|
||||||
|
defaults write -g InitialKeyRepeat -int ${toString cfg.global.InitialKeyRepeat}
|
||||||
|
'' + optionalString (cfg.global.KeyRepeat != null) ''
|
||||||
|
defaults write -g KeyRepeat -int ${toString cfg.global.KeyRepeat}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue