2022-01-23 01:32:58 +00:00
|
|
|
{
|
|
|
|
description = "mat's nix configs";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
# Package sets
|
2022-05-08 01:43:56 +00:00
|
|
|
nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-21.11-darwin;
|
2022-01-23 01:32:58 +00:00
|
|
|
nixpkgs-unstable.url = github:NixOS/nixpkgs/nixpkgs-unstable;
|
2022-05-08 01:43:56 +00:00
|
|
|
nixpkgs-master.url = github:NixOS/nixpkgs/master;
|
2022-01-23 01:32:58 +00:00
|
|
|
|
|
|
|
# Environment/system management
|
2022-05-08 01:43:56 +00:00
|
|
|
darwin.url = github:lnl7/nix-darwin/master;
|
2022-01-23 01:32:58 +00:00
|
|
|
darwin.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2022-05-08 01:43:56 +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
|
|
|
|
homebrew-enabled.url = github:boolean-option/true;
|
|
|
|
|
2022-01-23 01:32:58 +00:00
|
|
|
# Other sources
|
|
|
|
flake-utils.url = github:numtide/flake-utils;
|
2022-07-21 02:19:32 +00:00
|
|
|
flake-compat = {
|
|
|
|
url = github:edolstra/flake-compat;
|
|
|
|
flake = false;
|
|
|
|
};
|
2022-07-16 20:34:47 +00:00
|
|
|
dark-mode-notify-src = {
|
|
|
|
url = github:bouk/dark-mode-notify;
|
|
|
|
flake = false;
|
|
|
|
};
|
2022-07-21 02:19:32 +00:00
|
|
|
luar-src = {
|
|
|
|
url = github:gustavo-hms/luar;
|
|
|
|
flake = false;
|
|
|
|
};
|
2022-07-21 23:51:23 +00:00
|
|
|
smarttab-kak-src = {
|
|
|
|
url = github:andreyorst/smarttab.kak;
|
2022-07-21 04:38:26 +00:00
|
|
|
flake = false;
|
|
|
|
};
|
2022-07-29 22:01:24 +00:00
|
|
|
auto-pairs-kak-src = {
|
|
|
|
url = github:alexherbo2/auto-pairs.kak;
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
kakoune-sudo-write-src = {
|
|
|
|
url = github:occivink/kakoune-sudo-write;
|
|
|
|
flake = false;
|
|
|
|
};
|
2022-07-30 02:15:19 +00:00
|
|
|
kitty-icon = {
|
|
|
|
url = github:DinkDonk/kitty-icon;
|
|
|
|
flake = false;
|
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, darwin, nixpkgs, 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
|
|
|
|
genAttrs
|
|
|
|
makeOverridable
|
|
|
|
optional
|
|
|
|
optionalAttrs
|
|
|
|
singleton;
|
2022-01-23 23:50:34 +00:00
|
|
|
|
|
|
|
# Configuration for `nixpkgs`
|
|
|
|
nixpkgsConfig = {
|
|
|
|
config = { allowUnfree = true; };
|
2022-07-11 02:42:59 +00:00
|
|
|
overlays = attrValues self.overlays ++ singleton (
|
2022-07-16 20:34:47 +00:00
|
|
|
final: prev:
|
2022-07-21 02:19:32 +00:00
|
|
|
let
|
2022-07-21 23:51:23 +00:00
|
|
|
pkgs = import ./pkgs {
|
|
|
|
inherit inputs genAttrs;
|
|
|
|
inherit (final) callPackage;
|
|
|
|
};
|
2022-07-21 02:19:32 +00:00
|
|
|
in
|
2022-07-24 19:55:26 +00:00
|
|
|
pkgs // optionalAttrs (prev.stdenv.system == "aarch64-darwin")
|
2022-07-16 20:34:47 +00:00
|
|
|
{
|
|
|
|
# Sub in x86 version of packages that don't build on Apple Silicon yet
|
|
|
|
inherit (final.pkgs-x86);
|
|
|
|
}
|
2022-07-11 02:42:59 +00:00
|
|
|
);
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
2022-01-23 23:50:34 +00:00
|
|
|
# Shared home-manager configs
|
|
|
|
homeManagerStateVersion = "22.05";
|
|
|
|
homeManagerCommonConfig = {
|
|
|
|
imports = attrValues self.homeManagerModules ++ [
|
|
|
|
./home
|
|
|
|
{ home.stateVersion = homeManagerStateVersion; }
|
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 ++ [
|
|
|
|
# Main `nix-darwin` config
|
|
|
|
./darwin
|
|
|
|
# `home-manager` module
|
|
|
|
home-manager.darwinModules.home-manager
|
|
|
|
(
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
inherit (config.users) primaryUser;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
nixpkgs = nixpkgsConfig;
|
|
|
|
# Hack to support legacy worklows that use `<nixpkgs>` etc.
|
|
|
|
nix.nixPath = { nixpkgs = "$HOME/dotfiles.nix/nixpkgs.nix"; };
|
|
|
|
# `home-manager` config
|
|
|
|
users.users.${primaryUser}.home = "/Users/${primaryUser}";
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.users.${primaryUser} = homeManagerCommonConfig;
|
|
|
|
# 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 ++ [
|
|
|
|
{
|
|
|
|
users.primaryUser = "mat";
|
|
|
|
networking.computerName = "matbook pro m1";
|
|
|
|
networking.hostName = "matbook";
|
|
|
|
networking.knownNetworkServices = [
|
|
|
|
"Wi-Fi"
|
|
|
|
];
|
2022-07-30 02:15:19 +00:00
|
|
|
nix.buildCores = 2;
|
|
|
|
nix.maxJobs = 4;
|
|
|
|
|
|
|
|
games.enable = true;
|
|
|
|
home-manager.sharedModules = [{
|
|
|
|
programs.git.userEmail = "mat@mat.services";
|
|
|
|
programs.git.userName = "mat ess";
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
yelpbook-m1 = darwinSystem {
|
|
|
|
system = "aarch64-darwin";
|
|
|
|
modules = nixDarwinCommonModules ++ [
|
|
|
|
{
|
|
|
|
users.primaryUser = "mess";
|
|
|
|
networking.knownNetworkServices = [
|
|
|
|
"Wi-Fi"
|
|
|
|
];
|
|
|
|
nix.buildCores = 2;
|
|
|
|
nix.maxJobs = 5;
|
|
|
|
|
|
|
|
games.enable = false;
|
|
|
|
home-manager.sharedModules = [{
|
|
|
|
programs.git.userEmail = "mess@yelp.com";
|
|
|
|
programs.git.userName = "Matthew Ess";
|
|
|
|
}];
|
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, ... }: {
|
|
|
|
users.primaryUser = "runner";
|
|
|
|
homebrew.enable = lib.mkForce false;
|
|
|
|
})
|
|
|
|
];
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
2022-01-23 23:50:34 +00:00
|
|
|
|
|
|
|
# Build and activate with `nix build .#cloudVM.activationPackage; ./result/activate`
|
|
|
|
cloudVM = home-manager.lib.homeManagerConfiguration {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
stateVersion = homeManagerStateVersion;
|
|
|
|
homeDirectory = "/home/mat";
|
|
|
|
username = "mat";
|
|
|
|
configuration = {
|
|
|
|
imports = [ homeManagerCommonConfig ];
|
|
|
|
nixpkgs = nixpkgsConfig;
|
|
|
|
};
|
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-29 22:01:24 +00:00
|
|
|
kakounePlugins = prev.kakounePlugins // {
|
|
|
|
auto-pairs-kak = prev.kakounePlugins.auto-pairs-kak.overrideAttrs (attrs: {
|
|
|
|
src = inputs.auto-pairs-kak-src;
|
|
|
|
});
|
|
|
|
};
|
2022-07-24 19:55:26 +00:00
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
2022-01-23 23:50:34 +00:00
|
|
|
|
|
|
|
# `nix-darwin` modules (some are pending upstream acceptance)
|
|
|
|
darwinModules = {
|
2022-07-30 02:15:19 +00:00
|
|
|
games = import ./modules/darwin/games.nix;
|
2022-01-23 23:50:34 +00:00
|
|
|
programs-nix-index = import ./modules/darwin/programs/nix-index.nix;
|
|
|
|
security-pam = import ./modules/darwin/security/pam.nix;
|
|
|
|
users = import ./modules/darwin/users.nix;
|
|
|
|
};
|
|
|
|
|
|
|
|
# home manager configurations
|
|
|
|
homeManagerModules = {
|
|
|
|
# configs-git-aliases = import ./home/configs/git-aliases.nix;
|
|
|
|
# configs-gh-aliases = import ./home/configs/gh-aliases.nix;
|
|
|
|
configs-starship-symbols = import ./home/configs/starship-symbols.nix;
|
2022-07-26 04:22:16 +00:00
|
|
|
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-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
|
|
|
}
|