From 9e6145c031b47fc37398b80dec1b4dfc0cfb5183 Mon Sep 17 00:00:00 2001 From: sefidel Date: Fri, 9 Sep 2022 17:49:03 +0900 Subject: milestone: darwin! feat(darwin/kompakt)!: support darwin chore: reformat feat(home/o32): manage neovim feat(home/development): fix haskell lsp version mismatch feat(darwin/*): stabilise --- darwin/darwin-x86.nix | 8 +++++ darwin/default.nix | 9 ++++++ darwin/kompakt/configuration.nix | 66 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 darwin/darwin-x86.nix create mode 100644 darwin/default.nix create mode 100644 darwin/kompakt/configuration.nix (limited to 'darwin') diff --git a/darwin/darwin-x86.nix b/darwin/darwin-x86.nix new file mode 100644 index 0000000..30baf23 --- /dev/null +++ b/darwin/darwin-x86.nix @@ -0,0 +1,8 @@ +{ unstable, ... }: + +final: prev: prev.lib.optionalAttrs (prev.stdenv.system == "aarch64-darwin") { + # Add access to x86 packages system is running Apple Silicon + pkgs-x86 = import unstable { + system = "x86_64-darwin"; + }; +} diff --git a/darwin/default.nix b/darwin/default.nix new file mode 100644 index 0000000..3144894 --- /dev/null +++ b/darwin/default.nix @@ -0,0 +1,9 @@ +{ self, darwin, unstable, ... } @ inputs: + +{ + kompakt = self.lib.mkDarwin { + name = "kompakt"; + system = "aarch64-darwin"; + nixpkgs = unstable; + }; +} diff --git a/darwin/kompakt/configuration.nix b/darwin/kompakt/configuration.nix new file mode 100644 index 0000000..8507adb --- /dev/null +++ b/darwin/kompakt/configuration.nix @@ -0,0 +1,66 @@ +{ config, pkgs, lib, ... }: + +{ + nix = { + settings.substituters = [ + "https://cache.nixos.org/" + ]; + settings.trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + ]; + + settings.trusted-users = [ + "@admin" + ]; + + settings.auto-optimise-store = lib.mkDefault true; + configureBuildUsers = true; + gc.automatic = lib.mkDefault true; + gc.options = lib.mkDefault "--delete-older-than 10d"; + extraOptions = '' + experimental-features = nix-command flakes + extra-platforms = x86_64-darwin aarch64-darwin + ''; + }; + + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = + [ + pkgs.vim + ]; + + # Use a custom configuration.nix location. + # $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix + # environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix"; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + # nix.package = pkgs.nix; + + users.users.o32 = { + name = "o32"; + home = "/Users/o32"; + }; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + # programs.fish.enable = true; + + # Make applications pop up in finder/spotlight + system.activationScripts.applications.text = pkgs.lib.mkForce ( + '' + echo "setting up ~/Applications..." >&2 + rm -rf ~/Applications/Nix\ Apps + mkdir -p ~/Applications/Nix\ Apps + for app in $(find ${config.system.build.applications}/Applications -maxdepth 1 -type l); do + src="$(/usr/bin/stat -f%Y "$app")" + cp -r "$src" ~/Applications/Nix\ Apps + done + '' + ); + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; +} -- cgit 1.4.1