Merge branch 'main' of https://git.syzygial.cc/Syzygial/NixMachines
This commit is contained in:
8
flake.lock
generated
8
flake.lock
generated
@@ -88,11 +88,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703003068,
|
||||
"narHash": "sha256-cAp7UbrQTiPAfNhIO9DRs271RUJJHPyBYchDJ4wDMd4=",
|
||||
"lastModified": 1706555256,
|
||||
"narHash": "sha256-nBLS68TsIbwd04oQRISqk/xaehZYWzGNDmdBOWpKWXw=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "ed6e88d1069557f1e68aa769934f008cb6c1fed5",
|
||||
"revCount": 45,
|
||||
"rev": "d3452d3f0a30162a8acdf11f452ac0ef3a3f5670",
|
||||
"revCount": 46,
|
||||
"type": "git",
|
||||
"url": "https://git.syzygial.cc/Syzygial/EmacsConfig.git"
|
||||
},
|
||||
|
||||
18
flake.nix
18
flake.nix
@@ -35,6 +35,10 @@
|
||||
# Will in future be macports based
|
||||
mac-emacs = me-emacs.packages."aarch64-darwin".emacs;
|
||||
});
|
||||
|
||||
pkgs_linux-x86_64 = nixpkgs.legacyPackages."x86-linux";
|
||||
pkgs_linux-aarch64 = nixpkgs.legacyPackages."aarch64-linux";
|
||||
|
||||
in {
|
||||
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
@@ -60,7 +64,7 @@
|
||||
sops-nix.nixosModules.sops
|
||||
];
|
||||
};
|
||||
darwinConfigurations."Universe-Air" = nix-darwin.lib.darwinSystem {
|
||||
darwinConfigurations."Universe-MacBook-Air" = nix-darwin.lib.darwinSystem {
|
||||
system = "aarch64-darwin";
|
||||
specialArgs = {
|
||||
inputs = attrs;
|
||||
@@ -76,5 +80,17 @@
|
||||
}
|
||||
];
|
||||
};
|
||||
homeConfigurations."universelaptop" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = pkgs_linux-aarch64;
|
||||
|
||||
# Specify your home configuration modules here, for example,
|
||||
# the path to your home.nix.
|
||||
modules = [ ./machines/asahi/home.nix ];
|
||||
|
||||
extraSpecialArgs = {
|
||||
pkgs-x86_64 = pkgs_linux-x86_64;
|
||||
inputs = attrs;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
62
machines/asahi/home.nix
Normal file
62
machines/asahi/home.nix
Normal file
@@ -0,0 +1,62 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
home.username = "universelaptop";
|
||||
home.homeDirectory = "/home/universelaptop";
|
||||
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
# introduces backwards incompatible changes.
|
||||
#
|
||||
# You should not change this value, even if you update Home Manager. If you do
|
||||
# want to update the value, then make sure to first check the Home Manager
|
||||
# release notes.
|
||||
home.stateVersion = "23.11"; # Please read the comment before changing.
|
||||
|
||||
# The home.packages option allows you to install Nix packages into your
|
||||
# environment.
|
||||
home.packages = [
|
||||
me-emacs
|
||||
armcord
|
||||
# TODO: Make home-manager module for loading x86_64 apps and automatically
|
||||
# wrapping them in box64-asahi (page size change, like in Fedora repo)
|
||||
# as well as, with override option, to enable support for box86/wine
|
||||
];
|
||||
|
||||
services.nextcloud-client.enable;
|
||||
|
||||
# Home Manager is pretty good at managing dotfiles. The primary way to manage
|
||||
# plain files is through 'home.file'.
|
||||
home.file = {
|
||||
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
|
||||
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
|
||||
# # symlink to the Nix store copy.
|
||||
# ".screenrc".source = dotfiles/screenrc;
|
||||
|
||||
# # You can also set the file content immediately.
|
||||
# ".gradle/gradle.properties".text = ''
|
||||
# org.gradle.console=verbose
|
||||
# org.gradle.daemon.idletimeout=3600000
|
||||
# '';
|
||||
};
|
||||
|
||||
# Home Manager can also manage your environment variables through
|
||||
# 'home.sessionVariables'. If you don't want to manage your shell through Home
|
||||
# Manager then you have to manually source 'hm-session-vars.sh' located at
|
||||
# either
|
||||
#
|
||||
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
#
|
||||
# or
|
||||
#
|
||||
# /etc/profiles/per-user/universelaptop/etc/profile.d/hm-session-vars.sh
|
||||
#
|
||||
home.sessionVariables = {
|
||||
EDITOR = "emacs";
|
||||
};
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
29
machines/universeair/app-fix.nix
Normal file
29
machines/universeair/app-fix.nix
Normal file
@@ -0,0 +1,29 @@
|
||||
{config, pkgs, lib, ...}: {
|
||||
# Nix-darwin does not link installed applications to the user environment. This means apps will not show up
|
||||
# in spotlight, and when launched through the dock they come with a terminal window. This is a workaround.
|
||||
# Upstream issue: https://github.com/LnL7/nix-darwin/issues/214
|
||||
system.activationScripts.applications.text = lib.mkForce ''
|
||||
echo "setting up /Applications..." >&2
|
||||
applications="/Applications"
|
||||
nix_apps="$applications/Nix Apps"
|
||||
|
||||
# Delete the directory to remove old links
|
||||
rm -rf "$nix_apps"
|
||||
mkdir -p "$nix_apps"
|
||||
find ${config.system.build.applications}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
|
||||
while read src; do
|
||||
# Spotlight does not recognize symlinks, it will ignore directory we link to the applications folder.
|
||||
# It does understand MacOS aliases though, a unique filesystem feature. Sadly they cannot be created
|
||||
# from bash (as far as I know), so we use the oh-so-great Apple Script instead.
|
||||
/usr/bin/osascript -e "
|
||||
set fileToAlias to POSIX file \"$src\"
|
||||
set applicationsFolder to POSIX file \"$nix_apps\"
|
||||
tell application \"Finder\"
|
||||
make new alias at applicationsFolder to fileToAlias
|
||||
# This renames the alias; 'mpv.app alias' -> 'mpv.app'
|
||||
set name of result to \"$(rev <<< "$src" | cut -d'/' -f1 | rev)\"
|
||||
end tell
|
||||
" 1>/dev/null
|
||||
done
|
||||
'';
|
||||
}
|
||||
@@ -1,44 +1,51 @@
|
||||
{ config, pkgs, inputs, ... }: let
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
# Install Apps Detactable by Spotlight
|
||||
./app-fix.nix
|
||||
# Tiling Window Manager
|
||||
./yabai.nix
|
||||
# Shortcuts babe, not Automator
|
||||
./skhd.nix
|
||||
];
|
||||
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
# Auto upgrade nix package and the daemon service.
|
||||
services.nix-daemon.enable = true;
|
||||
nix.package = pkgs.nixUnstable;
|
||||
nix.settings.auto-optimise-store = false;
|
||||
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
users.users.universelaptop = {
|
||||
name = "universelaptop";
|
||||
home = "/Users/universelaptop";
|
||||
};
|
||||
home-manager.users.universelaptop = { pkgs, ... }: {
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
programs.bash.enable = true;
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
initExtra = ''
|
||||
PATH=$HOME/flutter/bin:$PATH
|
||||
DYLD_LIBRARY_PATH=MR/v99/runtime/maci64:MR/v99/sys/os/maci64:MR/v99/bin/maci64:$DYLD_LIBRARY_PATH
|
||||
flakify() {
|
||||
eval "$(direnv hook bash)"
|
||||
if [ ! -e flake.nix ]; then
|
||||
nix flake new -t github:nix-community/nix-direnv .
|
||||
fi
|
||||
$EDITOR flake.nix
|
||||
}
|
||||
'';
|
||||
shellAliases = {
|
||||
ssh = "kitty +kitten ssh";
|
||||
sshu = "ssh universe@syzygial.cc -p 7000";
|
||||
tailscale =
|
||||
"/Applications/Tailscale.app/Contents/MacOS/Tailscale";
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users.universelaptop = { pkgs, ... }: {
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
programs.bash.enable = true;
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
initExtra = ''
|
||||
if [[ $(uname -m) == 'arm64' ]]; then
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
fi
|
||||
'';
|
||||
shellAliases = {
|
||||
ssh = "kitty +kitten ssh";
|
||||
sshu = "ssh universe";
|
||||
};
|
||||
};
|
||||
home.stateVersion = "22.05";
|
||||
};
|
||||
home.stateVersion = "22.05";
|
||||
};
|
||||
|
||||
environment.variables = {
|
||||
EDITOR = "emacs";
|
||||
};
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
environment.systemPackages = (with pkgs; [
|
||||
mac-emacs
|
||||
@@ -57,14 +64,36 @@ flakify() {
|
||||
|
||||
cbqn-replxx
|
||||
|
||||
podman
|
||||
qemu
|
||||
]);
|
||||
# Or any other shell you're using. };
|
||||
# Auto upgrade nix package and the daemon service.
|
||||
services.nix-daemon.enable = true;
|
||||
nix.package = pkgs.nixUnstable;
|
||||
nix.settings.auto-optimise-store = false;
|
||||
# Graphical Apps:
|
||||
rectangle
|
||||
tailscale
|
||||
discord
|
||||
slack
|
||||
# TODO: Consider using Yabai??
|
||||
]);
|
||||
|
||||
homebrew = {
|
||||
# It is not installed by nix, for now, so manually install:
|
||||
# https://brew.sh/
|
||||
enable = true;
|
||||
onActivation = {
|
||||
cleanup = "uninstall";
|
||||
};
|
||||
# Graphical apps to install through homebrew instead of nixpkgs
|
||||
casks = [
|
||||
"firefox"
|
||||
"nextcloud"
|
||||
"tidal"
|
||||
"bitwarden"
|
||||
];
|
||||
# Apps to install outside of nix for when wanting to test/run
|
||||
# things that... aren't used by other people who use nix, like
|
||||
# python apps (which is why poetry is there)
|
||||
brews = [
|
||||
"poetry"
|
||||
];
|
||||
};
|
||||
|
||||
# Create /etc/zshrc that loads the nix-darwin environment.
|
||||
programs.bash.enable = true; # default shell on catalina
|
||||
programs.zsh.enable = true; # default shell on catalina
|
||||
|
||||
30
machines/universeair/sketchybar.nix
Normal file
30
machines/universeair/sketchybar.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{config, pkgs, lib, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
sketchybar
|
||||
];
|
||||
services.sketchybar = {
|
||||
enable = true;
|
||||
config = ''
|
||||
##### Bar Appearance #####
|
||||
# Configuring the general appearance of the bar, these are only some of the
|
||||
# options available. For all options see:
|
||||
# https://felixkratz.github.io/SketchyBar/config/bar
|
||||
# If you are looking for other colors, see the color picker:
|
||||
# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker
|
||||
|
||||
sketchybar --bar height=32 \
|
||||
blur_radius=30 \
|
||||
position=top \
|
||||
sticky=off \
|
||||
padding_left=10 \
|
||||
padding_right=10 \
|
||||
color=0x15ffffff
|
||||
|
||||
##### Finalizing Setup #####
|
||||
# The below command is only needed at the end of the initial configuration to
|
||||
# force all scripts to run the first time, it should never be run in an item script.
|
||||
|
||||
sketchybar --update
|
||||
'';
|
||||
};
|
||||
}
|
||||
9
machines/universeair/skhd.nix
Normal file
9
machines/universeair/skhd.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{config, pkgs, lib, ...}: {
|
||||
services.skhd = {
|
||||
enable = true;
|
||||
skhdConfig = ''
|
||||
cmd + shift - e : open ${pkgs.mac-emacs}/Applications/Emacs.app
|
||||
cmd + shift + ctrl - e : open ${pkgs.kitty}/Applications/Kitty.app
|
||||
'';
|
||||
};
|
||||
}
|
||||
43
machines/universeair/yabai.nix
Normal file
43
machines/universeair/yabai.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
{config, pkgs, lib, ...}: {
|
||||
imports = [
|
||||
# Custom Bar
|
||||
# ./sketchybar.nix
|
||||
# TODO: Customize Bar Later
|
||||
];
|
||||
environment.systemPackages = with pkgs; [
|
||||
yabai
|
||||
];
|
||||
services.yabai = {
|
||||
enable = true;
|
||||
config = {
|
||||
layout = "bsp";
|
||||
focus_follows_mouse = "autofocus";
|
||||
auto_balance = "on";
|
||||
|
||||
top_padding = 5;
|
||||
bottom_padding = 5;
|
||||
left_padding = 5;
|
||||
right_padding = 5;
|
||||
window_gap = 5;
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
yabai -m rule --add app='System Settings' manage=off
|
||||
yabai -m rule --add app='Boot Camp Assistant' manage=off
|
||||
yabai -m rule --add app='System Information' manage=off
|
||||
'';
|
||||
};
|
||||
|
||||
# https://github.com/IvarWithoutBones/dotfiles/blob/main/modules/darwin/yabai/default.nix
|
||||
# The scripting addition needs root access to load, which we want to do automatically when logging in.
|
||||
# Disable the password requirement for it so that a service can do so without user interaction.
|
||||
environment.etc."sudoers.d/yabai-load-sa".text = ''
|
||||
universelaptop ALL = (root) NOPASSWD: sha256:${builtins.hashFile "sha256" "${pkgs.yabai}/bin/yabai"} ${pkgs.yabai}/bin/yabai
|
||||
'';
|
||||
|
||||
launchd.user.agents.yabai-load-sa = {
|
||||
path = [ pkgs.yabai config.environment.systemPath ];
|
||||
command = "/usr/bin/sudo ${pkgs.yabai}/bin/yabai --load-sa";
|
||||
serviceConfig.RunAtLoad = true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user