Create static build of mac-portable config
This commit is contained in:
@@ -10,11 +10,11 @@ git clone git@github.com:dotdoom/dotfiles.git
|
||||
cd dotfiles
|
||||
```
|
||||
|
||||
Step 2 - stow.
|
||||
Step 2 - if Nix is not an option.
|
||||
|
||||
```
|
||||
stow migrated
|
||||
stow legacy
|
||||
stow exported/{machine}
|
||||
```
|
||||
|
||||
Step 2 - Nix.
|
||||
@@ -30,15 +30,12 @@ nix run \
|
||||
|
||||
## Layout
|
||||
|
||||
- `migrated`: files which are assets for home-manager, but can still be used to
|
||||
stow
|
||||
- `assets`: files which are assets for home-manager
|
||||
- `legacy`: files to be placed under `$HOME` which are still under stow
|
||||
- `hosts/*/{darwin,nixos,home}.nix`: personal machine nix configs
|
||||
- `modules/{darwin,nixos,home}/*.nix`: exported nix configs
|
||||
|
||||
TODO: rename `migrated` to `assets` and create `exported` which would be the
|
||||
exact mirror of nix-built configuration, but without nix (for machines where nix
|
||||
can not be installed). That `exported` will then be used by stow.
|
||||
- `exported`: for those poor souls who can not run nix, a pre-built collection
|
||||
of files for `$HOME`, best effort
|
||||
|
||||
## Security
|
||||
|
||||
|
||||
Executable
+7
@@ -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/"
|
||||
@@ -53,6 +53,12 @@
|
||||
pre-commit-check = inputs.git-hooks.lib.${system}.run (
|
||||
{
|
||||
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
|
||||
);
|
||||
@@ -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 {
|
||||
system = "x86_64-darwin";
|
||||
specialArgs.primaryUser = "artem";
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
trustedSSHKeys,
|
||||
...
|
||||
}:
|
||||
@@ -20,7 +19,7 @@
|
||||
home.activation.setupAuthorizedKeys = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
run install -m 0600 -D \
|
||||
${pkgs.writeText "keys" (builtins.concatStringsSep "\n" trustedSSHKeys)} \
|
||||
${config.home.homeDirectory}/.ssh/ephemeral_sshd/authorized_keys
|
||||
''${HOME?}/.ssh/ephemeral_sshd/authorized_keys
|
||||
'';
|
||||
|
||||
# TODO: consider
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
fi
|
||||
|
||||
if [ -r ~/dotfiles/migrated/.zshrc ]; then
|
||||
if [ -r ~/dotfiles/assets/.zshrc ]; then
|
||||
# Hack for faster iterations
|
||||
. ~/dotfiles/migrated/.zshrc
|
||||
. ~/dotfiles/assets/.zshrc
|
||||
else
|
||||
. ${../../migrated/.zshrc}
|
||||
. ${../../assets/.zshrc}
|
||||
fi
|
||||
'';
|
||||
|
||||
@@ -61,10 +61,11 @@
|
||||
vim-startify
|
||||
];
|
||||
extraConfig = ''
|
||||
if filereadable(expand("~/dotfiles/migrated/.vimrc"))
|
||||
source ~/dotfiles/migrated/.vimrc
|
||||
if filereadable(expand("~/dotfiles/assets/.vimrc"))
|
||||
# Hack for faster iterations
|
||||
source ~/dotfiles/assets/.vimrc
|
||||
else
|
||||
source ${../../migrated/.vimrc}
|
||||
source ${../../assets/.vimrc}
|
||||
endif
|
||||
'';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user