nixpkgs-fmt everything

This commit is contained in:
willemml 2023-03-20 08:49:39 -07:00
parent be200a87c2
commit 4a2bef980b
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
10 changed files with 98 additions and 89 deletions

View file

@ -1,7 +1,6 @@
{ writeShellApplication
, home-manager
, stdenv
,
}:
writeShellApplication {
name = "home-switch";

View file

@ -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 { })
];
}

View file

@ -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.";
};
}

View file

@ -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.

View file

@ -18,7 +18,7 @@
default = {
imports = builtins.attrValues modules;
};
nixpkgs-Config = {
nixpkgs.config.allowUnfreePredicate = (_: true);
nixpkgs.config.allowUnsupportedSystem = true;

View file

@ -30,7 +30,7 @@
}))
builtins.listToAttrs
];
mk-mac-binpkg = import ../../packages/mk-mac-binpkg.nix;
};
}

View file

@ -23,10 +23,10 @@
];
systems = [
# "x86_64-linux"
# "x86_64-darwin"
# "x86_64-linux"
# "x86_64-darwin"
"aarch64-darwin"
# "aarch64-linux"
# "aarch64-linux"
];
};
}

View file

@ -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";
};

View file

@ -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;

View file

@ -2,7 +2,7 @@
{
imports = [ ../profiles/common.nix ];
environment.etc."nix/user-sandbox.sb".text = ''
(version 1)
(allow default)