From 25d3917db6f95d16d795cd1a894e2391098007d0 Mon Sep 17 00:00:00 2001 From: Dennis Date: Thu, 5 Mar 2026 22:26:16 +0100 Subject: [PATCH] migrates dnsc-air --- Justfile | 3 ++ flake.lock | 36 +++++++++++++++++ flake.nix | 1 + modules/base/default.nix | 10 ++++- modules/cli-tools/default.nix | 1 + modules/homebrew/default.nix | 56 +++++++++++++++++++++++++++ modules/hosts/dnsc-air/default.nix | 32 +++++++++++++++ modules/scrolling-desktop/default.nix | 4 ++ modules/shell/default.nix | 1 + 9 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 modules/homebrew/default.nix create mode 100644 modules/hosts/dnsc-air/default.nix diff --git a/Justfile b/Justfile index 8096d30..acbcb8e 100644 --- a/Justfile +++ b/Justfile @@ -1,6 +1,9 @@ deploy: nixos-rebuild switch --flake . +dd: + darwin-rebuild switch --flake . + debug: nixos-rebuild switch --flake . --show-trace --verbose diff --git a/flake.lock b/flake.lock index 24f5719..ae836aa 100644 --- a/flake.lock +++ b/flake.lock @@ -21,6 +21,23 @@ "type": "github" } }, + "brew-src": { + "flake": false, + "locked": { + "lastModified": 1769363988, + "narHash": "sha256-BiGPeulrDVetXP+tjxhMcGLUROZAtZIhU5m4MqawCfM=", + "owner": "Homebrew", + "repo": "brew", + "rev": "d01011cac6d72032c75fd2cd9489909e95d9faf2", + "type": "github" + }, + "original": { + "owner": "Homebrew", + "ref": "5.0.12", + "repo": "brew", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -204,6 +221,24 @@ "type": "github" } }, + "nix-homebrew": { + "inputs": { + "brew-src": "brew-src" + }, + "locked": { + "lastModified": 1769437432, + "narHash": "sha256-8d7KnCpT2LweRvSzZYEGd9IM3eFX+A78opcnDM0+ndk=", + "owner": "zhaofengli", + "repo": "nix-homebrew", + "rev": "a5409abd0d5013d79775d3419bcac10eacb9d8c5", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "repo": "nix-homebrew", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1754028485, @@ -300,6 +335,7 @@ "home-manager": "home-manager_2", "import-tree": "import-tree", "nix-darwin": "nix-darwin", + "nix-homebrew": "nix-homebrew", "nixpkgs": "nixpkgs_2", "nixpkgs-lib": [ "nixpkgs" diff --git a/flake.nix b/flake.nix index 22f1926..7635066 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,7 @@ nixpkgs-lib.follows = "nixpkgs"; nixvim.url = "github:nix-community/nixvim"; agenix.url = "github:ryantm/agenix"; + nix-homebrew.url = "github:zhaofengli/nix-homebrew"; dms = { url = "github:AvengeMedia/DankMaterialShell/stable"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/base/default.nix b/modules/base/default.nix index 1887adf..44c23b8 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -1,11 +1,17 @@ -{ config, pkgs, ... }: +{ config, ... }: let username = config.flake.globalConfig.username; + fullname = config.flake.globalConfig.fullname; in { - flake.modules.darwin.system = + flake.modules.darwin.base = { pkgs, ... }: { + users.users.${username} = { + home = "/Users/${username}"; + description = fullname; + }; + system = { primaryUser = username; stateVersion = 5; diff --git a/modules/cli-tools/default.nix b/modules/cli-tools/default.nix index f98e22b..f015699 100644 --- a/modules/cli-tools/default.nix +++ b/modules/cli-tools/default.nix @@ -19,6 +19,7 @@ let lazygit wget btop + rsync ]; in { diff --git a/modules/homebrew/default.nix b/modules/homebrew/default.nix new file mode 100644 index 0000000..6781eb6 --- /dev/null +++ b/modules/homebrew/default.nix @@ -0,0 +1,56 @@ +{ config, ... }: +let + username = config.flake.globalConfig.username; +in +{ + flake.modules.darwin.homebrew = + { pkgs, ... }: + { + nix-homebrew = { + enable = true; + user = username; + autoMigrate = true; + }; + + homebrew = { + user = username; + enable = true; + + onActivation = { + autoUpdate = true; + upgrade = true; + cleanup = "zap"; + }; + + brews = [ + "go" + "mas" + "yt-dlp" + ]; + + casks = [ + "font-victor-mono" + "font-victor-mono-nerd-font" + "vlc" + "ghostty" + "hiddenbar" + "eurkey" + "karabiner-elements" + "caffeine" + "raycast" + "spotify" + "keyboard-cowboy" + "krita" + "darktable" + ]; + + masApps = { + Bitwarden = 1352778147; + "Yesterday For Old Reddit" = 1603279883; + "Final Cut Pro" = 424389933; + Wireguard = 1451685025; + Pages = 409201541; + }; + }; + }; +} diff --git a/modules/hosts/dnsc-air/default.nix b/modules/hosts/dnsc-air/default.nix new file mode 100644 index 0000000..8bef6fc --- /dev/null +++ b/modules/hosts/dnsc-air/default.nix @@ -0,0 +1,32 @@ +{ inputs, config, ... }: +let + hostname = "dnsc-air"; +in +{ + flake.darwinConfigurations.${hostname} = inputs.nix-darwin.lib.darwinSystem { + system = "aarch64-darwin"; + modules = with config.flake.modules.darwin; [ + inputs.nix-homebrew.darwinModules.nix-homebrew + + base + home-manager + shell + git + ssh + cli-tools + nix + neovim + terminal + browser + + ( + { ... }: + { + networking.hostName = hostname; + networking.computerName = hostname; + system.defaults.smb.NetBIOSName = hostname; + } + ) + ]; + }; +} diff --git a/modules/scrolling-desktop/default.nix b/modules/scrolling-desktop/default.nix index de5d2e6..40f6548 100644 --- a/modules/scrolling-desktop/default.nix +++ b/modules/scrolling-desktop/default.nix @@ -61,6 +61,10 @@ flake.modules.homeManager.scrolling-desktop = { pkgs, config, ... }: { + imports = [ + ({ lib, pkgs, ... }: lib.mkIf pkgs.stdenv.isDarwin { }) + ]; + services.polkit-gnome.enable = true; services.mpris-proxy.enable = true; diff --git a/modules/shell/default.nix b/modules/shell/default.nix index a734158..4a4e584 100644 --- a/modules/shell/default.nix +++ b/modules/shell/default.nix @@ -19,6 +19,7 @@ { programs.fish.enable = true; users.defaultUserShell = pkgs.fish; + environment.shells = [ pkgs.fish ]; home-manager.sharedModules = [ inputs.self.modules.homeManager.shell