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
;;
3)
chsh -s /bin/bash
mkdir -p ~/.config/nix-darwin/
cp -rf ./nix/macOS/* ~/.config/nix-darwin/
cp -f ./nix/home.nix ~/.config/nix-darwin/

View File

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

View File

@@ -375,10 +375,14 @@ in
# ===========================================================
# Autostart services on boot
services.gnome-keyring.enable = isLinux;
programs.home-manager.enable = true;
services = {
gnome-keyring.enable = isLinux;
};
programs.firefox = {
programs = {
home-manager.enable = true;
firefox = {
enable = false;
policies = {
DisableTelemetry = true;
@@ -505,7 +509,7 @@ in
};
};
programs.neovim = {
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
@@ -518,7 +522,7 @@ in
# even more plugins : https://search.nixos.org/packages
};
programs.tmux = {
tmux = {
enable = true;
aggressiveResize = true;
baseIndex = 1;
@@ -529,6 +533,7 @@ in
plugins = with pkgs; [ tmuxPlugins.cpu ];
prefix = "C-s";
terminal = "tmux-256color";
shell = "${pkgs.zsh}/bin/zsh";
extraConfig = ''
bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
@@ -566,7 +571,7 @@ in
'';
};
programs.git = {
git = {
enable = true;
userName = "TrudeEH";
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;
enableCompletion = true;
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;
package = pkgs.vscodium;
enableUpdateCheck = false;
@@ -701,4 +753,5 @@ in
"explorer.confirmDelete" = false;
};
};
};
}

View File

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

View File

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