2022-01-23 01:32:58 +00:00
|
|
|
{
|
|
|
|
description = "mat's nix configs";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
# Package sets
|
2022-12-20 02:45:46 +00:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2022-12-21 05:22:57 +00:00
|
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixpkgs-22.11-darwin";
|
2022-09-04 17:39:34 +00:00
|
|
|
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
|
2022-01-23 01:32:58 +00:00
|
|
|
|
2022-11-05 22:03:58 +00:00
|
|
|
# Flake helpers
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
|
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-12-20 02:45:46 +00:00
|
|
|
darwin.inputs.nixpkgs.follows = "nixpkgs";
|
2022-09-04 17:39:34 +00:00
|
|
|
home-manager.url = "github:nix-community/home-manager";
|
2022-12-20 02:45:46 +00:00
|
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
2022-11-05 22:03:58 +00:00
|
|
|
home-manager.inputs.utils.follows = "flake-utils";
|
2022-01-23 01:32:58 +00:00
|
|
|
|
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-11-20 22:07:02 +00:00
|
|
|
# pre-commit and hooks
|
2022-11-30 01:41:05 +00:00
|
|
|
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
|
2022-12-21 05:22:57 +00:00
|
|
|
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
pre-commit.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
|
2022-11-20 22:07:02 +00:00
|
|
|
pre-commit.inputs.flake-utils.follows = "flake-utils";
|
2022-11-20 16:49:45 +00:00
|
|
|
|
2022-09-17 23:02:51 +00:00
|
|
|
# Extra sources
|
2022-09-04 17:39:34 +00:00
|
|
|
helix.url = "github:helix-editor/helix";
|
2022-12-20 02:45:46 +00:00
|
|
|
helix.inputs.nixpkgs.follows = "nixpkgs";
|
2022-09-17 23:02:51 +00:00
|
|
|
dark-mode-notify-src.url = "github:bouk/dark-mode-notify";
|
|
|
|
dark-mode-notify-src.flake = false;
|
2022-11-22 01:36:15 +00:00
|
|
|
ia-writer-family-src.url = "github:iaolo/iA-Fonts";
|
|
|
|
ia-writer-family-src.flake = false;
|
2022-09-17 23:02:51 +00:00
|
|
|
kitty-icon.url = "github:DinkDonk/kitty-icon";
|
|
|
|
kitty-icon.flake = false;
|
2022-11-21 21:49:35 +00:00
|
|
|
kitty-themes.url = "github:kovidgoyal/kitty-themes";
|
|
|
|
kitty-themes.flake = false;
|
2022-10-17 17:29:38 +00:00
|
|
|
fisher-src.url = "github:jorgebucaran/fisher";
|
|
|
|
fisher-src.flake = false;
|
2023-04-14 06:40:01 +00:00
|
|
|
starship-src.url = "github:starship/starship";
|
|
|
|
starship-src.flake = false;
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
2022-12-20 02:45:46 +00:00
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, flake-utils
|
|
|
|
, pre-commit
|
|
|
|
, ...
|
|
|
|
}@inputs:
|
2022-01-23 23:50:34 +00:00
|
|
|
let
|
2022-12-20 02:45:46 +00:00
|
|
|
# this is a "functor" that takes an option name
|
|
|
|
# this allows for creating identical modules
|
|
|
|
# which can be accessed by appropriate paths darwin or home-manager
|
|
|
|
mkPrimaryUserModule = import ./modules/mk-primary-user-module.nix;
|
2022-01-23 23:50:34 +00:00
|
|
|
|
2022-12-20 02:45:46 +00:00
|
|
|
inherit (inputs.darwin.lib) darwinSystem;
|
|
|
|
inherit (inputs.nixpkgs.lib)
|
2022-07-21 02:19:32 +00:00
|
|
|
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-12-21 05:22:57 +00:00
|
|
|
overlays = attrValues self.overlays;
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
2022-12-21 05:22:57 +00:00
|
|
|
homeStateVersion = "22.05";
|
2022-09-15 21:17:21 +00:00
|
|
|
|
|
|
|
primaryUserInfo = {
|
|
|
|
username = "mat";
|
|
|
|
fullName = "mat ess";
|
|
|
|
email = "mat@mat.services";
|
|
|
|
};
|
|
|
|
|
|
|
|
workUserInfo = {
|
|
|
|
username = "mess";
|
|
|
|
fullName = "Matthew Ess";
|
|
|
|
email = "mess@yelp.com";
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
2022-12-21 05:22:57 +00:00
|
|
|
# helper for defining nix-darwin systems
|
|
|
|
mkDarwinSystem =
|
|
|
|
{ modules ? [ ]
|
|
|
|
, homeModules ? [ ]
|
|
|
|
, ...
|
|
|
|
}@args: import ./lib/mkDarwinSystem.nix self inputs nixpkgsConfig (args // {
|
|
|
|
inherit homeStateVersion;
|
|
|
|
modules = attrValues self.darwinModules ++ modules;
|
|
|
|
homeModules = attrValues self.homeManagerModules ++ homeModules;
|
|
|
|
});
|
2022-01-23 23:50:34 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
# `nix-darwin` configs
|
2022-12-21 05:22:57 +00:00
|
|
|
darwinConfigurations =
|
|
|
|
let
|
|
|
|
bootstrap-x86 = makeOverridable darwinSystem {
|
|
|
|
system = "x86_64-darwin";
|
|
|
|
modules = [ ./darwin/bootstrap.nix { nixpkgs = nixpkgsConfig; } ];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
# Mininal configurations to bootstrap systems
|
|
|
|
inherit bootstrap-x86;
|
|
|
|
bootstrap-arm = bootstrap-x86.override { system = "aarch64-darwin"; };
|
|
|
|
|
|
|
|
# M1 MBP
|
|
|
|
matbook = mkDarwinSystem {
|
|
|
|
primaryUser = primaryUserInfo;
|
|
|
|
modules = [
|
|
|
|
({ pkgs, ... }: {
|
|
|
|
networking.computerName = "matbook pro m1";
|
|
|
|
networking.hostName = "matbook";
|
|
|
|
networking.knownNetworkServices = [
|
|
|
|
"Wi-Fi"
|
|
|
|
];
|
|
|
|
nix.settings.cores = 2;
|
|
|
|
nix.settings.max-jobs = 4;
|
|
|
|
|
|
|
|
homebrew.casks = [
|
|
|
|
# games
|
|
|
|
"gog-galaxy"
|
|
|
|
"origin"
|
|
|
|
"sony-ps-remote-play"
|
|
|
|
"steam"
|
|
|
|
];
|
|
|
|
home-manager.sharedModules = [{
|
|
|
|
programs.fish.shellAliases = {
|
|
|
|
code = "${pkgs.vscodium}/bin/codium";
|
|
|
|
};
|
|
|
|
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-12-21 05:22:57 +00:00
|
|
|
yelpbook-m1 = mkDarwinSystem {
|
|
|
|
primaryUser = workUserInfo;
|
|
|
|
modules = [
|
|
|
|
({ pkgs, lib, ... }: {
|
|
|
|
users.primaryUser = workUserInfo;
|
|
|
|
networking.knownNetworkServices = [
|
|
|
|
"Wi-Fi"
|
|
|
|
];
|
|
|
|
nix.settings.cores = 2;
|
|
|
|
nix.settings.max-jobs = 5;
|
|
|
|
|
|
|
|
homebrew.casks = [ "itsycal" ];
|
|
|
|
home-manager.sharedModules = [{
|
|
|
|
# TODO: how to remove this entirely?
|
|
|
|
home.file.".tarsnaprc" = lib.mkForce { text = ""; };
|
|
|
|
home.packages = [ pkgs.yubiswitch ];
|
|
|
|
programs.ssh.matchBlocks.devbox = {
|
2023-04-12 18:08:49 +00:00
|
|
|
hostname = "csdev6";
|
2022-12-21 05:22:57 +00:00
|
|
|
forwardAgent = true;
|
|
|
|
serverAliveInterval = 120;
|
|
|
|
};
|
|
|
|
programs.fish.functions.devbox.body = ''
|
|
|
|
ssh -t devbox "agenttmux attach; or agenttmux new -s yelp"
|
|
|
|
'';
|
|
|
|
launchd.agents.tarsnap.enable = lib.mkForce false;
|
|
|
|
}];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2022-01-23 23:50:34 +00:00
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
|
2022-01-23 23:50:34 +00:00
|
|
|
# Overlays --------------------------------------------------------------- {{{
|
|
|
|
|
|
|
|
overlays = {
|
|
|
|
# nixpkgs overlays
|
2022-12-20 02:45:46 +00:00
|
|
|
pkgs-stable = _: prev: {
|
|
|
|
pkgs-stable = import inputs.nixpkgs-stable {
|
2022-01-23 23:50:34 +00:00
|
|
|
inherit (prev.stdenv) system;
|
|
|
|
inherit (nixpkgsConfig) config;
|
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
|
|
|
|
2022-12-20 02:45:46 +00:00
|
|
|
pkgs-unstable = _: prev: {
|
|
|
|
pkgs-unstable = import inputs.nixpkgs {
|
2022-01-23 23:50:34 +00:00
|
|
|
inherit (prev.stdenv) system;
|
|
|
|
inherit (nixpkgsConfig) config;
|
|
|
|
};
|
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
|
2022-12-20 02:45:46 +00:00
|
|
|
pkgs-master = _: prev: {
|
2022-05-08 01:43:56 +00:00
|
|
|
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
|
2022-12-20 02:45:46 +00:00
|
|
|
apple-silicon = _: prev: optionalAttrs (prev.stdenv.system == "aarch64-darwin") {
|
2022-01-23 23:50:34 +00:00
|
|
|
# Add access to x86 packages system is running Apple Silicon
|
2022-12-20 02:45:46 +00:00
|
|
|
pkgs-x86 = import inputs.nixpkgs {
|
2022-01-23 23:50:34 +00:00
|
|
|
system = "x86_64-darwin";
|
|
|
|
inherit (nixpkgsConfig) config;
|
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
};
|
2022-07-24 19:55:26 +00:00
|
|
|
|
2022-12-20 02:45:46 +00:00
|
|
|
homebrew-enabled = _: prev: optionalAttrs prev.stdenv.isDarwin {
|
2022-07-30 02:15:19 +00:00
|
|
|
lib = prev.lib // { homebrew-enabled = inputs.homebrew-enabled.value; };
|
2022-07-24 19:55:26 +00:00
|
|
|
};
|
2022-12-21 05:22:57 +00:00
|
|
|
|
|
|
|
extra-pkgs = import ./pkgs { inherit inputs; };
|
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-12-20 02:45:46 +00:00
|
|
|
darwin-primary-user = mkPrimaryUserModule "users";
|
2022-01-23 23:50:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# home manager configurations
|
|
|
|
homeManagerModules = {
|
2022-10-10 21:54:15 +00:00
|
|
|
# services
|
|
|
|
dark-mode-notify-service = import ./home/services/dark-mode-notify.nix;
|
|
|
|
tarsnap-service = import ./home/services/tarsnap.nix;
|
|
|
|
# etc
|
2022-09-15 21:17:21 +00:00
|
|
|
files = import ./home/files.nix;
|
|
|
|
fish = import ./home/fish.nix;
|
|
|
|
git = import ./home/git.nix;
|
2022-11-28 21:55:43 +00:00
|
|
|
helix = import ./home/helix.nix;
|
2022-09-15 21:17:21 +00:00
|
|
|
kitty = import ./home/kitty.nix;
|
|
|
|
programs = import ./home/programs.nix;
|
|
|
|
starship = import ./home/starship.nix;
|
2022-12-20 02:45:46 +00:00
|
|
|
starship-symbols = import ./home/starship-symbols.nix;
|
2022-09-15 21:17:21 +00:00
|
|
|
# modules
|
2022-11-28 21:55:43 +00:00
|
|
|
programs-kakoune-extras = import ./modules/home/programs/kakoune/extras.nix; # currently unused
|
|
|
|
programs-helix-extras = import ./modules/home/programs/helix/extras.nix;
|
2022-01-23 23:50:34 +00:00
|
|
|
programs-kitty-extras = import ./modules/home/programs/kitty/extras.nix;
|
2022-12-20 02:45:46 +00:00
|
|
|
home-primary-user = mkPrimaryUserModule "home";
|
2022-01-23 23:50:34 +00:00
|
|
|
};
|
2022-01-23 01:32:58 +00:00
|
|
|
|
2022-12-21 05:22:57 +00:00
|
|
|
templates = import ./templates;
|
|
|
|
} // flake-utils.lib.eachDefaultSystem (system: {
|
|
|
|
legacyPackages = import inputs.nixpkgs (nixpkgsConfig // { inherit system; });
|
2022-12-20 02:45:46 +00:00
|
|
|
|
|
|
|
checks.pre-commit = pre-commit.lib.${system}.run {
|
|
|
|
src = ./.;
|
|
|
|
hooks = {
|
|
|
|
deadnix.enable = true;
|
|
|
|
nixpkgs-fmt.enable = true;
|
|
|
|
statix.enable = true;
|
2022-11-20 22:07:02 +00:00
|
|
|
};
|
2022-12-20 02:45:46 +00:00
|
|
|
};
|
2022-11-20 22:07:02 +00:00
|
|
|
|
2022-12-21 05:22:57 +00:00
|
|
|
devShells = let pkgs = self.legacyPackages.${system}; in {
|
2022-12-20 02:45:46 +00:00
|
|
|
default = pkgs.mkShell {
|
2022-11-30 01:41:05 +00:00
|
|
|
inherit (self.checks.${system}.pre-commit) shellHook;
|
|
|
|
};
|
2022-12-20 02:45:46 +00:00
|
|
|
# TODO: add utility devShells here
|
|
|
|
};
|
|
|
|
});
|
2022-01-23 23:50:34 +00:00
|
|
|
}
|