diff --git a/modules/apps.nix b/modules/apps.nix new file mode 100644 index 0000000..cf617fd --- /dev/null +++ b/modules/apps.nix @@ -0,0 +1,42 @@ +{ ... }: + +{ + # 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" + ]; +} \ No newline at end of file diff --git a/profiles/personal/archive-installs.nix b/modules/archive-installs.nix similarity index 72% rename from profiles/personal/archive-installs.nix rename to modules/archive-installs.nix index 40062e3..828cf94 100644 --- a/profiles/personal/archive-installs.nix +++ b/modules/archive-installs.nix @@ -1,17 +1,9 @@ { pkgs, lib, ... }: 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 { + optiosn.archiveApps = lib.mkOption { + type = lib.types.typesOf (lib.types.attrsOf lib.types.str); + default = [ ]; + description = "Apps distributed as .zip archives to install into /Applications"; + } + system.activationScripts.postActivation.text = - lib.concatStringsSep "\n" ( - (map appScript apps) - ); + lib.concatMapStringsSep "\n" appScript cfg; } diff --git a/modules/base.nix b/modules/base.nix index 5d37283..070d42d 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -8,39 +8,11 @@ system.stateVersion = 6; system.primaryUser = "briannelson"; - environment.systemPackages = with pkgs; [ - exif - exiftool - git - helix - ]; - homebrew = { enable = true; onActivation = { autoUpdate = true; cleanup = "none"; }; - - brews = [ - "bun" - "defaultbrowser" - "harper" - "rust" - "ykman" - ]; - - casks = [ - "bitwarden" - "harper-desktop" - "nextcloud" - "obsidian" - "signal" - "task-manager-tmog" - "twingate" - "vlc" - "vscodium" - "firefox" - ]; }; } \ No newline at end of file diff --git a/modules/default.nix b/modules/default.nix index afbbf70..44451ff 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -3,8 +3,10 @@ { imports = [ ./base.nix + ./apps.nix ./cli-tools.nix ./mac-settings.nix ./pkg-installs.nix + ./archive-installs.nix ]; } \ No newline at end of file diff --git a/modules/pkg-installs.nix b/modules/pkg-installs.nix index 3fb8342..041691b 100644 --- a/modules/pkg-installs.nix +++ b/modules/pkg-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 { + options.pkgInstalls = lib.mkOption { + type = lib.types.listOf (lib.types.attrsOf lib.types.str); + default = [ ];' + description = "PKG files to install on activation"; + }; + system.activationScripts.postActivation.text = - lib.concatMapStringsSep "\n" installScript pkgInstalls; + lib.concatMapStringsSep "\n" installScript cfg; } diff --git a/profiles/personal/apps.nix b/profiles/personal/apps.nix index b09f880..e783521 100644 --- a/profiles/personal/apps.nix +++ b/profiles/personal/apps.nix @@ -1,6 +1,15 @@ { pkgs, ... }: { + 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