From 9826423b29d0bff67fc51d2f6ca7418ba0fde3a9 Mon Sep 17 00:00:00 2001 From: Olli Vuolteenaho Date: Wed, 17 Jan 2024 09:29:59 +0200 Subject: [PATCH] Initial commit --- README.md | 1 + flake.lock | 48 ++++++++++++++++++++ flake.nix | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..9808b21 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Nix-darwin attempt diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e82b9d0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1705356404, + "narHash": "sha256-0/WnHU5S9GXOJD2HGe/mFNmGGE+8UGnhwofsyJQVoDA=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "44a6ec1faeff61a6404c25ef1a263fc2d98d081b", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1705303754, + "narHash": "sha256-loWkd7lUzSvGBU9xnva37iPB2rr5ulq1qBLT44KjzGA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e0629618b4b419a47e2c8a3cab223e2a7f3a8f97", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1f3cb01 --- /dev/null +++ b/flake.nix @@ -0,0 +1,130 @@ +{ + description = "Example Darwin system flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ self, nix-darwin, nixpkgs }: + let + configuration = { pkgs, ... }: { + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment = { + shells = [ + pkgs.fish + ]; + systemPackages = [ + pkgs.android-tools + pkgs.bat + pkgs.coreutils + pkgs.curl + pkgs.direnv + pkgs.git + pkgs.git-lfs + pkgs.lsd + pkgs.neovim + pkgs.openfortivpn + pkgs.openjdk17 + pkgs.python3 + pkgs.rectangle + pkgs.ripgrep + pkgs.timidity + pkgs.vim + pkgs.wget + ]; + variables = { + JAVA_HOME = "${pkgs.openjdk17.home}"; + ANDROID_SDK_ROOT = "/Users/ollivuolteenaho/Library/Android/sdk"; + ANDROID_NDK_ROOT = "/Users/ollivuolteenaho/Library/Android/sdk/ndk/25.1.8937393"; + CMAKE_ROOT = "/Users/ollivuolteenaho/Qt/Tools/CMake/Cmake.app/Contents/bin"; + NINJA_ROOT = "/Users/ollivuolteenaho/Qt/Tools/Ninja"; + }; + }; + + homebrew = { + enable = true; + casks = [ + "android-studio" + "firefox" + "kitty" + "microsoft-outlook" + "microsoft-teams" + "orion" + ]; + global.autoUpdate = false; + onActivation = { + autoUpdate = true; + cleanup = "zap"; + upgrade = true; + }; + }; + + launchd.user.envVariables = { + JAVA_HOME = "${pkgs.openjdk17.home}"; + ANDROID_SDK_ROOT = "/Users/ollivuolteenaho/Library/Android/sdk"; + ANDROID_NDK_ROOT = "/Users/ollivuolteenaho/Library/Android/sdk/ndk/25.1.8937393"; + CMAKE_ROOT = "/Users/ollivuolteenaho/Qt/Tools/CMake/Cmake.app/Contents/bin"; + NINJA_ROOT = "/Users/ollivuolteenaho/Qt/Tools/Ninja"; + }; + + programs.fish = { + enable = true; + shellAliases = { + ls = "lsd"; + vim = "nvim"; + }; + }; + + system.defaults = { + dock = { + autohide = true; + magnification = false; + mru-spaces = false; + orientation = "bottom"; + show-recents = false; + static-only = true; + }; + finder = { + AppleShowAllExtensions = true; + AppleShowAllFiles = true; + FXDefaultSearchScope = "SCcf"; + ShowPathbar = true; + ShowStatusBar = true; + }; + screencapture.location = "~/Pictures/screenshots"; + screensaver.askForPassword = true; + screensaver.askForPasswordDelay = 10; + }; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + # nix.package = pkgs.nix; + + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + + # Set Git commit hash for darwin-version. + system.configurationRevision = self.rev or self.dirtyRev or null; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = "aarch64-darwin"; + }; + in + { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#QT-L-K0HG663WJR + darwinConfigurations."QT-L-K0HG663WJR" = nix-darwin.lib.darwinSystem { + modules = [ configuration ]; + }; + + # Expose the package set, including overlays, for convenience. + darwinPackages = self.darwinConfigurations."QT-L-K0HG663WJR".pkgs; + }; +}