merge paperclover changes in :3

This commit is contained in:
Natalie 2025-05-07 10:22:05 -07:00
parent 5170a02cf0
commit 91c676f3f5
No known key found for this signature in database
GPG key ID: 61F4EAEB0C9C3D5F
37 changed files with 872 additions and 444 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
flake.lock
.DS_STORE
**/.DS_STORE
result
result-*

View file

@ -2,7 +2,6 @@
description = "New Modular flake!";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
# nixpkgs.url = "github:NixOS/nixpkgs/master";
nixpkgs-stable.url = "nixpkgs/nixos-23.11";
home-manager.url = "github:nix-community/home-manager/master";
@ -69,41 +68,51 @@
inputs.nh.overlays.default
];
# ----- USER SETTINGS ----- #
userSettings = rec {
#enable if you want to use a tiling wm on macos
darwinTiling = true;
username = "nmarks"; # username
name = "Natalie"; # name/identifier
email = "nmarks413@gmail.com"; # email (used for certain configurations)
dotfilesDir = "~/.dotfiles"; # absolute path of the local repo
theme = "catppuccin-mocha"; #name of theme that stylix will use
browser = "firefox"; # Default browser; must select one from ./user/app/browser/
term = "ghostty"; # Default terminal command;
font = "iosevka"; # Selected font
editor = "neovim"; # Default editor;
spawnEditor = "exec" + term + " -e " + editor;
timeZone = "America/Los_Angeles";
sexuality = "bisexual";
darwinHost = "laptop";
nixosHost = "desktop";
};
mkSystem = import ./lib/mkSystem.nix {
inherit overlays nixpkgs inputs userSettings;
inherit overlays nixpkgs inputs;
};
in {
in rec {
# "nix run .#darwin-rebuild"
packages.aarch64-darwin.darwin-rebuild = darwin.packages.aarch64-darwin.darwin-rebuild;
# "nix fmt ."
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
formatter.aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.alejandra;
# natalie's desktop computer
nixosConfigurations.nixos = mkSystem "nixos" {
user = "natalie";
host = "desktop";
system = "x86_64-linux";
extraModules = [
nixos-cosmic.nixosModules.default
];
};
# natalie's laptop
darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" {
user = "natalie";
host = "laptop";
system = "aarch64-darwin";
darwin = true;
};
# chloe's mac studio "sandwich"
darwinConfigurations.sandwich = mkSystem "sandwich" {
user = "chloe";
host = "sandwich";
system = "aarch64-darwin";
};
# chloe's macbook air "paperback"
darwinConfigurations.paperback = mkSystem "paperback" {
user = "chloe";
host = "paperback";
system = "aarch64-darwin";
};
# generate checks for "nix flake check --all-systems --no-build"
checks.aarch64-darwin = builtins.listToAttrs (builtins.map (name: let
d = darwinConfigurations.${name}.system;
in {
name = "darwinConfiguration-" + d.name;
value = d;
}) (builtins.attrNames darwinConfigurations));
};
}

BIN
hosts/.DS_Store vendored

Binary file not shown.

View file

@ -1,72 +0,0 @@
{
inputs,
config,
pkgs,
lib,
userSettings,
systemSettings,
...
}: let
shared-programs = import ../../modules/shared/homeManagerPrograms.nix {inherit inputs config pkgs lib userSettings systemSettings;};
in {
imports = [
inputs.nixvim.homeManagerModules.nixvim
#set up nixvim
# ../../modules/nixvim
];
home = {
stateVersion = "23.05"; # Please read the comment before changing.
packages = with pkgs; let
shared-packages = import ../../modules/shared/packages.nix {inherit pkgs systemSettings;};
in
shared-packages
++ [
#building macos apps hard :(
ghostty
stremio
julia
qbittorrent
#gaming
bottles
lutris
mangohud
dxvk_2
steam-run
vulkan-tools
path-of-building
wineWowPackages.stable
winetricks
(prismlauncher.override {gamemodeSupport = true;})
#window manager stuff
wofi
xorg.xauth
#linux tools
legcord
pavucontrol
ethtool
grub2
efibootmgr
distrobox
xdg-desktop-portal-gtk
xclip
kdePackages.dolphin
#broken on macos
calibre
mpv
wireguard-tools
signal-desktop
]
++ [
inputs.zls.packages.x86_64-linux.zls
rust-bin.stable.latest.default
];
# programs.mangohud.enable = true;
};
programs = shared-programs;
# xdg.mimeApps.defaultApplications."inode/directory" = "dolphin.desktop";
}

BIN
hosts/laptop/.DS_Store vendored

Binary file not shown.

View file

@ -1,40 +0,0 @@
{
inputs,
config,
pkgs,
lib,
userSettings,
systemSettings,
...
}: {
imports =
[
inputs.nixvim.homeManagerModules.nixvim
#set up nixvim
# ../../modules/nixvim
]
++ lib.optionals userSettings.darwinTiling [../../modules/macos/tiling/sketchybar-home.nix];
programs = import ../../modules/shared/homeManagerPrograms.nix {inherit inputs config pkgs lib userSettings systemSettings;};
home = {
inherit (userSettings) username;
# homeDirectory = systemSettings.homeConfig;
# shell = pkgs.fish;
stateVersion = "23.05"; # Please read the comment before changing.
packages = pkgs.callPackage ../../modules/shared/packages.nix {inherit systemSettings;};
# file = {
# ".config/sketchybar" = {
# source = ../../modules/macos/tiling/sketchybar;
# recursive = true;
# onChange = "${pkgs.sketchybar}/bin/sketchybar --reload";
# };
# };
sessionPath = [
"$HOME/.emacs.d/bin"
];
};
}

View file

@ -4,116 +4,149 @@
nixpkgs,
overlays,
inputs,
userSettings,
}: name: {
system,
darwin ? false,
user, # ./users/{name}
host ? null, # ./users/{name}/{host} (optional)
system, # arch-os
extraModules ? [],
}: let
nixindex =
if darwin
then inputs.nix-index-database.darwinModules.nix-index
else inputs.nix-index-database.nixosModules.nix-index;
inherit (builtins) pathExists;
darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system;
getInputModule = a: b:
inputs.${
a
}.${
if darwin
then "darwinModules"
else "nixosModules"
}.${
b
};
stylix =
# NixOS vs nix-darwin functions
systemFunc =
if darwin
then inputs.stylix.darwinModules.stylix
else inputs.stylix.nixosModules.stylix;
then inputs.darwin.lib.darwinSystem
else nixpkgs.lib.nixosSystem;
systemModuleDir =
if darwin
then "macos"
else "nixos";
userDir = ../users + "/${user}";
userConfig = import (userDir + "/user.nix");
hostDir = userDir + "/${host}";
hostConfigPath = hostDir + "/configuration.nix";
userConfigPath = userDir + "/configuration.nix";
hostHomePath = hostDir + "/home.nix";
userHomePath = userDir + "/home.nix";
# Arguments passed to all module files
args = {
inherit inputs;
currentSystem = system;
# Details about the host machine
host = {
inherit darwin name;
};
user = ({
# This acts as formal documentation for what is allowed in user.nix
username, # unix username
name, # your display name
email, # for identity in programs such as git
dotfilesDir, # location to `../.`
timeZone ? "America/Los_Angeles",
# Stylix/Theming
theme ? null, # theme name for stylix
sexuality ? null, # pride flag for hyfetch
font ? null, # font to use
term, # preferred $TERM
editor, # preferred $EDITOR
browser ? null, # preferred $BROWSER
} @ user:
user)
userConfig;
};
systemSettings = rec {
inherit darwin;
host =
homeDir = "/${
if darwin
then userSettings.darwinHost
else userSettings.nixosHost;
# The config files for this system.
hostConfig = ../hosts/${host}/configuration.nix;
homeConfig = ../hosts/${host}/home.nix;
homeDir =
if darwin
then "/Users/" + userSettings.username + "/"
else "/home/" + userSettings.username + "/";
# NixOS vs nix-darwin functions
systemFunc =
if darwin
then inputs.darwin.lib.darwinSystem
else nixpkgs.lib.nixosSystem;
hmModules =
if darwin
then inputs.home-manager.darwinModules
else inputs.home-manager.nixosModules;
then "Users"
else "home"
}/${userConfig.username}";
};
in
with systemSettings;
systemFunc rec {
inherit system;
systemFunc {
inherit system;
#gross and ugly hack do NOT like
specialArgs = {
inherit (userSettings) darwinTiling;
};
modules =
builtins.filter (f: f != null)
[
# Apply our overlays. Overlays are keyed by system type so we have
# to go through and apply our system type. We do this first so
# the overlays are available globally.
{nixpkgs.overlays = overlays;}
modules =
[
# Apply our overlays. Overlays are keyed by system type so we have
# to go through and apply our system type. We do this first so
# the overlays are available globally.
{nixpkgs.overlays = overlays;}
# Modules shared between nix-darwin and NixOS
../modules/shared
# Modules for the specific OS
(
if darwin
then ../modules/macos
else ../modules/nixos
)
# Enable caching for nix-index so we dont have to rebuild it
# The user-wide configuration.nix
(
if pathExists userConfigPath
then userConfigPath
else null
)
# The host-wide configuration.nix
(
if host != null && pathExists hostConfigPath
then hostConfigPath
else null
)
#shared modules
../modules/shared
# Set up nix-index and enable comma for easy one-shot command use
# https://github.com/nix-community/comma
(getInputModule "nix-index-database" "nix-index")
{programs.nix-index-database.comma.enable = true;}
#system specific modules
../modules/${systemModuleDir}
# Themes for all programs
(getInputModule "stylix" "stylix")
# Link to config.nix
hostConfig
# Home manager
(getInputModule "home-manager" "home-manager")
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "hm-backup";
# Arguments passed to all module files
extraSpecialArgs =
args
// {
mainHomeImports = builtins.filter (f: f != null) [
(
if pathExists userHomePath
then userHomePath
else null
)
(
if host != null && pathExists hostHomePath
then hostHomePath
else null
)
];
};
# can't find how to make this an array without the param
users.${userConfig.username} = ../modules/home-manager.nix;
};
users.users.${userConfig.username}.home = systemSettings.homeDir;
}
#Set up nix-index and enable comma for easy one-shot command use
#https://github.com/nix-community/comma
nixindex
{programs.nix-index-database.comma.enable = true;}
#style programs
stylix
hmModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "hm-backup";
extraSpecialArgs = {inherit inputs userSettings systemSettings;};
users.${userSettings.username} = homeConfig;
};
users.users.${userSettings.username}.home = homeDir;
}
# We expose some extra arguments so that our modules can parameterize
# better based on these values.
{
config._module.args = {
currentSystem = system;
# currentSystemName = name;
# currentSystemUser = userSettings.username;
inherit inputs userSettings systemSettings;
};
}
]
#Add extra modules depending on system
++ extraModules;
}
# Arguments passed to all module files
{config._module.args = args;}
]
# Add extra modules specified from config
++ extraModules;
}

82
modules/home-manager.nix Normal file
View file

@ -0,0 +1,82 @@
# This contains default configurations for set of programs
# and configuration, but does not enable many things on it's own.
{
pkgs,
lib,
config,
user,
host,
mainHomeImports,
...
}: let
cfg = config.programs;
in {
imports = mainHomeImports;
programs = {
home-manager.enable = true;
nix-index.enable = true;
direnv = {
enableZshIntegration = true;
nix-direnv.enable = config.programs.direnv.enable;
};
git = {
enable = true;
userName = lib.mkDefault user.name;
userEmail = lib.mkDefault user.email;
ignores = [
(lib.mkIf host.darwin ".DS_Store") # When using Finder
(lib.mkIf host.darwin "._*") # When using non-APFS drives
# ViM and Neovim
".*.swp"
".nvimlog"
];
};
atuin = {
enableBashIntegration = true;
enableFishIntegration = true;
daemon.enable = cfg.atuin.enable;
};
bat = {
extraPackages = with pkgs.bat-extras; [batdiff batman batgrep batwatch batpipe prettybat];
};
hyfetch = {
settings = {
backend = "fastfetch";
preset = user.sexuality;
mode = "rgb";
light_dark = "dark";
lightness = {
};
color_align = {
mode = "horizontal";
};
};
};
fastfetch.enable = cfg.hyfetch.enable;
fish = {
plugins = [
{
name = "tide";
inherit (pkgs.fishPlugins.tide) src;
}
{
name = "!!";
inherit (pkgs.fishPlugins.bang-bang) src;
}
];
shellAliases =
{}
// lib.optionalAttrs (!host.darwin) {
reboot-windows = "sudo efibootmgr --bootnext 0000; sudo reboot -h now";
};
shellInit = ''
batman --export-env | source
'';
##test -r '/Users/${user.username}/.opam/opam-init/init.fish' && source '/Users/${user.username}/.opam/opam-init/init.fish' > /dev/null 2> /dev/null; or true
};
};
}

View file

@ -1,13 +1,20 @@
{
pkgs,
lib,
darwinTiling,
...
}: {
imports =
[
./homebrew.nix
./system.nix
]
++ lib.optionals darwinTiling [./tiling];
imports = [
# sort-lines: start
./mac-app-store.nix
./system.nix
./icons.nix
./tiling
# sort-lines: end
];
# make 'shared.linux' not an error to define.
options.shared.linux = lib.mkOption {
type = lib.types.anything;
default = {};
description = "no-op on darwin";
};
}

View file

@ -0,0 +1,44 @@
{
config,
lib,
pkgs,
...
}: let
types = lib.types;
# Mapping of Mac App Store applications.
# Add new entries to this list via the App Store's share button
# https://apps.apple.com/us/app/logic-pro/id634148309?mt=12
# --------- ID HERE
allMasApps = {
# sort-lines:start
adguard = 1440147259;
final-cut-pro = 424389933;
logic-pro = 634148309;
magnet = 441258766;
motion = 434290957;
wireguard = 1451685025;
# sort-lines:end
};
# the resolved configuration from the user
masApps = config.shared.darwin.macAppStoreApps;
in {
options = {
# Installs Mac Applications via name using homebrew.
shared.darwin.macAppStoreApps = lib.mkOption {
type = types.listOf types.str;
default = [];
};
};
config = lib.mkIf (builtins.length masApps > 0) {
homebrew.enable = true;
homebrew.masApps = builtins.listToAttrs (
builtins.map (name: {
inherit name;
value = allMasApps.${name};
})
masApps
);
};
}

View file

@ -1,21 +1,25 @@
{
config,
pkgs,
userSettings,
lib,
...
}: {
#Use touchid or watch to activate sudo
}: let
tiling = config.shared.darwin.tiling.enable;
in {
# Use touchid or watch to activate sudo
security.pam.services.sudo_local = {
enable = true;
reattach = true;
touchIdAuth = true;
};
# set some OSX preferences that I always end up hunting down and changing.
# Set some OSX preferences that I always end up hunting down and changing.
system = {
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
stateVersion = 6;
defaults = {
defaults = lib.mkDefault {
# Turn quarantine off
LaunchServices = {
LSQuarantine = false;
@ -53,14 +57,14 @@
NSDocumentSaveNewDocumentsToCloud = false;
AppleICUForce24HourTime = true;
#Autohide menu bar
_HIHideMenuBar = userSettings.darwinTiling;
# Autohide menu bar for tiling window manager
_HIHideMenuBar = tiling;
};
# minimal dock
dock = {
autohide = true;
#instant hide and show
autohide-time-modifier = 0.0;
autohide-time-modifier = 0.0; # make animation instant
autohide-delay = 0.0; # remove delay when touching bottom of screen
show-process-indicators = true;
expose-group-apps = true;
@ -80,13 +84,12 @@
AppleShowAllExtensions = true;
ShowPathbar = true;
FXEnableExtensionChangeWarning = false;
# TODO: default to list view and not saving .DS_Store
};
CustomSystemPreferences = {
"com.apple.universalaccess" = {
closeViewTrackpadGestureZoomEnabled = 1;
};
"com.apple.symbolichotkeys" = {
AppleSymbolicHotKeys = {
"64" = {
@ -96,7 +99,6 @@
};
};
};
# Bind caps to escape for better normal mode stuff
keyboard = {
enableKeyMapping = true;

View file

@ -1,6 +1,6 @@
{pkgs, ...}: {
{config,pkgs, ...}: {
services.aerospace = {
enable = true;
enable = config.shared.darwin.tiling.enable;
settings = {
# Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization
enable-normalization-flatten-containers = true;

View file

@ -1,6 +1,16 @@
{pkgs, ...}: {
{ lib, ... }: let
inherit (lib) types;
in {
imports = [
./aerospace.nix
./sketchybar.nix
./aerospace.nix
];
options = {
shared.darwin.tiling.enable = lib.mkOption {
type = types.bool;
default = false;
example = true;
description = "Enable tiling window management.";
};
};
}

View file

@ -1,6 +1,150 @@
{pkgs, ...}: {
{config,pkgs, ...}: {
services.sketchybar = {
enable = true;
package = pkgs.sketchybar;
enable = config.shared.darwin.tiling.enable;
config = ''
# This is a demo config to showcase some of the most important commands.
# It is meant to be changed and configured, as it is intentionally kept sparse.
# For a (much) more advanced configuration example see my dotfiles:
# https://github.com/FelixKratz/dotfiles
PLUGIN_DIR="$CONFIG_DIR/plugins"
##### 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 position=top height=40 blur_radius=30 color=0x04313244
# Colours
SURFACE=0xff313244
##### Changing Defaults #####
# We now change some default values, which are applied to all further items.
# For a full list of all available item properties see:
# https://felixkratz.github.io/SketchyBar/config/items
default=(
padding_left=5
padding_right=5
icon.font="Hack Nerd Font:Bold:17.0"
label.font="Hack Nerd Font:Bold:14.0"
icon.color=0xffcdd6f4
label.color=0xffcdd6f4
icon.padding_left=8
icon.padding_right=4
label.padding_left=4
label.padding_right=8
background.padding_left=2
background.padding_right=2
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
background.border_width=1 \
)
sketchybar --default "$\{default[@]}"
sketchybar --add event aerospace_workspace_change
for sid in $(aerospace list-workspaces --all); do
sketchybar --add item space.$sid left \
--subscribe space.$sid aerospace_workspace_change \
--set space.$sid \
background.border_width=1 \
background.border_color=0xffb4befe \
background.corner_radius=5 \
background.height=20 \
icon.padding_left=0 \
icon.padding_right=0 \
label.padding_right=6 \
label="$sid" \
click_script="aerospace workspace $sid" \
script="$CONFIG_DIR/plugins/aerospace.sh $sid"
done
##### Adding Left Items #####
# We add some regular items to the left side of the bar, where
# only the properties deviating from the current defaults need to be set
sketchybar --add item chevron left \
--set chevron icon= label.drawing=off background.drawing=off \
icon.color=0xfff5e0dc \
--add item front_app left \
--set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \
label.color=0xff94e2d5 \
label.padding_left=8 \
background.border_color=0xff94e2d5 \
--subscribe front_app front_app_switched
##### Adding Right Items #####
# In the same way as the left items we can add items to the right side.
# Additional position (e.g. center) are available, see:
# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar
# Some items refresh on a fixed cycle, e.g. the clock runs its script once
# every 10s. Other items respond to events they subscribe to, e.g. the
# volume.sh script is only executed once an actual change in system audio
# volume is registered. More info about the event system can be found here:
# https://felixkratz.github.io/SketchyBar/config/events
sketchybar --add item clock right \
--set clock update_freq=10 icon=󰃰 script="$PLUGIN_DIR/clock.sh" \
icon.color=0xfffab387 \
label.color=0xffcdd6f4 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
--add item volume right \
--set volume script="$PLUGIN_DIR/volume.sh" \
label.color=0xffcdd6f4 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
--subscribe volume volume_change \
--add item battery right \
--set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
label.color=0xffcdd6f4 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
--subscribe battery system_woke power_source_change
sketchybar -m --add item mullvad right \
--set mullvad icon= \
icon.color=0xfff38ba8 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
background.border_width=1 \
background.border_color=0xfff38ba8 \
label.padding_left=0 \
label.padding_right=0 \
icon.padding_left=6 \
update_freq=5 \
script="$PLUGIN_DIR/mullvad.sh"
# Add event
sketchybar -m --add event song_update com.apple.iTunes.playerInfo
# Add Music Item
sketchybar -m --add item music right \
--set music script="$PLUGIN_DIR/music.sh" \
click_script="$PLUGIN_DIR/music_click.sh" \
label.padding_right=10 \
label.color=0xffcdd6f4 \
background.color=$SURFACE \
background.corner_radius=10 \
background.height=30 \
background.border_width=1 \
background.border_color=0xfff38ba8 \
drawing=off \
--subscribe music song_update
##### Force all scripts to run the first time (never do this in a script) #####
sketchybar --update
'';
};
}

View file

@ -1,8 +1,14 @@
{pkgs, ...}: {
{ lib, pkgs, ... }: {
imports = [
./boot.nix
./ld.nix
./nvidia.nix
./services.nix
];
# make 'shared.darwin' not an error to define.
options.shared.darwin = lib.mkOption {
type = lib.types.anything;
default = {};
description = "no-op on linux";
};
}

View file

@ -1,6 +1,9 @@
# shared is used by nixos-rebuild and darwin-rebuild
{pkgs, ...}: {
imports = [
./extras.nix
# sort-lines:start
./user-system-settings.nix
./nix.nix
# sort-lines:end
];
}

View file

@ -1,53 +0,0 @@
{
inputs,
pkgs,
userSettings,
...
}: {
services.tailscale.enable = true;
networking = {
};
fonts.packages = with pkgs; [
nerd-fonts.fira-code
nerd-fonts.iosevka
iosevka
nerd-fonts.symbols-only
nerd-fonts.iosevka
inputs.apple-fonts.packages.${pkgs.system}.sf-pro
];
# Set your time zone.
time.timeZone = userSettings.timeZone;
home-manager.users.${userSettings.username}.home.sessionVariables = {
EDITOR = userSettings.editor;
VISUAL = userSettings.editor;
TERMINAL = userSettings.term;
BROWSER = userSettings.browser;
};
stylix = {
enable = true;
base16Scheme = "${pkgs.base16-schemes}/share/themes/${userSettings.theme}.yaml";
fonts = {
serif = {
package = pkgs.nerd-fonts.${userSettings.font};
name = "${userSettings.font} Nerd Font";
};
sansSerif = {
package = pkgs.nerd-fonts.${userSettings.font};
name = "${userSettings.font} Nerd Font";
};
monospace = {
package = pkgs.nerd-fonts.${userSettings.font};
name = "${userSettings.font} Nerd Font";
};
emoji = {
package = pkgs.twemoji-color-font;
name = "Twemoji Color";
};
};
};
}

View file

@ -1,67 +0,0 @@
{
pkgs,
lib,
userSettings,
systemSettings,
...
}: {
nix-index.enable = true;
atuin = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
daemon.enable = true;
};
direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
bat = {
enable = true;
extraPackages = with pkgs.bat-extras; [batdiff batman batgrep batwatch batpipe prettybat];
};
hyfetch = {
enable = true;
settings = {
backend = "fastfetch";
preset = userSettings.sexuality;
mode = "rgb";
light_dark = "dark";
lightness = {
};
color_align = {
mode = "horizontal";
};
};
};
fish = {
enable = true;
plugins = [
{
name = "tide";
inherit (pkgs.fishPlugins.tide) src;
}
{
name = "!!";
inherit (pkgs.fishPlugins.bang-bang) src;
}
];
shellAliases =
{
}
// lib.optionalAttrs (!systemSettings.darwin) {
reboot-windows = "sudo efibootmgr --bootnext 0000; sudo reboot -h now";
};
shellInit = ''
batman --export-env | source
'';
##test -r '/Users/${userSettings.username}/.opam/opam-init/init.fish' && source '/Users/${userSettings.username}/.opam/opam-init/init.fish' > /dev/null 2> /dev/null; or true
};
home-manager.enable = true;
}

View file

@ -0,0 +1,43 @@
# applies user settings for the system
{
pkgs,
user,
lib,
...
}: {
# Set your time zone.
time.timeZone = user.timeZone;
home-manager.users.${user.username}.home.sessionVariables =
{
EDITOR = user.editor;
TERMINAL = user.term;
}
// lib.optionalAttrs (user ? "browser") {
BROWSER = user.browser;
};
stylix = {
enable = user ? "theme";
base16Scheme = "${pkgs.base16-schemes}/share/themes/${user.theme}.yaml";
fonts = lib.optionalAttrs (user ? "font") {
serif = {
package = pkgs.nerd-fonts.${user.font};
name = "${user.font} Nerd Font";
};
sansSerif = {
package = pkgs.nerd-fonts.${user.font};
name = "${user.font} Nerd Font";
};
monospace = {
package = pkgs.nerd-fonts.${user.font};
name = "${user.font} Nerd Font";
};
emoji = {
package = pkgs.twemoji-color-font;
name = "Twemoji Color";
};
};
};
}

View file

@ -1,47 +0,0 @@
{
description = "My first flake!";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
home-manager = {
url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
# nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=<0.2.0>";
# hyprland.url = "github:hyprwm/Hyprland";
# hyprland-plugins = {
# url = "github:hyprwm/hyprland-plugins";
# inputs.hyprland.follows = "hyprland";
# };
# use the following for unstable:
# nixpkgs.url = "nixpkgs/nixos-unstable";
# or any branch you want:
# nixpkgs.url = "nixpkgs/{BRANCH-NAME}"
};
outputs = {
self,
home-manager,
nixpkgs,
...
}: let
system = "x86_64-linux";
lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages.${system};
in {
nixosConfigurations = {
nmarks = lib.nixosSystem {
inherit system;
modules = [./configuration.nix];
};
};
homeConfigurations = {
nmarks = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [./home.nix];
};
};
};
}

65
readme.md Normal file
View file

@ -0,0 +1,65 @@
# nix config
this setup allows natalie and chloe to share common configuration between their machines, but also share useful modules between each other.
```
lib/ # reusable functions
modules/ # reusable modules
+-- macos/ # nix-darwin configurations
+-- nixos/ # linux configurations
+-- nixvim/ # neovim configurations
+-- shared/ # shared between nixos-rebuild & darwin-rebuild
+-- home-manager.nix # home program presets
users/
+-- chloe/
| +-- user.nix # info about her
| +-- configuration.nix # for all hosts
| +-- home.nix # for all hosts
| +-- sandwich/
| | +-- configuration.nix # per host
| | +-- home.nix
| +-- paperback/
| ...
+-- natalie/
+-- user.nix # info about her
...
```
A new machine can be added by adding a new definition in `flake.nix`. Note that the user and host `configuration.nix` and `home.nix` files are
## macOS installation instructions
Install Nix using the upstream Nix (Pick "no" then "yes):
```
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
sh -s -- install
```
While this installs, now is a good time to perform manual setup steps:
- Setup your SSH keys in `~/.ssh`
- Configure the device hostname in System Settings in
- About -> Name
- General -> Sharing -> Local Hostname
- Make sure you're logged into iCloud / Mac App Store
- `xcode-select --install` to make sure Git and other utilities are available.
- Optional: Disable app verification with `sudo spctl --master-disable`, then, go to System Settings -> Privacy to allow unsigned apps.
Once Nix is installed, open a new shell and clone the repository:
```
# Clone via HTTPs
git clone https://git.paperclover.net/clo/config.git
# With SSH Authentication
git clone git@git.paperclover.net:clo/config
```
The location of the cloned repository must match what is in your `user.nix` file.
Setup `nix-darwin` using the `switch` helper:
```
./switch
```

12
switch Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
nh_subcommand="os"
fallback_command="nixos-rebuild"
if [ "$(uname -o)" ]; then
nh_subcommand="darwin"
fallback_command="nix run .#darwin-rebuild"
fi;
if command -v nh > /dev/null; then
nh $nh_subcommand switch .
else
$fallback_command -- switch --flake .
fi

View file

@ -0,0 +1,28 @@
# Configuration applied to all of chloe's machines
{ pkgs, ... }: {
# packages for all machines
environment.systemPackages = with pkgs; [
neovim
];
# configuration for shared modules.
# all custom options in 'shared' for clarity.
shared.darwin = {
macAppStoreApps = [
"adguard"
"magnet"
];
};
# system preferences
system.defaults = {
NSGlobalDomain = {
KeyRepeat = 1;
InitialKeyRepeat = 10;
};
CustomUserPreferences = {
NSGlobalDomain = {
# TODO: how to change system accent color
AppleHighlightColor = "1.000000 0.874510 0.701961 Orange";
};
};
};
}

24
users/chloe/home.nix Normal file
View file

@ -0,0 +1,24 @@
{
inputs,
pkgs,
lib,
...
}: {
home = {
stateVersion = "23.05"; # Please read the comment before changing.
packages = [
pkgs.neovim
pkgs.nh
pkgs.ffmpeg
];
};
programs = {
# sort-lines:start
hyfetch.enable = true;
zsh.enable = true;
# sort-lines:end
# use a git-specific email
git.userEmail = "git@paperclover.net";
};
}

View file

@ -0,0 +1,5 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
reaper
];
}

View file

@ -0,0 +1,14 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
ffmpeg
ripgrep
reaper
];
shared.darwin = {
macAppStoreApps = [
"final-cut-pro"
"logic-pro"
"motion"
];
};
}

18
users/chloe/user.nix Normal file
View file

@ -0,0 +1,18 @@
# This definition is used by modules to customize as needed.
{
username = "clo"; # username
name = "chloe caruso";
email = "account@paperclover.net";
timeZone = "America/Los_Angeles";
dotfilesDir = "~/config"; # absolute path of the local repo
# Stylix/Theming
theme = "catppuccin-mocha";
#font
sexuality = "lesbian"; # hyfetch
# Default terminal command. NOTE: ghostty is not installed for you
term = "ghostty"; # preferred $TERMINAL
editor = "nvim"; # preferred $EDITOR
}

View file

@ -0,0 +1,17 @@
# Applied to all systems
{pkgs, ...}: {
services.tailscale.enable = true;
fonts.packages = with pkgs; [
nerd-fonts.fira-code
nerd-fonts.iosevka
iosevka
nerd-fonts.symbols-only
nerd-fonts.iosevka
];
# configuration for shared modules.
# all custom options in 'shared' for clarity.
shared.darwin = {
tiling.enable = true; # use tiling window manager
};
}

View file

@ -1,7 +1,7 @@
{
pkgs,
userSettings,
systemSettings,
user,
host,
...
}: {
imports = [
@ -16,7 +16,7 @@
enable = true;
# Certain features, including CLI integration and system authentication support,
# require enabling PolKit integration on some desktop environments (e.g. Plasma).
polkitPolicyOwners = [userSettings.username];
polkitPolicyOwners = [user.username];
};
noisetorch.enable = true;
@ -75,7 +75,7 @@
libvirtd.enable = true;
};
nix.settings.trusted-users = ["root" userSettings.username];
nix.settings.trusted-users = ["root" user.username];
systemd = {
targets = {
sleep.enable = false;
@ -129,10 +129,10 @@
# Define a user account. Don't forget to set a password with passwd.
# users.defaultUserShell = pkgs.fish;
users.users.${userSettings.username} = {
users.users.${user.username} = {
shell = pkgs.fish;
isNormalUser = true;
description = "Natalie Marks";
description = user.name;
extraGroups = ["networkmanager" "wheel" "docker"];
# openssh.authorizedKeys.keyFiles = ["~/.ssh/id_ed25519.pub"];
packages = with pkgs; [
@ -153,7 +153,7 @@
};
networking = {
hostName = systemSettings.host; # Define your hostname.
hostName = host.name; # Define your hostname.
# wireless.enable = true; # Enables wireless support via wpa_supplicant.
networkmanager.enable = true;
firewall = {

View file

@ -0,0 +1,62 @@
{
inputs,
config,
pkgs,
lib,
userSettings,
systemSettings,
...
}: {
imports = [
inputs.nixvim.homeManagerModules.nixvim
#set up nixvim
# ../../modules/nixvim
];
home = {
stateVersion = "23.05"; # Please read the comment before changing.
packages = with pkgs; [
#building macos apps hard :(
ghostty
stremio
julia
qbittorrent
#gaming
bottles
lutris
mangohud
dxvk_2
steam-run
vulkan-tools
path-of-building
wineWowPackages.stable
winetricks
(prismlauncher.override {gamemodeSupport = true;})
#window manager stuff
wofi
xorg.xauth
#linux tools
legcord
pavucontrol
ethtool
grub2
efibootmgr
distrobox
xdg-desktop-portal-gtk
xclip
kdePackages.dolphin
#broken on macos
calibre
mpv
wireguard-tools
signal-desktop
inputs.zls.packages.x86_64-linux.zls
rust-bin.stable.latest.default
];
# programs.mangohud.enable = true;
};
# xdg.mimeApps.defaultApplications."inode/directory" = "dolphin.desktop";
}

16
users/natalie/home.nix Normal file
View file

@ -0,0 +1,16 @@
{
pkgs,
lib,
...
} @ args: {
programs = {
# sort-lines:start
atuin.enable = true;
bat.enable = true;
hyfetch.enable = true;
direnv.enable = true;
# sort-lines:end
};
home.packages = import ./packages.nix args;
}

View file

@ -1,14 +1,16 @@
{
pkgs,
userSettings,
...
}: {
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
neovim
pinentry_mac
signal-desktop-bin
];
# Custom configuration modules in "modules" are shared between users,
# and can be configured in this "shared" namespace
shared.darwin = {
macAppStoreApps = ["wireguard"];
};
# Create /etc/zshrc that loads the nix-darwin environment.
programs = {
gnupg.agent.enable = true;
@ -25,4 +27,30 @@
fi
'';
};
# Use homebrew to install casks
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "none";
upgrade = true;
};
brews = [
"imagemagick"
"opam"
];
casks = [
"battle-net"
"stremio"
"alt-tab"
"legcord"
"zulip"
"zen-browser"
"supertuxkart"
];
};
}

View file

@ -0,0 +1,23 @@
{
inputs,
config,
pkgs,
lib,
user,
host,
...
} @ args: {
imports = [
inputs.nixvim.homeManagerModules.nixvim
#set up nixvim
# ../../modules/nixvim
];
home = {
stateVersion = "23.05"; # Please read the comment before changing.
# shell = pkgs.fish;
sessionPath = [
"$HOME/.emacs.d/bin"
];
};
}

View file

@ -1,8 +1,5 @@
{
pkgs,
systemSettings,
...
}:
# Packages installed with home-manager
{pkgs, ...}:
with pkgs; [
#general development
just

13
users/natalie/user.nix Normal file
View file

@ -0,0 +1,13 @@
rec {
username = "nmarks"; # username
name = "Natalie"; # name/identifier
email = "nmarks413@gmail.com"; # email (used for certain configurations)
dotfilesDir = "~/.dotfiles"; # absolute path of the local repo
theme = "catppuccin-mocha"; #name of theme that stylix will use
browser = "firefox"; # Default browser; must select one from ./user/app/browser/
term = "ghostty"; # Default terminal command;
font = "iosevka"; # Selected font
editor = "neovim"; # Default editor;
timeZone = "America/Los_Angeles";
sexuality = "bisexual";
}