-
Notifications
You must be signed in to change notification settings - Fork 2
feat: detect platform in make #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,43 @@ | ||
| .PHONY: macos-build macos-switch macos-brew-install macos-brew macos-brew-gui macos-brew-optional macos-brew-himkt macos-update macos-clean macos-gc nixos-build nixos-switch nixos-update nixos-clean nixos-gc | ||
| UNAME := $(shell uname -s) | ||
|
|
||
| # macOS targets | ||
| macos-build: | ||
| nix build .#darwinConfigurations.macos.system | ||
| ifeq ($(UNAME),Darwin) | ||
| NIX_BUILD_CMD := nix build .\#darwinConfigurations.macos.system | ||
| NIX_SWITCH_CMD := sudo darwin-rebuild switch --flake .\#macos | ||
| else | ||
| NIX_BUILD_CMD := nix build .\#nixosConfigurations.nixos.config.system.build.toplevel | ||
| NIX_SWITCH_CMD := sudo nixos-rebuild switch --flake .\#nixos | ||
| endif | ||
|
|
||
| macos-switch: | ||
| sudo darwin-rebuild switch --flake .#macos | ||
| .PHONY: build switch update clean gc brew-install brew brew-gui brew-optional brew-himkt | ||
|
|
||
| macos-brew-install: | ||
| $(PWD)/brew/bin/setup.sh | ||
| # Nix targets (platform-aware) | ||
| build: | ||
| $(NIX_BUILD_CMD) | ||
|
Comment on lines
+14
to
+15
|
||
|
|
||
| macos-brew: | ||
| brew bundle --verbose --file=$(PWD)/brew/config.d/base/Brewfile | ||
| switch: | ||
| $(NIX_SWITCH_CMD) | ||
|
|
||
| macos-brew-gui: | ||
| brew bundle --verbose --file=$(PWD)/brew/config.d/gui/Brewfile | ||
|
|
||
| macos-brew-optional: | ||
| brew bundle --verbose --file=$(PWD)/brew/config.d/optional/Brewfile | ||
|
|
||
| macos-brew-himkt: | ||
| brew bundle --verbose --file=$(PWD)/brew/config.d/himkt/Brewfile | ||
|
|
||
| macos-update: | ||
| update: | ||
| nix flake update | ||
|
|
||
| macos-clean: | ||
| sudo nix-env --delete-generations +7 --profile /nix/var/nix/profiles/system-profiles/darwin | ||
| clean: | ||
| sudo nix-env --delete-generations +7 --profile /nix/var/nix/profiles/system | ||
|
Comment on lines
+23
to
+24
|
||
|
|
||
| macos-gc: | ||
| gc: | ||
| sudo nix-collect-garbage -d | ||
|
|
||
| # NixOS targets | ||
| nixos-build: | ||
| nix build .#nixosConfigurations.nixos.config.system.build.toplevel | ||
| # Homebrew targets (macOS only) | ||
| brew-install: | ||
| $(PWD)/brew/bin/setup.sh | ||
|
|
||
| nixos-switch: | ||
| sudo nixos-rebuild switch --flake .#nixos | ||
| brew: | ||
| brew bundle --verbose --file=$(PWD)/brew/config.d/base/Brewfile | ||
|
|
||
| nixos-update: | ||
| nix flake update | ||
| brew-gui: | ||
| brew bundle --verbose --file=$(PWD)/brew/config.d/gui/Brewfile | ||
|
|
||
| nixos-clean: | ||
| sudo nix-env --delete-generations +7 --profile /nix/var/nix/profiles/system | ||
| brew-optional: | ||
| brew bundle --verbose --file=$(PWD)/brew/config.d/optional/Brewfile | ||
|
|
||
| nixos-gc: | ||
| sudo nix-collect-garbage -d | ||
| brew-himkt: | ||
| brew bundle --verbose --file=$(PWD)/brew/config.d/himkt/Brewfile | ||
|
Comment on lines
+30
to
+43
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hash character in the flake references is escaped with a backslash (e.g.,
.\#darwinConfigurations.macos.system), but the original working Makefile used unescaped hashes (.#darwinConfigurations.macos.system). In Makefile recipe lines (commands after tabs), the hash character is typically passed literally to the shell and does not start a comment, so the backslash escaping may be unnecessary and could potentially cause the command to fail. Verify that these commands work correctly with the escaped syntax, or revert to the unescaped syntax that was previously working.