summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2019-06-05 21:05:53 +0200
committerAlan Pearce2019-06-05 21:05:53 +0200
commitaf54fb9ff51211ef2b17b642cfa96efa10445fde (patch)
tree7473f9159222e029fe53a2ec2dc20d4a25a1f0f7
parent7e6f5a6d6f329c890a4259b03dbeded189580003 (diff)
downloadnixos-configuration-af54fb9ff51211ef2b17b642cfa96efa10445fde.tar.xz
nixos-configuration-af54fb9ff51211ef2b17b642cfa96efa10445fde.zip
trillian: Enable completion for nix-darwin commands
-rw-r--r--trillian.nix35
1 files changed, 34 insertions, 1 deletions
diff --git a/trillian.nix b/trillian.nix index 1ffb8c7..86dc4c4 100644 --- a/trillian.nix +++ b/trillian.nix
@@ -47,6 +47,7 @@ in
47 emacsPackage 47 emacsPackage
48 aspell 48 aspell
49 aspellDicts.en 49 aspellDicts.en
50 darwin-zsh-completions
50 ]; 51 ];
51 52
52 # Use a custom configuration.nix location. 53 # Use a custom configuration.nix location.
@@ -85,7 +86,7 @@ in
85 # KeepAlive = true; 86 # KeepAlive = true;
86 # }; 87 # };
87 # }; 88 # };
88 # 89 #
89 nix.gc = { 90 nix.gc = {
90 automatic = true; 91 automatic = true;
91 options = "--max-freed $((25 * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | awk '{ print $4 }')))"; 92 options = "--max-freed $((25 * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | awk '{ print $4 }')))";
@@ -93,6 +94,38 @@ in
93 nix.daemonNiceLevel = 10; 94 nix.daemonNiceLevel = 10;
94 nix.daemonIONice = true; 95 nix.daemonIONice = true;
95 96
97 nixpkgs.overlays = [
98 (self: super: {
99 darwin-zsh-completions = super.runCommandNoCC "darwin-zsh-completions-0.0.0"
100 { preferLocalBuild = true; }
101 ''
102 mkdir -p $out/share/zsh/site-functions
103 cat <<-'EOF' > $out/share/zsh/site-functions/_darwin-rebuild
104 #compdef darwin-rebuild
105 #autoload
106 _nix-common-options
107 local -a _1st_arguments
108 _1st_arguments=(
109 'switch:Build, activate, and update the current generation'\
110 'build:Build without activating or updating the current generation'\
111 'check:Build and run the activation sanity checks'\
112 'changelog:Show most recent entries in the changelog'\
113 )
114 _arguments \
115 '--list-generations[Print a list of all generations in the active profile]'\
116 '--rollback[Roll back to the previous configuration]'\
117 {--switch-generation,-G}'[Activate specified generation]'\
118 '(--profile-name -p)'{--profile-name,-p}'[Profile to use to track current and previous system configurations]:Profile:_nix_profiles'\
119 '1:: :->subcmds' && return 0
120 case $state in
121 subcmds)
122 _describe -t commands 'darwin-rebuild subcommands' _1st_arguments
123 ;;
124 esac
125 EOF
126 '';
127 })
128 ];
96 # Used for backwards compatibility, please read the changelog before changing. 129 # Used for backwards compatibility, please read the changelog before changing.
97 # $ darwin-rebuild changelog 130 # $ darwin-rebuild changelog
98 system.stateVersion = 3; 131 system.stateVersion = 3;