commit 33112e908a217597e9ea1319113110a4f26d1a14 Author: Curt Spark Date: Fri Apr 26 01:08:20 2024 +0100 Init repo diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f810204 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711763326, + "narHash": "sha256-sXcesZWKXFlEQ8oyGHnfk4xc9f2Ip0X/+YZOq3sKviI=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "36524adc31566655f2f4d55ad6b875fb5c1a4083", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1711715736, + "narHash": "sha256-9slQ609YqT9bT/MNX9+5k5jltL9zgpn36DpFB7TkttM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "807c549feabce7eddbf259dbdcec9e0600a0660d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f18424f --- /dev/null +++ b/flake.nix @@ -0,0 +1,138 @@ +{ + description = "Nix-Darwin Configuration Flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ self, nix-darwin, nixpkgs }: + let + configuration = { pkgs, ... }: { + networking.computerName = "cspark-macos-desktop"; + networking.hostName = "cspark-macos-desktop"; + networking.localHostName = "cspark-macos-desktop"; + + nixpkgs.config.allowUnfree = true; + + # Nix packages. + environment.systemPackages = with pkgs; [ + git + unrar + pass + neofetch + neovim + yt-dlp + qbittorrent + emacs + discord + ]; + + # Homebrew configuration and packages. + homebrew.enable = true; + # Homebrew formulae + homebrew.brews = [ + ]; + # Homebrew casks + homebrew.casks = [ + "steam" + "librewolf" + # "eloston-chromium" # Ungoogled Chromium + "chromium" + # "blackhole-2ch" # Virtual Audio driver that I'm using alongside the builtin Mac audio routing (Multi-Output/Aggregate + ]; + + services.yabai = { + enable = true; + config = { + external_bar = "off:40:0"; + menubar_opacity = 1.0; + mouse_follows_focus = "off"; + focus_follows_mouse = "off"; + display_arrangement_order = "default"; + window_origin_display = "default"; + window_placement = "second_child"; + window_zoom_persist = "on"; + window_shadow = "on"; + window_animation_duration = 0.0; + window_animation_easing = "ease_out_circ"; + window_opacity_duration = 0.0; + active_window_opacity = 1.0; + normal_window_opacity = 0.90; + window_opacity = "off"; + insert_feedback_color = "0xffd75f5f"; + split_ratio = 0.50; + split_type = "auto"; + auto_balance = "off"; + top_padding = 12; + bottom_padding = 12; + left_padding = 12; + right_padding = 12; + window_gap = 06; + layout = "bsp"; + mouse_modifier = "fn"; + mouse_action1 = "move"; + mouse_action2 = "resize"; + mouse_drop_action = "swap"; + }; + }; + services.skhd = { + enable = true; + skhdConfig = '' + cmd - return : open -a Terminal "`pwd`" + ''; + }; + + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + # nix.package = pkgs.nix; + + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + + # Create /etc/zshrc that loads the nix-darwin environment. + # programs.zsh.enable = true; # default shell on catalina + # programs.fish.enable = true; + programs.bash = { + enable = true; + enableCompletion = true; + interactiveShellInit = '' + export PS1="\[\e[92;40m\]\h\[\e[m\]:\[\e[93m\]\W\[\e[m\] \\$ " + cd ~ + neofetch + ''; + }; + environment.shellAliases = { + edit = "emacs -nw"; + nix-darwin-rebuild-system-flake = "nix run nix-darwin -- switch --flake ~/.config/nix-darwin#desktop"; + }; + + # Set Git commit hash for darwin-version. + system.configurationRevision = self.rev or self.dirtyRev or null; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = "x86_64-darwin"; + }; + in + { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#Curts-Mac-Pro + darwinConfigurations = { + desktop = nix-darwin.lib.darwinSystem { + specialArgs = {inherit inputs;}; + modules = [ + configuration + ]; + }; + }; + + # Expose the package set, including overlays, for convenience. + darwinPackages = self.darwinConfigurations.desktop-macos.pkgs; + }; +}