2022-01-23 01:32:58 +00:00
|
|
|
{
|
|
|
|
description = "mat's nix configs";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
# Package sets
|
2022-09-04 17:39:34 +00:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-21.11-darwin";
|
|
|
|
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
|
2022-01-23 01:32:58 +00:00
|
|
|
|
|
|
|
# Environment/system management
|
2022-09-04 17:39:34 +00:00
|
|
|
darwin.url = "github:lnl7/nix-darwin/master";
|
2022-01-23 01:32:58 +00:00
|
|
|
darwin.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2022-09-04 17:39:34 +00:00
|
|
|
home-manager.url = "github:nix-community/home-manager";
|
2022-01-23 01:32:58 +00:00
|
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
|
|
|
|
2022-07-24 19:55:26 +00:00
|
|
|
# Config "flag" for disabling homebrew
|
2022-09-04 17:39:34 +00:00
|
|
|
homebrew-enabled.url = "github:boolean-option/true";
|
2022-07-24 19:55:26 +00:00
|
|
|
|
2022-09-17 23:02:51 +00:00
|
|
|
# Flake helpers
|
2022-09-04 17:39:34 +00:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
flake-utils.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2022-09-17 23:02:51 +00:00
|
|
|
flake-compat.url = "github:edolstra/flake-compat";
|
|
|
|
flake-compat.flake = false;
|
|
|
|
|
|
|
|
# Extra sources
|
2022-09-04 17:39:34 +00:00
|
|
|
helix.url = "github:helix-editor/helix";
|
|
|
|
helix.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2022-09-17 23:02:51 +00:00
|
|
|
dark-mode-notify-src.url = "github:bouk/dark-mode-notify";
|
|
|
|
dark-mode-notify-src.flake = false;
|
|
|
|
kitty-icon.url = "github:DinkDonk/kitty-icon";
|
|
|
|
kitty-icon.flake = false;
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
2022-09-17 23:02:51 +00:00
|
|
|
outputs = { self, darwin, home-manager, flake-utils, ... }@inputs:
|
2022-01-23 23:50:34 +00:00
|
|
|
let
|
|
|
|
|
|
|
|
inherit (darwin.lib) darwinSystem;
|
2022-07-21 02:19:32 +00:00
|
|
|
inherit (inputs.nixpkgs-unstable.lib)
|
|
|
|
attrValues
|
|
|
|
makeOverridable
|
2022-09-15 21:17:21 +00:00
|
|
|
optionalAttrs;
|
2022-01-23 23:50:34 +00:00
|
|
|
|
|
|
|
# Configuration for `nixpkgs`
|
|
|
|
nixpkgsConfig = {
|
|
|
|
config = { allowUnfree = true; };
|
2022-09-15 21:17:21 +00:00
|
|
|
overlays = attrValues self.overlays ++ [
|
|
|
|
(final: prev:
|
|
|
|
import ./pkgs {
|
2022-09-17 23:02:51 +00:00
|
|
|
inherit inputs;
|
2022-09-15 21:17:21 +00:00
|
|
|
inherit (final) callPackage;
|
|
|
|
inherit (final.stdenv) system;
|
|
|
|
})
|
|
|
|
(final: prev: optionalAttrs (prev.stdenv.system == "aarch64-darwin")
|
|
|
|
{
|
|
|
|
# Sub in x86 version of packages that don't build on Apple Silicon yet
|
|
|
|
inherit (final.pkgs-x86);
|
|
|
|
})
|
|
|
|
];
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
2022-01-23 23:50:34 +00:00
|
|
|
homeManagerStateVersion = "22.05";
|
2022-09-15 21:17:21 +00:00
|
|
|
|
|
|
|
primaryUserInfo = {
|
|
|
|
username = "mat";
|
|
|
|
fullName = "mat ess";
|
|
|
|
email = "mat@mat.services";
|
|
|
|
nixConfigDirectory = "/Users/mat/dotfiles.nix";
|
|
|
|
};
|
|
|
|
|
|
|
|
workUserInfo = {
|
|
|
|
username = "mess";
|
|
|
|
fullName = "Matthew Ess";
|
|
|
|
email = "mess@yelp.com";
|
|
|
|
nixConfigDirectory = "/Users/mess/dotfiles.nix";
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
2022-01-23 23:50:34 +00:00
|
|
|
# Modules shared by most `nix-darwin` personal configurations.
|
|
|
|
nixDarwinCommonModules = attrValues self.darwinModules ++ [
|
|
|
|
# `home-manager` module
|
|
|
|
home-manager.darwinModules.home-manager
|
|
|
|
(
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
inherit (config.users) primaryUser;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
nixpkgs = nixpkgsConfig;
|
2022-09-15 21:17:21 +00:00
|
|
|
# Hack to support legacy worklows that use `<nixpkgs>`, darwin-option, etc.
|
2022-08-31 04:48:25 +00:00
|
|
|
nix.nixPath = {
|
2022-09-15 21:17:21 +00:00
|
|
|
nixpkgs = "${inputs.nixpkgs-unstable}";
|
|
|
|
darwin = "${inputs.darwin}";
|
2022-08-31 04:48:25 +00:00
|
|
|
};
|
2022-01-23 23:50:34 +00:00
|
|
|
# `home-manager` config
|
2022-09-15 21:17:21 +00:00
|
|
|
users.users.${primaryUser.username}.home = "/Users/${primaryUser.username}";
|
2022-01-23 23:50:34 +00:00
|
|
|
home-manager.useGlobalPkgs = true;
|
2022-09-15 21:17:21 +00:00
|
|
|
home-manager.users.${primaryUser.username} = {
|
|
|
|
imports = attrValues self.homeManagerModules;
|
|
|
|
home.stateVersion = homeManagerStateVersion;
|
|
|
|
home.primaryUser = primaryUser;
|
|
|
|
home.enableNixpkgsReleaseCheck = true;
|
|
|
|
};
|
2022-01-23 23:50:34 +00:00
|
|
|
# Add a registry entry for this flake
|
|
|
|
nix.registry.my.flake = self;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
];
|
|
|
|
in
|
|
|
|
{
|
|
|
|
# `nix-darwin` configs
|
|
|
|
darwinConfigurations = rec {
|
|
|
|
# Mininal configurations to bootstrap systems
|
|
|
|
bootstrap-x86 = makeOverridable darwinSystem {
|
|
|
|
system = "x86_64-darwin";
|
|
|
|
modules = [ ./darwin/bootstrap.nix { nixpkgs = nixpkgsConfig; } ];
|
|
|
|
};
|
|
|
|
bootstrap-arm = bootstrap-x86.override { system = "aarch64-darwin"; };
|
|
|
|
|
|
|
|
# M1 MBP
|
|
|
|
matbook = darwinSystem {
|
|
|
|
system = "aarch64-darwin";
|
|
|
|
modules = nixDarwinCommonModules ++ [
|
2022-08-09 23:56:18 +00:00
|
|
|
({ pkgs, ... }: {
|
2022-09-15 21:17:21 +00:00
|
|
|
users.primaryUser = primaryUserInfo;
|
2022-01-23 23:50:34 +00:00
|
|
|
networking.computerName = "matbook pro m1";
|
|
|
|
networking.hostName = "matbook";
|
|
|
|
networking.knownNetworkServices = [
|
|
|
|
"Wi-Fi"
|
|
|
|
];
|
2022-08-31 04:48:25 +00:00
|
|
|
nix.settings.cores = 2;
|
|
|
|
nix.settings.max-jobs = 4;
|
2022-07-30 02:15:19 +00:00
|
|
|
|
2022-08-09 23:56:18 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
vscodium
|
|
|
|
];
|
2022-07-30 02:15:19 +00:00
|
|
|
games.enable = true;
|
2022-09-11 04:56:57 +00:00
|
|
|
homebrew.casks = [ "docker" ];
|
2022-07-30 02:15:19 +00:00
|
|
|
home-manager.sharedModules = [{
|
2022-09-06 14:51:18 +00:00
|
|
|
programs.fish.shellAliases = {
|
|
|
|
code = "${pkgs.vscodium}/bin/codium";
|
|
|
|
};
|
2022-08-09 23:56:18 +00:00
|
|
|
programs.ssh.matchBlocks.remarkable = {
|
|
|
|
hostname = "10.11.99.1";
|
|
|
|
user = "root";
|
|
|
|
port = 22;
|
|
|
|
};
|
|
|
|
programs.vscode.package = pkgs.vscodium;
|
2022-07-30 02:15:19 +00:00
|
|
|
}];
|
2022-08-09 23:56:18 +00:00
|
|
|
})
|
2022-07-30 02:15:19 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
yelpbook-m1 = darwinSystem {
|
|
|
|
system = "aarch64-darwin";
|
|
|
|
modules = nixDarwinCommonModules ++ [
|
2022-08-09 23:56:18 +00:00
|
|
|
({ pkgs, ... }: {
|
2022-09-15 21:17:21 +00:00
|
|
|
users.primaryUser = workUserInfo;
|
2022-07-30 02:15:19 +00:00
|
|
|
networking.knownNetworkServices = [
|
|
|
|
"Wi-Fi"
|
|
|
|
];
|
2022-09-06 14:51:18 +00:00
|
|
|
nix.settings.cores = 2;
|
|
|
|
nix.settings.max-jobs = 5;
|
2022-07-30 02:15:19 +00:00
|
|
|
|
|
|
|
games.enable = false;
|
2022-08-09 23:56:18 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
yubiswitch
|
|
|
|
vscode
|
|
|
|
];
|
|
|
|
homebrew.casks = [ "itsycal" ];
|
2022-07-30 02:15:19 +00:00
|
|
|
home-manager.sharedModules = [{
|
2022-08-09 23:56:18 +00:00
|
|
|
programs.ssh.matchBlocks.devbox = {
|
|
|
|
hostname = "amp1";
|
|
|
|
forwardAgent = true;
|
|
|
|
serverAliveInterval = 120;
|
|
|
|
};
|
|
|
|
programs.fish.functions.devbox.body = ''
|
|
|
|
ssh -t devbox "agenttmux attach; or agenttmux new -s yelp"
|
|
|
|
'';
|
2022-07-30 02:15:19 +00:00
|
|
|
}];
|
2022-08-09 23:56:18 +00:00
|
|
|
})
|
2022-01-23 23:50:34 +00:00
|
|
|
];
|
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
|
2022-01-23 23:50:34 +00:00
|
|
|
# Config with small modifications needed/desired for CI with GitHub workflow
|
|
|
|
githubCI = darwinSystem {
|
|
|
|
system = "x86_64-darwin";
|
|
|
|
modules = nixDarwinCommonModules ++ [
|
|
|
|
({ lib, ... }: {
|
2022-09-15 21:17:21 +00:00
|
|
|
users.primaryUser = primaryUserInfo // {
|
|
|
|
username = "runner";
|
|
|
|
nixConfigDirectory = "/Users/runner/work/nixpkgs/nixpkgs";
|
|
|
|
};
|
2022-01-23 23:50:34 +00:00
|
|
|
homebrew.enable = lib.mkForce false;
|
|
|
|
})
|
|
|
|
];
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
2022-01-23 23:50:34 +00:00
|
|
|
|
2022-09-15 21:17:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Build and activate on new system with:
|
|
|
|
# `nix build .#homeConfigurations.<name>.activationPackage; ./result/activate`
|
|
|
|
homeConfigurations = rec {
|
2022-01-23 23:50:34 +00:00
|
|
|
cloudVM = home-manager.lib.homeManagerConfiguration {
|
2022-09-15 21:17:21 +00:00
|
|
|
pkgs = import inputs.nixpkgs-unstable {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
inherit (nixpkgsConfig) config overlays;
|
2022-01-23 23:50:34 +00:00
|
|
|
};
|
2022-09-15 21:17:21 +00:00
|
|
|
modules = attrValues self.homeManagerModules ++ [
|
|
|
|
({ config, ... }: {
|
|
|
|
home.username = config.home.primaryUser.username;
|
|
|
|
home.homeDirectory = "/home/${config.home.username}";
|
|
|
|
home.stateVersion = homeManagerStateVersion;
|
|
|
|
home.primaryUser = primaryUserInfo // {
|
|
|
|
nixConfigDirectory = "${config.home.homeDirectory}/dotfiles.nix";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-01-23 23:50:34 +00:00
|
|
|
# Overlays --------------------------------------------------------------- {{{
|
|
|
|
|
|
|
|
overlays = {
|
|
|
|
# nixpkgs overlays
|
|
|
|
pkgs-stable = final: prev: {
|
|
|
|
pkgs-stable = import inputs.nixpkgs {
|
|
|
|
inherit (prev.stdenv) system;
|
|
|
|
inherit (nixpkgsConfig) config;
|
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
2022-01-23 23:50:34 +00:00
|
|
|
pkgs-unstable = final: prev: {
|
|
|
|
pkgs-unstable = import inputs.nixpkgs-unstable {
|
|
|
|
inherit (prev.stdenv) system;
|
|
|
|
inherit (nixpkgsConfig) config;
|
|
|
|
};
|
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
|
2022-05-08 01:43:56 +00:00
|
|
|
pkgs-master = final: prev: {
|
|
|
|
pkgs-master = import inputs.nixpkgs-master {
|
|
|
|
inherit (prev.stdenv) system;
|
|
|
|
inherit (nixpkgsConfig) config;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-01-23 23:50:34 +00:00
|
|
|
colors = import ./overlays/colors.nix;
|
|
|
|
|
|
|
|
# Overlay useful on Macs with Apple Silicon
|
|
|
|
apple-silicon = final: prev: optionalAttrs (prev.stdenv.system == "aarch64-darwin") {
|
|
|
|
# Add access to x86 packages system is running Apple Silicon
|
|
|
|
pkgs-x86 = import inputs.nixpkgs-unstable {
|
|
|
|
system = "x86_64-darwin";
|
|
|
|
inherit (nixpkgsConfig) config;
|
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
2022-07-24 19:55:26 +00:00
|
|
|
|
|
|
|
patched = final: prev: optionalAttrs prev.stdenv.isDarwin {
|
2022-07-30 02:15:19 +00:00
|
|
|
inherit (inputs) kitty-icon;
|
|
|
|
lib = prev.lib // { homebrew-enabled = inputs.homebrew-enabled.value; };
|
2022-07-24 19:55:26 +00:00
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
2022-01-23 23:50:34 +00:00
|
|
|
|
2022-09-15 21:17:21 +00:00
|
|
|
# `nix-darwin` configs and modules
|
2022-01-23 23:50:34 +00:00
|
|
|
darwinModules = {
|
2022-09-15 21:17:21 +00:00
|
|
|
# configs
|
|
|
|
bootstrap = import ./darwin/bootstrap.nix;
|
|
|
|
defaults = import ./darwin/defaults.nix;
|
|
|
|
general = import ./darwin/general.nix;
|
|
|
|
homebrew = import ./darwin/homebrew.nix;
|
|
|
|
# modules
|
2022-07-30 02:15:19 +00:00
|
|
|
games = import ./modules/darwin/games.nix;
|
2022-01-23 23:50:34 +00:00
|
|
|
security-pam = import ./modules/darwin/security/pam.nix;
|
2022-09-15 21:17:21 +00:00
|
|
|
primary-user = import ./modules/darwin/primary-user.nix;
|
2022-01-23 23:50:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# home manager configurations
|
|
|
|
homeManagerModules = {
|
2022-09-15 21:17:21 +00:00
|
|
|
# configs
|
2022-01-23 23:50:34 +00:00
|
|
|
configs-starship-symbols = import ./home/configs/starship-symbols.nix;
|
2022-09-15 21:17:21 +00:00
|
|
|
copyApplications = import ./home/copyApplications.nix;
|
2022-09-17 23:02:51 +00:00
|
|
|
dark-mode-notify-service = import ./home/dark-mode-notify-service.nix;
|
2022-09-15 21:17:21 +00:00
|
|
|
files = import ./home/files.nix;
|
|
|
|
fish = import ./home/fish.nix;
|
|
|
|
git = import ./home/git.nix;
|
|
|
|
kitty = import ./home/kitty.nix;
|
|
|
|
programs = import ./home/programs.nix;
|
|
|
|
starship = import ./home/starship.nix;
|
|
|
|
# modules
|
2022-09-17 23:02:51 +00:00
|
|
|
# TODO: migrate to helix
|
|
|
|
# programs-kakoune-extras = import ./modules/home/programs/kakoune/extras.nix;
|
2022-01-23 23:50:34 +00:00
|
|
|
programs-kitty-extras = import ./modules/home/programs/kitty/extras.nix;
|
2022-09-15 21:17:21 +00:00
|
|
|
home-primary-user = { lib, ... }: {
|
|
|
|
options.home.primaryUser =
|
|
|
|
(self.darwinModules.primary-user { inherit lib; }).options.users.primaryUser;
|
|
|
|
};
|
2022-01-23 23:50:34 +00:00
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
|
|
|
|
} // flake-utils.lib.eachDefaultSystem (system: {
|
|
|
|
legacyPackages = import inputs.nixpkgs-unstable {
|
|
|
|
inherit system;
|
|
|
|
inherit (nixpkgsConfig) config;
|
|
|
|
overlays = with self.overlays; [
|
2022-05-08 02:09:19 +00:00
|
|
|
pkgs-master
|
2022-01-23 01:32:58 +00:00
|
|
|
pkgs-stable
|
|
|
|
colors
|
|
|
|
apple-silicon
|
2022-07-24 19:55:26 +00:00
|
|
|
patched
|
2022-01-23 01:32:58 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
});
|
2022-01-23 23:50:34 +00:00
|
|
|
}
|