···5151 user = "ianchamberlain";
5252 # TODO: maybe some kinda nixos flag or something
5353 };
5454- # ??
5555- ichamberlain-dev = {
5454+ # Unusual case:
5555+ dev-ichamberlain = rec {
5656 system = "x86_64-linux";
5757 user = "ichamberlain";
5858+ homeDirectory = "/Users/${user}";
5859 };
5960 };
6061···9798 darwinPackages = mapAttrs (cfg: cfg.pkgs) self.darwinConfigurations;
989999100 homeConfigurations = lib.mapAttrs'
100100- (host: { system, user }: lib.nameValuePair
101101+ (host: hostVars @ { system, user, ... }: lib.nameValuePair
101102 "${user}@${host}"
102103 (if isDarwin system then
103104 # Expose the home configuration built by darwinModules.home-manager:
104105 self.darwinConfigurations.${host}.config.home-manager.users.${user}
105106 else
106107 home-manager.lib.homeManagerConfiguration {
108108+ pkgs = nixpkgs.legacyPackages.${system};
109109+107110 modules = [
108111 ./home-manager/home.nix
112112+ ({ pkgs, ... }: {
113113+ nix.package = pkgs.lix;
114114+ })
109115 ];
110116111111- extraSpecialArgs = {
112112- username = user;
113113- pkgs-unstable = inputs.nixpkgs-unstable.legacyPackages.${system};
117117+ extraSpecialArgs = hostVars // {
118118+ unstable = inputs.nixpkgs-unstable.legacyPackages.${system};
114119 };
115120 }))
116121 systems;
117122118123 devShell = lib.mapAttrs'
119124 (_: { system, ... }:
120120- let
121121- pkgs = if isDarwin system then
122122- inputs.nixpkgs-darwin.legacyPackages.${system}
123123- else
124124- inputs.nixpkgs.legacyPackages.${system};
125125- in
125125+ let
126126+ pkgs =
127127+ if isDarwin system then
128128+ inputs.nixpkgs-darwin.legacyPackages.${system}
129129+ else
130130+ inputs.nixpkgs.legacyPackages.${system};
131131+ in
126132 lib.nameValuePair
127127- system
128128- (pkgs.mkShell {
129129- # Minimal set of packages needed for bootstrapping dotfiles
130130- packages = with pkgs; [
131131- cacert
132132- git
133133- git-crypt
134134- git-lfs
135135- gnupg
136136- yadm
137137- ];
138138- })
133133+ system
134134+ (pkgs.mkShell {
135135+ # Minimal set of packages needed for bootstrapping dotfiles
136136+ packages = with pkgs; [
137137+ cacert
138138+ git
139139+ git-crypt
140140+ git-lfs
141141+ gnupg
142142+ yadm
143143+ ];
144144+ })
139145 )
140146 systems;
141147 };
+15-7
.config/home-manager/home.nix
···11-inputs @ { config, lib, pkgs, ... }:
11+inputs @ { config
22+, lib
33+, pkgs
44+, user ? "ianchamberlain"
55+, unstable ? import <nixos-unstable> { }
66+, ...
77+}:
28let
39 inherit (pkgs) stdenv;
410 inherit (config.lib.file) mkOutOfStoreSymlink;
55- # TODO: proper input should be handled by flake or something
66- unstable = inputs.unstable or (import <nixos-unstable> { });
711in
812{
913 # These defaults are mainly just for nixOS which I haven't converted to flakes yet
1014 # so it needs to be deprioritized to avoid conflict with e.g. darwinModules
1111- home.username = lib.mkDefault "ianchamberlain";
1212- home.homeDirectory = lib.mkDefault "/home/${config.home.username}";
1515+ home.username = lib.mkDefault user;
1616+ home.homeDirectory = lib.mkDefault inputs.homeDirectory or "/home/${config.home.user}";
13171418 nix.extraOptions = ''
1519 repl-overlays = ${config.xdg.configHome}/nix/repl-overlays.nix
···2024 home-manager.enable = true;
21252226 bat.enable = true;
2323- # fd.enable = true;
2727+ fd.enable = true;
2428 fish.enable = true;
2529 git.enable = true;
2630 gpg.enable = true;
···96100 nil
97101 unstable.nixd
98102 nixpkgs-fmt
103103+ python3
99104 rustup
105105+ openssh
100106 shellcheck
101107 thefuck
102108 tree
···104110 tmux.terminfo
105111 unzip
106112 yadm
107107- ] ++ lib.optionals stdenv.isDarwin [
113113+108114 # Fish completions + path setup stuff, needed since I'm not letting
109115 # home-manager do all the shell setup for me. Most notably, this creates
110116 # ~/.nix-profile/etc/profile.d/nix.fish - don't remove without a replacement!
117117+ #
118118+ # This may cause trouble on nixOS but I can't remember why...
111119 config.nix.package
112120 ];
113121
+2-4
.config/yadm/bootstrap
···3636}
37373838function main() {
3939+ cd ~ || exit 1
4040+3941 yadm submodule update --init
40424143 # Include "shared" git config in yadm repo
···4547 yadm enter \
4648 ~/.config/yadm/hooks/pre-commit.pyz install \
4749 --config ~/.config/yadm/.pre-commit-config.yaml
4848-4949- # For flakes to work nicely, see flake.nix for details
5050- # TODO: maybe could be done as part of home-manager setup instead...
5151- ln -s "$(yadm rev-parse --git-dir)" ~/.config/.git
52505351 # Ensure yadm alt SSH config files are set with the right permissions
5452 chmod go-rw ~/.ssh/*