summaryrefslogtreecommitdiff
path: root/hostnix
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-04-13 20:47:25 -0400
committerJoe Mou <dev@mou.fo>2026-04-15 00:02:13 -0400
commit1c9249426a274884f8104e26ca63e4b3b3578687 (patch)
tree4a0e70104f7af1b23d4ef7586bba987f233684a9 /hostnix
parent8e814b1baffbcec81c177d098337804a01a354a8 (diff)
mojo: Refactor
Diffstat (limited to 'hostnix')
-rw-r--r--hostnix/mojo/flake.nix101
-rw-r--r--hostnix/mojo/modules/apps.nix26
-rw-r--r--hostnix/mojo/modules/system.nix23
-rw-r--r--hostnix/mojo/packages/claude-code/claude.sb (renamed from hostnix/mojo/claude.sb)0
-rw-r--r--hostnix/mojo/packages/claude-code/default.nix11
5 files changed, 93 insertions, 68 deletions
diff --git a/hostnix/mojo/flake.nix b/hostnix/mojo/flake.nix
index 9c6ca1c..319dfad 100644
--- a/hostnix/mojo/flake.nix
+++ b/hostnix/mojo/flake.nix
@@ -8,79 +8,44 @@
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
- outputs = inputs@{ self, nix-darwin, nixpkgs, nixpkgs-unstable }:
- let
- configuration = { pkgs, ... }: {
- environment.systemPackages = let
- # TODO is there a better way to do this?
- pkgsUnstable = import nixpkgs-unstable {
- localSystem = pkgs.stdenv.system;
- config.allowUnfree = true;
- };
- in
- [
- pkgs.direnv
- pkgs.nix-direnv
-
- (pkgs.writeShellScriptBin "claude" ''
- exec /usr/bin/sandbox-exec -f ${self}/claude.sb \
- -D TARGET_DIR=$HOME/src \
- -D TMP_DIR=/tmp \
- -D HOME_DIR=$HOME \
- -D CACHE_DIR=$HOME/.cache \
- ${pkgsUnstable.claude-code}/bin/claude \
- --allow-dangerously-skip-permissions "$@"
- '')
- pkgsUnstable.jujutsu
- ];
-
- # $ chsh -s /run/current-system/sw/bin/bash
- environment.shells = [ pkgs.bashInteractive ];
- programs.bash.completion.enable = true;
-
- nix.settings.experimental-features = "nix-command flakes";
-
- system.primaryUser = "joe";
-
- # Set Git commit hash for darwin-version.
- system.configurationRevision = self.rev or self.dirtyRev or null;
+ outputs =
+ inputs@{
+ self,
+ nix-darwin,
+ nixpkgs,
+ nixpkgs-unstable,
+ }:
+ let
+ configuration =
+ { pkgs, pkgsUnstable, ... }:
+ {
+ nix.settings.experimental-features = "nix-command flakes";
- # Used for backwards compatibility, please read the changelog before changing.
- # $ darwin-rebuild changelog
- system.stateVersion = 6;
+ # Set Git commit hash for darwin-version.
+ system.configurationRevision = self.rev or self.dirtyRev or null;
- # The platform the configuration will be used on.
- nixpkgs.hostPlatform = "aarch64-darwin";
+ # Used for backwards compatibility, please read the changelog before changing.
+ # $ darwin-rebuild changelog
+ system.stateVersion = 6;
- nixpkgs.config.allowUnfree = true;
- };
+ # The platform the configuration will be used on.
+ nixpkgs.hostPlatform = "aarch64-darwin";
+ };
- apps = { pkgs, ... }: {
- homebrew = {
- enable = true;
- # Enable after nix-darwin 25.11
- # enableBashIntegration = true;
- caskArgs.require_sha = true;
- onActivation.cleanup = "uninstall";
- brews = [ "mas" ];
- casks = [
- # Swap Command/Option, simulate fn, default fn1-12, reverse scroll.
- "karabiner-elements"
- # Scroll by lines and universal back/forward.
- "linearmouse"
- ];
- masApps = {
- "Ghostery Privacy Ad Blocker" = 6504861501;
- "Kagi for Safari" = 1622835804;
- "KeePassium (KeePass passwords)" = 1435127111;
- Xcode = 497799835;
+ in
+ {
+ darwinConfigurations.mojo = nix-darwin.lib.darwinSystem {
+ specialArgs = {
+ pkgsUnstable = import nixpkgs-unstable {
+ system = "aarch64-darwin";
+ config.allowUnfree = true;
+ };
};
+ modules = [
+ configuration
+ ./modules/apps.nix
+ ./modules/system.nix
+ ];
};
};
- in
- {
- darwinConfigurations.mojo = nix-darwin.lib.darwinSystem {
- modules = [ configuration apps ];
- };
- };
}
diff --git a/hostnix/mojo/modules/apps.nix b/hostnix/mojo/modules/apps.nix
new file mode 100644
index 0000000..1562893
--- /dev/null
+++ b/hostnix/mojo/modules/apps.nix
@@ -0,0 +1,26 @@
+{ pkgs, pkgsUnstable, ... }:
+{
+ environment.systemPackages = [
+ pkgs.direnv
+ pkgs.nix-direnv
+
+ (pkgsUnstable.callPackage ../packages/claude-code { })
+ pkgsUnstable.jujutsu
+ ];
+
+ homebrew = {
+ brews = [ "mas" ];
+
+ casks = [
+ "karabiner-elements" # modifiers, fn, reverse scroll
+ "linearmouse" # scroll by lines, universal back/forward
+ ];
+
+ masApps = {
+ "Ghostery Privacy Ad Blocker" = 6504861501;
+ "Kagi for Safari" = 1622835804;
+ "KeePassium (KeePass passwords)" = 1435127111;
+ Xcode = 497799835;
+ };
+ };
+}
diff --git a/hostnix/mojo/modules/system.nix b/hostnix/mojo/modules/system.nix
new file mode 100644
index 0000000..362a01b
--- /dev/null
+++ b/hostnix/mojo/modules/system.nix
@@ -0,0 +1,23 @@
+{
+ pkgs,
+ pkgsUnstable,
+ self,
+ ...
+}:
+{
+ nixpkgs.config.allowUnfree = true;
+
+ homebrew = {
+ enable = true;
+ # Enable after nix-darwin 25.11
+ # enableBashIntegration = true;
+ caskArgs.require_sha = true;
+ onActivation.cleanup = "uninstall";
+ };
+
+ system.primaryUser = "joe";
+
+ # $ chsh -s /run/current-system/sw/bin/bash
+ environment.shells = [ pkgs.bashInteractive ];
+ programs.bash.completion.enable = true;
+}
diff --git a/hostnix/mojo/claude.sb b/hostnix/mojo/packages/claude-code/claude.sb
index 72797de..72797de 100644
--- a/hostnix/mojo/claude.sb
+++ b/hostnix/mojo/packages/claude-code/claude.sb
diff --git a/hostnix/mojo/packages/claude-code/default.nix b/hostnix/mojo/packages/claude-code/default.nix
new file mode 100644
index 0000000..d8e333a
--- /dev/null
+++ b/hostnix/mojo/packages/claude-code/default.nix
@@ -0,0 +1,11 @@
+{ writeShellScriptBin, claude-code }:
+
+writeShellScriptBin "claude" ''
+ exec /usr/bin/sandbox-exec -f ${./claude.sb} \
+ -D TARGET_DIR=$HOME/src \
+ -D TMP_DIR=/tmp \
+ -D HOME_DIR=$HOME \
+ -D CACHE_DIR=$HOME/.cache \
+ ${claude-code}/bin/claude \
+ --allow-dangerously-skip-permissions "$@"
+''