mirror of
https://github.com/willemml/dotfiles.nix.git
synced 2025-04-13 19:57:19 +00:00
home-manager separate darwin modules
This commit is contained in:
parent
74abfa083f
commit
32bda17076
11 changed files with 67 additions and 73 deletions
|
@ -15,7 +15,7 @@
|
||||||
;
|
;
|
||||||
inherit (flake-parts-lib) mkSubmoduleOptions;
|
inherit (flake-parts-lib) mkSubmoduleOptions;
|
||||||
in {
|
in {
|
||||||
imports = [./modules.nix ./users.nix ./configurations.nix];
|
imports = [./configurations.nix ./modules.nix ./users.nix];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
flake = mkSubmoduleOptions {
|
flake = mkSubmoduleOptions {
|
||||||
|
|
|
@ -10,13 +10,19 @@
|
||||||
}: {
|
}: {
|
||||||
flake.homeManagerModules = let
|
flake.homeManagerModules = let
|
||||||
modules = self.lib.importDirToAttrs ../../home-manager/modules;
|
modules = self.lib.importDirToAttrs ../../home-manager/modules;
|
||||||
|
non-darwin-modules = lib.filterAttrs (n: v: !(lib.hasInfix "darwin" n)) modules;
|
||||||
|
darwin-modules = lib.filterAttrs (n: v: (lib.hasInfix "darwin" n)) modules;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = {
|
default = {
|
||||||
imports = builtins.attrValues modules;
|
imports = builtins.attrValues non-darwin-modules;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs-Config = {
|
darwin = {
|
||||||
|
imports = builtins.attrValues darwin-modules;
|
||||||
|
};
|
||||||
|
|
||||||
|
nixpkgs-config = {
|
||||||
nixpkgs.config.allowUnfreePredicate = _: true;
|
nixpkgs.config.allowUnfreePredicate = _: true;
|
||||||
nixpkgs.config.allowUnsupportedSystem = true;
|
nixpkgs.config.allowUnsupportedSystem = true;
|
||||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
nixpkgs.overlays = builtins.attrValues self.overlays;
|
||||||
|
|
|
@ -4,23 +4,49 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
flake = {
|
||||||
|
homeManagerModules.user-willem = {
|
||||||
|
imports = [
|
||||||
|
self.homeManagerModules.default
|
||||||
|
self.homeManagerModules.nixpkgs-useFlakeNixpkgs
|
||||||
|
self.homeManagerModules.nixpkgs-config
|
||||||
|
];
|
||||||
|
|
||||||
|
home.username = "willem";
|
||||||
|
home.stateVersion = "22.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
homeManagerModules.user-willem-darwin = {
|
||||||
|
imports = [
|
||||||
|
self.homeManagerModules.darwin
|
||||||
|
self.homeManagerModules.user-willem
|
||||||
|
];
|
||||||
|
|
||||||
|
home.homeDirectory = "/Users/willem";
|
||||||
|
};
|
||||||
|
|
||||||
|
homeManagerModules.user-willem-linux = {
|
||||||
|
imports = [self.homeManagerModules.user-willem];
|
||||||
|
|
||||||
|
home.homeDirectory = "/home/willem";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
perSystem = {
|
perSystem = {
|
||||||
pkgs,
|
pkgs,
|
||||||
self',
|
self',
|
||||||
|
system,
|
||||||
...
|
...
|
||||||
}: rec {
|
}: rec {
|
||||||
homeConfigurations.willem = inputs.home-manager.lib.homeManagerConfiguration {
|
homeConfigurations.willem = let
|
||||||
|
systemType =
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then "darwin"
|
||||||
|
else "linux";
|
||||||
|
in
|
||||||
|
inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules = let
|
modules = [self.homeManagerModules."user-willem-${systemType}"];
|
||||||
nurNoPkgs = import inputs.nur {
|
|
||||||
pkgs = null;
|
|
||||||
nurpkgs = pkgs;
|
|
||||||
};
|
|
||||||
in [
|
|
||||||
self.homeManagerModules.nixpkgs-useFlakeNixpkgs
|
|
||||||
self.homeManagerModules.nixpkgs-Config
|
|
||||||
self.homeManagerModules.default
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
packages = let
|
packages = let
|
||||||
activationPackages = builtins.mapAttrs (_: lib.getAttr "activationPackage") homeConfigurations;
|
activationPackages = builtins.mapAttrs (_: lib.getAttr "activationPackage") homeConfigurations;
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
|
|
||||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
nixpkgs.overlays = builtins.attrValues self.overlays;
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
sharedModules = [self.homeManagerModules.user-willem-linux];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
darwinModules.base = {config, ...}: {
|
darwinModules.base = {config, ...}: {
|
||||||
|
@ -28,6 +32,10 @@
|
||||||
|
|
||||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
nixpkgs.overlays = builtins.attrValues self.overlays;
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
sharedModules = [self.homeManagerModules.user-willem-darwin];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosConfigurations.zeusvm = inputs.nixpkgs.lib.nixosSystem {
|
nixosConfigurations.zeusvm = inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
emacsCommand = "emacsclient -c -nw";
|
emacsCommand = "emacsclient -c -nw";
|
||||||
in rec {
|
in rec {
|
||||||
home = {
|
home = {
|
||||||
homeDirectory = "/Users/willem";
|
|
||||||
keyboard = {
|
keyboard = {
|
||||||
layout = "us";
|
layout = "us";
|
||||||
variant = "colemak";
|
variant = "colemak";
|
||||||
|
@ -23,7 +22,5 @@ in rec {
|
||||||
UBCDIR = "${ORGDIR}/ubc";
|
UBCDIR = "${ORGDIR}/ubc";
|
||||||
MAILDIR = "${config.home.homeDirectory}/Maildir";
|
MAILDIR = "${config.home.homeDirectory}/Maildir";
|
||||||
};
|
};
|
||||||
stateVersion = "22.11";
|
|
||||||
username = "willem";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf;
|
|
||||||
inherit (pkgs) stdenv;
|
|
||||||
appCommands = {
|
appCommands = {
|
||||||
calibre = "Calibre";
|
calibre = "Calibre";
|
||||||
ical = "Calendar";
|
ical = "Calendar";
|
||||||
|
@ -17,7 +15,7 @@
|
||||||
zotero = "Zotero";
|
zotero = "Zotero";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
home.file.".gnupg/gpg-agent.conf" = mkIf stdenv.isDarwin {
|
home.file.".gnupg/gpg-agent.conf" = {
|
||||||
text = ''
|
text = ''
|
||||||
pinentry-program "${pkgs.pinentry-touchid}/bin/pinentry-touchid"
|
pinentry-program "${pkgs.pinentry-touchid}/bin/pinentry-touchid"
|
||||||
default-cache-ttl 30
|
default-cache-ttl 30
|
||||||
|
@ -25,7 +23,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".config/zsh/am.sh" = mkIf stdenv.isDarwin {
|
home.file.".config/zsh/am.sh" = {
|
||||||
executable = true;
|
executable = true;
|
||||||
source = builtins.fetchurl {
|
source = builtins.fetchurl {
|
||||||
url = "https://raw.githubusercontent.com/mcthomas/Apple-Music-CLI-Player/27353ec55abac8b5d73b8a061fb87f305c663adb/src/am.sh";
|
url = "https://raw.githubusercontent.com/mcthomas/Apple-Music-CLI-Player/27353ec55abac8b5d73b8a061fb87f305c663adb/src/am.sh";
|
||||||
|
@ -33,7 +31,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.zsh.shellAliases = mkIf stdenv.isDarwin ({
|
programs.zsh.shellAliases =
|
||||||
|
{
|
||||||
drs = "darwin-rebuild switch --flake ${config.home.homeDirectory}/.config/dotfiles.nix#";
|
drs = "darwin-rebuild switch --flake ${config.home.homeDirectory}/.config/dotfiles.nix#";
|
||||||
dbs = "darwin-rebuild build --flake ${config.home.homeDirectory}/.config/dotfiles.nix#";
|
dbs = "darwin-rebuild build --flake ${config.home.homeDirectory}/.config/dotfiles.nix#";
|
||||||
f = "open \"$(${config.programs.fzf.package}/bin/fzf)\"";
|
f = "open \"$(${config.programs.fzf.package}/bin/fzf)\"";
|
||||||
|
@ -41,12 +40,12 @@ in {
|
||||||
oa = "open -a";
|
oa = "open -a";
|
||||||
pinentry = "pinentry-mac";
|
pinentry = "pinentry-mac";
|
||||||
}
|
}
|
||||||
// lib.attrsets.mapAttrs (name: value: "open -a '" + value + "'") appCommands);
|
// lib.attrsets.mapAttrs (name: value: "open -a '" + value + "'") appCommands;
|
||||||
|
|
||||||
programs.firefox.package = mkIf stdenv.isDarwin pkgs.firefox-mac;
|
programs.firefox.package = pkgs.firefox-mac;
|
||||||
programs.chromium.package = mkIf stdenv.isDarwin pkgs.chromium-mac;
|
programs.chromium.package = pkgs.chromium-mac;
|
||||||
|
|
||||||
targets.darwin = mkIf stdenv.isDarwin {
|
targets.darwin = {
|
||||||
defaults = {
|
defaults = {
|
||||||
NSGlobalDomain = {
|
NSGlobalDomain = {
|
||||||
AppleLanguages = ["en-CA"];
|
AppleLanguages = ["en-CA"];
|
|
@ -92,7 +92,7 @@
|
||||||
}
|
}
|
||||||
// default-view-settings;
|
// default-view-settings;
|
||||||
in {
|
in {
|
||||||
targets.darwin.defaults."com.apple.finder" = lib.mkIf pkgs.stdenv.isDarwin {
|
targets.darwin.defaults."com.apple.finder" = {
|
||||||
AppleShowAllExtensions = true;
|
AppleShowAllExtensions = true;
|
||||||
|
|
||||||
ComputerViewSettings = dvs-with-ws;
|
ComputerViewSettings = dvs-with-ws;
|
||||||
|
|
|
@ -232,7 +232,7 @@
|
||||||
}
|
}
|
||||||
// dracula_plus;
|
// dracula_plus;
|
||||||
in {
|
in {
|
||||||
targets.darwin.defaults."com.googlecode.iterm2" = lib.mkIf pkgs.stdenv.isDarwin {
|
targets.darwin.defaults."com.googlecode.iterm2" = {
|
||||||
"AlternateMouseScroll" = true;
|
"AlternateMouseScroll" = true;
|
||||||
"Default Bookmark Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106";
|
"Default Bookmark Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106";
|
||||||
"HotkeyMigratedFromSingleToMulti" = true;
|
"HotkeyMigratedFromSingleToMulti" = true;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
launchd = lib.mkIf pkgs.stdenv.isDarwin {
|
launchd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
agents.emacs = {
|
agents.emacs = {
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
launchd.agents.emacs = lib.mkIf pkgs.stdenv.isDarwin {
|
|
||||||
enable = true;
|
|
||||||
config = {
|
|
||||||
ProgramArguments = [
|
|
||||||
"${config.programs.emacs.finalPackage}/bin/emacs"
|
|
||||||
"--fg-daemon"
|
|
||||||
];
|
|
||||||
KeepAlive = true;
|
|
||||||
UserName = "${config.home.username}";
|
|
||||||
ProcessType = "Adaptive";
|
|
||||||
StandardOutPath = "${config.home.homeDirectory}/Library/Logs/emacs-stdout.log";
|
|
||||||
StandardErrorPath = "${config.home.homeDirectory}/Library/Logs/emacs-stderr.log";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
launchd.agents.emacs = lib.mkIf pkgs.stdenv.isDarwin {
|
|
||||||
enable = true;
|
|
||||||
config = {
|
|
||||||
ProgramArguments = [
|
|
||||||
"${config.programs.emacs.finalPackage}/bin/emacs"
|
|
||||||
"--fg-daemon"
|
|
||||||
];
|
|
||||||
KeepAlive = true;
|
|
||||||
UserName = "${config.home.username}";
|
|
||||||
ProcessType = "Adaptive";
|
|
||||||
StandardOutPath = "${config.home.homeDirectory}/Library/Logs/emacs-stdout.log";
|
|
||||||
StandardErrorPath = "${config.home.homeDirectory}/Library/Logs/emacs-stderr.log";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue