Merge pull request #12 from DannyDannyDanny/feat/add-nix-on-macos
Nix on MacOs 🍎
This commit is contained in:
commit
c8685c0f89
4 changed files with 102 additions and 80 deletions
22
nixos/flake.lock
generated
22
nixos/flake.lock
generated
|
|
@ -34,6 +34,27 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1757130842,
|
||||||
|
"narHash": "sha256-4i7KKuXesSZGUv0cLPLfxbmF1S72Gf/3aSypgvVkwuA=",
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "15f067638e2887c58c4b6ba1bdb65a0b61dc58c5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixos-wsl": {
|
"nixos-wsl": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
|
|
@ -102,6 +123,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
"nixos-wsl": "nixos-wsl",
|
"nixos-wsl": "nixos-wsl",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"vscode-server": "vscode-server"
|
"vscode-server": "vscode-server"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
||||||
vscode-server.url = "github:nix-community/nixos-vscode-server";
|
vscode-server.url = "github:nix-community/nixos-vscode-server";
|
||||||
|
|
||||||
|
# nix-darwin for macOS
|
||||||
|
# (follows nixpkgs so both use the same channel)
|
||||||
|
nix-darwin.url = "github:nix-darwin/nix-darwin/master";
|
||||||
|
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
# for later
|
# for later
|
||||||
# home-manager.url = "github:nix-community/home-manager";
|
# home-manager.url = "github:nix-community/home-manager";
|
||||||
# home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
# home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
@ -12,18 +18,18 @@
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
nixos-wsl,
|
nixos-wsl,
|
||||||
vscode-server,
|
vscode-server,
|
||||||
|
nix-darwin,
|
||||||
self,
|
self,
|
||||||
# home-manager,
|
# home-manager,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
|
|
||||||
wsl = nixpkgs.lib.nixosSystem {
|
wsl = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
nixos-wsl.nixosModules.default
|
nixos-wsl.nixosModules.default
|
||||||
vscode-server.nixosModules.default
|
vscode-server.nixosModules.default
|
||||||
./hosts/wsl.nix # previously configuration.nix
|
./hosts/wsl.nix
|
||||||
./tmux.nix
|
./tmux.nix
|
||||||
./neovim.nix
|
./neovim.nix
|
||||||
./fish.nix
|
./fish.nix
|
||||||
|
|
@ -35,17 +41,28 @@
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
vscode-server.nixosModules.default
|
vscode-server.nixosModules.default
|
||||||
./hosts/macbookair.nix # previously configuration.nix
|
./hosts/macbookair.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./tmux.nix
|
./tmux.nix
|
||||||
./neovim.nix
|
./neovim.nix
|
||||||
./fish.nix
|
./fish.nix
|
||||||
# home-manager.nixosModules.default
|
# home-manager.nixosModules.default
|
||||||
# ./configuration.nix # shouldn't this be necessary???
|
# ./configuration.nix
|
||||||
# ./uxplay.nix
|
# ./uxplay.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# macOS (nix-darwin) configuration
|
||||||
|
darwinConfigurations."Daniel-Macbook-Air" = nix-darwin.lib.darwinSystem {
|
||||||
|
modules = [
|
||||||
|
./hosts/macos.nix
|
||||||
|
# TODO: nix-darwin lacks tmux options; move to Home Manager.x
|
||||||
|
# ./tmux.nix
|
||||||
|
# TODO: add neovim via homemanager, that should work the same for NixOS as Nix-Darwin
|
||||||
|
# ./neovim.nix # NOTE: Option only exists on NixOS.
|
||||||
|
./fish.nix
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,90 +1,74 @@
|
||||||
# Edit this configuration file to define what should be installed on
|
|
||||||
# your system. Help is available in the configuration.nix(5) man page, on
|
|
||||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
|
||||||
|
|
||||||
# NixOS-WSL specific options are documented on the NixOS-WSL repository:
|
|
||||||
# https://github.com/nix-community/NixOS-WSL
|
|
||||||
|
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
networking = {
|
# Apple Silicon + nix-darwin basics
|
||||||
useDHCP = true;
|
nixpkgs.hostPlatform = "aarch64-darwin";
|
||||||
# nameserver sources: https://dnsmap.io/articles/most-popular-dns-servers
|
nix.enable = false; # Determinate manages Nix
|
||||||
nameservers = [ "84.200.69.80" "8.26.56.26" "1.1.1.1" "8.8.8.8" "64.6.65.6" "208.67.222.222" "209.244.0.3" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
||||||
|
|
||||||
programs.nix-ld.enable = true;
|
|
||||||
# TODO: move to home manager (?)
|
|
||||||
programs = {
|
|
||||||
direnv = {
|
|
||||||
enable = true;
|
|
||||||
# enableFishIntegration = true;
|
|
||||||
nix-direnv.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
|
||||||
# settings for stateful data, like file locations and database versions
|
|
||||||
# on your system were taken. It's perfectly fine and recommended to leave
|
|
||||||
# this value at the release version of the first install of this system.
|
|
||||||
# Before changing this value read the documentation for this option
|
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
||||||
system.stateVersion = "25.05"; # Did you read the comment?
|
|
||||||
|
|
||||||
users.users.danny = {
|
|
||||||
isNormalUser = true;
|
|
||||||
extraGroups = [ "wheel" ];
|
|
||||||
initialPassword = "test";
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
system.primaryUser = "danny";
|
||||||
|
|
||||||
|
# Shells & dev ergonomics
|
||||||
|
programs.fish.enable = true;
|
||||||
|
environment.shells = [ pkgs.fish ];
|
||||||
|
# If you want fish as default shell, uncomment:
|
||||||
|
# users.defaultUserShell = pkgs.fish;
|
||||||
|
|
||||||
|
programs.direnv.enable = true;
|
||||||
|
programs.direnv.nix-direnv.enable = true;
|
||||||
|
|
||||||
|
# Networking (macOS-safe)
|
||||||
|
networking = {
|
||||||
|
# Set if you want a specific hostname in macOS UI as well:
|
||||||
|
hostName = "Daniel-Macbook-Air";
|
||||||
|
knownNetworkServices = [ "Wi-Fi" "Thunderbolt Bridge" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# macOS niceties
|
||||||
|
security.pam.services.sudo_local.touchIdAuth = true;
|
||||||
|
|
||||||
|
system.defaults = {
|
||||||
|
# Keyboard
|
||||||
|
NSGlobalDomain = {
|
||||||
|
AppleShowAllExtensions = true;
|
||||||
|
ApplePressAndHoldEnabled = true;
|
||||||
|
"com.apple.mouse.tapBehavior" = 1;
|
||||||
|
"com.apple.sound.beep.volume" = 0.0;
|
||||||
|
"com.apple.sound.beep.feedback" = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Finder & Dock
|
||||||
|
finder.AppleShowAllExtensions = true;
|
||||||
|
dock.autohide = true;
|
||||||
|
dock.mru-spaces = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Environment
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
DBT_USER = "DNTH";
|
DBT_USER = "DNTH";
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
# tmux # activated in tmux.nix
|
gh
|
||||||
# vim # using neovim in stead
|
ripgrep
|
||||||
# neovim # activated in neovim.nix
|
wget
|
||||||
|
# busybox #TODO: doesn't run on darwin
|
||||||
# disabled git as it comes pre-installed on macos - delete or re-enable?
|
git
|
||||||
# git # version control
|
gnupg
|
||||||
gh # github cli tool
|
coreutils
|
||||||
|
openssl
|
||||||
ripgrep # faster grep
|
neofetch
|
||||||
wget # for vscode-server
|
btop
|
||||||
busybox # useful programs e.g. tree, unzip etc
|
tldr
|
||||||
openssl # cryptography swiss army knife
|
fzf
|
||||||
xdg-utils # terminal desktop intergrations (i.e. allow terminal to open browser)
|
|
||||||
|
|
||||||
# make default.nix in python project folders instead of using a top-level python environment manager
|
|
||||||
# pyenv
|
|
||||||
# poetry
|
|
||||||
|
|
||||||
neofetch # system info
|
|
||||||
btop # resource monitor
|
|
||||||
tldr # community alternative to man
|
|
||||||
fzf # fuzzy finder
|
|
||||||
|
|
||||||
# gimp # bloat
|
|
||||||
# blender # bloat
|
|
||||||
# inkscape # bloat
|
|
||||||
|
|
||||||
cowsay
|
cowsay
|
||||||
lolcat
|
lolcat
|
||||||
|
neovim
|
||||||
];
|
];
|
||||||
|
|
||||||
# services.vscode-server.enable = true;
|
# Keep for darwin as well (tracks defaults across upgrades)
|
||||||
# security.rtkit.enable = true; # realtime kit hands out realtime scheduling priority
|
# current max per nix-darwin; bump only if a release notes says so
|
||||||
# services.pipewire = {
|
system.stateVersion = 6;
|
||||||
# enable = true; # if not already enabled
|
|
||||||
# alsa.enable = true;
|
|
||||||
# alsa.support32Bit = true;
|
|
||||||
# pulse.enable = true;
|
|
||||||
# # If you want to use JACK applications, uncomment this
|
|
||||||
# #jack.enable = true;
|
|
||||||
# };
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,3 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue