Create static build of mac-portable config

This commit is contained in:
2026-05-14 14:32:22 +00:00
parent 6e1631d77b
commit 75ccb8678f
8 changed files with 27 additions and 8 deletions

View File

@@ -10,11 +10,11 @@ git clone git@github.com:dotdoom/dotfiles.git
cd dotfiles cd dotfiles
``` ```
Step 2 - stow. Step 2 - if Nix is not an option.
``` ```
stow migrated
stow legacy stow legacy
stow exported/{machine}
``` ```
Step 2 - Nix. Step 2 - Nix.

7
bin/export-home-config Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
set -e
CONFIG=$1
OUT_DIR="exported/$CONFIG"
STORE_PATH=$(nix build .#homeConfigurations."$CONFIG".activationPackage --extra-experimental-features 'nix-command flakes' --no-link --print-out-paths)
mkdir -p "$OUT_DIR"
cp -rL "$STORE_PATH/home-files/." "$OUT_DIR/"

View File

@@ -53,6 +53,12 @@
pre-commit-check = inputs.git-hooks.lib.${system}.run ( pre-commit-check = inputs.git-hooks.lib.${system}.run (
{ {
src = ./.; src = ./.;
hooks.export-mac-portable = {
enable = nixpkgs.lib.hasInfix "darwin" system;
name = "Build static mac-portable home directory files";
entry = "bin/export-home-config mac-portable && git add exported/mac-portable";
pass_filenames = false;
};
} }
// inputs.fw_nix.lib.pre-commit // inputs.fw_nix.lib.pre-commit
); );
@@ -92,6 +98,12 @@
]; ];
}; };
homeConfigurations.mac-portable = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-darwin;
extraSpecialArgs.primaryUser = "empty";
modules = [ self.homeModules.mac-portable ];
};
darwinConfigurations.mars = darwin.lib.darwinSystem { darwinConfigurations.mars = darwin.lib.darwinSystem {
system = "x86_64-darwin"; system = "x86_64-darwin";
specialArgs.primaryUser = "artem"; specialArgs.primaryUser = "artem";

View File

@@ -1,7 +1,6 @@
{ {
pkgs, pkgs,
lib, lib,
config,
trustedSSHKeys, trustedSSHKeys,
... ...
}: }:
@@ -20,7 +19,7 @@
home.activation.setupAuthorizedKeys = lib.hm.dag.entryAfter [ "writeBoundary" ] '' home.activation.setupAuthorizedKeys = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
run install -m 0600 -D \ run install -m 0600 -D \
${pkgs.writeText "keys" (builtins.concatStringsSep "\n" trustedSSHKeys)} \ ${pkgs.writeText "keys" (builtins.concatStringsSep "\n" trustedSSHKeys)} \
${config.home.homeDirectory}/.ssh/ephemeral_sshd/authorized_keys ''${HOME?}/.ssh/ephemeral_sshd/authorized_keys
''; '';
# TODO: consider # TODO: consider

View File

@@ -30,7 +30,7 @@
if [ -r ~/dotfiles/migrated/.zshrc ]; then if [ -r ~/dotfiles/migrated/.zshrc ]; then
# Hack for faster iterations # Hack for faster iterations
. ~/dotfiles/migrated/.zshrc . ~/dotfiles/assets/.zshrc
else else
. ${../../migrated/.zshrc} . ${../../migrated/.zshrc}
fi fi
@@ -61,10 +61,11 @@
vim-startify vim-startify
]; ];
extraConfig = '' extraConfig = ''
if filereadable(expand("~/dotfiles/migrated/.vimrc")) if filereadable(expand("~/dotfiles/assets/.vimrc"))
source ~/dotfiles/migrated/.vimrc # Hack for faster iterations
source ~/dotfiles/assets/.vimrc
else else
source ${../../migrated/.vimrc} source ${../../assets/.vimrc}
endif endif
''; '';
}; };