Add nix package installation
This commit is contained in:
1 parent
cfca5a109a
commit
60e546e2b8
4 files changed
+65
-9
No files matched your search
@@ -4,24 +4,34 @@ packages:
|
||||
- age
|
||||
- base-devel
|
||||
- bat
|
||||
- btop
|
||||
- bitwarden-cli
|
||||
- btop
|
||||
- curl
|
||||
- dotnet-sdk
|
||||
- eza
|
||||
- fd
|
||||
- ffmpeg
|
||||
- fzf
|
||||
- git
|
||||
- imagemagick
|
||||
- jq
|
||||
- lazygit
|
||||
- npm
|
||||
- openssh
|
||||
- poppler
|
||||
- python-pip
|
||||
- resvg
|
||||
- ripgrep
|
||||
- tmux
|
||||
- wget
|
||||
- unzip
|
||||
- wget
|
||||
- yazi
|
||||
- zoxide
|
||||
- zsh
|
||||
aur:
|
||||
- nixfmt
|
||||
- prizrak-box-bin
|
||||
- python-xmlformatter
|
||||
- tree-sitter-cli-github-bin
|
||||
go:
|
||||
- github.com/davidbudnick/redis-tui
|
||||
@@ -1,9 +1,14 @@
|
||||
#!/bin/sh
|
||||
set -euo pipefail
|
||||
|
||||
# NixOS
|
||||
{{ if eq .chezmoi.osRelease.id "nixos" }}
|
||||
exit 0
|
||||
{{ end }}
|
||||
|
||||
echo "Installing native packages..."
|
||||
|
||||
# 1. Arch-based
|
||||
# Arch-based
|
||||
{{ if or (eq .chezmoi.osRelease.id "arch") (eq .chezmoi.osRelease.id "cachyos") }}
|
||||
sudo pacman -Sy --noconfirm
|
||||
|
||||
@@ -19,7 +24,6 @@ if [[ ${#pkgs[@]} -gt 0 ]]; then
|
||||
sudo pacman -S --noconfirm --needed "${pkgs[@]}"
|
||||
fi
|
||||
|
||||
# Install paru
|
||||
if command -v paru >/dev/null 2>&1; then
|
||||
echo "Paru is already installed."
|
||||
else
|
||||
@@ -32,7 +36,6 @@ else
|
||||
rm -rf "$build_dir"
|
||||
fi
|
||||
|
||||
# Install AUR pkgs
|
||||
aur_pkgs=()
|
||||
{{ range .packages.aur }}
|
||||
if ! pacman -Q "{{ . }}" &>/dev/null; then
|
||||
@@ -41,15 +44,35 @@ fi
|
||||
{{ end }}
|
||||
|
||||
if [[ ${#aur_pkgs[@]} -gt 0 ]]; then
|
||||
echo "Installing AUR packages"
|
||||
echo "Installing AUR packages..."
|
||||
paru -S --noconfirm --needed "${aur_pkgs[@]}"
|
||||
fi
|
||||
{{ end }}
|
||||
|
||||
# 2. NixOS
|
||||
{{ if eq .chezmoi.osRelease.id "nixos" }}
|
||||
exit 0
|
||||
# Go packages
|
||||
go_pkgs=()
|
||||
{{ range .packages.go }}
|
||||
go_pkgs+=("{{ . }}")
|
||||
{{ end }}
|
||||
|
||||
if ! command -v go >/dev/null 2>&1; then
|
||||
echo "Go is not installed, skipping packages installation..."
|
||||
else
|
||||
for pkg in "${go_pkgs[@]}"; do
|
||||
echo "Installing: $pkg"
|
||||
go install "${pkg}@latest"
|
||||
done
|
||||
fi
|
||||
|
||||
# Nix packages
|
||||
if ! command -v nix >/dev/null 2>&1; then
|
||||
echo "Nix is not installed, skipping packages installation..."
|
||||
else
|
||||
FLAKE_DIR="$HOME/.config/nixpkgs"
|
||||
if [ -d "$FLAKE_DIR" ] && [ -f "$FLAKE_DIR/flake.nix" ]; then
|
||||
echo "Installing Nix packages..."
|
||||
nix profile install "$FLAKE_DIR" || true
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Done"
|
||||
@@ -0,0 +1 @@
|
||||
experimental-features = nix-command flakes
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
description = "Nix packages";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in {
|
||||
packages.${system}.default = pkgs.buildEnv {
|
||||
name = "user-packages";
|
||||
paths = with pkgs; [
|
||||
nixd
|
||||
nixfmt
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user