Compare commits

..

6 Commits

16 changed files with 210 additions and 119 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
result

View File

@@ -1,65 +0,0 @@
{ pkgs, ... }:
{
imports = [
./cli-tools.nix
./mac-settings.nix
./pkg-installs.nix
./archive-installs.nix
];
nixpkgs.hostPlatform = "aarch64-darwin";
nix.settings.experimental-features = "nix-command flakes";
system.stateVersion = 6;
system.primaryUser = "briannelson";
environment.systemPackages = with pkgs; [
exif
exiftool
ffmpeg
flac
git
helix
librewolf
tea
yt-dlp
];
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "none";
};
brews = [
"bun"
"defaultbrowser"
"harper"
"nicotine-plus"
"rust"
"ykman"
];
casks = [
"bitwarden"
"cap"
"discord"
"docker-desktop"
"harper-desktop"
"libreoffice"
"nextcloud"
"obsidian"
"protonvpn"
"rustdesk"
"signal"
"task-manager-tmog"
"twingate"
"vlc"
"vscodium"
"firefox"
];
};
}

View File

@@ -8,19 +8,29 @@
nix-homebrew.url = "github:zhaofengli/nix-homebrew"; nix-homebrew.url = "github:zhaofengli/nix-homebrew";
}; };
outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, ... }: { outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, ... }:
darwinConfigurations."Brians-MacBook-Air" = nix-darwin.lib.darwinSystem { let
modules = [ mkDarwin = { profile, user, system ? "aarch-64-dawin" }:
./configuration.nix nix-darwin.lib.darwinSystem {
nix-homebrew.darwinModules.nix-homebrew specialArgs = { inherit user system; };
{ modules = [
nix-homebrew = { ./modules
enable = true; ./profiles/${profile}
enableRosetta = true; nix-homebrew.darwinModules.nix-homebrew
user = "briannelson"; {
}; nix-homebrew = {
} enable = true;
]; enableRosetta = true;
user = "briannelson";
};
}
];
};
in
{
darwinConfigurations = {
personal = mkDarwin { profile = "personal"; user = "briannelson"; };
work = mkDarwin { profile = "work"; user = "YOUR-WORK-USERNAME"; };
}; };
}; };
} }

42
modules/apps.nix Normal file
View File

@@ -0,0 +1,42 @@
{ pkgs, ... }:
{
# This file installs these apps on all configurations
pkgInstalls = [
{
name = "cupsadmin";
url = "https://github.com/kfattic/cupsadmin/releases/download/v1.4.1/cupsadmin-1.4.1.pkg";
hash = "sha256-DyIyDYSjAlcU7ivyfldMapIZw5nczEBXfnLicnK6k7Y=";
}
];
archiveApps = [];
environment.systemPackages = with pkgs; [
exif
exiftool
git
helix
];
homebrew.brews = [
"bun"
"defaultbrowser"
"harper"
"rust"
"ykman"
];
homebrew.casks = [
"bitwarden"
"harper-desktop"
"nextcloud"
"obsidian"
"signal"
"task-manager-tmog"
"twingate"
"vlc"
"vscodium"
"firefox"
];
}

View File

@@ -1,17 +1,9 @@
{ pkgs, lib, ... }: { pkgs, lib, config, ... }:
let let
cfg = config.archiveApps;
stampDir = "/usr/local/share/nix-pkg-stamps"; stampDir = "/usr/local/share/nix-pkg-stamps";
apps = [
{
name = "removemacai-app";
app = "RemoveMacAI.app";
url = "https://github.com/omlahore/RemoveMacAI/releases/download/v1.1.4/RemoveMacAI.zip";
sha256 = "2063d4dc7e0b41b15cebcd9e1b9807b04615b96e3e23db35cbd1196be3c96bee";
}
];
appScript = a: appScript = a:
let let
src = pkgs.fetchurl { inherit (a) url sha256; }; src = pkgs.fetchurl { inherit (a) url sha256; };
@@ -38,8 +30,12 @@ let
''; '';
in in
{ {
system.activationScripts.postActivation.text = options.archiveApps = lib.mkOption {
lib.concatStringsSep "\n" ( type = lib.types.listOf (lib.types.attrsOf lib.types.str);
(map appScript apps) default = [ ];
); description = "Apps distributed as .zip archives to install into /Applications";
};
config.system.activationScripts.postActivation.text =
lib.concatMapStringsSep "\n" appScript cfg;
} }

18
modules/base.nix Normal file
View File

@@ -0,0 +1,18 @@
{ ... }:
{
nixpkgs.hostPlatform = "aarch64-darwin";
nix.settings.experimental-features = "nix-command flakes";
system.stateVersion = 6;
system.primaryUser = "briannelson";
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "none";
};
};
}

19
modules/cli-tools.nix Normal file
View File

@@ -0,0 +1,19 @@
{ ... }:
{
environment.shellAliases = {
ll = "ls -la";
};
environment.etc."gitconfig".text = ''
[user]
name = Brian Nelson
email = brian@briannelson.dev
[init]
defaultBranch = main
[credential]
helper = osxkeychain
'';
environment.variables.GIT_CONFIG_SYSTEM = "/etc/gitconfig";
}

12
modules/default.nix Normal file
View File

@@ -0,0 +1,12 @@
{ ... }:
{
imports = [
./base.nix
./apps.nix
./cli-tools.nix
./mac-settings.nix
./pkg-installs.nix
./archive-installs.nix
];
}

View File

@@ -1,15 +1,7 @@
{ pkgs, lib, ... }: { pkgs, lib, config, ... }:
let let
# Add one entry per program you want to install from a .pkg file cfg = config.pkgInstalls;
pkgInstalls = [
{
name = "cupsadmin";
url = "https://github.com/kfattic/cupsadmin/releases/download/v1.4.1/cupsadmin-1.4.1.pkg";
hash = "sha256-DyIyDYSjAlcU7ivyfldMapIZw5nczEBXfnLicnK6k7Y=";
}
];
installScript = p: installScript = p:
let let
src = pkgs.fetchurl { inherit (p) url hash; }; src = pkgs.fetchurl { inherit (p) url hash; };
@@ -28,6 +20,12 @@ let
''; '';
in in
{ {
system.activationScripts.postActivation.text = options.pkgInstalls = lib.mkOption {
lib.concatMapStringsSep "\n" installScript pkgInstalls; type = lib.types.listOf (lib.types.attrsOf lib.types.str);
default = [ ];
description = "PKG files to install on activation";
};
config.system.activationScripts.postActivation.text =
lib.concatMapStringsSep "\n" installScript cfg;
} }

View File

@@ -0,0 +1,35 @@
{ pkgs, ... }:
{
pkgInstalls = [];
archiveApps = [
{
name = "removemacai-app";
app = "RemoveMacAI.app";
url = "https://github.com/omlahore/RemoveMacAI/releases/download/v1.1.4/RemoveMacAI.zip";
sha256 = "2063d4dc7e0b41b15cebcd9e1b9807b04615b96e3e23db35cbd1196be3c96bee";
}
];
environment.systemPackages = with pkgs; [
ffmpeg
flac
librewolf
tea
yt-dlp
];
homebrew.brews = [
"nicotine-plus"
];
homebrew.casks = [
"cap"
"discord"
"docker-desktop"
"libreoffice"
"protonvpn"
"rustdesk"
];
}

View File

@@ -1,23 +1,10 @@
{ pkgs, ... }: { ... }:
{ {
environment.shellAliases = { environment.shellAliases = {
yt = "yt-dlp"; yt = "yt-dlp";
ll = "ls -la";
}; };
environment.etc."gitconfig".text = ''
[user]
name = Brian Nelson
email = brian@briannelson.dev
[init]
defaultBranch = main
[credential]
helper = osxkeychain
'';
environment.variables.GIT_CONFIG_SYSTEM = "/etc/gitconfig";
environment.etc."yt-dlp.conf".text = '' environment.etc."yt-dlp.conf".text = ''
-o /Users/briannelson/Downloads/yt-dlp/%(title)s.%(ext)s -o /Users/briannelson/Downloads/yt-dlp/%(title)s.%(ext)s
--no-mtime --no-mtime
@@ -33,4 +20,4 @@
sudo -u briannelson /opt/homebrew/bin/defaultbrowser librewolf || echo "could not set deffault browser, skipping" sudo -u briannelson /opt/homebrew/bin/defaultbrowser librewolf || echo "could not set deffault browser, skipping"
fi fi
''; '';
} }

View File

@@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./cli-tools.nix
./apps.nix
];
}

13
profiles/work/apps.nix Normal file
View File

@@ -0,0 +1,13 @@
{ pkgs, ... }:
{
pkgInstalls = [];
archiveApps = [];
environment.systemPackages = with pkgs; [];
homebrew.brews = [];
homebrew.casks = [];
}

View File

@@ -0,0 +1,9 @@
{ ... }:
{
system.activationScripts.postActivation.text = ''
if [ -x /opt/homebrew/bin/defaultbrowser ]; then
sudo -u briannelson /opt/homebrew/bin/defaultbrowser firefox || echo "could not set deffault browser, skipping"
fi
'';
}

View File

@@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./apps.nix
./cli-tools.nix
];
}