Merge pull request 'brian/profiles' (#1) from brian/profiles into main
Reviewed-on: #1
This commit is contained in:
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";
|
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
|
||||||
|
mkDarwin = { profile, user, system ? "aarch-64-dawin" }:
|
||||||
|
nix-darwin.lib.darwinSystem {
|
||||||
|
specialArgs = { inherit user system; };
|
||||||
modules = [
|
modules = [
|
||||||
./configuration.nix
|
./modules
|
||||||
|
./profiles/${profile}
|
||||||
nix-homebrew.darwinModules.nix-homebrew
|
nix-homebrew.darwinModules.nix-homebrew
|
||||||
{
|
{
|
||||||
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
|
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
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
|
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;
|
||||||
}
|
}
|
||||||
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 = {
|
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
|
||||||
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