mirror of
https://github.com/srid/nixos-config.git
synced 2026-01-08 17:27:22 +08:00
Add M1 Max; flesh out macOS install instructions in README.md; parametrize Makefile
This commit is contained in:
parent
dcf7cd80ae
commit
1e06aa40b5
3 changed files with 51 additions and 36 deletions
3
Makefile
3
Makefile
|
|
@ -1,3 +1,4 @@
|
|||
HOSTNAME := $(shell hostname -s)
|
||||
|
||||
all:
|
||||
if [[ "`uname`" == 'Darwin' ]]; then \
|
||||
|
|
@ -14,7 +15,7 @@ nixos:
|
|||
macos:
|
||||
sudo ls # cache sudo
|
||||
# The `TERM` needs to be set to workaround kitty issue: `tput: unknown terminal "xterm-kitty"`
|
||||
TERM=xterm $$(nix build --extra-experimental-features "flakes nix-command" .#darwinConfigurations.air.system --no-link --json | jq -r '.[].outputs.out')/sw/bin/darwin-rebuild switch --flake .
|
||||
TERM=xterm $$(nix build --extra-experimental-features "flakes nix-command" .#darwinConfigurations.$(HOSTNAME).system --no-link --json | nix --extra-experimental-features "flakes nix-command" run ${WITHEXP} nixpkgs#jq -- -r '.[].outputs.out')/sw/bin/darwin-rebuild switch --flake .
|
||||
|
||||
freeupboot:
|
||||
# Delete all but the last few generations
|
||||
|
|
|
|||
|
|
@ -19,4 +19,11 @@ make darwin # Or, just `make`
|
|||
- Hetzner dedicated from Linux Rescue system: https://github.com/serokell/nixos-install-scripts/pull/1#pullrequestreview-746593205
|
||||
- Digital Ocean: https://github.com/elitak/nixos-infect
|
||||
- X1 Carbon: https://www.srid.ca/x1c7-install
|
||||
- macOS: https://github.com/LnL7/nix-darwin
|
||||
- macOS:
|
||||
- Install Nix normally (multi-user)
|
||||
- Install [nix-darwin](https://github.com/LnL7/nix-darwin)
|
||||
- This will create a `~/.nixpkgs/darwin-configuration.nix`, but we do not need that.
|
||||
- Edit `flake.nix` and add your Mac's [hostname](https://support.apple.com/en-ca/guide/mac-help/mchlp2322/mac) in the `darwinConfigurations` set.
|
||||
- Run `make`.[^cleanup] That's it. Re-open your shell.
|
||||
|
||||
[^cleanup]: You might have to `rm -rf /etc/nix/nix.conf`, so our flake.nix can do its thing.
|
||||
|
|
|
|||
75
flake.nix
75
flake.nix
|
|
@ -122,44 +122,51 @@
|
|||
};
|
||||
|
||||
# Configurations for macOS systems (using nix-darwin)
|
||||
darwinConfigurations."air" =
|
||||
darwinConfigurations =
|
||||
let
|
||||
system = "aarch64-darwin";
|
||||
mkMacosSystem = darwin.lib.darwinSystem;
|
||||
in
|
||||
mkMacosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs system;
|
||||
rosettaPkgs = import nixpkgs { system = "x86_64-darwin"; };
|
||||
defaultMacosSystem = mkMacosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs system;
|
||||
rosettaPkgs = import nixpkgs { system = "x86_64-darwin"; };
|
||||
};
|
||||
modules = [
|
||||
overlayModule
|
||||
./hosts/darwin.nix
|
||||
./features/caches/oss.nix
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.extraSpecialArgs = { inherit system inputs; };
|
||||
home-manager.users.srid = { pkgs, ... }: {
|
||||
imports = [
|
||||
./home/git.nix
|
||||
./home/tmux.nix
|
||||
./home/neovim.nix
|
||||
./home/email.nix
|
||||
./home/terminal.nix
|
||||
./home/direnv.nix
|
||||
./home/starship.nix
|
||||
];
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
initExtra = ''
|
||||
export PATH=$HOME/.nix-profile/bin:/run/current-system/sw/bin/:$PATH
|
||||
'';
|
||||
} // (import ./home/shellcommon.nix { inherit pkgs; });
|
||||
home.stateVersion = "21.11";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
modules = [
|
||||
overlayModule
|
||||
./hosts/darwin.nix
|
||||
./features/caches/oss.nix
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.extraSpecialArgs = { inherit system inputs; };
|
||||
home-manager.users.srid = { pkgs, ... }: {
|
||||
imports = [
|
||||
./home/git.nix
|
||||
./home/tmux.nix
|
||||
./home/neovim.nix
|
||||
./home/email.nix
|
||||
./home/terminal.nix
|
||||
./home/direnv.nix
|
||||
./home/starship.nix
|
||||
];
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
initExtra = ''
|
||||
export PATH=$HOME/.nix-profile/bin:/run/current-system/sw/bin/:$PATH
|
||||
'';
|
||||
} // (import ./home/shellcommon.nix { inherit pkgs; });
|
||||
home.stateVersion = "21.11";
|
||||
};
|
||||
}
|
||||
];
|
||||
in
|
||||
{
|
||||
# These are indexed, by convention, using hostnames.
|
||||
# For example, if `sky.local` is the hostname of your Mac, then use
|
||||
# `sky` here.
|
||||
air = defaultMacosSystem;
|
||||
sky = defaultMacosSystem;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue