This commit is contained in:
2026-02-28 14:31:09 +00:00
parent e5a935ca79
commit 9cd1adf12d
2 changed files with 55 additions and 92 deletions

145
flake.nix
View File

@@ -99,37 +99,37 @@
]; ];
}; };
systemPackages = with pkgs; [ systemPackages = with pkgs; [
#bat bat
#highlight #highlight
#btop btop
#eza eza
#fzf fzf
#git git
#gnumake #gnumake
#neofetch #neofetch
#neovim neovim
#ripgrep ripgrep
#tldr tldr
#unzip unzip
#openssl openssl
#wget wget
#zip zip
#zoxide zoxide
#jq jq
#lazygit lazygit
#lazysql #sqlit
#less less
#mlocate mlocate
#tree tree
#tmux tmux
#tmuxinator tmuxinator
#wget wget
#zenity zenity
#gum gum
#yazi yazi
#rsync rsync
#p7zip p7zip
#impala impala
]; ];
}; };
networking = { networking = {
@@ -152,39 +152,6 @@
}; };
system.stateVersion = "25.11"; system.stateVersion = "25.11";
environment.systemPackages = with pkgs; [
bat
#highlight
btop
eza
fzf
git
#gnumake
#neofetch
neovim
ripgrep
tldr
unzip
openssl
wget
zip
zoxide
jq
lazygit
#sqlit
less
mlocate
tree
tmux
tmuxinator
wget
zenity
gum
yazi
rsync
p7zip
impala
];
home-manager = { home-manager = {
users.chris = { pkgs, lib, ... }: { users.chris = { pkgs, lib, ... }: {
home = { home = {
@@ -203,45 +170,41 @@
activation.setupDotfiles = lib.hm.dag.entryAfter ["writeBoundary"] '' activation.setupDotfiles = lib.hm.dag.entryAfter ["writeBoundary"] ''
if [[ -v DRY_RUN ]]; then if [[ -v DRY_RUN ]]; then
echo "Dry run: Would bootstrap dotfiles from labs.scarif.space" echo "Dry run: Would bootstrap dotfiles from labs.scarif.space"
exit
fi fi
DOTFILES_DIR="$HOME/.config/dotfiles" DOTFILES_DIR="$HOME/.config/dotfiles"
if [ -d "$DOTFILES_DIR/.git" ]; then if [ -d "$DOTFILES_DIR/.git" ]; then
# Restore tracked files from the local metadata SOURCE="$DOTFILES_DIR/.git"
${pkgs.git}/bin/git --git-dir="$DOTFILES_DIR/.git" --work-tree="$HOME" checkout -f
${pkgs.git}/bin/git submodule update --init --recursive
else else
echo "Dotfiles not found. Running bootstrap script..." SOURCE="https://labs.scarif.space/chris/dotfiles.git"
# Setup a temporary workspace
TEMP_DIR=$(mktemp -d)
# Clone the repo (using the public URL for the initial pull)
${pkgs.git}/bin/git clone -b main https://labs.scarif.space/chris/dotfiles.git "$TEMP_DIR"
# Copy files to HOME
${pkgs.coreutils}/bin/cp -rfT "$TEMP_DIR" "$HOME"
# Initialize the separate git directory # Initialize the separate git directory
${pkgs.coreutils}/bin/mkdir -p "$DOTFILES_DIR" if [ ! -d "$DOTFILES_DIR" ]; then
cd "$HOME" ${pkgs.coreutils}/bin/mkdir -p "$DOTFILES_DIR"
${pkgs.git}/bin/git init --separate-git-dir "$DOTFILES_DIR/.git" "$HOME" fi
fi
# Update submodules TEMP_DIR=$(mktemp -d)
${pkgs.git}/bin/git submodule set-url ".config/nvim" https://labs.scarif.space/chris/nvim.git
${pkgs.git}/bin/git submodule update --init
# Set URLs back to SSH ${pkgs.git}/bin/git clone -b main "$SOURCE" "$TEMP_DIR"
${pkgs.git}/bin/git submodule set-url ".config/nvim" git@labs.scarif.space:chris/nvim.git
${pkgs.git}/bin/git remote set-url origin git@labs.scarif.space:chris/dotfiles.git
# Clean up ${pkgs.coreutils}/bin/cp -rfT "$TEMP_DIR" "$HOME"
${pkgs.coreutils}/bin/rm -rf "$TEMP_DIR" cd "$HOME"
${pkgs.coreutils}/bin/rm -f "$HOME/.git" ${pkgs.git}/bin/git init --separate-git-dir "$DOTFILES_DIR/.git" "$HOME"
echo "Dotfiles bootstrapped successfully." ${pkgs.git}/bin/git submodule set-url ".config/nvim" https://labs.scarif.space/chris/nvim.git
fi ${pkgs.git}/bin/git submodule update --init
${pkgs.git}/bin/git submodule set-url ".config/nvim" git@labs.scarif.space:chris/nvim.git
${pkgs.git}/bin/git remote set-url origin git@labs.scarif.space:chris/dotfiles.git
# Clean up
${pkgs.coreutils}/bin/rm -rf "$TEMP_DIR"
${pkgs.coreutils}/bin/rm -f "$HOME/.git"
echo "Dotfiles bootstrapped successfully."
''; '';
packages = with pkgs; [ packages = with pkgs; [
# jetbrains.rider # jetbrains.rider

View File

@@ -19,7 +19,7 @@
boot.initrd.postDeviceCommands = lib.mkAfter '' boot.initrd.postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp mkdir /btrfs_tmp
mount /dev/disk/by-label/disk-stationette-root /btrfs_tmp mount /dev/disk/by-partlabel/disk-stationette-root /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots mkdir -p /btrfs_tmp/old_roots
timestamp=$(dat +%Y-%m-%d_%H-%M-%S) timestamp=$(dat +%Y-%m-%d_%H-%M-%S)