From 4a2bef980b7209350fd4bfbea3ad56a2d47b417c Mon Sep 17 00:00:00 2001 From: willemml Date: Mon, 20 Mar 2023 08:49:39 -0700 Subject: [PATCH] nixpkgs-fmt everything --- apps/home-switch.nix | 1 - flake-parts/apps.nix | 8 +- flake-parts/home-manager/configurations.nix | 16 +-- flake-parts/home-manager/default.nix | 21 ++-- flake-parts/home-manager/modules.nix | 2 +- flake-parts/lib/default.nix | 2 +- flake.nix | 6 +- .../modules/profiles/user/willem/accounts.nix | 16 +-- home-manager/modules/programs/emacs-init.nix | 113 ++++++++++-------- nixos/hosts/zeus.darwin.nix | 2 +- 10 files changed, 98 insertions(+), 89 deletions(-) diff --git a/apps/home-switch.nix b/apps/home-switch.nix index be4847e..dff71f8 100644 --- a/apps/home-switch.nix +++ b/apps/home-switch.nix @@ -1,7 +1,6 @@ { writeShellApplication , home-manager , stdenv -, }: writeShellApplication { name = "home-switch"; diff --git a/flake-parts/apps.nix b/flake-parts/apps.nix index 0b03156..f3952fc 100644 --- a/flake-parts/apps.nix +++ b/flake-parts/apps.nix @@ -5,11 +5,11 @@ # https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/apps.nix -{lib, ...}: { - perSystem = {pkgs, ...}: +{ lib, ... }: { + perSystem = { pkgs, ... }: lib.pipe ../apps [ lib.filesystem.listFilesRecursive - (map (file: pkgs.callPackage file {})) + (map (file: pkgs.callPackage file { })) (map (drv: { apps.${drv.name} = { type = "app"; @@ -17,6 +17,6 @@ }; checks."app-${drv.name}" = drv; })) - (lib.fold lib.recursiveUpdate {}) + (lib.fold lib.recursiveUpdate { }) ]; } diff --git a/flake-parts/home-manager/configurations.nix b/flake-parts/home-manager/configurations.nix index c5b50e9..dc43d2d 100644 --- a/flake-parts/home-manager/configurations.nix +++ b/flake-parts/home-manager/configurations.nix @@ -4,13 +4,13 @@ let inherit (flake-parts-lib) mkTransposedPerSystemModule; in mkTransposedPerSystemModule - { - name = "homeConfigurations"; - file = ./configurations.nix; - option = mkOption { - type = types.lazyAttrsOf types.unspecified; - default = { }; - description = "Home Manager user configurations."; - }; +{ + name = "homeConfigurations"; + file = ./configurations.nix; + option = mkOption { + type = types.lazyAttrsOf types.unspecified; + default = { }; + description = "Home Manager user configurations."; + }; } diff --git a/flake-parts/home-manager/default.nix b/flake-parts/home-manager/default.nix index d674583..e0dce14 100644 --- a/flake-parts/home-manager/default.nix +++ b/flake-parts/home-manager/default.nix @@ -5,29 +5,30 @@ # https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/home-manager/default.nix -{ - lib, - flake-parts-lib, - self, - ... -}: let +{ lib +, flake-parts-lib +, self +, ... +}: +let inherit (lib) mkOption types ; inherit (flake-parts-lib) mkSubmoduleOptions; -in { - imports = [./modules.nix ./users.nix ./configurations.nix]; +in +{ + imports = [ ./modules.nix ./users.nix ./configurations.nix ]; options = { flake = mkSubmoduleOptions { homeManagerModules = mkOption { type = types.lazyAttrsOf types.unspecified; - default = {}; + default = { }; apply = lib.mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#homeManagerModules.${k}"; - imports = [v]; + imports = [ v ]; }); description = '' Home Manager modules. diff --git a/flake-parts/home-manager/modules.nix b/flake-parts/home-manager/modules.nix index 100c597..210c43e 100644 --- a/flake-parts/home-manager/modules.nix +++ b/flake-parts/home-manager/modules.nix @@ -18,7 +18,7 @@ default = { imports = builtins.attrValues modules; }; - + nixpkgs-Config = { nixpkgs.config.allowUnfreePredicate = (_: true); nixpkgs.config.allowUnsupportedSystem = true; diff --git a/flake-parts/lib/default.nix b/flake-parts/lib/default.nix index 4ba1c00..886051c 100644 --- a/flake-parts/lib/default.nix +++ b/flake-parts/lib/default.nix @@ -30,7 +30,7 @@ })) builtins.listToAttrs ]; - + mk-mac-binpkg = import ../../packages/mk-mac-binpkg.nix; }; } diff --git a/flake.nix b/flake.nix index c46b84f..cc698db 100644 --- a/flake.nix +++ b/flake.nix @@ -23,10 +23,10 @@ ]; systems = [ -# "x86_64-linux" -# "x86_64-darwin" + # "x86_64-linux" + # "x86_64-darwin" "aarch64-darwin" -# "aarch64-linux" + # "aarch64-linux" ]; }; } diff --git a/home-manager/modules/profiles/user/willem/accounts.nix b/home-manager/modules/profiles/user/willem/accounts.nix index 2284587..050e349 100644 --- a/home-manager/modules/profiles/user/willem/accounts.nix +++ b/home-manager/modules/profiles/user/willem/accounts.nix @@ -31,13 +31,15 @@ in { accounts.email.accounts = { gmail = (gmailAccount "willemleitso@gmail.com") // { realName = "Willem Leitso"; }; - icloud = (pkgs.lib.attrsets.recursiveUpdate { - flavor = "plain"; - imap.host = "imap.mail.me.com"; - imap.port = 993; - smtp.host = "smtp.mail.me.com"; - smtp.port = 587; - } (generalAccount "coalminecraft@icloud.com")) // { folders.inbox = "INBOX"; }; + icloud = (pkgs.lib.attrsets.recursiveUpdate + { + flavor = "plain"; + imap.host = "imap.mail.me.com"; + imap.port = 993; + smtp.host = "smtp.mail.me.com"; + smtp.port = 587; + } + (generalAccount "coalminecraft@icloud.com")) // { folders.inbox = "INBOX"; }; leitso = (gmailAccount "willem@leit.so") // { primary = true; realName = "Willem Leitso"; }; wnuke9 = gmailAccount "wnuke9@gmail.com"; }; diff --git a/home-manager/modules/programs/emacs-init.nix b/home-manager/modules/programs/emacs-init.nix index 2f50097..97f6e18 100644 --- a/home-manager/modules/programs/emacs-init.nix +++ b/home-manager/modules/programs/emacs-init.nix @@ -219,42 +219,45 @@ let }; config = mkIf config.enable { - assembly = let - quoted = v: ''"${escape [ ''"'' ] v}"''; - mkBindHelper = cmd: prefix: bs: - optionals (bs != { }) ([ ":${cmd} (${prefix}" ] - ++ mapAttrsToList (n: v: " (${quoted n} . ${v})") bs ++ [ ")" ]); + assembly = + let + quoted = v: ''"${escape [ ''"'' ] v}"''; + mkBindHelper = cmd: prefix: bs: + optionals (bs != { }) ([ ":${cmd} (${prefix}" ] + ++ mapAttrsToList (n: v: " (${quoted n} . ${v})") bs ++ [ ")" ]); - mkAfter = vs: optional (vs != [ ]) ":after (${toString vs})"; - mkCommand = vs: optional (vs != [ ]) ":commands (${toString vs})"; - mkDefines = vs: optional (vs != [ ]) ":defines (${toString vs})"; - mkDiminish = vs: optional (vs != [ ]) ":diminish (${toString vs})"; - mkMode = map (v: ":mode ${v}"); - mkFunctions = vs: optional (vs != [ ]) ":functions (${toString vs})"; - mkBind = mkBindHelper "bind" ""; - mkBindLocal = bs: - let mkMap = n: v: mkBindHelper "bind" ":map ${n}" v; - in flatten (mapAttrsToList mkMap bs); - mkBindKeyMap = mkBindHelper "bind-keymap" ""; - mkChords = mkBindHelper "chords" ""; - mkHook = map (v: ":hook ${v}"); - mkDefer = v: - if isBool v then - optional v ":defer t" - else - [ ":defer ${toString v}" ]; - mkDemand = v: optional v ":demand t"; - in concatStringsSep "\n " ([ "(use-package ${name}" ] - ++ mkAfter config.after ++ mkBind config.bind - ++ mkBindKeyMap config.bindKeyMap ++ mkBindLocal config.bindLocal - ++ mkChords config.chords ++ mkCommand config.command - ++ mkDefer config.defer ++ mkDefines config.defines - ++ mkFunctions config.functions ++ mkDemand config.demand - ++ mkDiminish config.diminish ++ mkHook config.hook - ++ mkMode config.mode - ++ optionals (config.init != "") [ ":init" config.init ] - ++ optionals (config.config != "") [ ":config" config.config ] - ++ optional (config.extraConfig != "") config.extraConfig) + ")"; + mkAfter = vs: optional (vs != [ ]) ":after (${toString vs})"; + mkCommand = vs: optional (vs != [ ]) ":commands (${toString vs})"; + mkDefines = vs: optional (vs != [ ]) ":defines (${toString vs})"; + mkDiminish = vs: optional (vs != [ ]) ":diminish (${toString vs})"; + mkMode = map (v: ":mode ${v}"); + mkFunctions = vs: optional (vs != [ ]) ":functions (${toString vs})"; + mkBind = mkBindHelper "bind" ""; + mkBindLocal = bs: + let mkMap = n: v: mkBindHelper "bind" ":map ${n}" v; + in flatten (mapAttrsToList mkMap bs); + mkBindKeyMap = mkBindHelper "bind-keymap" ""; + mkChords = mkBindHelper "chords" ""; + mkHook = map (v: ":hook ${v}"); + mkDefer = v: + if isBool v then + optional v ":defer t" + else + [ ":defer ${toString v}" ]; + mkDemand = v: optional v ":demand t"; + in + concatStringsSep "\n " + ([ "(use-package ${name}" ] + ++ mkAfter config.after ++ mkBind config.bind + ++ mkBindKeyMap config.bindKeyMap ++ mkBindLocal config.bindLocal + ++ mkChords config.chords ++ mkCommand config.command + ++ mkDefer config.defer ++ mkDefines config.defines + ++ mkFunctions config.functions ++ mkDemand config.demand + ++ mkDiminish config.diminish ++ mkHook config.hook + ++ mkMode config.mode + ++ optionals (config.init != "") [ ":init" config.init ] + ++ optionals (config.config != "") [ ":config" config.config ] + ++ optional (config.extraConfig != "") config.extraConfig) + ")"; }; }); @@ -390,7 +393,8 @@ let ;; hm-init.el ends here ''; -in { +in +{ options.programs.emacs.init = { enable = mkEnableOption "Emacs configuration"; @@ -469,27 +473,29 @@ in { home.packages = concatMap (v: v.extraPackages) (filter (getAttr "enable") (builtins.attrValues cfg.usePackage)); - programs.emacs.init.earlyInit = let + programs.emacs.init.earlyInit = + let - standardEarlyInit = mkBefore '' - ${optionalString cfg.recommendedGcSettings gcSettings} + standardEarlyInit = mkBefore '' + ${optionalString cfg.recommendedGcSettings gcSettings} - ${if cfg.packageQuickstart then '' - (setq package-quickstart t - package-quickstart-file "hm-package-quickstart.el") - '' else '' - (setq package-enable-at-startup nil) - ''} + ${if cfg.packageQuickstart then '' + (setq package-quickstart t + package-quickstart-file "hm-package-quickstart.el") + '' else '' + (setq package-enable-at-startup nil) + ''} - ;; Avoid expensive frame resizing. Inspired by Doom Emacs. - (setq frame-inhibit-implied-resize t) - ''; + ;; Avoid expensive frame resizing. Inspired by Doom Emacs. + (setq frame-inhibit-implied-resize t) + ''; - # Collect the early initialization strings for each package. - packageEarlyInits = map (p: p.earlyInit) - (filter (p: p.earlyInit != "") (builtins.attrValues cfg.usePackage)); + # Collect the early initialization strings for each package. + packageEarlyInits = map (p: p.earlyInit) + (filter (p: p.earlyInit != "") (builtins.attrValues cfg.usePackage)); - in mkMerge ([ standardEarlyInit ] ++ packageEarlyInits); + in + mkMerge ([ standardEarlyInit ] ++ packageEarlyInits); programs.emacs.extraPackages = epkgs: let @@ -501,7 +507,8 @@ in { packages = concatMap (v: getPkg (v.package)) (filter (getAttr "enable") (builtins.attrValues cfg.usePackage)); - in [ + in + [ (epkgs.trivialBuild { pname = "hm-early-init"; src = pkgs.writeText "hm-early-init.el" earlyInitFile; diff --git a/nixos/hosts/zeus.darwin.nix b/nixos/hosts/zeus.darwin.nix index 49062a7..39b1bb7 100644 --- a/nixos/hosts/zeus.darwin.nix +++ b/nixos/hosts/zeus.darwin.nix @@ -2,7 +2,7 @@ { imports = [ ../profiles/common.nix ]; - + environment.etc."nix/user-sandbox.sb".text = '' (version 1) (allow default)