makito: nix setup for mac
This commit is contained in:
commit
02f131c903
51
README.md
Normal file
51
README.md
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
# nix
|
||||
|
||||
## macos
|
||||
|
||||
add your user as a trusted-user:
|
||||
|
||||
/etc/nix/nix.conf
|
||||
|
||||
```
|
||||
build-users-group = nixbld
|
||||
trusted-users = varl root
|
||||
```
|
||||
|
||||
reload the daemon
|
||||
|
||||
```
|
||||
sudo launchctl stop org.nixos.nix-daemon
|
||||
sudo launchctl start org.nixos.nix-daemon
|
||||
```
|
||||
|
||||
```
|
||||
mkdir -p ~/.config/nixpkgs
|
||||
cp macos.config.nix ~/.config/nixpkgs/config.nix
|
||||
```
|
||||
|
||||
~/.zlogin
|
||||
|
||||
```sh
|
||||
cp zlogin ~/.zlogin
|
||||
```
|
||||
|
||||
~/.zprofile
|
||||
|
||||
```sh
|
||||
cp zprofile ~/.zprofile
|
||||
```
|
||||
|
||||
~/.zshenv
|
||||
|
||||
```sh
|
||||
cp zshenv ~/.zshenv
|
||||
```
|
||||
|
||||
Logout/login.
|
||||
|
||||
Install mac packages
|
||||
|
||||
```
|
||||
nix-env -ir user-macos
|
||||
```
|
||||
57
macos.config.nix
Normal file
57
macos.config.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
pkgs : {
|
||||
allowUnfree = true;
|
||||
packageOverrides = pkgs: with pkgs; rec {
|
||||
nixUserProfile = writeText "nix-user-profile" ''
|
||||
export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
|
||||
export FPATH=$HOME/.nix-profile/share/zsh/site-functions:$HOME/.nix-profile/share/zsh/$ZSH_VERSION/functions:$FPATH
|
||||
export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
|
||||
'';
|
||||
|
||||
userBasePkgs = pkgs.buildEnv {
|
||||
name = "user-base";
|
||||
paths = [
|
||||
(runCommand "profile" {} ''
|
||||
mkdir -p $out/etc/profile.d
|
||||
cp ${nixUserProfile} $out/etc/profile.d/nix-user-profile.sh
|
||||
'')
|
||||
];
|
||||
pathsToLink = [
|
||||
"/share"
|
||||
"/bin"
|
||||
"/etc"
|
||||
];
|
||||
extraOutputsToInstall = [ "man" "doc" ];
|
||||
};
|
||||
|
||||
userMacOSPkgs = pkgs.buildEnv {
|
||||
name = "user-macos";
|
||||
paths = [
|
||||
userBasePkgs
|
||||
bash
|
||||
zsh
|
||||
zsh-completions
|
||||
podman
|
||||
podman-compose
|
||||
rsync
|
||||
gnupg
|
||||
curl
|
||||
wget
|
||||
alacritty
|
||||
karabiner-elements
|
||||
coreutils
|
||||
direnv
|
||||
ripgrep
|
||||
fd
|
||||
chezmoi
|
||||
fzf
|
||||
vim
|
||||
];
|
||||
pathsToLink = [
|
||||
"/Applications"
|
||||
] ++ (userBasePkgs.pathsToLink or []);
|
||||
extraOutputsToInstall = []
|
||||
++ (userBasePkgs.extraOutputsToInstall or []);
|
||||
};
|
||||
};
|
||||
}
|
||||
2
macos.nix.conf
Normal file
2
macos.nix.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
keep-derivations = true
|
||||
keep-outputs = true
|
||||
5
zlogin
Normal file
5
zlogin
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Nix
|
||||
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
|
||||
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
|
||||
fi
|
||||
# End Nix
|
||||
12
zprofile
Normal file
12
zprofile
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# let nix setup the path
|
||||
if [ -d $HOME/.nix-profile/etc/profile.d ]; then
|
||||
for i in $HOME/.nix-profile/etc/profile.d/*.sh; do
|
||||
if [ -r $i ]; then
|
||||
. $i
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -f '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]]; then
|
||||
source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
|
||||
fi
|
||||
Loading…
Reference in a new issue