format with alejandra

This commit is contained in:
willemml 2023-03-20 13:15:32 -07:00
parent 27a1707ff1
commit 74abfa083f
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
46 changed files with 1107 additions and 999 deletions

View file

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

View file

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

View file

@ -1,10 +1,7 @@
# Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/apps.nix
{lib, ...}: {
perSystem = {pkgs, ...}:
lib.pipe ../apps [

View file

@ -1,5 +1,9 @@
{ lib, flake-parts-lib, self, ... }:
let
{
lib,
flake-parts-lib,
self,
...
}: let
inherit (lib) mkOption types;
inherit (flake-parts-lib) mkTransposedPerSystemModule;
in
@ -13,4 +17,3 @@ mkTransposedPerSystemModule
description = "Home Manager user configurations.";
};
}

View file

@ -1,24 +1,20 @@
# Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.
# 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
{
in {
imports = [./modules.nix ./users.nix ./configurations.nix];
options = {

View file

@ -1,17 +1,14 @@
# Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/home-manager/modules.nix
{ lib
, self
, inputs
, ...
{
lib,
self,
inputs,
...
}: {
flake.homeManagerModules =
let
flake.homeManagerModules = let
modules = self.lib.importDirToAttrs ../../home-manager/modules;
in
{
@ -20,7 +17,7 @@
};
nixpkgs-Config = {
nixpkgs.config.allowUnfreePredicate = (_: true);
nixpkgs.config.allowUnfreePredicate = _: true;
nixpkgs.config.allowUnsupportedSystem = true;
nixpkgs.overlays = builtins.attrValues self.overlays;
};

View file

@ -1,21 +1,29 @@
{ inputs, self, lib, ... }:
{
perSystem = { pkgs, self', ... }:
rec {
inputs,
self,
lib,
...
}: {
perSystem = {
pkgs,
self',
...
}: rec {
homeConfigurations.willem = inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules =
let
nurNoPkgs = (import inputs.nur { pkgs = null; nurpkgs = pkgs; });
in
[
modules = let
nurNoPkgs = import inputs.nur {
pkgs = null;
nurpkgs = pkgs;
};
in [
self.homeManagerModules.nixpkgs-useFlakeNixpkgs
self.homeManagerModules.nixpkgs-Config
self.homeManagerModules.default
];
};
packages =
let activationPackages = builtins.mapAttrs (_: lib.getAttr "activationPackage") homeConfigurations;
packages = let
activationPackages = builtins.mapAttrs (_: lib.getAttr "activationPackage") homeConfigurations;
in
lib.pipe activationPackages [
(lib.filterAttrs (_: drv: pkgs.system == drv.system))

View file

@ -1,13 +1,11 @@
# Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/lib/default.nix
{ self
, lib
, ...
{
self,
lib,
...
}: {
flake.lib = {
kebabCaseToCamelCase =

View file

@ -1,4 +1,8 @@
{ self, inputs, ... }: {
{
self,
inputs,
...
}: {
flake = {
nixosModules.base = {config, ...}: {
imports = [
@ -41,7 +45,6 @@
self.nixosModules.base
../../nixos/hosts/zeus.asahi.nix
];
};
darwinConfigurations.zeus = inputs.darwin.lib.darwinSystem {

View file

@ -1,16 +1,13 @@
# Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/lib/default.nix
{ self
, inputs
, ...
{
self,
inputs,
...
}: {
flake.nixosModules =
let
flake.nixosModules = let
modules = self.lib.importDirToAttrs ../../nixos/modules;
in
{

View file

@ -1,6 +1,9 @@
{ self, inputs, lib, ... }:
{
self,
inputs,
lib,
...
}: {
flake.overlays = {
apps = final: prev: (
let

View file

@ -1,28 +1,25 @@
# Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/packages.nix
{ self
, lib
, ...
{
self,
lib,
...
}: {
perSystem =
{ config
, pkgs
, ...
}:
let
perSystem = {
config,
pkgs,
...
}: let
overlays = [
self.overlays.default
];
pkgs' = pkgs.extend (lib.composeManyExtensions overlays);
in
{
in {
packages = {
inherit (pkgs')
inherit
(pkgs')
chromium-mac
darwin-zsh-completions
firefox-mac
@ -32,17 +29,16 @@
pinentry-touchid
qbittorrent-mac
spotify-mac
vlc-mac;
vlc-mac
;
};
legacyPackages = {
wrapPackage =
{ wrapper
, package
, exes ? [ (lib.getExe package) ]
,
}:
let
wrapPackage = {
wrapper,
package,
exes ? [(lib.getExe package)],
}: let
wrapperExe = lib.getExe wrapper;
wrapExe = exe:
pkgs.writeShellScriptBin (builtins.baseNameOf exe) ''
@ -54,8 +50,7 @@
paths = (map wrapExe exes) ++ [package];
};
wrapPackages = pkgsWrapperFn: pkgNames: final: prev:
let
wrapPackages = pkgsWrapperFn: pkgNames: final: prev: let
wrapper = pkgsWrapperFn final;
in
builtins.listToAttrs (map

View file

@ -46,6 +46,8 @@
devShells.default = pkgs.mkShell {
inherit (self'.checks.pre-commit-check) shellHook;
};
formatter = pkgs.alejandra;
};
};
}

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
let
{
config,
pkgs,
...
}: let
passCmd = address: "${pkgs.python310Packages.keyring}/bin/keyring get login email(${address})";
generalAccount = address: {
inherit address;
@ -26,12 +28,13 @@ let
sent = "[Gmail].Sent Mail";
trash = "[Gmail].Trash";
};
} // generalAccount address);
in
{
}
// generalAccount address);
in {
accounts.email.accounts = {
gmail = (gmailAccount "willemleitso@gmail.com") // {realName = "Willem Leitso";};
icloud = (pkgs.lib.attrsets.recursiveUpdate
icloud =
(pkgs.lib.attrsets.recursiveUpdate
{
flavor = "plain";
imap.host = "imap.mail.me.com";
@ -39,9 +42,14 @@ in
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"; };
(generalAccount "coalminecraft@icloud.com"))
// {folders.inbox = "INBOX";};
leitso =
(gmailAccount "willem@leit.so")
// {
primary = true;
realName = "Willem Leitso";
};
wnuke9 = gmailAccount "wnuke9@gmail.com";
};
}

View file

@ -1,9 +1,11 @@
{ config, pkgs, lib, ... }:
let
{
config,
pkgs,
lib,
...
}: let
emacsCommand = "emacsclient -c -nw";
in
rec {
in rec {
home = {
homeDirectory = "/Users/willem";
keyboard = {

View file

@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }:
let
{
config,
pkgs,
lib,
...
}: let
inherit (lib) mkIf;
inherit (pkgs) stdenv;
appCommands = {
@ -13,8 +16,7 @@ let
settings = "System Settings";
zotero = "Zotero";
};
in
{
in {
home.file.".gnupg/gpg-agent.conf" = mkIf stdenv.isDarwin {
text = ''
pinentry-program "${pkgs.pinentry-touchid}/bin/pinentry-touchid"
@ -26,8 +28,7 @@ in
home.file.".config/zsh/am.sh" = mkIf stdenv.isDarwin {
executable = true;
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";
sha256 = "sha256-78zRpNg7/OR7p8dpsJt6Xc4j0Y+8zSUtm/PT94nf03M=";
};
};
@ -39,7 +40,8 @@ in
o = "open";
oa = "open -a";
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.chromium.package = mkIf stdenv.isDarwin pkgs.chromium-mac;

View file

@ -1,5 +1,8 @@
{ pkgs, lib, ... }:
let
{
pkgs,
lib,
...
}: let
columnSettings = {
name = {
visible = true;
@ -59,7 +62,8 @@ let
};
default-view-settings = {
ExtendedListViewSettingsV2 = {
ExtendedListViewSettingsV2 =
{
columns = builtins.sort (a: b: a.index < b.index) (map
(name:
(name: value: {
@ -67,14 +71,17 @@ let
visible = value.visible;
width = value.width;
index = value.index;
}) name
})
name
columnSettings.${name})
(builtins.attrNames columnSettings));
} // listviewsettings;
}
// listviewsettings;
ListViewSettings = {columns = columnSettings;} // listviewsettings;
};
dvs-with-ws = {
dvs-with-ws =
{
WindowState = {
ContainerShowSidebar = true;
ShowStatusBar = true;
@ -82,9 +89,9 @@ let
ShowToolbar = true;
ShowTabView = true;
};
} // default-view-settings;
in
{
}
// default-view-settings;
in {
targets.darwin.defaults."com.apple.finder" = lib.mkIf pkgs.stdenv.isDarwin {
AppleShowAllExtensions = true;
@ -99,9 +106,11 @@ in
FK_DefaultListViewSettingsV2 =
default-view-settings.ExtendedListViewSettingsV2;
FK_StandardViewSettings = {
FK_StandardViewSettings =
{
SettingsType = "FK_StandardViewSettings";
} // default-view-settings;
}
// default-view-settings;
FK_iCloudListViewSettingsV2 =
default-view-settings.ExtendedListViewSettingsV2;
@ -154,9 +163,11 @@ in
SidebarZoneOrder1 = ["icloud_drive" "favorites" "devices" "tags"];
StandardViewSettings = {
StandardViewSettings =
{
SettingsType = "StandardViewSettings";
} // default-view-settings;
}
// default-view-settings;
TrashViewSettings = dvs-with-ws;

View file

@ -1,6 +1,8 @@
{ pkgs, lib, ... }:
let
{
pkgs,
lib,
...
}: let
dracula_plus = {
"Ansi 0 Color" = {
"Alpha Component" = 1;
@ -192,7 +194,8 @@ let
"Red Component" = 0.231373;
};
};
profile_defaults = {
profile_defaults =
{
"ASCII Anti Aliased" = true;
"Ambiguous Double Width" = false;
"BM Growl" = true;
@ -226,9 +229,9 @@ let
"Vertical Spacing" = 1;
"Visual Bell" = true;
"Window Type" = 0;
} // dracula_plus;
in
{
}
// dracula_plus;
in {
targets.darwin.defaults."com.googlecode.iterm2" = lib.mkIf pkgs.stdenv.isDarwin {
"AlternateMouseScroll" = true;
"Default Bookmark Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106";
@ -254,7 +257,8 @@ in
"Screen" = -1;
"Tags" = [];
"Working Directory" = "/Users/willem";
} // profile_defaults)
}
// profile_defaults)
({
"Columns" = 120;
"Command" = "";
@ -283,7 +287,8 @@ in
"Space" = -1;
"Tags" = [];
"Working Directory" = "/Users/willem";
} // profile_defaults)
}
// profile_defaults)
];
};
}

View file

@ -1,6 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}: {
launchd = lib.mkIf pkgs.stdenv.isDarwin {
enable = true;

View file

@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }:
let
{
config,
pkgs,
lib,
...
}: let
feeds = {
calvinandhobbes = "https://www.comicsrss.com/rss/calvinandhobbes.rss";
dailywtf = "http://syndication.thedailywtf.com/TheDailyWtf";
@ -40,8 +43,7 @@ let
configArray = ["[DEFAULT]\n"] ++ configStrings ++ feedStrings;
configString = lib.concatStrings configArray;
in
{
in {
home.packages = [pkgs.rss2email];
home.file.".config/rss2email.cfg".text = configString;

View file

@ -1,6 +1,8 @@
{ pkgs, lib, ... }:
let
{
pkgs,
lib,
...
}: let
darwin = with pkgs; [
pngpaste
pinentry-touchid
@ -8,7 +10,8 @@ let
spoof-mac
];
linux = with pkgs; [];
python-wp = pkgs.python310.withPackages (p: with p; [
python-wp = pkgs.python310.withPackages (p:
with p; [
keyring
latexify-py
pyaml
@ -22,7 +25,9 @@ let
];
octave-wp = pkgs.octave.withPackages (p: with p; [symbolic]);
texliveset = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-basic
inherit
(pkgs.texlive)
scheme-basic
babel
amscls
amsmath
@ -63,10 +68,10 @@ let
url
wrapfig
xstring
xkeyval;
xkeyval
;
};
in
{
in {
home.packages = with pkgs;
[
autoconf

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }: {
{
lib,
config,
pkgs,
...
}: {
programs = {
bash.enableCompletion = true;
@ -177,7 +182,8 @@
RPROMPT = "%B%F{red}%*%f%b";
};
shellAliases = rec {
shellAliases =
rec {
cd = "z";
discord = "${web} https://discord.com/channels/@me";
dotd = "cd ${config.home.sessionVariables.DOTDIR} ";
@ -193,10 +199,15 @@
ubc = "cd ${config.home.sessionVariables.UBCDIR} ";
ubcmail = "${web} https://webmail.student.ubc.ca";
web = "${pkgs.coreutils-full}/bin/nohup ${config.programs.firefox.package}/bin/firefox &> ${config.home.homeDirectory}/.firefox.log";
} // (if pkgs.stdenv.isLinux then {
}
// (
if pkgs.stdenv.isLinux
then {
nbs = "sudo nixos-rebuild build --flake ${config.home.sessionVariables.DOTDIR}#";
nrs = "sudo nixos-rebuild switch --flake ${config.home.sessionVariables.DOTDIR}#";
} else { });
}
else {}
);
};
home-manager.enable = true;

View file

@ -1,9 +1,10 @@
{ config, pkgs, ... }:
let
pcfg = config.programs.emacs.init.usePackage;
in
{
config,
pkgs,
...
}: let
pcfg = config.programs.emacs.init.usePackage;
in {
programs.emacs.enable = true;
services.emacs = pkgs.lib.mkIf pkgs.stdenv.isLinux {
@ -154,8 +155,7 @@ in
;; Display text icon of type in company popup
(setq company-format-margin-function #'company-text-icons-margin)
'';
hook =
[ "(sh-mode . company-mode)" "(emacs-lisp-mode . company-mode)" ];
hook = ["(sh-mode . company-mode)" "(emacs-lisp-mode . company-mode)"];
};
company-math = {
@ -475,16 +475,13 @@ in
'';
};
mu4e =
let
smtpConfig = name:
(
mu4e = let
smtpConfig = name: (
let
account = config.accounts.email.accounts.${name};
port = builtins.toString account.smtp.port;
host = account.smtp.host;
in
''
in ''
("${name}"
(mu4e-drafts-folder "/${name}/${account.folders.drafts}")
(mu4e-sent-folder "/${name}/${account.folders.sent}")
@ -503,8 +500,7 @@ in
);
smtpAccountStrings = pkgs.lib.forEach (builtins.attrNames config.accounts.email.accounts) (account: " ${(smtpConfig account)} ");
smtpAccounts = "'( ${pkgs.lib.concatStrings smtpAccountStrings} )";
in
{
in {
enable = true;
after = ["async"];
package = epkgs: pkgs.mu;
@ -772,7 +768,8 @@ in
org-auctex = {
enable = true;
package = epkgs: epkgs.trivialBuild {
package = epkgs:
epkgs.trivialBuild {
pname = "org-auctex";
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c";

View file

@ -1,4 +1,8 @@
{ config, pkgs, ... }: {
{
config,
pkgs,
...
}: {
programs.firefox = {
enable = true;
profiles.primary = {
@ -13,13 +17,21 @@
];
engines = {
"Nix Packages" = {
urls = [{
urls = [
{
template = "https://search.nixos.org/packages";
params = [
{ name = "type"; value = "packages"; }
{ name = "query"; value = "{searchTerms}"; }
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@np"];

View file

@ -1,17 +1,13 @@
# MIT License
# Copyright (c) 2019 Robert Helgesson
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -19,13 +15,13 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
{ config, lib, pkgs, ... }:
with lib;
let
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.programs.emacs.init;
packageFunctionType = mkOptionType {
@ -35,12 +31,17 @@ let
merge = mergeOneOption;
};
usePackageType = types.submodule ({ name, config, ... }: {
usePackageType = types.submodule ({
name,
config,
...
}: {
options = {
enable = mkEnableOption "Emacs package ${name}";
package = mkOption {
type = types.either (types.str // { description = "name of package"; })
type =
types.either (types.str // {description = "name of package";})
packageFunctionType;
default = name;
description = ''
@ -219,12 +220,12 @@ let
};
config = mkIf config.enable {
assembly =
let
assembly = let
quoted = v: ''"${escape [''"''] v}"'';
mkBindHelper = cmd: prefix: bs:
optionals (bs != {}) ([":${cmd} (${prefix}"]
++ mapAttrsToList (n: v: " (${quoted n} . ${v})") bs ++ [ ")" ]);
++ mapAttrsToList (n: v: " (${quoted n} . ${v})") bs
++ [")"]);
mkAfter = vs: optional (vs != []) ":after (${toString vs})";
mkCommand = vs: optional (vs != []) ":commands (${toString vs})";
@ -233,31 +234,38 @@ let
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);
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}" ];
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
++ 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) + ")";
++ optional (config.extraConfig != "") config.extraConfig)
+ ")";
};
});
@ -271,9 +279,11 @@ let
type = types.bool;
default = false;
example = true;
description = ''
description =
''
Whether to enable recommended ${type} settings.
'' + optionalString (extraDescription != "") ''
''
+ optionalString (extraDescription != "") ''
</para><para>
${extraDescription}
'';
@ -318,30 +328,37 @@ let
hasDiminish = any (p: p.diminish != []) (attrValues cfg.usePackage);
# Whether the configuration makes use of `:bind`.
hasBind = any (p: p.bind != { } || p.bindLocal != { } || p.bindKeyMap != { })
hasBind =
any (p: p.bind != {} || p.bindLocal != {} || p.bindKeyMap != {})
(attrValues cfg.usePackage);
# Whether the configuration makes use of `:chords`.
hasChords = any (p: p.chords != {}) (attrValues cfg.usePackage);
usePackageSetup = ''
usePackageSetup =
''
(eval-when-compile
(require 'use-package)
;; To help fixing issues during startup.
(setq use-package-verbose ${
if cfg.usePackageVerbose then "t" else "nil"
if cfg.usePackageVerbose
then "t"
else "nil"
}))
'' + optionalString hasDiminish ''
''
+ optionalString hasDiminish ''
;; For :diminish in (use-package).
(require 'diminish)
'' + optionalString hasBind ''
''
+ optionalString hasBind ''
;; For :bind in (use-package).
(require 'bind-key)
;; Fixes "Symbols function definition is void: use-package-autoload-keymap".
(autoload #'use-package-autoload-keymap "use-package-bind-key")
'' + optionalString hasChords ''
''
+ optionalString hasChords ''
;; For :chords in (use-package).
(use-package use-package-chords
:config (key-chord-mode 1))
@ -362,7 +379,8 @@ let
;; hm-early-init.el ends here
'';
initFile = ''
initFile =
''
;;; hm-init.el --- Emacs configuration à la Home Manager -*- lexical-binding: t; -*-
;;
;;; Commentary:
@ -384,17 +402,17 @@ let
${cfg.prelude}
${usePackageSetup}
'' + concatStringsSep "\n\n" (map (getAttr "assembly")
(filter (getAttr "enable") (attrValues cfg.usePackage))) + ''
''
+ concatStringsSep "\n\n" (map (getAttr "assembly")
(filter (getAttr "enable") (attrValues cfg.usePackage)))
+ ''
${cfg.postlude}
(provide 'hm-init)
;; hm-init.el ends here
'';
in
{
in {
options.programs.emacs.init = {
enable = mkEnableOption "Emacs configuration";
@ -470,45 +488,46 @@ in
config = mkIf (config.programs.emacs.enable && cfg.enable) {
# Collect the extra packages that should be included in the user profile.
# These are typically tools called by Emacs packages.
home.packages = concatMap (v: v.extraPackages)
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}
${if cfg.packageQuickstart then ''
${
if cfg.packageQuickstart
then ''
(setq package-quickstart t
package-quickstart-file "hm-package-quickstart.el")
'' else ''
''
else ''
(setq package-enable-at-startup nil)
''}
''
}
;; 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)
packageEarlyInits =
map (p: p.earlyInit)
(filter (p: p.earlyInit != "") (builtins.attrValues cfg.usePackage));
in
mkMerge ([standardEarlyInit] ++ packageEarlyInits);
programs.emacs.extraPackages = epkgs:
let
programs.emacs.extraPackages = epkgs: let
getPkg = v:
if isFunction v then
[ (v epkgs) ]
else
optional (isString v && hasAttr v epkgs) epkgs.${v};
if isFunction v
then [(v epkgs)]
else optional (isString v && hasAttr v epkgs) epkgs.${v};
packages = concatMap (v: getPkg (v.package))
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;
@ -520,7 +539,9 @@ in
(epkgs.trivialBuild {
pname = "hm-init";
src = pkgs.writeText "hm-init.el" initFile;
packageRequires = [ epkgs.use-package ] ++ packages
packageRequires =
[epkgs.use-package]
++ packages
++ optional hasBind epkgs.bind-key
++ optional hasDiminish epkgs.diminish
++ optional hasChords epkgs.use-package-chords;

View file

@ -1,5 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}: {
launchd.agents.emacs = lib.mkIf pkgs.stdenv.isDarwin {
enable = true;
config = {
@ -15,4 +19,3 @@
};
};
}

View file

@ -1,5 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}: {
launchd.agents.emacs = lib.mkIf pkgs.stdenv.isDarwin {
enable = true;
config = {
@ -15,4 +19,3 @@
};
};
}

View file

@ -1,6 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
imports = [../profiles/linux-common.nix ../profiles/gnome.nix];
boot.loader.systemd-boot.enable = true;

View file

@ -1,6 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
imports = [../profiles/common.nix];
environment.etc."nix/user-sandbox.sb".text = ''
@ -100,10 +98,12 @@
enableKeyMapping = true;
remapCapsLockToEscape = true;
# see https://developer.apple.com/library/content/technotes/tn2450/_index.html for more info
userKeyMapping = [{
userKeyMapping = [
{
HIDKeyboardModifierMappingSrc = 30064771303; # remap right command to right control.
HIDKeyboardModifierMappingDst = 30064771300;
}];
}
];
};
};

View file

@ -1,6 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
imports = [
../profiles/desktop.nix
../profiles/gnome.nix

View file

@ -1,14 +1,17 @@
# https://github.com/LnL7/nix-darwin/issues/277#issuecomment-992866471
{ config, lib, pkgs, inputs, ... }:
with lib;
let
{
config,
lib,
pkgs,
inputs,
...
}:
with lib; let
cfg = config.nix;
nixRegistry = builtins.mapAttrs (name: value: {flake = value;}) inputs;
etcNixInputs = pkgs.runCommandNoCC "etc-nix-inputs"
etcNixInputs =
pkgs.runCommandNoCC "etc-nix-inputs"
{
inputNames = builtins.attrNames inputs;
inputPaths = builtins.map (x: x.outPath) (builtins.attrValues inputs);
@ -25,14 +28,12 @@ let
done
'';
in
# Based on flake-utils-plus#nixosModules.autoGenFromInputs
# https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/master/lib/options.nix
#
# We're not using that directly because we don't need the rest of the flake, and to work around
# https://github.com/gytis-ivaskevicius/flake-utils-plus/issues/105 and
# https://github.com/gytis-ivaskevicius/flake-utils-plus/issues/107
{
options = {
nix.generateNixPathFromInputs = mkOption {
@ -62,10 +63,12 @@ in
};
config = {
assertions = [{
assertions = [
{
assertion = cfg.generateNixPathFromInputs -> cfg.linkInputs;
message = "nix.generateNixPathFromInputs requires nix.linkInputs";
}];
}
];
nix.linkInputs = mkDefault cfg.generateNixPathFromInputs;

View file

@ -1,6 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
freecad
qbittorrent

View file

@ -1,12 +1,12 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
imports = [./desktop.nix];
environment.gnome.excludePackages = (with pkgs; [
environment.gnome.excludePackages =
(with pkgs; [
gnome-photos
gnome-tour
]) ++ (with pkgs.gnome; [
])
++ (with pkgs.gnome; [
cheese # webcam tool
gnome-music
gedit # text editor

View file

@ -1,6 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
imports = [./common.nix];
console.keyMap = "colemak";

View file

@ -1,6 +1,9 @@
{ fetchurl, lib, mkMacBinPackage, stdenv }:
let
{
fetchurl,
lib,
mkMacBinPackage,
stdenv,
}: let
versions = {
aarch64-darwin = "1101351";
x86_64-darwin = "1101350";
@ -13,14 +16,12 @@ let
srcs = {
aarch64-darwin = fetchurl {
url =
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac_Arm/${version}/chrome-mac.zip";
url = "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac_Arm/${version}/chrome-mac.zip";
sha256 = "sha256-LlbYlJmFLzyHIiygofa0Btm7NAOvWXXhmbjMHldVoGo=";
name = "${pname}_aarch64_${version}.zip";
};
x86_64-darwin = fetchurl {
url =
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/${version}/chrome-mac.zip";
url = "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/${version}/chrome-mac.zip";
sha256 = "sha256-O+OnjakEpjCRbSjDysEA6RKKaKaSMw+LSO2ZLcxz2vM=";
name = "${pname}_x86_64_${version}.zip";
};

View file

@ -1,7 +1,6 @@
# taken from nix-darwin repo
# https://github.com/LnL7/nix-darwin/blob/87b9d090ad39b25b2400029c64825fc2a8868943/modules/examples/lnl.nix
{runCommand}:
runCommand "darwin-zsh-completions-0.0.0"
{preferLocalBuild = true;}
''

View file

@ -1,14 +1,15 @@
{ fetchurl, lib, mkMacBinPackage }:
let
{
fetchurl,
lib,
mkMacBinPackage,
}: let
version = "109.0.1";
pname = "firefox";
appName = "Firefox";
src = fetchurl {
url =
"https://download-installer.cdn.mozilla.net/pub/firefox/releases/${version}/mac/en-CA/Firefox%20${version}.dmg";
url = "https://download-installer.cdn.mozilla.net/pub/firefox/releases/${version}/mac/en-CA/Firefox%20${version}.dmg";
sha256 = "sha256-V/8W3qqYhJmte2tq/ZSPtYChdhv8WFQoSORYRaxva9Y=";
name = "${pname}_${version}.dmg";
};
in
mkMacBinPackage {inherit src pname appName version;}

View file

@ -1,13 +1,16 @@
{ fetchurl, lib, makeWrapper, stdenv }:
let
{
fetchurl,
lib,
makeWrapper,
stdenv,
}: let
version = "0.20.2";
date = "2022-12-27";
appName = "FreeCAD";
pname = "freecad";
src = fetchurl {
url =
"https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg";
url = "https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg";
sha256 = "sha256-OAi98HUacHcLHVYSadnQFPnEhutJvE4YfRBtPSZk00c=";
};
in

View file

@ -1,4 +1,12 @@
pkgs: { src, version, pname, appName, srcsubdir ? ".", ... }: pkgs.stdenv.mkDerivation {
pkgs: {
src,
version,
pname,
appName,
srcsubdir ? ".",
...
}:
pkgs.stdenv.mkDerivation {
inherit version src;
name = pname;

View file

@ -1,5 +1,7 @@
{ emacsPackages, fetchFromGitHub }:
{
emacsPackages,
fetchFromGitHub,
}:
emacsPackages.trivialBuild {
pname = "org-auctex";
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c";

View file

@ -1,4 +1,9 @@
{ lib, pinentry_mac, stdenv }: stdenv.mkDerivation {
{
lib,
pinentry_mac,
stdenv,
}:
stdenv.mkDerivation {
name = "pinentry-mac";
src = pinentry_mac;
installPhase = ''
@ -16,4 +21,3 @@
platforms = platforms.darwin;
};
}

View file

@ -1,4 +1,10 @@
{ fetchFromGitHub, lib, pkgs, stdenv }: stdenv.mkDerivation {
{
fetchFromGitHub,
lib,
pkgs,
stdenv,
}:
stdenv.mkDerivation {
name = "pinentry-touchid";
src = fetchFromGitHub {
owner = "jorgelbg";

View file

@ -1,12 +1,14 @@
{ fetchurl, lib, mkMacBinPackage }:
let
{
fetchurl,
lib,
mkMacBinPackage,
}: let
version = "4.4.5";
appName = "qBittorrent";
pname = "qbittorrent";
src = fetchurl {
url =
"https://phoenixnap.dl.sourceforge.net/project/qbittorrent/qbittorrent-mac/qbittorrent-${version}/qbittorrent-${version}.dmg";
url = "https://phoenixnap.dl.sourceforge.net/project/qbittorrent/qbittorrent-mac/qbittorrent-${version}/qbittorrent-${version}.dmg";
sha256 = "sha256-9h+gFAEU0tKrltOjnOKLfylbbBunGZqvPzQogdP9uQM=";
};
in

View file

@ -1,5 +1,8 @@
{ fetchurl, lib, mkMacBinPackage }:
let
{
fetchurl,
lib,
mkMacBinPackage,
}: let
appName = "Spotify";
pname = "spotify";
version = "sha256-JESQZtyPE9o5PW/f5GdxbqbyeHCxs/oZEW0AakMJgKg=";
@ -20,4 +23,3 @@ mkMacBinPackage {
platforms = platforms.darwin;
};
}

View file

@ -1,18 +1,20 @@
{ fetchurl, lib, mkMacBinPackage, stdenv }:
let
{
fetchurl,
lib,
mkMacBinPackage,
stdenv,
}: let
appName = "VLC";
pname = "vlc";
version = "3.0.18";
srcs = {
aarch64-darwin = fetchurl {
url =
"http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-arm64.dmg";
url = "http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-arm64.dmg";
sha256 = "sha256-mcJZvbxSIf1QgX9Ri3Dpv57hdeiQdDkDyYB7x3hmj0c=";
name = "${pname}_aarch64_${version}.dmg";
};
x86_64-darwin = fetchurl {
url =
"http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-intel64.dmg";
url = "http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-intel64.dmg";
sha256 = "sha256-iO3N/Os70vaANn2QCdOKDBR/p1jy3TleQ0EsHgjOHMs=";
name = "${pname}_x86_64_${version}.dmg";
};
@ -28,5 +30,3 @@ mkMacBinPackage {
platforms = platforms.darwin;
};
}