1
0
Fork 0
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:
Daiderd Jordan 2016-12-01 21:34:37 +01:00
parent 5f7381fb7b
commit d82c472ab0
No known key found for this signature in database
GPG key ID: D02435D05B810C96
3 changed files with 47 additions and 11 deletions

View file

@ -9,6 +9,7 @@ let
[ config
./modules/system
./modules/system/activation-scripts.nix
./modules/system/defaults
./modules/system/etc.nix
./modules/environment
./modules/launchd
@ -38,15 +39,18 @@ let
{ serviceConfig.Program = "${pkgs.nix}/bin/nix-daemon";
serviceConfig.KeepAlive = 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.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.enableSensible = true;
programs.tmux.enableMouse = true;
@ -228,12 +232,6 @@ in {
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
cnoremap %% <C-r>=expand('%:h') . '/'<CR>

View file

@ -54,6 +54,7 @@ in
# Prevent the current configuration from being garbage-collected.
ln -sfn /run/current-system /nix/var/nix/gcroots/current-system
${cfg.activationScripts.defaults.text}
${cfg.activationScripts.etc.text}
${cfg.activationScripts.launchd.text}

View 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}
'';
};
}