1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-15 17:51:01 +00:00

lnl: add completions for darwin-rebuild

This commit is contained in:
Daiderd Jordan 2018-07-08 11:33:48 +02:00
parent e7ac0cc02d
commit 2726b44842
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -43,9 +43,9 @@
pkgs.shellcheck
pkgs.silver-searcher
pkgs.khd
pkgs.kwm
pkgs.qes
pkgs.lnl-zsh-completions
];
services.khd.enable = true;
@ -368,12 +368,48 @@
"darwin=$HOME/.nix-defexpr/darwin"
"nixpkgs=$HOME/.nix-defexpr/nixpkgs"
"$HOME/.nix-defexpr/channels"
"$HOME/.nix-defexpr"
];
nixpkgs.config.allowUnfree = true;
nixpkgs.config.packageOverrides = super: let self = super.pkgs; in {
};
nixpkgs.overlays = [
(self: super: {
lnl-zsh-completions = super.runCommandNoCC "lnl-zsh-completions-0.0.0"
{ preferLocalBuild = true; }
''
mkdir -p $out/share/zsh/site-functions
cat <<-'EOF' > $out/share/zsh/site-functions/_darwin-rebuild
#compdef darwin-rebuild
#autoload
_nix-common-options
local -a _1st_arguments
_1st_arguments=(
'switch:Build, activate, and update the current generation'\
'build:Build without activating or updating the current generation'\
'check:Build and run the activation sanity checks'\
'changelog:Show most recent entries in the changelog'\
)
_arguments \
'--list-generations[Print a list of all generations in the active profile]'\
'--rollback[Roll back to the previous configuration]'\
{--switch-generation,-G}'[Activate specified generation]'\
'(--profile-name -p)'{--profile-name,-p}'[Profile to use to track current and previous system configurations]:Profile:_nix_profiles'\
'1:: :->subcmds' && return 0
case $state in
subcmds)
_describe -t commands 'darwin-rebuild subcommands' _1st_arguments
;;
esac
EOF
'';
})
];
# TODO: add module for per-user config, etc, ...
system.activationScripts.extraUserActivation.text = "ln -sfn /etc/per-user/lnl/gitconfig ~/.gitconfig";