/ flake.nix
flake.nix
  1  {
  2    description = "elianiva nix config";
  3  
  4    inputs = {
  5      nixpkgs-stable.url = "github:nixos/nixpkgs/release-24.11";
  6      nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
  7      nixpkgs.follows = "nixpkgs-unstable";
  8  
  9      # nix darwin stuff
 10      nix-darwin.url = "github:nix-darwin/nix-darwin/master";
 11      nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
 12  
 13      home-manager.url = "github:nix-community/home-manager";
 14      home-manager.inputs.nixpkgs.follows = "nixpkgs";
 15  
 16      # manage homebrew through nix
 17      nix-homebrew.url = "github:zhaofengli/nix-homebrew";
 18      nix-homebrew.inputs.nixpkgs.follows = "nixpkgs";
 19      homebrew-core.url = "github:homebrew/homebrew-core";
 20      homebrew-core.flake = false;
 21      homebrew-cask.url = "github:homebrew/homebrew-cask";
 22      homebrew-cask.flake = false;
 23      homebrew-bundle.url = "github:homebrew/homebrew-bundle";
 24      homebrew-bundle.flake = false;
 25      homebrew-mhaeuser.url = "github:mhaeuser/homebrew-mhaeuser";
 26      homebrew-mhaeuser.flake = false;
 27      homebrew-jnsahaj.url = "github:jnsahaj/homebrew-lumen";
 28      homebrew-jnsahaj.flake = false;
 29  
 30      # fenix for rust
 31      fenix.url = "github:nix-community/fenix";
 32      fenix.inputs.nixpkgs.follows = "nixpkgs";
 33  
 34      # only needed for linux
 35      nixGL.url = "github:nix-community/nixGL/310f8e49a149e4c9ea52f1adf70cdc768ec53f8a";
 36      nixGL.inputs.nixpkgs.follows = "nixpkgs";
 37  
 38      jj-starship.url = "github:dmmulroy/jj-starship";
 39  
 40      bash-env-json = {
 41        url = "github:tesujimath/bash-env-json/main";
 42        inputs.nixpkgs.follows = "nixpkgs";
 43      };
 44    };
 45  
 46    outputs =
 47      inputs@{
 48        nixpkgs,
 49        home-manager,
 50        nix-darwin,
 51        nix-homebrew,
 52        fenix,
 53        jj-starship,
 54        ...
 55      }:
 56      let
 57        flakePkgs = system: {
 58          bash-env-json = inputs.bash-env-json.packages.${system}.default;
 59        };
 60      in
 61      {
 62        darwinConfigurations = {
 63          melon = nix-darwin.lib.darwinSystem {
 64            inherit inputs;
 65            system = "aarch64-darwin";
 66            # pkgs = nixpkgs.legacyPackages."aarch64-darwin";
 67            pkgs = import nixpkgs {
 68              system = "aarch64-darwin";
 69              overlays = [
 70                fenix.overlays.default
 71                jj-starship.overlays.default
 72              ];
 73            };
 74            specialArgs = {
 75              inherit (inputs) fenix;
 76              flakePkgs = flakePkgs "aarch64-darwin";
 77            };
 78            modules = [
 79              nix-homebrew.darwinModules.nix-homebrew
 80              home-manager.darwinModules.home-manager
 81              {
 82                nix-homebrew = {
 83                  enable = true;
 84                  enableRosetta = true;
 85                  user = "elianiva";
 86                  taps = {
 87                    "homebrew/homebrew-core" = inputs.homebrew-core;
 88                    "homebrew/homebrew-cask" = inputs.homebrew-cask;
 89                    "homebrew/homebrew-bundle" = inputs.homebrew-bundle;
 90                    "mhaeuser/homebrew-mhaeuser" = inputs.homebrew-mhaeuser;
 91                    "jnsahaj/homebrew-lumen" = inputs.homebrew-jnsahaj;
 92                  };
 93                  mutableTaps = false;
 94                  autoMigrate = true;
 95                };
 96                home-manager.useGlobalPkgs = true;
 97                home-manager.useUserPackages = true;
 98                home-manager.users.elianiva = {
 99                  imports = [
100                    ./modules/darwin-home.nix
101                    ./modules/git.nix
102                    ./modules/gpg.nix
103                  ];
104                };
105              }
106              ./modules/darwin-config.nix
107            ];
108          };
109        };
110        homeConfigurations = {
111          elianiva = home-manager.lib.homeManagerConfiguration {
112            system = "x86_64-linux";
113            pkgs = import nixpkgs {
114              system = "x86_64-linux";
115              config.allowUnfree = true;
116            };
117            extraSpecialArgs = {
118              inherit inputs;
119              flakePkgs = flakePkgs "x86_64-linux";
120            };
121            modules = [
122              ./modules/linux-home.nix
123              ./modules/gpg.nix
124              ./modules/git.nix
125              ./modules/linux-terminals.nix
126            ];
127          };
128        };
129      };
130  
131    nixConfig = {
132      trusted-substituters = [
133        "https://cache.nixos.org"
134  
135        "https://nix-community.cachix.org"
136      ];
137      trusted-public-keys = [
138        "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
139  
140        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
141      ];
142    };
143  }