File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545 - uses : actions/checkout@v4
4646 - uses : DeterminateSystems/nix-installer-action@v16
4747 - run : nix flake check
48- # Pure eval type-checks the whole darwin + home-manager module tree;
49- # no macOS runner needed.
50- - run : nix eval .#darwinConfigurations.Sankets-MacBook-Air. system.drvPath
48+ # Pure eval type-checks every host's darwin + home-manager module tree;
49+ # no macOS runner needed, and new hosts are covered automatically .
50+ - run : nix eval .#darwinConfigurations --apply 'cfgs: builtins.mapAttrs (_: c: c. system.drvPath) cfgs'
5151 - run : nix run nixpkgs#statix -- check nix/
Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ HM_PACKAGES := zsh git atuin btop gh bin
1313
1414# The brewfile is generated by the nix-darwin homebrew module
1515# (nix/darwin/homebrew.nix); scripts/nix-brewfile.sh prints its path.
16- NIX_HOST := Sankets-MacBook-Air
16+ # The local host name selects the darwinConfigurations entry; a new machine
17+ # needs its own entry in flake.nix (see mkDarwinHost).
18+ NIX_HOST := $(shell scutil --get LocalHostName)
1719# Absolute paths: make's shell (and sudo's secure_path) don't carry the
1820# nix profile dirs.
1921NIX := /nix/var/nix/profiles/default/bin/nix
Original file line number Diff line number Diff line change 77# curl -fsSL https://raw.githubusercontent.com/sanketsudake/dotfiles/main/bootstrap.sh -o /tmp/bootstrap.sh
88# bash /tmp/bootstrap.sh
99#
10- # The flake pins one host config (see NIX_HOST in the Makefile). On a machine
11- # with a different LocalHostName, add a darwinConfigurations entry for it (or
12- # rename the machine) before bootstrapping.
10+ # The host name selects the darwinConfigurations entry; on a new machine, add
11+ # an entry for its LocalHostName in flake.nix (mkDarwinHost) before running.
1312set -euo pipefail
1413
1514DOTFILES_DIR=" ${DOTFILES_DIR:- $HOME / personal/ dotfiles} "
1615DOTFILES_SSH=" git@github.com:sanketsudake/dotfiles.git"
1716DOTFILES_HTTPS=" https://github.com/sanketsudake/dotfiles.git"
18- NIX_HOST=" Sankets-MacBook-Air "
17+ NIX_HOST=" $( scutil --get LocalHostName ) "
1918
2019step () { printf ' \n==> %s\n' " $* " ; }
2120
Original file line number Diff line number Diff line change 1515
1616 outputs =
1717 inputs @{ nixpkgs , nix-darwin , ... } :
18+ let
19+ # One host = one entry below. Shared config lives in nix/darwin and
20+ # nix/home; per-host overrides go in the extraModules list.
21+ mkDarwinHost =
22+ extraModules :
23+ nix-darwin . lib . darwinSystem {
24+ specialArgs = { inherit inputs ; } ;
25+ modules = [
26+ ./nix/darwin
27+ inputs . home-manager . darwinModules . home-manager
28+ {
29+ home-manager = {
30+ useGlobalPkgs = true ;
31+ useUserPackages = true ;
32+ backupFileExtension = "hm-backup" ;
33+ users . sanketsudake = import ./nix/home ;
34+ } ;
35+ }
36+ ]
37+ ++ extraModules ;
38+ } ;
39+ in
1840 {
19- darwinConfigurations . "Sankets-MacBook-Air" = nix-darwin . lib . darwinSystem {
20- specialArgs = { inherit inputs ; } ;
21- modules = [
22- ./nix/darwin
23- inputs . home-manager . darwinModules . home-manager
24- {
25- home-manager = {
26- useGlobalPkgs = true ;
27- useUserPackages = true ;
28- backupFileExtension = "hm-backup" ;
29- users . sanketsudake = import ./nix/home ;
30- } ;
31- }
32- ] ;
33- } ;
41+ darwinConfigurations . "Sankets-MacBook-Air" = mkDarwinHost [ ] ;
3442
3543 formatter . aarch64-darwin = nixpkgs . legacyPackages . aarch64-darwin . nixfmt-rfc-style ;
3644 } ;
You can’t perform that action at this time.
0 commit comments