brian/profiles #1
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
result
|
||||
@@ -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"
|
||||
];
|
||||
};
|
||||
}
|
||||
16
flake.nix
16
flake.nix
@@ -8,10 +8,14 @@
|
||||
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, ... }: {
|
||||
darwinConfigurations."Brians-MacBook-Air" = nix-darwin.lib.darwinSystem {
|
||||
outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, ... }:
|
||||
let
|
||||
mkDarwin = { profile, user, system ? "aarch-64-dawin" }:
|
||||
nix-darwin.lib.darwinSystem {
|
||||
specialArgs = { inherit user system; };
|
||||
modules = [
|
||||
./configuration.nix
|
||||
./modules
|
||||
./profiles/${profile}
|
||||
nix-homebrew.darwinModules.nix-homebrew
|
||||
{
|
||||
nix-homebrew = {
|
||||
@@ -22,5 +26,11 @@
|
||||
}
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
darwinConfigurations = {
|
||||
personal = mkDarwin { profile = "personal"; user = "briannelson"; };
|
||||
work = mkDarwin { profile = "work"; user = "YOUR-WORK-USERNAME"; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
42
modules/apps.nix
Normal file
42
modules/apps.nix
Normal 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"
|
||||
];
|
||||
}
|
||||
@@ -1,17 +1,9 @@
|
||||
{ pkgs, lib, ... }:
|
||||
{ pkgs, lib, config, ... }:
|
||||
|
||||
let
|
||||
cfg = config.archiveApps;
|
||||
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:
|
||||
let
|
||||
src = pkgs.fetchurl { inherit (a) url sha256; };
|
||||
@@ -38,8 +30,12 @@ let
|
||||
'';
|
||||
in
|
||||
{
|
||||
system.activationScripts.postActivation.text =
|
||||
lib.concatStringsSep "\n" (
|
||||
(map appScript apps)
|
||||
);
|
||||
options.archiveApps = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.attrsOf lib.types.str);
|
||||
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
18
modules/base.nix
Normal 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
19
modules/cli-tools.nix
Normal 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
12
modules/default.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./base.nix
|
||||
./apps.nix
|
||||
./cli-tools.nix
|
||||
./mac-settings.nix
|
||||
./pkg-installs.nix
|
||||
./archive-installs.nix
|
||||
];
|
||||
}
|
||||
@@ -1,15 +1,7 @@
|
||||
{ pkgs, lib, ... }:
|
||||
{ pkgs, lib, config, ... }:
|
||||
|
||||
let
|
||||
# Add one entry per program you want to install from a .pkg file
|
||||
pkgInstalls = [
|
||||
{
|
||||
name = "cupsadmin";
|
||||
url = "https://github.com/kfattic/cupsadmin/releases/download/v1.4.1/cupsadmin-1.4.1.pkg";
|
||||
hash = "sha256-DyIyDYSjAlcU7ivyfldMapIZw5nczEBXfnLicnK6k7Y=";
|
||||
}
|
||||
];
|
||||
|
||||
cfg = config.pkgInstalls;
|
||||
installScript = p:
|
||||
let
|
||||
src = pkgs.fetchurl { inherit (p) url hash; };
|
||||
@@ -28,6 +20,12 @@ let
|
||||
'';
|
||||
in
|
||||
{
|
||||
system.activationScripts.postActivation.text =
|
||||
lib.concatMapStringsSep "\n" installScript pkgInstalls;
|
||||
options.pkgInstalls = lib.mkOption {
|
||||
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;
|
||||
}
|
||||
35
profiles/personal/apps.nix
Normal file
35
profiles/personal/apps.nix
Normal 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"
|
||||
];
|
||||
}
|
||||
@@ -1,23 +1,10 @@
|
||||
{ pkgs, ... }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
environment.shellAliases = {
|
||||
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 = ''
|
||||
-o /Users/briannelson/Downloads/yt-dlp/%(title)s.%(ext)s
|
||||
--no-mtime
|
||||
8
profiles/personal/default.nix
Normal file
8
profiles/personal/default.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./cli-tools.nix
|
||||
./apps.nix
|
||||
];
|
||||
}
|
||||
13
profiles/work/apps.nix
Normal file
13
profiles/work/apps.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
pkgInstalls = [];
|
||||
|
||||
archiveApps = [];
|
||||
|
||||
environment.systemPackages = with pkgs; [];
|
||||
|
||||
homebrew.brews = [];
|
||||
|
||||
homebrew.casks = [];
|
||||
}
|
||||
9
profiles/work/cli-tools.nix
Normal file
9
profiles/work/cli-tools.nix
Normal 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
|
||||
'';
|
||||
}
|
||||
8
profiles/work/default.nix
Normal file
8
profiles/work/default.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./apps.nix
|
||||
./cli-tools.nix
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user