diff --git a/README.md b/README.md index 1469223..16065be 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/migrated/.vimrc b/assets/.vimrc similarity index 100% rename from migrated/.vimrc rename to assets/.vimrc diff --git a/migrated/.zshenv b/assets/.zshenv similarity index 100% rename from migrated/.zshenv rename to assets/.zshenv diff --git a/migrated/.zshrc b/assets/.zshrc similarity index 100% rename from migrated/.zshrc rename to assets/.zshrc diff --git a/bin/export-home-config b/bin/export-home-config new file mode 100755 index 0000000..0c2aae9 --- /dev/null +++ b/bin/export-home-config @@ -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/" diff --git a/flake.nix b/flake.nix index 70a5bf4..326336c 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; diff --git a/hosts/mars/home.nix b/hosts/mars/home.nix index 16fe530..667d283 100644 --- a/hosts/mars/home.nix +++ b/hosts/mars/home.nix @@ -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 diff --git a/modules/home/common.nix b/modules/home/common.nix index f25c892..29e73f1 100644 --- a/modules/home/common.nix +++ b/modules/home/common.nix @@ -30,7 +30,7 @@ if [ -r ~/dotfiles/migrated/.zshrc ]; then # Hack for faster iterations - . ~/dotfiles/migrated/.zshrc + . ~/dotfiles/assets/.zshrc else . ${../../migrated/.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 ''; };