Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jetiaime committed Jan 12, 2025
0 parents commit 5d9f888
Show file tree
Hide file tree
Showing 39 changed files with 2,105 additions and 0 deletions.
542 changes: 542 additions & 0 deletions flake.lock

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
description = "TeAmo's Nix Darwin Configuration";

inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";

# Nixpkgs Unstable
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";

# Nix-Darwin
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};

# Nix-Homebrew
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";

# Home Manager
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};

# Snowfall Lib
snowfall-lib = {
url = "github:snowfallorg/lib";
inputs.nixpkgs.follows = "nixpkgs";
};

# Snowfall Flake
snowfall-flake = {
url = "github:snowfallorg/flake";
inputs.nixpkgs.follows = "nixpkgs";
};

# WezTerm
wezterm.url = "github:wez/wezterm?dir=nix";
};

outputs = {...} @ inputs:
let
inherit (inputs) snowfall-lib;

lib = snowfall-lib.mkLib {
inherit inputs;

src = ./.;

snowfall = {
namespace = "teamo";
meta = {
name = "teamo";
title = "TeAmo";
};
};
};
in lib.mkFlake {
channels-config = {
allowUnfree = true;
permittedInsecurePackages = [];
config = {};
};

overlays = [];

systems = {};
};
}
4 changes: 4 additions & 0 deletions lib/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_: {
override-meta =
meta: package: package.overrideAttrs (_: { inherit meta; });
}
34 changes: 34 additions & 0 deletions lib/module/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
lib,
...
}: let
inherit (lib) types mkOption mapAttrs;
in rec {
mkOpt = type: default: description: mkOption { inherit type default description; };

mkOpt' = type: default: mkOpt type default null;

mkBoolOpt = mkOpt types.bool;

mkBoolOpt' = mkOpt' types.bool;

mkStrOpt = mkOpt types.str;
mkStrOpt' = mkOpt' types.str;

mkIntOpt = mkOpt types.int;
mkIntOpt' = mkOpt' types.int;

mkAttrsOpt = mkOpt types.attrs;
mkAttrsOpt' = mkOpt' types.attrs;

enabled = {
enable = true;
};

disabled = {
enable = false;
};

force-attrs = mapAttrs (_key: lib.mkForce);

}
35 changes: 35 additions & 0 deletions modules/common/programs/cli/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
lib,
pkgs,
config,
namespace,
...
}: let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;

cfg = config.${namespace}.programs.cli;
in {
options.${namespace}.programs.cli = {
enable = mkBoolOpt false "Whether or not enable cli configuration.";
};

config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
bat # A cat(1) clone with wings
coreutils # GNU core utilities
curl # Curl
eza # A modern replacement for ls
fd # A modern replacement for find
fzf # A command-line fuzzy finder
git # Git
jq # jq is a lightweight and flexible command-line JSON processor
lsof # List open files
nixd
nil
unzip
wget
vim
];
};
}
27 changes: 27 additions & 0 deletions modules/common/system/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
lib,
inputs,
config,
namespace,
...
}: let
inherit (lib) types mkIf;
inherit (lib.${namespace}) mkOpt mkBoolOpt;

cfg = config.${namespace}.system;
in {

options.${namespace}.system = {
enable = mkBoolOpt false "Whether or not enable system configuration.";
stateVersion = mkOpt (types.oneOf [types.str types.int]) null "The state version of the system.";
};

config = mkIf cfg.enable {
system = {
stateVersion = cfg.stateVersion;

# Set Git commit hash for darwin-version.
configurationRevision = inputs.rev or inputs.dirtyRev or null;
};
};
}
49 changes: 49 additions & 0 deletions modules/common/system/font/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
lib,
pkgs,
config,
namespace,
...
}: let
inherit (lib) types mkIf;
inherit (lib.${namespace}) mkOpt mkStrOpt mkBoolOpt;

cfg = config.${namespace}.system.fonts;

in {
options.${namespace}.system.fonts = with types; {
enable = mkBoolOpt false "Whether or not to manage fonts.";

fonts = with pkgs; mkOpt (listOf package) [
# Desktop Fonts
corefonts # MS fonts
b612 # high legibility
material-icons
material-design-icons
work-sans
comic-neue
source-sans
inter
lexend

# Emojis
noto-fonts-color-emoji
twemoji-color-font

# Nerd Fonts
nerd-fonts.caskaydia-cove
nerd-fonts.iosevka
nerd-fonts.monaspace
nerd-fonts.symbols-only
] "Custom font packages to install.";

default = mkStrOpt "MonaspiceNe Nerd Font" "Default font name";
};

config = mkIf cfg.enable {
environment.variables = {
# Enable icons in tooling since we have nerdfonts.
LOG_ICONS = "true";
};
};
}
42 changes: 42 additions & 0 deletions modules/common/system/package-manager/nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
config,
lib,
pkgs,
namespace,
...
}: let
inherit (lib.${namespace}) mkBoolOpt mkOpt;

cfg = config.${namespace}.system.package-manager.nix;

in {
options.${namespace}.system.package-manager.nix = {
enable = mkBoolOpt true "Whether or not to manage nix configuration.";
package = mkOpt lib.types.package pkgs.nixVersions.latest "Which nix package to use.";
};

config = lib.mkIf cfg.enable {
nix.settings = {
builders-use-substitutes = true;

experimental-features = [
"nix-command"
"flakes"
];

substituters = [
"https://cache.nixos.org"
"https://numtide.cachix.org"
"https://nix-community.cachix.org"
"https://nixpkgs-unfree.cachix.org"
];

trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-unfree.cachix.org-1:hqvoInulhbV4nJ9yJOEr+4wxhDV4xq2d1DK7S6Nj6rs="
];
};
};
}
25 changes: 25 additions & 0 deletions modules/darwin/home/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
lib,
namespace,
...
}: let
inherit (lib.${namespace}) mkAttrsOpt;

in {
options.${namespace}.home = {
file = mkAttrsOpt {} "A set of files to be managed by home-manager's <option>home.file</option>.";
configFile = mkAttrsOpt {} "A set of config files to be managed by home-manager's <option>home.configFile</option>.";
extraConfig = mkAttrsOpt {} "Options to pass directly to home-manager.";
homeConfig = mkAttrsOpt {} "Final configuration for home-manager.";
};

config = {

home-manager = {
backupFileExtension = "hm.old";
useGlobalPkgs = true;
useUserPackages = true;
verbose = true;
};
};
}
26 changes: 26 additions & 0 deletions modules/darwin/programs/cli/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
lib,
pkgs,
config,
namespace,
...
}: let
inherit (lib) mkIf;

cfg = config.${namespace}.programs.cli;
in {
imports = [ (lib.snowfall.fs.get-file "modules/common/programs/cli/default.nix") ];

config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
bash-completion
cask # unknown package
gawk # GNU awk
gnused # GNU sed
gnugrep # GNU grep
gnupg # GNU Privacy Guard
gnutls # GNU Transport Layer Security Library
mas # Mac App Store CLI
];
};
}
18 changes: 18 additions & 0 deletions modules/darwin/programs/cli/shell/zsh/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
lib,
config,
namespace,
...
}: let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;
cfg = config.${namespace}.programs.cli.shell.zsh;
in {
options.${namespace}.programs.cli.shell.zsh = {
enable = mkBoolOpt false "Whether or not enable zsh configuration.";
};

config = mkIf cfg.enable {
programs.zsh.enable = true;
};
}
21 changes: 21 additions & 0 deletions modules/darwin/programs/gui/network/clash-verge-rev/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
lib,
config,
namespace,
...
}: let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;

cfg = config.${namespace}.programs.gui.network.clash-verge-rev;
in {
options.${namespace}.programs.gui.network.clash-verge-rev = {
enable = mkBoolOpt false "Whether or not enable clash-verge-rev configuration.";
};

config = mkIf cfg.enable {
homebrew.casks = [
"clash-verge-rev"
];
};
}
21 changes: 21 additions & 0 deletions modules/darwin/programs/gui/network/zerotier-one/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
lib,
config,
namespace,
...
}: let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;

cfg = config.${namespace}.programs.gui.network.zerotier-one;
in {
options.${namespace}.programs.gui.network.zerotier-one = {
enable = mkBoolOpt false "Whether or not enable zerotier-one configuration.";
};

config = mkIf cfg.enable {
homebrew.casks = [
"zerotier-one"
];
};
}
Loading

0 comments on commit 5d9f888

Please sign in to comment.