[darwin] Add nix-darwin for work laptop
Adds nix-darwin Simplifies emacs tree-sitter Probably breaks vterm on linux :(
This commit is contained in:
21
flake.lock
generated
21
flake.lock
generated
@@ -56,6 +56,26 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1758447883,
|
||||
"narHash": "sha256-yGA6MV0E4JSEXqLTb4ZZkmdJZcoQ8HUzihRRX12Bvpg=",
|
||||
"owner": "nix-darwin",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "25381509d5c91bbf3c30e23abc6d8476d2143cd1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-darwin",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-wsl": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
@@ -135,6 +155,7 @@
|
||||
"inputs": {
|
||||
"google-cookie-retrieval": "google-cookie-retrieval",
|
||||
"home-manager": "home-manager",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nixos-wsl": "nixos-wsl",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"plasma-manager": "plasma-manager"
|
||||
|
||||
75
flake.nix
75
flake.nix
@@ -4,6 +4,11 @@
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
||||
|
||||
nix-darwin = {
|
||||
url = "github:nix-darwin/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
@@ -23,8 +28,9 @@
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixos-wsl, ... } @ inputs: let
|
||||
baseModules = [
|
||||
nixosModules = [
|
||||
./roles
|
||||
] ++ [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
@@ -37,10 +43,23 @@
|
||||
};
|
||||
}
|
||||
];
|
||||
darwinModules = [
|
||||
./roles/darwin.nix
|
||||
] ++ [
|
||||
inputs.home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.extraSpecialArgs = {
|
||||
globalInputs = inputs;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
in {
|
||||
nixosConfigurations.nix-book = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = baseModules ++ [
|
||||
modules = nixosModules ++ [
|
||||
./machines/nix-book/configuration.nix
|
||||
{
|
||||
home-manager.users.johno = {
|
||||
@@ -57,7 +76,7 @@
|
||||
|
||||
nixosConfigurations.boxy = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = baseModules ++ [
|
||||
modules = nixosModules ++ [
|
||||
./machines/boxy/configuration.nix
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
@@ -69,7 +88,7 @@
|
||||
|
||||
nixosConfigurations.wixos = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = baseModules ++ [
|
||||
modules = nixosModules ++ [
|
||||
nixos-wsl.nixosModules.default
|
||||
./machines/wixos/configuration.nix
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
@@ -82,7 +101,7 @@
|
||||
|
||||
nixosConfigurations.zix790prors = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = baseModules ++ [
|
||||
modules = nixosModules ++ [
|
||||
./machines/zix790prors/configuration.nix
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
@@ -95,7 +114,7 @@
|
||||
# Live USB ISO configuration
|
||||
nixosConfigurations.live-usb = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = baseModules ++ [
|
||||
modules = nixosModules ++ [
|
||||
./machines/live-usb/configuration.nix
|
||||
{
|
||||
home-manager.users.nixos = import ./home/home-live-usb.nix;
|
||||
@@ -104,42 +123,16 @@
|
||||
];
|
||||
};
|
||||
|
||||
# Standalone home-manager configurations for non-NixOS systems
|
||||
homeConfigurations."johno@desktop" = inputs.home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
|
||||
modules = [
|
||||
inputs.plasma-manager.homeManagerModules.plasma-manager
|
||||
./home/home-desktop.nix
|
||||
# Darwin/macOS configurations
|
||||
darwinConfigurations.johno-macbookpro = inputs.nix-darwin.lib.darwinSystem rec {
|
||||
system = "aarch64-darwin";
|
||||
modules = darwinModules ++ [
|
||||
./machines/johno-macbookpro/configuration.nix
|
||||
{
|
||||
home-manager.users.johno = import ./home/home-darwin-work.nix;
|
||||
home-manager.extraSpecialArgs = { inherit system; };
|
||||
}
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
system = "x86_64-linux";
|
||||
globalInputs = inputs;
|
||||
};
|
||||
};
|
||||
|
||||
homeConfigurations."johno@laptop-compact" = inputs.home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
|
||||
modules = [
|
||||
inputs.plasma-manager.homeManagerModules.plasma-manager
|
||||
./home/home-laptop-compact.nix
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
system = "x86_64-linux";
|
||||
globalInputs = inputs;
|
||||
};
|
||||
};
|
||||
|
||||
# Legacy configuration for backward compatibility
|
||||
homeConfigurations."johno" = inputs.home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
|
||||
modules = [
|
||||
inputs.plasma-manager.homeManagerModules.plasma-manager
|
||||
./home/home-desktop.nix
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
system = "x86_64-linux";
|
||||
globalInputs = inputs;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
61
home/home-darwin-work.nix
Normal file
61
home/home-darwin-work.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{ config, lib, pkgs, globalInputs, system, ... }:
|
||||
|
||||
let
|
||||
customPkgs = pkgs.callPackage ../packages {};
|
||||
in
|
||||
{
|
||||
# Provide arguments to role modules
|
||||
_module.args = { inherit customPkgs; };
|
||||
# Home Manager configuration for Darwin work laptop
|
||||
# Corporate-friendly setup with essential development tools
|
||||
|
||||
home.username = lib.mkForce "johno";
|
||||
home.homeDirectory = lib.mkForce "/Users/johno";
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# Roles temporarily disabled to avoid kubectl dependency
|
||||
|
||||
# Override Darwin-incompatible settings from base role
|
||||
programs.rbw.settings.pinentry = lib.mkForce pkgs.pinentry_mac;
|
||||
|
||||
# Re-enable bash with bashrcExtra to append rather than replace
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
initExtra = ''
|
||||
source ~/Development/config_files/square/bashrc
|
||||
|
||||
# Generated by Hermit; START; DO NOT EDIT.
|
||||
if [[ $- == *i* ]]; then
|
||||
HERMIT_ROOT_BIN="''${HERMIT_ROOT_BIN:-"$HOME/bin/hermit"}"
|
||||
eval "$(test -x $HERMIT_ROOT_BIN && $HERMIT_ROOT_BIN shell-hooks --print --bash)"
|
||||
fi
|
||||
# Generated by Hermit; END; DO NOT EDIT.
|
||||
'';
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
initContent = ''
|
||||
source ~/Development/config_files/square/zshrc
|
||||
|
||||
# Generated by Hermit; START; DO NOT EDIT.
|
||||
if [[ -o interactive ]]; then
|
||||
HERMIT_ROOT_BIN="''${HERMIT_ROOT_BIN:-"$HOME/bin/hermit"}"
|
||||
eval "$(test -x $HERMIT_ROOT_BIN && $HERMIT_ROOT_BIN shell-hooks --print --zsh)"
|
||||
fi
|
||||
# Generated by Hermit; END; DO NOT EDIT.
|
||||
'';
|
||||
};
|
||||
|
||||
# Keep SSH and Git disabled to avoid conflicts with work environment
|
||||
programs.ssh.enable = lib.mkForce false;
|
||||
programs.git.enable = lib.mkForce false;
|
||||
programs.rbw.enable = lib.mkForce false;
|
||||
|
||||
home.shell.enableShellIntegration = true;
|
||||
|
||||
imports = [
|
||||
./modules/emacs
|
||||
./modules/tmux
|
||||
];
|
||||
}
|
||||
@@ -10,62 +10,21 @@ let
|
||||
sha256 = "sha256-vHwgENjip2+AFzs4oZfnKEAJKwf5Zid7fakImvxxQUw=";
|
||||
};
|
||||
|
||||
# Pre-built tree-sitter grammars for common languages
|
||||
treeSitterGrammars = with pkgs.tree-sitter-grammars; [
|
||||
# Core languages
|
||||
tree-sitter-bash
|
||||
tree-sitter-c
|
||||
tree-sitter-cpp
|
||||
tree-sitter-css
|
||||
tree-sitter-html
|
||||
tree-sitter-javascript
|
||||
tree-sitter-json
|
||||
tree-sitter-markdown
|
||||
tree-sitter-python
|
||||
tree-sitter-rust
|
||||
tree-sitter-yaml
|
||||
|
||||
# Configuration and markup
|
||||
tree-sitter-dockerfile
|
||||
tree-sitter-nix
|
||||
tree-sitter-toml
|
||||
|
||||
# Development tools and frameworks
|
||||
tree-sitter-elisp
|
||||
tree-sitter-typescript
|
||||
tree-sitter-tsx
|
||||
tree-sitter-go
|
||||
tree-sitter-java
|
||||
tree-sitter-lua
|
||||
tree-sitter-make
|
||||
tree-sitter-sql
|
||||
|
||||
# Additional useful languages
|
||||
tree-sitter-haskell
|
||||
tree-sitter-ruby
|
||||
tree-sitter-scala
|
||||
tree-sitter-clojure
|
||||
tree-sitter-scheme
|
||||
tree-sitter-latex
|
||||
tree-sitter-org-nvim
|
||||
tree-sitter-vim
|
||||
tree-sitter-regex
|
||||
tree-sitter-comment
|
||||
];
|
||||
# Default emacs configuration with vterm support
|
||||
defaultEmacsPackage = pkgs.emacs-macport.pkgs.withPackages (epkgs: [
|
||||
epkgs.vterm
|
||||
epkgs.treesit-grammars.with-all-grammars
|
||||
]);
|
||||
in
|
||||
{
|
||||
config = {
|
||||
home.packages = [
|
||||
(pkgs.emacs.pkgs.withPackages (epkgs: [
|
||||
epkgs.vterm
|
||||
]))
|
||||
|
||||
pkgs.emacs-all-the-icons-fonts
|
||||
pkgs.fira-code
|
||||
pkgs.fontconfig
|
||||
pkgs.graphviz
|
||||
pkgs.isort
|
||||
pkgs.libvterm # native vterm library
|
||||
#pkgs.libvterm # native vterm library
|
||||
pkgs.nerd-fonts.fira-code
|
||||
pkgs.nerd-fonts.droid-sans-mono
|
||||
pkgs.nil # nix lsp language server
|
||||
@@ -76,38 +35,17 @@ in
|
||||
pkgs.python3
|
||||
];
|
||||
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
package = defaultEmacsPackage;
|
||||
};
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
# Mount emacs and tree-sitter grammars from nix store
|
||||
home.file = {
|
||||
"${config.xdg.configHome}/emacs".source = doomEmacs;
|
||||
} // lib.listToAttrs (lib.flatten (map (grammar:
|
||||
let
|
||||
# Extract just the language name from the package name
|
||||
grammarName = let
|
||||
fullName = grammar.pname or (lib.getName grammar);
|
||||
# Remove "tree-sitter-" prefix and "-grammar" suffix
|
||||
cleaned = lib.removePrefix "tree-sitter-" fullName;
|
||||
final = lib.removeSuffix "-grammar" cleaned;
|
||||
in final;
|
||||
in [
|
||||
# Place grammars where Emacs tree-sitter expects them
|
||||
{
|
||||
name = ".local/share/doom/etc/tree-sitter/libtree-sitter-${grammarName}.so";
|
||||
value.source = "${grammar}/parser";
|
||||
}
|
||||
# Also place in standard tree-sitter location as backup
|
||||
{
|
||||
name = ".local/share/tree-sitter/bin/libtree-sitter-${grammarName}.so";
|
||||
value.source = "${grammar}/parser";
|
||||
}
|
||||
] ++ lib.optionals (builtins.pathExists "${grammar}/queries") [
|
||||
{
|
||||
name = ".local/share/tree-sitter/queries/${grammarName}";
|
||||
value.source = "${grammar}/queries";
|
||||
}
|
||||
]
|
||||
) treeSitterGrammars));
|
||||
};
|
||||
|
||||
home.sessionPath = [
|
||||
"${config.xdg.configHome}/emacs/bin"
|
||||
@@ -116,19 +54,12 @@ in
|
||||
home.sessionVariables = {
|
||||
DOOMDIR = "${config.xdg.configHome}/doom";
|
||||
DOOMLOCALDIR = "${config.xdg.dataHome}/doom";
|
||||
# Set tree-sitter grammar directory to use pre-built grammars
|
||||
TREE_SITTER_DIR = "${config.xdg.dataHome}/tree-sitter";
|
||||
};
|
||||
|
||||
home.activation.doomConfig = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
# Always remove and recreate the symlink to ensure it points to the source directory
|
||||
rm -rf "${config.xdg.configHome}/doom"
|
||||
ln -sf "${config.home.homeDirectory}/nixos-configs/home/modules/emacs/doom" "${config.xdg.configHome}/doom"
|
||||
|
||||
# Run doom sync to apply any configuration changes
|
||||
if command -v doom >/dev/null 2>&1; then
|
||||
doom sync
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
23
machines/johno-macbookpro/configuration.nix
Normal file
23
machines/johno-macbookpro/configuration.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Basic system configuration for macOS work laptop
|
||||
system.stateVersion = 6;
|
||||
|
||||
# Set primary user for nix-darwin
|
||||
system.primaryUser = "johno";
|
||||
|
||||
# System preferences (can be expanded later)
|
||||
system.defaults = {
|
||||
dock.autohide = true;
|
||||
finder.AppleShowAllExtensions = true;
|
||||
NSGlobalDomain.AppleShowAllExtensions = true;
|
||||
};
|
||||
|
||||
# TODO: Find a way to not duplicate this
|
||||
launchd.user.envVariables = {
|
||||
# DOOM Emacs environment variables
|
||||
DOOMDIR = "/Users/johno/.config/doom";
|
||||
DOOMLOCALDIR = "/Users/johno/.local/doom";
|
||||
};
|
||||
}
|
||||
46
roles/darwin.nix
Normal file
46
roles/darwin.nix
Normal file
@@ -0,0 +1,46 @@
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
time.timeZone = "America/Los_Angeles";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
glances
|
||||
pciutils
|
||||
tree
|
||||
usbutils
|
||||
vim
|
||||
];
|
||||
|
||||
nix = {
|
||||
package = pkgs.nix;
|
||||
# distributedBuilds = true;
|
||||
# buildMachines = [{
|
||||
# hostName = "z790prors.oglehome";
|
||||
# system = "x86_64-linux";
|
||||
# protocol = "ssh-ng";
|
||||
# sshUser = "johno";
|
||||
# sshKey = "/root/.ssh/id_ed25519";
|
||||
# maxJobs = 3;
|
||||
# speedFactor = 2;
|
||||
# }];
|
||||
settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
max-jobs = "auto";
|
||||
trusted-users = [ "johno" ];
|
||||
substituters = [
|
||||
];
|
||||
};
|
||||
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 10d";
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user