Nix overhaul; Zsh/starship and vm update

This commit is contained in:
2024-10-13 16:56:25 +01:00
parent 39be4398db
commit e011e2b24c
5 changed files with 484 additions and 391 deletions

View File

@@ -47,7 +47,6 @@ case $main_menu in
sudo nixos-rebuild switch --flake /etc/nixos#default sudo nixos-rebuild switch --flake /etc/nixos#default
;; ;;
3) 3)
chsh -s /bin/bash
mkdir -p ~/.config/nix-darwin/ mkdir -p ~/.config/nix-darwin/
cp -rf ./nix/macOS/* ~/.config/nix-darwin/ cp -rf ./nix/macOS/* ~/.config/nix-darwin/
cp -f ./nix/home.nix ~/.config/nix-darwin/ cp -f ./nix/home.nix ~/.config/nix-darwin/

View File

@@ -11,7 +11,7 @@ pkgs.mkShellNoCC {
shellHook = '' shellHook = ''
mkdir -p macos-vm mkdir -p macos-vm
cd macos-vm cd macos-vm
quickget macos ventura quickget macos sonoma
quickemu --vm macos-ventura.conf quickemu --vm macos-sonoma.conf
''; '';
} }

View File

@@ -375,10 +375,14 @@ in
# =========================================================== # ===========================================================
# Autostart services on boot # Autostart services on boot
services.gnome-keyring.enable = isLinux; services = {
programs.home-manager.enable = true; gnome-keyring.enable = isLinux;
};
programs.firefox = { programs = {
home-manager.enable = true;
firefox = {
enable = false; enable = false;
policies = { policies = {
DisableTelemetry = true; DisableTelemetry = true;
@@ -505,7 +509,7 @@ in
}; };
}; };
programs.neovim = { neovim = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
viAlias = true; viAlias = true;
@@ -518,7 +522,7 @@ in
# even more plugins : https://search.nixos.org/packages # even more plugins : https://search.nixos.org/packages
}; };
programs.tmux = { tmux = {
enable = true; enable = true;
aggressiveResize = true; aggressiveResize = true;
baseIndex = 1; baseIndex = 1;
@@ -529,6 +533,7 @@ in
plugins = with pkgs; [ tmuxPlugins.cpu ]; plugins = with pkgs; [ tmuxPlugins.cpu ];
prefix = "C-s"; prefix = "C-s";
terminal = "tmux-256color"; terminal = "tmux-256color";
shell = "${pkgs.zsh}/bin/zsh";
extraConfig = '' extraConfig = ''
bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'" bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
@@ -566,7 +571,7 @@ in
''; '';
}; };
programs.git = { git = {
enable = true; enable = true;
userName = "TrudeEH"; userName = "TrudeEH";
userEmail = "ehtrude@gmail.com"; userEmail = "ehtrude@gmail.com";
@@ -606,7 +611,16 @@ in
}; };
}; };
programs.bash = { starship = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
settings = {
add_newline = true;
};
};
bash = {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
shellAliases = { shellAliases = {
@@ -638,7 +652,45 @@ in
''; '';
}; };
programs.vscode = { zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
l = "ls -alh";
ls = "ls --color=auto";
ll = "ls -lhi";
grep = "grep --color=auto";
ta = "tmux attach";
t = "tmux";
v = "nvim";
cpp = "rsync -ah --progress";
code = "codium --enable-features=UseOzonePlatform --ozone-platform=wayland";
neofetch = "fastfetch";
sudo = "sudo -i";
ns = "nix-shell";
};
initExtra = ''
# Case-insensitive completion
autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
set -o vi
export EDITOR="nvim";
if [[ -z $TMUX ]]; then
tmux attach
if [[ $? == 1 ]]; then
tmux new -s main
fi
fi
'';
};
vscode = {
enable = true; enable = true;
package = pkgs.vscodium; package = pkgs.vscodium;
enableUpdateCheck = false; enableUpdateCheck = false;
@@ -701,4 +753,5 @@ in
"explorer.confirmDelete" = false; "explorer.confirmDelete" = false;
}; };
}; };
};
} }

View File

@@ -30,84 +30,115 @@
system.configurationRevision = self.rev or self.dirtyRev or null; system.configurationRevision = self.rev or self.dirtyRev or null;
system.stateVersion = 5; system.stateVersion = 5;
# Home-manager module
users.users.trude = { users.users.trude = {
name = "trude"; name = "trude";
home = "/Users/trude"; home = "/Users/trude";
}; };
home-manager = { home-manager = {
extraSpecialArgs = {inherit inputs;}; extraSpecialArgs = {inherit inputs;};
backupFileExtension = "backup"; backupFileExtension = "backup";
users = { users = {
"trude" = import ./home.nix; "trude" = import ./home.nix;
}; };
}; sharedModules = [
home-manager.sharedModules = [
mac-app-util.homeManagerModules.default mac-app-util.homeManagerModules.default
]; ];
};
# System packages
environment.systemPackages = []; environment.systemPackages = [];
# Configure macOS
security.pam.enableSudoTouchIdAuth = true; security.pam.enableSudoTouchIdAuth = true;
system.defaults = { system.defaults = {
# https://daiderd.com/nix-darwin/manual/index.html # https://daiderd.com/nix-darwin/manual/index.html
ActivityMonitor.IconType = 5;
ActivityMonitor.SortColumn = "CPUUsage"; ActivityMonitor = {
ActivityMonitor.SortDirection = 0; IconType = 5;
SortColumn = "CPUUsage";
SortDirection = 0;
};
CustomUserPreferences = { CustomUserPreferences = {
"com.apple.Safari" = { "com.apple.Safari" = {
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" = true; "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" = true;
}; };
}; };
NSGlobalDomain.AppleICUForce24HourTime = false;
NSGlobalDomain.AppleInterfaceStyle = "Dark"; NSGlobalDomain = {
NSGlobalDomain.AppleScrollerPagingBehavior = true; AppleICUForce24HourTime = false;
NSGlobalDomain.AppleShowAllExtensions = true; AppleInterfaceStyle = "Dark";
NSGlobalDomain.AppleShowAllFiles = true; AppleScrollerPagingBehavior = true;
NSGlobalDomain.NSDocumentSaveNewDocumentsToCloud = false; AppleShowAllExtensions = true;
NSGlobalDomain.NSWindowShouldDragOnGesture = true; AppleShowAllFiles = true;
NSGlobalDomain.KeyRepeat = 2; NSDocumentSaveNewDocumentsToCloud = false;
NSGlobalDomain."com.apple.mouse.tapBehavior" = 1; #Tap to click on mouse. NSWindowShouldDragOnGesture = true;
NSGlobalDomain."com.apple.swipescrolldirection" = false; #Normal scrolling. KeyRepeat = 2;
WindowManager.EnableStandardClickToShowDesktop = true; "com.apple.mouse.tapBehavior" = 1; #Tap to click on mouse.
WindowManager.StandardHideDesktopIcons = false; "com.apple.swipescrolldirection" = false; #Normal scrolling.
alf.globalstate = 1; #Firewall
alf.stealthenabled = 1; #Drop incoming ping requests };
dock.autohide = false;
dock.autohide-delay = 0.0; WindowManager = {
dock.autohide-time-modifier = 0.5; #Dock autohide animation speed EnableStandardClickToShowDesktop = true;
dock.expose-animation-duration = 0.5; #Mission Control animation speed StandardHideDesktopIcons = false;
dock.minimize-to-application = true; #Minimize windows into their application icon };
dock.persistent-apps = [ #Dock apps
alf = {
globalstate = 1; #Firewall
stealthenabled = 1; #Drop incoming ping requests
};
dock = {
autohide = false;
autohide-delay = 0.0;
autohide-time-modifier = 0.5; #Dock autohide animation speed
expose-animation-duration = 0.5; #Mission Control animation speed
minimize-to-application = true; #Minimize windows into their application icon
persistent-apps = [ #Dock apps
"/Applications/Safari.app" "/Applications/Safari.app"
"/System/Applications/Utilities/Terminal.app" "/System/Applications/Utilities/Terminal.app"
]; ];
dock.persistent-others = [ #Dock folders
persistent-others = [ #Dock folders
"~/Downloads" "~/Downloads"
]; ];
dock.show-recents = false; #Dock show ecent apps
dock.showhidden = true; show-recents = false; #Dock show ecent apps
dock.static-only = true; #Show only open apps in dock showhidden = true;
dock.tilesize = 32; #Dock icon size static-only = true; #Show only open apps in dock
finder.AppleShowAllExtensions = true; tilesize = 32; #Dock icon size
finder.AppleShowAllFiles = true; };
finder.FXDefaultSearchScope = "SCcf"; #Search defaults to current folder
finder.FXEnableExtensionChangeWarning = false;
finder.FXPreferredViewStyle = "Nlsv"; #Default to list view finder = {
finder.ShowPathbar = true; AppleShowAllExtensions = true;
finder.ShowStatusBar = true; AppleShowAllFiles = true;
finder._FXSortFoldersFirst = true; FXDefaultSearchScope = "SCcf"; #Search defaults to current folder
FXEnableExtensionChangeWarning = false;
FXPreferredViewStyle = "Nlsv"; #Default to list view
ShowPathbar = true;
ShowStatusBar = true;
_FXSortFoldersFirst = true;
};
loginwindow.GuestEnabled = false; loginwindow.GuestEnabled = false;
menuExtraClock.Show24Hour = false;
menuExtraClock.ShowAMPM = true; menuExtraClock = {
menuExtraClock.ShowDayOfMonth = true; Show24Hour = false;
ShowAMPM = true;
ShowDayOfMonth = true;
};
screencapture.disable-shadow = true; screencapture.disable-shadow = true;
screensaver.askForPassword = true; screensaver.askForPassword = true;
trackpad.Clicking = true; #Tap to click trackpad.Clicking = true; #Tap to click
trackpad.Dragging = true; trackpad.Dragging = true;
}; };
system.keyboard = { system.keyboard = {
enableKeyMapping = true; enableKeyMapping = true;
remapCapsLockToControl = true; remapCapsLockToControl = true;

View File

@@ -13,19 +13,28 @@
outputs = { self, nixpkgs, ... }@inputs: outputs = { self, nixpkgs, ... }@inputs:
let let
configuration = { lib, config, pkgs, inputs, ... }: { configuration = { lib, config, pkgs, inputs, ... }: {
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ ]; environment = {
systemPackages = with pkgs; [ ];
shells = with pkgs; [ zsh ];
};
users.users.trude = { users = {
defaultUserShell = pkgs.zsh;
users.trude = {
isNormalUser = true; isNormalUser = true;
initialPassword = "trude"; initialPassword = "trude";
description = "TrudeEH"; description = "TrudeEH";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];
}; };
};
programs.zsh.enable = true;
# Home-manager module.
home-manager = { home-manager = {
extraSpecialArgs = {inherit inputs;}; extraSpecialArgs = {inherit inputs;};
backupFileExtension = "backup"; backupFileExtension = "backup";
@@ -34,39 +43,44 @@
}; };
}; };
# Network. networking = {
networking.hostName = "trudeDev"; hostName = "trudeDev";
networking.networkmanager.enable = true; networkmanager.enable = true;
#firewall.allowedTCPPorts = [ ... ];
#firewall.allowedUDPPorts = [ ... ];
};
# GNOME. services = {
services.xserver.enable = true; xserver = {
services.xserver.displayManager.gdm.enable = true; enable = true;
services.xserver.desktopManager.gnome.enable = true; displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
# Enable CUPS to print documents. xkb = {
services.printing.enable = true; layout = "pt";
variant = "";
# Enable sound with pipewire. };
hardware.pulseaudio.enable = false; };
security.rtkit.enable = true; printing.enable = true;
services.pipewire = { pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
#jack.enable = true; #jack.enable = true;
}; };
#openssh.enable = true;
};
# System Services. hardware.pulseaudio.enable = false;
# services.openssh.enable = true; security.rtkit.enable = true;
virtualisation.libvirtd.enable = true;
# Firewall. boot = {
# networking.firewall.allowedTCPPorts = [ ... ]; loader.systemd-boot.enable = true;
# networking.firewall.allowedUDPPorts = [ ... ]; loader.efi.canTouchEfiVariables = true;
supportedFilesystems = ["ntfs"];
};
# System options.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
time.timeZone = "Europe/Lisbon"; time.timeZone = "Europe/Lisbon";
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = { i18n.extraLocaleSettings = {
@@ -80,10 +94,6 @@
LC_TELEPHONE = "pt_PT.UTF-8"; LC_TELEPHONE = "pt_PT.UTF-8";
LC_TIME = "pt_PT.UTF-8"; LC_TIME = "pt_PT.UTF-8";
}; };
services.xserver.xkb = {
layout = "pt";
variant = "";
};
system.stateVersion = "24.05"; system.stateVersion = "24.05";
}; };
in in