{ description = "Simen Andre's dotfiles configuration"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nix-darwin = { url = "github:LnL7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; config-nvim = { url = "git+https://git.simenandre.no/config.nvim"; flake = false; }; dina = { # Pin: newer commits ship a broken vendorHash upstream (hash mismatch on # go-modules). Bump once dinacomputer/cli fixes it. url = "github:dinacomputer/cli/0277ff9e82107ee9a582ae6e0da1258a44a60e1a"; inputs.nixpkgs.follows = "nixpkgs"; }; skills = { url = "git+https://git.simenandre.no/skills"; inputs.nixpkgs.follows = "nixpkgs"; }; nix-homebrew.url = "github:zhaofengli/nix-homebrew"; # Homebrew taps are pinned here so that tap updates land in flake.lock and # go through vet like every other input. With homebrew-core pinned, # nix-homebrew makes brew install from these instead of its JSON API. homebrew-core = { url = "github:homebrew/homebrew-core"; flake = false; }; homebrew-cask = { url = "github:homebrew/homebrew-cask"; flake = false; }; homebrew-anomalyco = { url = "github:anomalyco/homebrew-tap"; flake = false; }; homebrew-simenandre = { url = "github:simenandre/homebrew-tools"; flake = false; }; }; outputs = { self, nixpkgs, nix-darwin, home-manager, config-nvim, dina, skills, nix-homebrew, homebrew-core, homebrew-cask, homebrew-anomalyco, homebrew-simenandre, }: let # flakeAttr must match the darwinConfigurations attribute this machine is # built from; the rebuild/update aliases in modules/home/zsh.nix use it so # each machine targets its own configuration. mkHomeModules = { username, flakeAttr ? "default" }: [ ./modules/home skills.homeManagerModules.default { home.username = username; home.file.".config/nvim".source = config-nvim; _module.args.flakeAttr = flakeAttr; } ]; mkDarwin = { username, flakeAttr, hostName ? null, }: nix-darwin.lib.darwinSystem { system = "aarch64-darwin"; modules = [ ./modules/darwin home-manager.darwinModules.home-manager nix-homebrew.darwinModules.nix-homebrew { nix-homebrew = { enable = true; user = username; autoMigrate = true; mutableTaps = false; taps = { "homebrew/homebrew-core" = homebrew-core; "homebrew/homebrew-cask" = homebrew-cask; "anomalyco/homebrew-tap" = homebrew-anomalyco; "simenandre/homebrew-tools" = homebrew-simenandre; }; trust.taps = [ "anomalyco/tap" "simenandre/tools" ]; }; } { # Primary user for system defaults and homebrew system.primaryUser = username; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.backupFileExtension = "bak"; home-manager.extraSpecialArgs = { inherit dina; }; home-manager.users.${username} = { imports = mkHomeModules { inherit username flakeAttr; }; }; } ] ++ nixpkgs.lib.optional (hostName != null) { networking = { inherit hostName; computerName = hostName; localHostName = hostName; }; }; }; in { packages.aarch64-darwin.vet = nixpkgs.legacyPackages.aarch64-darwin.callPackage ./pkgs/vet { }; darwinConfigurations = { "makkie" = mkDarwin { username = "simenandre"; flakeAttr = "makkie"; hostName = "makkie"; }; "default" = mkDarwin { username = "cobraz"; flakeAttr = "default"; }; }; nixosConfigurations."nixbox" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./hosts/nixbox/hardware-configuration.nix ./modules/nixos home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.backupFileExtension = "bak"; home-manager.extraSpecialArgs = { inherit dina; }; home-manager.users.simenandre = { imports = mkHomeModules { username = "simenandre"; }; }; } ]; }; homeConfigurations."simenandre" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages."x86_64-linux"; extraSpecialArgs = { inherit dina; }; modules = mkHomeModules { username = "simenandre"; }; }; homeConfigurations."simenandre@aarch64-linux" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages."aarch64-linux"; extraSpecialArgs = { inherit dina; }; modules = mkHomeModules { username = "simenandre"; }; }; }; }