From 91c676f3f54a4a3e68ea02c7d0dd48e21538345d Mon Sep 17 00:00:00 2001 From: Natalie Date: Wed, 7 May 2025 10:22:05 -0700 Subject: [PATCH] merge paperclover changes in :3 --- .gitignore | 2 + flake.nix | 61 ++--- hosts/.DS_Store | Bin 6148 -> 0 bytes hosts/desktop/home.nix | 72 ------ hosts/laptop/.DS_Store | Bin 6148 -> 0 bytes hosts/laptop/home.nix | 40 ---- lib/mkSystem.nix | 221 ++++++++++-------- modules/home-manager.nix | 82 +++++++ modules/macos/default.nix | 21 +- modules/macos/mac-app-store.nix | 44 ++++ modules/macos/system.nix | 26 ++- modules/macos/tiling/aerospace.nix | 4 +- modules/macos/tiling/default.nix | 14 +- modules/macos/tiling/sketchybar.nix | 150 +++++++++++- modules/nixos/default.nix | 8 +- modules/shared/default.nix | 5 +- modules/shared/extras.nix | 53 ----- modules/shared/homeManagerPrograms.nix | 67 ------ modules/shared/user-system-settings.nix | 43 ++++ oldflake.nix | 47 ---- readme.md | 65 ++++++ switch | 12 + users/chloe/configuration.nix | 28 +++ users/chloe/home.nix | 24 ++ users/chloe/paperback/configuration.nix | 5 + users/chloe/sandwich/configuration.nix | 14 ++ users/chloe/user.nix | 18 ++ users/natalie/configuration.nix | 17 ++ .../natalie}/desktop/configuration.nix | 14 +- .../desktop/hardware-configuration.nix | 0 users/natalie/desktop/home.nix | 62 +++++ glance.yml => users/natalie/glance.yml | 0 users/natalie/home.nix | 16 ++ .../natalie}/laptop/configuration.nix | 38 ++- users/natalie/laptop/home.nix | 23 ++ .../shared => users/natalie}/packages.nix | 7 +- users/natalie/user.nix | 13 ++ 37 files changed, 872 insertions(+), 444 deletions(-) delete mode 100644 hosts/.DS_Store delete mode 100644 hosts/desktop/home.nix delete mode 100644 hosts/laptop/.DS_Store delete mode 100644 hosts/laptop/home.nix create mode 100644 modules/home-manager.nix create mode 100644 modules/macos/mac-app-store.nix delete mode 100644 modules/shared/extras.nix delete mode 100644 modules/shared/homeManagerPrograms.nix create mode 100644 modules/shared/user-system-settings.nix delete mode 100644 oldflake.nix create mode 100644 readme.md create mode 100755 switch create mode 100644 users/chloe/configuration.nix create mode 100644 users/chloe/home.nix create mode 100644 users/chloe/paperback/configuration.nix create mode 100644 users/chloe/sandwich/configuration.nix create mode 100644 users/chloe/user.nix create mode 100644 users/natalie/configuration.nix rename {hosts => users/natalie}/desktop/configuration.nix (93%) rename {hosts => users/natalie}/desktop/hardware-configuration.nix (100%) create mode 100644 users/natalie/desktop/home.nix rename glance.yml => users/natalie/glance.yml (100%) create mode 100644 users/natalie/home.nix rename {hosts => users/natalie}/laptop/configuration.nix (52%) create mode 100644 users/natalie/laptop/home.nix rename {modules/shared => users/natalie}/packages.nix (95%) create mode 100644 users/natalie/user.nix diff --git a/.gitignore b/.gitignore index 5ad4d89..bd001b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ flake.lock .DS_STORE **/.DS_STORE +result +result-* diff --git a/flake.nix b/flake.nix index 07c39d1..ee9fe40 100644 --- a/flake.nix +++ b/flake.nix @@ -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)); }; } diff --git a/hosts/.DS_Store b/hosts/.DS_Store deleted file mode 100644 index 35fbfdbfc0e1e2dbaad4d81ec972ed669ba56405..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKQA+|r5S~?24+(rI@NuD6AvFu6m&5E2bWsl#cE<@GUAN+$_#nbP*B|Pa^n04w zT_drcgeaMT*>84sW|#eL*|`M((VvBFfI0wFQ3(qUHs1)1lWs`CdI*J{L%}4Nr;{L7 z!A3MY{vreP?aB~?4-?2>{rkNIlQ>GVR_k39ilx1BrQ%d-l?QLE=3eG!v$XF|@2GdJ zR2-~qKe&lT^I`qqLM53WC8McMh{6$u+}}n?sOEh&OTtv=dS<|Js?M<9SS(Jv-KK1x zoGqJj(d)FDvfJw{mrnKY==l6<_!K`U>ctQ#@XTr1x442=G|G^|7a|q6k$>kO{%a@3}MpIFKwJ_F*j(^LFkon9=o!zFBG9yN59nJAY6moG6T%OIs--1 ztyBHK{Q3RAp2R(7fEm~+21IG#4f?nxTU$3aN3~X>KBAIPTyF3)1r1$_F_ubk162$9 YB^ijW#oQozQ20kc)4&Zg@T&}b00eP<5C8xG diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix deleted file mode 100644 index af74a4d..0000000 --- a/hosts/desktop/home.nix +++ /dev/null @@ -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"; -} diff --git a/hosts/laptop/.DS_Store b/hosts/laptop/.DS_Store deleted file mode 100644 index 4be084eeb267c00f5520ddb5bd0a88f0f42b9f06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z>*NNhm@N3Oz1(E!fs76fdFH7cim+m717>!I&*gN)Dxvv%Zi|;`2DO zyDbEB7SS1){buK9v-u#q8O9i&tfB#9E@R9FMdWDI2)b)S4U^0PL1B$7EV4zI$gpOa z-|51=w^_`dm}F^X{~zHZiL<=l|KyEktG#Dgj@7Xq{AXGCd62KNNwB=b*|n5OxV3}u zCY~2F_uxXNc@U@br7DP{Ii%d*#%UyriCm>orfPj1a2(s2x!v{pbTsOT!O7XCC)VR( zzb8iH;b!C5heyZfSF@MoHI;9gNRB&4+1Ice-**-n!~iis3=jjvKpg|-2C+MJLGlp; z#K6C10M7>jis%_EHL9Zn2Gs%pw!p0fZ0selMi}%AmKq@f!gVR2F6E}h;JO_A!sK}d zOO3jmanpQo^W<&w!qwAZeWB7B_cYQ-3=jiV2AX>6;{AUKpG<9&UoD{-F+dFbF$Q>R z>Q5)|Qs!>`_Ih~N3eZPT6wE8p00F!5695xDN4hGg;{t8S^9+_6aTWBdazOeKP=wGx I4Ez8CU+ /dev/null 2> /dev/null; or true + }; + }; +} diff --git a/modules/macos/default.nix b/modules/macos/default.nix index 8001529..57d92a7 100644 --- a/modules/macos/default.nix +++ b/modules/macos/default.nix @@ -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"; + }; } diff --git a/modules/macos/mac-app-store.nix b/modules/macos/mac-app-store.nix new file mode 100644 index 0000000..3b0dc41 --- /dev/null +++ b/modules/macos/mac-app-store.nix @@ -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 + ); + }; +} diff --git a/modules/macos/system.nix b/modules/macos/system.nix index f0d75af..578dda9 100644 --- a/modules/macos/system.nix +++ b/modules/macos/system.nix @@ -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; diff --git a/modules/macos/tiling/aerospace.nix b/modules/macos/tiling/aerospace.nix index 83aace4..1405b4d 100644 --- a/modules/macos/tiling/aerospace.nix +++ b/modules/macos/tiling/aerospace.nix @@ -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; diff --git a/modules/macos/tiling/default.nix b/modules/macos/tiling/default.nix index 0e55ef2..2d79dc4 100644 --- a/modules/macos/tiling/default.nix +++ b/modules/macos/tiling/default.nix @@ -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."; + }; + }; } diff --git a/modules/macos/tiling/sketchybar.nix b/modules/macos/tiling/sketchybar.nix index 9716021..e1121e3 100644 --- a/modules/macos/tiling/sketchybar.nix +++ b/modules/macos/tiling/sketchybar.nix @@ -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 + + ''; }; } diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 7ae65d7..e8f99dd 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -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"; + }; } diff --git a/modules/shared/default.nix b/modules/shared/default.nix index 383c1a1..e44a841 100644 --- a/modules/shared/default.nix +++ b/modules/shared/default.nix @@ -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 ]; } diff --git a/modules/shared/extras.nix b/modules/shared/extras.nix deleted file mode 100644 index d1ba2b5..0000000 --- a/modules/shared/extras.nix +++ /dev/null @@ -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"; - }; - }; - }; -} diff --git a/modules/shared/homeManagerPrograms.nix b/modules/shared/homeManagerPrograms.nix deleted file mode 100644 index 078b1f1..0000000 --- a/modules/shared/homeManagerPrograms.nix +++ /dev/null @@ -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; -} diff --git a/modules/shared/user-system-settings.nix b/modules/shared/user-system-settings.nix new file mode 100644 index 0000000..99ef4f7 --- /dev/null +++ b/modules/shared/user-system-settings.nix @@ -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"; + }; + }; + }; +} diff --git a/oldflake.nix b/oldflake.nix deleted file mode 100644 index e5cf756..0000000 --- a/oldflake.nix +++ /dev/null @@ -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]; - }; - }; - }; -} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e48f331 --- /dev/null +++ b/readme.md @@ -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 +``` + diff --git a/switch b/switch new file mode 100755 index 0000000..bd3388f --- /dev/null +++ b/switch @@ -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 diff --git a/users/chloe/configuration.nix b/users/chloe/configuration.nix new file mode 100644 index 0000000..77debaf --- /dev/null +++ b/users/chloe/configuration.nix @@ -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"; + }; + }; + }; +} diff --git a/users/chloe/home.nix b/users/chloe/home.nix new file mode 100644 index 0000000..e5a7181 --- /dev/null +++ b/users/chloe/home.nix @@ -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"; + }; +} diff --git a/users/chloe/paperback/configuration.nix b/users/chloe/paperback/configuration.nix new file mode 100644 index 0000000..d79cf59 --- /dev/null +++ b/users/chloe/paperback/configuration.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [ + reaper + ]; +} diff --git a/users/chloe/sandwich/configuration.nix b/users/chloe/sandwich/configuration.nix new file mode 100644 index 0000000..5ef1b72 --- /dev/null +++ b/users/chloe/sandwich/configuration.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [ + ffmpeg + ripgrep + reaper + ]; + shared.darwin = { + macAppStoreApps = [ + "final-cut-pro" + "logic-pro" + "motion" + ]; + }; +} diff --git a/users/chloe/user.nix b/users/chloe/user.nix new file mode 100644 index 0000000..376ec60 --- /dev/null +++ b/users/chloe/user.nix @@ -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 +} diff --git a/users/natalie/configuration.nix b/users/natalie/configuration.nix new file mode 100644 index 0000000..84680c6 --- /dev/null +++ b/users/natalie/configuration.nix @@ -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 + }; +} diff --git a/hosts/desktop/configuration.nix b/users/natalie/desktop/configuration.nix similarity index 93% rename from hosts/desktop/configuration.nix rename to users/natalie/desktop/configuration.nix index dfa4ffb..22c8521 100644 --- a/hosts/desktop/configuration.nix +++ b/users/natalie/desktop/configuration.nix @@ -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 = { diff --git a/hosts/desktop/hardware-configuration.nix b/users/natalie/desktop/hardware-configuration.nix similarity index 100% rename from hosts/desktop/hardware-configuration.nix rename to users/natalie/desktop/hardware-configuration.nix diff --git a/users/natalie/desktop/home.nix b/users/natalie/desktop/home.nix new file mode 100644 index 0000000..54607fd --- /dev/null +++ b/users/natalie/desktop/home.nix @@ -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"; +} diff --git a/glance.yml b/users/natalie/glance.yml similarity index 100% rename from glance.yml rename to users/natalie/glance.yml diff --git a/users/natalie/home.nix b/users/natalie/home.nix new file mode 100644 index 0000000..0d8ac9e --- /dev/null +++ b/users/natalie/home.nix @@ -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; +} diff --git a/hosts/laptop/configuration.nix b/users/natalie/laptop/configuration.nix similarity index 52% rename from hosts/laptop/configuration.nix rename to users/natalie/laptop/configuration.nix index 3208c09..3c1d194 100644 --- a/hosts/laptop/configuration.nix +++ b/users/natalie/laptop/configuration.nix @@ -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" + ]; + }; } diff --git a/users/natalie/laptop/home.nix b/users/natalie/laptop/home.nix new file mode 100644 index 0000000..7aaf691 --- /dev/null +++ b/users/natalie/laptop/home.nix @@ -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" + ]; + }; +} diff --git a/modules/shared/packages.nix b/users/natalie/packages.nix similarity index 95% rename from modules/shared/packages.nix rename to users/natalie/packages.nix index f54cdc8..0222c75 100644 --- a/modules/shared/packages.nix +++ b/users/natalie/packages.nix @@ -1,8 +1,5 @@ -{ - pkgs, - systemSettings, - ... -}: +# Packages installed with home-manager +{pkgs, ...}: with pkgs; [ #general development just diff --git a/users/natalie/user.nix b/users/natalie/user.nix new file mode 100644 index 0000000..5d87f17 --- /dev/null +++ b/users/natalie/user.nix @@ -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"; +}