From 79ce8d824b4015ec3c58b0b5d374722122d9d223 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Mon, 5 Aug 2024 02:34:34 -0700 Subject: [PATCH] refactor: add nix-darwin module --- flake.nix | 2 +- modules/darwin/darwin-configuration.nix | 39 +++++++++++++++++++ .../nixos/nixos-configuration.nix | 0 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 modules/darwin/darwin-configuration.nix rename configuration.nix => modules/nixos/nixos-configuration.nix (100%) diff --git a/flake.nix b/flake.nix index 6f746f0..836d087 100755 --- a/flake.nix +++ b/flake.nix @@ -30,7 +30,7 @@ specialArgs = { inherit inputs; }; system = "x86_64-linux"; modules = [ - ./configuration.nix + ./modules/nixos/nixos-configuration.nix ./modules/nixos/secureboot.nix ./modules/nixos/gaming.nix ./modules/nixos/audio.nix diff --git a/modules/darwin/darwin-configuration.nix b/modules/darwin/darwin-configuration.nix new file mode 100644 index 0000000..e84f8ca --- /dev/null +++ b/modules/darwin/darwin-configuration.nix @@ -0,0 +1,39 @@ +{ config, pkgs, ... }: { + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = with pkgs; [ ]; + + # 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; + + nix.settings.experimental-features = "nix-command flakes"; + + nixpkgs.config.allowUnfree = true; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + programs.fish.enable = true; + programs.bash.enable = true; + + system.configurationRevision = + config.self.rev or config.self.dirtyRev or null; + + nixpkgs.hostPlatform = "aarch64-darwin"; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + + users.users.youwen = { + home = "/Users/youwen"; + description = "Youwen Wu"; + shell = pkgs.fish; + }; + + security.pam.enableSudoTouchIdAuth = true; +} diff --git a/configuration.nix b/modules/nixos/nixos-configuration.nix similarity index 100% rename from configuration.nix rename to modules/nixos/nixos-configuration.nix