This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/bash/module/Nix.sh

35 lines
688 B
Bash
Raw Normal View History

2024-01-24 17:05:52 +03:00
# Find Nix package path.
2024-01-24 18:49:45 +03:00
# Usage: nix_find <PACKAGE>
function nix_find() {
2024-01-24 17:05:52 +03:00
local IFS=$'\n'
local package="${1}"
if [[ "${package}" = "" ]]; then
help find_nix
return 2
fi
local found=$(ls --classify /nix/store/ | grep "${package}".*/)
if [[ "${found}" != "" ]]; then
echo "/nix/store/${found%/}"
else
false
fi
}
2024-01-24 18:56:14 +03:00
# Switch to Unstable branch.
function nix_unstable() {
nix-channel --add https://nixos.org/channels/nixos-unstable nixos
}
# Switch to Small Unstable branch (for server).
function nix_unstable_small() {
nix-channel --add https://nixos.org/channels/nixos-unstable-small nixos
}
# Update system.
function nix_update() {
nixos-rebuild switch --upgrade
}