diff --git a/flake.nix b/flake.nix index 5fb3ada..d753a09 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,7 @@ }; }; - outputs = { + outputs = inputs @ { self, nix-darwin, home-manager, @@ -54,129 +54,16 @@ catppuccin, ... }: let - configuration = {pkgs, ...}: { - environment.systemPackages = with pkgs; [ - nil - alejandra - nixpkgs-fmt - attic-client - cachix - direnv - - fenix.packages.${system}.stable.defaultToolchain - ccache - ccacheWrapper - deno - fnm - go - bun - - pkgs."_1password" - age - pkgs.agenix - asciinema - bat - btop - cloudflared - doggo - doppler - du-dust - exa - exiftool - fd - ffmpeg - fish - flyctl - fzf - gh - git - git-lfs - gen-license - gum - helix - hyperfine - jq - just - spicetify-cli - mkcert - nerdfix - opencv - pipx - pscale - pyenv - railway - redis - silicon - starship - tealdeer - tokei - vhs - vivid - xh - zoxide - ]; - - services.nix-daemon.enable = true; - nix.package = pkgs.nix; - - nix.settings = { - experimental-features = "nix-command flakes"; - build-users-group = "nixbld"; - trusted-users = ["ryanccn"]; - auto-optimise-store = true; - extra-platforms = ["x86_64-darwin" "aarch64-darwin"]; - - extra-sandbox-paths = ["/nix/var/cache/ccache"]; - - extra-substituters = [ - "https://nix-community.cachix.org" - ]; - extra-trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; + configuration = {pkgs, ...}: + import ./system.nix { + inherit (inputs) agenix fenix attic catppuccin; + inherit pkgs; }; - - nixpkgs = { - overlays = [ - attic.overlays.default - agenix.overlays.default - fenix.overlays.default - (import ./overlays/ccache-wrapper.nix) - (import ./overlays/gen-license.nix) - ]; - - config.allowUnfree = true; - hostPlatform = "aarch64-darwin"; - }; - - programs.zsh.enable = true; - programs.fish.enable = true; - programs.fish.shellInit = '' - for p in /run/current-system/sw/bin - if not contains $p $fish_user_paths - set -g fish_user_paths $p $fish_user_paths - end - end - ''; - - system.stateVersion = 4; - }; in { darwinConfigurations.Ryans-MacBook-Pro = nix-darwin.lib.darwinSystem { modules = [ configuration home-manager.darwinModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - agenixModule = agenix.homeManagerModules.age; - ctpModule = catppuccin.homeManagerModules.catppuccin; - }; - - users.users.ryanccn.home = "/Users/ryanccn"; - home-manager.users.ryanccn = import ./home.nix; - } ]; }; diff --git a/system.nix b/system.nix new file mode 100644 index 0000000..63c7913 --- /dev/null +++ b/system.nix @@ -0,0 +1,124 @@ +{ + pkgs, + attic, + agenix, + fenix, + catppuccin, + ... +}: { + environment.systemPackages = with pkgs; [ + nil + alejandra + nixpkgs-fmt + attic-client + cachix + direnv + + fenix.packages.${system}.stable.defaultToolchain + ccache + ccacheWrapper + deno + fnm + go + bun + + pkgs."_1password" + age + pkgs.agenix + asciinema + bat + btop + cloudflared + doggo + doppler + du-dust + exa + exiftool + fd + ffmpeg + fish + flyctl + fzf + gh + git + git-lfs + gen-license + gum + helix + hyperfine + jq + just + spicetify-cli + mkcert + nerdfix + opencv + pipx + pscale + pyenv + railway + redis + silicon + starship + tealdeer + tokei + vhs + vivid + xh + zoxide + ]; + + services.nix-daemon.enable = true; + nix.package = pkgs.nix; + + nix.settings = { + experimental-features = "nix-command flakes"; + build-users-group = "nixbld"; + trusted-users = ["ryanccn"]; + auto-optimise-store = true; + extra-platforms = ["x86_64-darwin" "aarch64-darwin"]; + + extra-sandbox-paths = ["/nix/var/cache/ccache"]; + + extra-substituters = [ + "https://nix-community.cachix.org" + ]; + extra-trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + + nixpkgs = { + overlays = [ + attic.overlays.default + agenix.overlays.default + fenix.overlays.default + (import ./overlays/ccache-wrapper.nix) + (import ./overlays/gen-license.nix) + ]; + + config.allowUnfree = true; + hostPlatform = "aarch64-darwin"; + }; + + programs.zsh.enable = true; + programs.fish.enable = true; + programs.fish.shellInit = '' + for p in /run/current-system/sw/bin + if not contains $p $fish_user_paths + set -g fish_user_paths $p $fish_user_paths + end + end + ''; + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { + agenixModule = agenix.homeManagerModules.age; + ctpModule = catppuccin.homeManagerModules.catppuccin; + }; + + users.users.ryanccn.home = "/Users/ryanccn"; + home-manager.users.ryanccn = import ./home.nix; + + system.stateVersion = 4; +}