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,11 +1,11 @@
{ writeShellApplication {
, home-manager writeShellApplication,
, stdenv home-manager,
, stdenv,
}: }:
writeShellApplication { writeShellApplication {
name = "home-build"; name = "home-build";
runtimeInputs = [ home-manager ]; runtimeInputs = [home-manager];
text = '' text = ''
export FLAKE_CONFIG_URI=".#homeConfigurations.${stdenv.hostPlatform.system}.$USER" export FLAKE_CONFIG_URI=".#homeConfigurations.${stdenv.hostPlatform.system}.$USER"
exec home-manager build "$@" exec home-manager build "$@"

View file

@ -1,10 +1,11 @@
{ writeShellApplication {
, home-manager writeShellApplication,
, stdenv home-manager,
stdenv,
}: }:
writeShellApplication { writeShellApplication {
name = "home-switch"; name = "home-switch";
runtimeInputs = [ home-manager ]; runtimeInputs = [home-manager];
text = '' text = ''
export FLAKE_CONFIG_URI=".#homeConfigurations.${stdenv.hostPlatform.system}.$USER" export FLAKE_CONFIG_URI=".#homeConfigurations.${stdenv.hostPlatform.system}.$USER"
exec home-manager switch "$@" exec home-manager switch "$@"

View file

@ -1,15 +1,12 @@
# Copyright (c) 2018 Terje Larsen # Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT. # For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/apps.nix # https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/apps.nix
{lib, ...}: {
{ lib, ... }: { perSystem = {pkgs, ...}:
perSystem = { pkgs, ... }:
lib.pipe ../apps [ lib.pipe ../apps [
lib.filesystem.listFilesRecursive lib.filesystem.listFilesRecursive
(map (file: pkgs.callPackage file { })) (map (file: pkgs.callPackage file {}))
(map (drv: { (map (drv: {
apps.${drv.name} = { apps.${drv.name} = {
type = "app"; type = "app";
@ -17,6 +14,6 @@
}; };
checks."app-${drv.name}" = drv; checks."app-${drv.name}" = drv;
})) }))
(lib.fold lib.recursiveUpdate { }) (lib.fold lib.recursiveUpdate {})
]; ];
} }

View file

@ -1,16 +1,19 @@
{ lib, flake-parts-lib, self, ... }: {
let lib,
flake-parts-lib,
self,
...
}: let
inherit (lib) mkOption types; inherit (lib) mkOption types;
inherit (flake-parts-lib) mkTransposedPerSystemModule; inherit (flake-parts-lib) mkTransposedPerSystemModule;
in in
mkTransposedPerSystemModule mkTransposedPerSystemModule
{ {
name = "homeConfigurations"; name = "homeConfigurations";
file = ./configurations.nix; file = ./configurations.nix;
option = mkOption { option = mkOption {
type = types.lazyAttrsOf types.unspecified; type = types.lazyAttrsOf types.unspecified;
default = { }; default = {};
description = "Home Manager user configurations."; description = "Home Manager user configurations.";
}; };
} }

View file

@ -1,34 +1,30 @@
# Copyright (c) 2018 Terje Larsen # Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT. # For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/home-manager/default.nix # https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/home-manager/default.nix
{
{ lib lib,
, flake-parts-lib flake-parts-lib,
, self self,
, ... ...
}: }: let
let
inherit inherit
(lib) (lib)
mkOption mkOption
types types
; ;
inherit (flake-parts-lib) mkSubmoduleOptions; inherit (flake-parts-lib) mkSubmoduleOptions;
in in {
{ imports = [./modules.nix ./users.nix ./configurations.nix];
imports = [ ./modules.nix ./users.nix ./configurations.nix ];
options = { options = {
flake = mkSubmoduleOptions { flake = mkSubmoduleOptions {
homeManagerModules = mkOption { homeManagerModules = mkOption {
type = types.lazyAttrsOf types.unspecified; type = types.lazyAttrsOf types.unspecified;
default = { }; default = {};
apply = lib.mapAttrs (k: v: { apply = lib.mapAttrs (k: v: {
_file = "${toString self.outPath}/flake.nix#homeManagerModules.${k}"; _file = "${toString self.outPath}/flake.nix#homeManagerModules.${k}";
imports = [ v ]; imports = [v];
}); });
description = '' description = ''
Home Manager modules. Home Manager modules.

View file

@ -1,26 +1,23 @@
# Copyright (c) 2018 Terje Larsen # Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT. # For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/home-manager/modules.nix # https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/home-manager/modules.nix
{
{ lib lib,
, self self,
, inputs inputs,
, ... ...
}: { }: {
flake.homeManagerModules = flake.homeManagerModules = let
let modules = self.lib.importDirToAttrs ../../home-manager/modules;
modules = self.lib.importDirToAttrs ../../home-manager/modules; in
in
{ {
default = { default = {
imports = builtins.attrValues modules; imports = builtins.attrValues modules;
}; };
nixpkgs-Config = { 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;
}; };

View file

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

View file

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

View file

@ -1,6 +1,10 @@
{ self, inputs, ... }: { {
self,
inputs,
...
}: {
flake = { flake = {
nixosModules.base = { config, ... }: { nixosModules.base = {config, ...}: {
imports = [ imports = [
../../nixos/profiles/common.nix ../../nixos/profiles/common.nix
../../nixos/profiles/linux-common.nix ../../nixos/profiles/linux-common.nix
@ -14,7 +18,7 @@
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
}; };
darwinModules.base = { config, ... }: { darwinModules.base = {config, ...}: {
imports = [ imports = [
../../nixos/profiles/common.nix ../../nixos/profiles/common.nix
inputs.home-manager.darwinModules.home-manager inputs.home-manager.darwinModules.home-manager
@ -41,7 +45,6 @@
self.nixosModules.base self.nixosModules.base
../../nixos/hosts/zeus.asahi.nix ../../nixos/hosts/zeus.asahi.nix
]; ];
}; };
darwinConfigurations.zeus = inputs.darwin.lib.darwinSystem { darwinConfigurations.zeus = inputs.darwin.lib.darwinSystem {

View file

@ -1,30 +1,27 @@
# Copyright (c) 2018 Terje Larsen # Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license. # This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT. # For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/lib/default.nix # https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/lib/default.nix
{
{ self self,
, inputs inputs,
, ... ...
}: { }: {
flake.nixosModules = flake.nixosModules = let
let modules = self.lib.importDirToAttrs ../../nixos/modules;
modules = self.lib.importDirToAttrs ../../nixos/modules; in
in
{ {
default = { default = {
imports = builtins.attrValues modules; imports = builtins.attrValues modules;
}; };
appleSilicon = { config, ... }: { appleSilicon = {config, ...}: {
imports = [ inputs.nixos-apple-silicon.nixosModules.apple-silicon-support ]; imports = [inputs.nixos-apple-silicon.nixosModules.apple-silicon-support];
nixpkgs.overlays = [ inputs.nixos-apple-silicon.overlays.default ]; nixpkgs.overlays = [inputs.nixos-apple-silicon.overlays.default];
}; };
nixpkgs-useFlakeNixpkgs = { nixpkgs-useFlakeNixpkgs = {
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; nix.nixPath = ["nixpkgs=${inputs.nixpkgs}"];
nix.registry.nixpkgs.flake = inputs.nixpkgs; nix.registry.nixpkgs.flake = inputs.nixpkgs;
}; };

View file

@ -1,14 +1,17 @@
{ self, inputs, lib, ... }:
{ {
self,
inputs,
lib,
...
}: {
flake.overlays = { flake.overlays = {
apps = final: prev: ( apps = final: prev: (
let let
appsDir = self.lib.importDirToAttrs ../apps; appsDir = self.lib.importDirToAttrs ../apps;
in in
lib.mapAttrs (name: value: value.definition self.lib prev) appsDir lib.mapAttrs (name: value: value.definition self.lib prev) appsDir
); );
default = import ../packages; default = import ../packages;
rycee-firefox-addons = final: prev: { rycee-firefox-addons = inputs.rycee-firefox-addons.outputs.packages.${prev.system}; }; rycee-firefox-addons = final: prev: {rycee-firefox-addons = inputs.rycee-firefox-addons.outputs.packages.${prev.system};};
}; };
} }

View file

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

View file

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

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }: {
config,
let pkgs,
...
}: let
passCmd = address: "${pkgs.python310Packages.keyring}/bin/keyring get login email(${address})"; passCmd = address: "${pkgs.python310Packages.keyring}/bin/keyring get login email(${address})";
generalAccount = address: { generalAccount = address: {
inherit address; inherit address;
@ -19,29 +21,35 @@ let
}; };
gmailAccount = address: ({ gmailAccount = address: ({
flavor = "gmail.com"; flavor = "gmail.com";
folders = { folders = {
drafts = "[Gmail].Drafts"; drafts = "[Gmail].Drafts";
inbox = "INBOX"; inbox = "INBOX";
sent = "[Gmail].Sent Mail"; sent = "[Gmail].Sent Mail";
trash = "[Gmail].Trash"; trash = "[Gmail].Trash";
}; };
} // generalAccount address); }
in // generalAccount address);
{ in {
accounts.email.accounts = { accounts.email.accounts = {
gmail = (gmailAccount "willemleitso@gmail.com") // { realName = "Willem Leitso"; }; 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"; flavor = "plain";
imap.port = 993; imap.host = "imap.mail.me.com";
smtp.host = "smtp.mail.me.com"; imap.port = 993;
smtp.port = 587; 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"; wnuke9 = gmailAccount "wnuke9@gmail.com";
}; };
} }

View file

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

View file

@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
let pkgs,
lib,
...
}: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (pkgs) stdenv; inherit (pkgs) stdenv;
appCommands = { appCommands = {
@ -13,8 +16,7 @@ let
settings = "System Settings"; settings = "System Settings";
zotero = "Zotero"; zotero = "Zotero";
}; };
in in {
{
home.file.".gnupg/gpg-agent.conf" = mkIf stdenv.isDarwin { home.file.".gnupg/gpg-agent.conf" = mkIf stdenv.isDarwin {
text = '' text = ''
pinentry-program "${pkgs.pinentry-touchid}/bin/pinentry-touchid" pinentry-program "${pkgs.pinentry-touchid}/bin/pinentry-touchid"
@ -26,20 +28,20 @@ in
home.file.".config/zsh/am.sh" = mkIf stdenv.isDarwin { home.file.".config/zsh/am.sh" = mkIf stdenv.isDarwin {
executable = true; executable = true;
source = builtins.fetchurl { source = builtins.fetchurl {
url = url = "https://raw.githubusercontent.com/mcthomas/Apple-Music-CLI-Player/27353ec55abac8b5d73b8a061fb87f305c663adb/src/am.sh";
"https://raw.githubusercontent.com/mcthomas/Apple-Music-CLI-Player/27353ec55abac8b5d73b8a061fb87f305c663adb/src/am.sh";
sha256 = "sha256-78zRpNg7/OR7p8dpsJt6Xc4j0Y+8zSUtm/PT94nf03M="; sha256 = "sha256-78zRpNg7/OR7p8dpsJt6Xc4j0Y+8zSUtm/PT94nf03M=";
}; };
}; };
programs.zsh.shellAliases = mkIf stdenv.isDarwin ({ programs.zsh.shellAliases = mkIf stdenv.isDarwin ({
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)\"";
o = "open"; o = "open";
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 = mkIf stdenv.isDarwin pkgs.firefox-mac;
programs.chromium.package = mkIf stdenv.isDarwin pkgs.chromium-mac; programs.chromium.package = mkIf stdenv.isDarwin pkgs.chromium-mac;
@ -47,7 +49,7 @@ in
targets.darwin = mkIf stdenv.isDarwin { targets.darwin = mkIf stdenv.isDarwin {
defaults = { defaults = {
NSGlobalDomain = { NSGlobalDomain = {
AppleLanguages = [ "en-CA" ]; AppleLanguages = ["en-CA"];
AppleLocale = "en_CA"; AppleLocale = "en_CA";
}; };
"com.apple.Safari" = { "com.apple.Safari" = {

View file

@ -1,5 +1,8 @@
{ pkgs, lib, ... }: {
let pkgs,
lib,
...
}: let
columnSettings = { columnSettings = {
name = { name = {
visible = true; visible = true;
@ -59,32 +62,36 @@ let
}; };
default-view-settings = { default-view-settings = {
ExtendedListViewSettingsV2 = { ExtendedListViewSettingsV2 =
columns = builtins.sort (a: b: a.index < b.index) (map {
(name: columns = builtins.sort (a: b: a.index < b.index) (map
(name: value: { (name:
identifier = "${name}"; (name: value: {
visible = value.visible; identifier = "${name}";
width = value.width; visible = value.visible;
index = value.index; width = value.width;
}) name index = value.index;
})
name
columnSettings.${name}) columnSettings.${name})
(builtins.attrNames columnSettings)); (builtins.attrNames columnSettings));
} // listviewsettings; }
ListViewSettings = { columns = columnSettings; } // listviewsettings; // listviewsettings;
ListViewSettings = {columns = columnSettings;} // listviewsettings;
}; };
dvs-with-ws = { dvs-with-ws =
WindowState = { {
ContainerShowSidebar = true; WindowState = {
ShowStatusBar = true; ContainerShowSidebar = true;
ShowSidebar = true; ShowStatusBar = true;
ShowToolbar = true; ShowSidebar = true;
ShowTabView = true; ShowToolbar = true;
}; ShowTabView = true;
} // default-view-settings; };
in }
{ // default-view-settings;
in {
targets.darwin.defaults."com.apple.finder" = lib.mkIf pkgs.stdenv.isDarwin { targets.darwin.defaults."com.apple.finder" = lib.mkIf pkgs.stdenv.isDarwin {
AppleShowAllExtensions = true; AppleShowAllExtensions = true;
@ -92,16 +99,18 @@ in
CreateDesktop = false; CreateDesktop = false;
DesktopViewSettings = { GroupBy = "Kind"; }; DesktopViewSettings = {GroupBy = "Kind";};
FinderSpawnTab = false; FinderSpawnTab = false;
FK_DefaultListViewSettingsV2 = FK_DefaultListViewSettingsV2 =
default-view-settings.ExtendedListViewSettingsV2; default-view-settings.ExtendedListViewSettingsV2;
FK_StandardViewSettings = { FK_StandardViewSettings =
SettingsType = "FK_StandardViewSettings"; {
} // default-view-settings; SettingsType = "FK_StandardViewSettings";
}
// default-view-settings;
FK_iCloudListViewSettingsV2 = FK_iCloudListViewSettingsV2 =
default-view-settings.ExtendedListViewSettingsV2; default-view-settings.ExtendedListViewSettingsV2;
@ -152,11 +161,13 @@ in
SidebarWidth = 135; SidebarWidth = 135;
SidebarZoneOrder1 = [ "icloud_drive" "favorites" "devices" "tags" ]; SidebarZoneOrder1 = ["icloud_drive" "favorites" "devices" "tags"];
StandardViewSettings = { StandardViewSettings =
SettingsType = "StandardViewSettings"; {
} // default-view-settings; SettingsType = "StandardViewSettings";
}
// default-view-settings;
TrashViewSettings = dvs-with-ws; TrashViewSettings = dvs-with-ws;

View file

@ -1,6 +1,8 @@
{ pkgs, lib, ... }: {
pkgs,
let lib,
...
}: let
dracula_plus = { dracula_plus = {
"Ansi 0 Color" = { "Ansi 0 Color" = {
"Alpha Component" = 1; "Alpha Component" = 1;
@ -192,43 +194,44 @@ let
"Red Component" = 0.231373; "Red Component" = 0.231373;
}; };
}; };
profile_defaults = { profile_defaults =
"ASCII Anti Aliased" = true; {
"Ambiguous Double Width" = false; "ASCII Anti Aliased" = true;
"BM Growl" = true; "Ambiguous Double Width" = false;
"Background Image Location" = ""; "BM Growl" = true;
"Blinking Cursor" = false; "Background Image Location" = "";
"Blur" = false; "Blinking Cursor" = false;
"Character Encoding" = 4; "Blur" = false;
"Close Sessions On End" = true; "Character Encoding" = 4;
"Flashing Bell" = false; "Close Sessions On End" = true;
"Horizontal Spacing" = 1; "Flashing Bell" = false;
"Idle Code" = 0; "Horizontal Spacing" = 1;
"Jobs to Ignore" = [ "rlogin" "ssh" "slogin" "telnet" ]; "Idle Code" = 0;
"Mouse Reporting" = true; "Jobs to Ignore" = ["rlogin" "ssh" "slogin" "telnet"];
"Non Ascii Font" = "Monaco 12"; "Mouse Reporting" = true;
"Non-ASCII Anti Aliased" = true; "Non Ascii Font" = "Monaco 12";
"Normal Font" = "MesloLGS-NF-Regular 12"; "Non-ASCII Anti Aliased" = true;
"Option Key Sends" = 2; "Normal Font" = "MesloLGS-NF-Regular 12";
"Prompt Before Closing 2" = false; "Option Key Sends" = 2;
"Right Option Key Sends" = 0; "Prompt Before Closing 2" = false;
"Scrollback Lines" = 0; "Right Option Key Sends" = 0;
"Send Code When Idle" = false; "Scrollback Lines" = 0;
"Silence Bell" = false; "Send Code When Idle" = false;
"Sync Title" = false; "Silence Bell" = false;
"Terminal Type" = "xterm-256color"; "Sync Title" = false;
"Transparency" = 0; "Terminal Type" = "xterm-256color";
"Unlimited Scrollback" = true; "Transparency" = 0;
"Use Bold Font" = true; "Unlimited Scrollback" = true;
"Use Bright Bold" = true; "Use Bold Font" = true;
"Use Italic Font" = true; "Use Bright Bold" = true;
"Use Non-ASCII Font" = false; "Use Italic Font" = true;
"Vertical Spacing" = 1; "Use Non-ASCII Font" = false;
"Visual Bell" = true; "Vertical Spacing" = 1;
"Window Type" = 0; "Visual Bell" = true;
} // dracula_plus; "Window Type" = 0;
in }
{ // dracula_plus;
in {
targets.darwin.defaults."com.googlecode.iterm2" = lib.mkIf pkgs.stdenv.isDarwin { targets.darwin.defaults."com.googlecode.iterm2" = lib.mkIf pkgs.stdenv.isDarwin {
"AlternateMouseScroll" = true; "AlternateMouseScroll" = true;
"Default Bookmark Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106"; "Default Bookmark Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106";
@ -242,48 +245,50 @@ in
"VisualIndicatorForEsc" = false; "VisualIndicatorForEsc" = false;
"New Bookmarks" = [ "New Bookmarks" = [
({ ({
"Columns" = 120; "Columns" = 120;
"Command" = ""; "Command" = "";
"Custom Command" = "No"; "Custom Command" = "No";
"Custom Directory" = "No"; "Custom Directory" = "No";
"Default Bookmark" = "Yes"; "Default Bookmark" = "Yes";
"Description" = "Default"; "Description" = "Default";
"Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106"; "Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106";
"Name" = "Primary"; "Name" = "Primary";
"Rows" = 30; "Rows" = 30;
"Screen" = -1; "Screen" = -1;
"Tags" = [ ]; "Tags" = [];
"Working Directory" = "/Users/willem"; "Working Directory" = "/Users/willem";
} // profile_defaults) }
// profile_defaults)
({ ({
"Columns" = 120; "Columns" = 120;
"Command" = ""; "Command" = "";
"Custom Command" = "No"; "Custom Command" = "No";
"Custom Directory" = "No"; "Custom Directory" = "No";
"Default Bookmark" = "No"; "Default Bookmark" = "No";
"Description" = "Default"; "Description" = "Default";
"Disable Window Resizing" = true; "Disable Window Resizing" = true;
"Guid" = "00A17AC2-1885-4AE2-B941-A47A5D8C36B4"; "Guid" = "00A17AC2-1885-4AE2-B941-A47A5D8C36B4";
"Has Hotkey" = true; "Has Hotkey" = true;
"HotKey Activated By Modifier" = false; "HotKey Activated By Modifier" = false;
"HotKey Alternate Shortcuts" = { }; "HotKey Alternate Shortcuts" = {};
"HotKey Characters Ignoring Modifiers" = " "; "HotKey Characters Ignoring Modifiers" = " ";
"HotKey Characters" = " "; "HotKey Characters" = " ";
"HotKey Key Code" = 49; "HotKey Key Code" = 49;
"HotKey Modifier Activation" = 3; "HotKey Modifier Activation" = 3;
"HotKey Modifier Flags" = 1048576; "HotKey Modifier Flags" = 1048576;
"HotKey Window Animates" = false; "HotKey Window Animates" = false;
"HotKey Window AutoHides" = true; "HotKey Window AutoHides" = true;
"HotKey Window Dock Click Action" = 0; "HotKey Window Dock Click Action" = 0;
"HotKey Window Floats" = true; "HotKey Window Floats" = true;
"HotKey Window Reopens On Activation" = false; "HotKey Window Reopens On Activation" = false;
"Name" = "Hotkey Window"; "Name" = "Hotkey Window";
"Rows" = 25; "Rows" = 25;
"Screen" = -1; "Screen" = -1;
"Space" = -1; "Space" = -1;
"Tags" = [ ]; "Tags" = [];
"Working Directory" = "/Users/willem"; "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 { launchd = lib.mkIf pkgs.stdenv.isDarwin {
enable = true; enable = true;
@ -22,7 +25,7 @@
agents.offlineimap = { agents.offlineimap = {
enable = true; enable = true;
config = { config = {
ProgramArguments = [ "${pkgs.offlineimap}/bin/offlineimap" ]; ProgramArguments = ["${pkgs.offlineimap}/bin/offlineimap"];
UserName = "${config.home.username}"; UserName = "${config.home.username}";
StartInterval = 900; StartInterval = 900;
StandardOutPath = "${config.home.homeDirectory}/Library/Logs/offlineimap-stdout.log"; StandardOutPath = "${config.home.homeDirectory}/Library/Logs/offlineimap-stdout.log";

View file

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

View file

@ -1,28 +1,33 @@
{ pkgs, lib, ... }: {
pkgs,
let lib,
...
}: let
darwin = with pkgs; [ darwin = with pkgs; [
pngpaste pngpaste
pinentry-touchid pinentry-touchid
pinentry-mac pinentry-mac
spoof-mac spoof-mac
]; ];
linux = with pkgs; [ ]; linux = with pkgs; [];
python-wp = pkgs.python310.withPackages (p: with p; [ python-wp = pkgs.python310.withPackages (p:
keyring with p; [
latexify-py keyring
pyaml latexify-py
requests pyaml
setuptools requests
]); setuptools
]);
node-packages = with pkgs.nodePackages; [ node-packages = with pkgs.nodePackages; [
bash-language-server bash-language-server
prettier prettier
yarn yarn
]; ];
octave-wp = pkgs.octave.withPackages (p: with p; [ symbolic ]); octave-wp = pkgs.octave.withPackages (p: with p; [symbolic]);
texliveset = pkgs.texlive.combine { texliveset = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-basic inherit
(pkgs.texlive)
scheme-basic
babel babel
amscls amscls
amsmath amsmath
@ -63,10 +68,10 @@ let
url url
wrapfig wrapfig
xstring xstring
xkeyval; xkeyval
;
}; };
in in {
{
home.packages = with pkgs; home.packages = with pkgs;
[ [
autoconf autoconf

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }: { {
lib,
config,
pkgs,
...
}: {
programs = { programs = {
bash.enableCompletion = true; bash.enableCompletion = true;
@ -13,8 +18,8 @@
chromium = { chromium = {
enable = true; enable = true;
extensions = [ extensions = [
{ id = "naepdomgkenhinolocfifgehidddafch"; } # browserpass {id = "naepdomgkenhinolocfifgehidddafch";} # browserpass
{ id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # ublock origin {id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";} # ublock origin
]; ];
}; };
@ -22,7 +27,7 @@
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = true;
enableZshIntegration = true; enableZshIntegration = true;
nix-direnv = { enable = true; }; nix-direnv = {enable = true;};
}; };
exa = { exa = {
@ -38,7 +43,7 @@
git = { git = {
enable = true; enable = true;
delta = { enable = true; }; delta = {enable = true;};
signing = { signing = {
key = "C3DE5DF6198DACBD"; key = "C3DE5DF6198DACBD";
signByDefault = true; signByDefault = true;
@ -82,7 +87,7 @@
password-store = { password-store = {
enable = true; enable = true;
package = pkgs.pass.withExtensions (exts: [ exts.pass-genphrase exts.pass-otp exts.pass-import ]); package = pkgs.pass.withExtensions (exts: [exts.pass-genphrase exts.pass-otp exts.pass-import]);
settings = { settings = {
PASSWORD_STORE_DIR = "${config.home.homeDirectory}/.password-store"; PASSWORD_STORE_DIR = "${config.home.homeDirectory}/.password-store";
PASSWORD_STORE_CLIP_TIME = "60"; PASSWORD_STORE_CLIP_TIME = "60";
@ -177,26 +182,32 @@
RPROMPT = "%B%F{red}%*%f%b"; RPROMPT = "%B%F{red}%*%f%b";
}; };
shellAliases = rec { shellAliases =
cd = "z"; rec {
discord = "${web} https://discord.com/channels/@me"; cd = "z";
dotd = "cd ${config.home.sessionVariables.DOTDIR} "; discord = "${web} https://discord.com/channels/@me";
e = "emacsclient -c -nw"; dotd = "cd ${config.home.sessionVariables.DOTDIR} ";
em = "emacs -nw"; e = "emacsclient -c -nw";
email = "${ew} -n --eval '(mu4e)'"; em = "emacs -nw";
emw = "emacs"; email = "${ew} -n --eval '(mu4e)'";
ew = "emacsclient -c"; emw = "emacs";
l = "ls -1"; ew = "emacsclient -c";
np = "nix-shell -p"; l = "ls -1";
org = "cd ${config.home.sessionVariables.ORGDIR} "; np = "nix-shell -p";
spotify = "${web} https://open.spotify.com/"; org = "cd ${config.home.sessionVariables.ORGDIR} ";
ubc = "cd ${config.home.sessionVariables.UBCDIR} "; spotify = "${web} https://open.spotify.com/";
ubcmail = "${web} https://webmail.student.ubc.ca"; ubc = "cd ${config.home.sessionVariables.UBCDIR} ";
web = "${pkgs.coreutils-full}/bin/nohup ${config.programs.firefox.package}/bin/firefox &> ${config.home.homeDirectory}/.firefox.log"; ubcmail = "${web} https://webmail.student.ubc.ca";
} // (if pkgs.stdenv.isLinux then { web = "${pkgs.coreutils-full}/bin/nohup ${config.programs.firefox.package}/bin/firefox &> ${config.home.homeDirectory}/.firefox.log";
nbs = "sudo nixos-rebuild build --flake ${config.home.sessionVariables.DOTDIR}#"; }
nrs = "sudo nixos-rebuild switch --flake ${config.home.sessionVariables.DOTDIR}#"; // (
} else { }); 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 {}
);
}; };
home-manager.enable = true; 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; programs.emacs.enable = true;
services.emacs = pkgs.lib.mkIf pkgs.stdenv.isLinux { services.emacs = pkgs.lib.mkIf pkgs.stdenv.isLinux {
@ -120,7 +121,7 @@ in
all-the-icons-dired = { all-the-icons-dired = {
enable = true; enable = true;
hook = [ "(dired-mode . all-the-icons-dired-mode)" ]; hook = ["(dired-mode . all-the-icons-dired-mode)"];
}; };
calibredb = { calibredb = {
@ -136,15 +137,15 @@ in
cdlatex = { cdlatex = {
enable = true; enable = true;
after = [ "latex" ]; after = ["latex"];
hook = [ "(LaTeX-mode . turn-on-cdlatex)" ]; hook = ["(LaTeX-mode . turn-on-cdlatex)"];
}; };
citeproc.enable = true; citeproc.enable = true;
company = { company = {
enable = true; enable = true;
defines = [ "comapny-text-icons-margin" ]; defines = ["comapny-text-icons-margin"];
init = '' init = ''
;; Align company-mode tooltips to the right hand side ;; Align company-mode tooltips to the right hand side
(setq company-tooltip-align-annotations t) (setq company-tooltip-align-annotations t)
@ -154,13 +155,12 @@ in
;; Display text icon of type in company popup ;; Display text icon of type in company popup
(setq company-format-margin-function #'company-text-icons-margin) (setq company-format-margin-function #'company-text-icons-margin)
''; '';
hook = hook = ["(sh-mode . company-mode)" "(emacs-lisp-mode . company-mode)"];
[ "(sh-mode . company-mode)" "(emacs-lisp-mode . company-mode)" ];
}; };
company-math = { company-math = {
enable = true; enable = true;
after = [ "company" ]; after = ["company"];
init = '' init = ''
; -*-emacs-lisp-*- ; -*-emacs-lisp-*-
(add-to-list 'company-backends 'company-math-symbols-unicode) (add-to-list 'company-backends 'company-math-symbols-unicode)
@ -185,13 +185,13 @@ in
"C-S-o" = "counsel-rhythmbox"; "C-S-o" = "counsel-rhythmbox";
}; };
bindLocal = { bindLocal = {
minibuffer-local-map = { "C-r" = "counsel-minibuffer-history"; }; minibuffer-local-map = {"C-r" = "counsel-minibuffer-history";};
}; };
}; };
doom-modeline = { doom-modeline = {
enable = true; enable = true;
hook = [ "(after-init . doom-modeline-mode)" ]; hook = ["(after-init . doom-modeline-mode)"];
config = '' config = ''
(setq doom-modeline-icon t) (setq doom-modeline-icon t)
''; '';
@ -201,11 +201,11 @@ in
edit-server = { edit-server = {
enable = true; enable = true;
command = [ "edit-server-start" ]; command = ["edit-server-start"];
config = '' config = ''
(setq edit-server-new-frame nil) (setq edit-server-new-frame nil)
''; '';
hook = [ "(after-init . edit-server-start)" ]; hook = ["(after-init . edit-server-start)"];
}; };
editorconfig = { editorconfig = {
@ -227,7 +227,7 @@ in
flycheck = { flycheck = {
enable = true; enable = true;
hook = [ "(after-init . global-flycheck-mode)" ]; hook = ["(after-init . global-flycheck-mode)"];
config = '' config = ''
(setq flycheck-disabled-checkers '(emacs-lisp-checkdoc)) (setq flycheck-disabled-checkers '(emacs-lisp-checkdoc))
''; '';
@ -237,7 +237,7 @@ in
format-all = { format-all = {
enable = true; enable = true;
command = [ "format-all-buffer" ]; command = ["format-all-buffer"];
config = '' config = ''
(setq-default format-all-formatters format-all-default-formatters) (setq-default format-all-formatters format-all-default-formatters)
''; '';
@ -265,19 +265,19 @@ in
ivy = { ivy = {
enable = true; enable = true;
command = [ "ivy-mode" ]; command = ["ivy-mode"];
init = '' init = ''
(setq ivy-use-virtual-buffers t) (setq ivy-use-virtual-buffers t)
(setq ivy-use-selectable-prompt t) (setq ivy-use-selectable-prompt t)
(setq enable-recursive-minibuffers t) (setq enable-recursive-minibuffers t)
''; '';
bind = { "C-c C-r" = "ivy-resume"; }; bind = {"C-c C-r" = "ivy-resume";};
hook = [ "(after-init . ivy-mode)" ]; hook = ["(after-init . ivy-mode)"];
}; };
ivy-bibtex = { ivy-bibtex = {
enable = true; enable = true;
after = [ "ivy" ]; after = ["ivy"];
init = '' init = ''
; -*-emacs-lisp-*- ; -*-emacs-lisp-*-
;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which ;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which
@ -311,7 +311,7 @@ in
lsp-ivy = { lsp-ivy = {
enable = true; enable = true;
command = [ "lsp-ivy-workspace-symbol" ]; command = ["lsp-ivy-workspace-symbol"];
}; };
lsp-java = { lsp-java = {
@ -325,13 +325,13 @@ in
(setq lsp-java-jdt-download-url (setq lsp-java-jdt-download-url
"https://download.eclipse.org/jdtls/milestones/1.16.0/jdt-language-server-1.16.0-202209291445.tar.gz") "https://download.eclipse.org/jdtls/milestones/1.16.0/jdt-language-server-1.16.0-202209291445.tar.gz")
''; '';
hook = [ "(java-mode . lsp)" ]; hook = ["(java-mode . lsp)"];
}; };
lsp-mode = { lsp-mode = {
enable = true; enable = true;
after = [ "format-all" ]; after = ["format-all"];
command = [ "lsp-format-buffer" ]; command = ["lsp-format-buffer"];
extraConfig = '' extraConfig = ''
:preface :preface
(defun my/format-document () (defun my/format-document ()
@ -344,21 +344,21 @@ in
((lsp-feature? "textDocument/rangeFormatting") ((lsp-feature? "textDocument/rangeFormatting")
(lsp-format-buffer)) (lsp-format-buffer))
(t (format-all-buffer)))) (t (format-all-buffer))))
(t (t
(format-all-buffer)))) (format-all-buffer))))
''; '';
functions = [ "lsp-deferred" "lsp-feature" "lsp-register-client" ]; functions = ["lsp-deferred" "lsp-feature" "lsp-register-client"];
init = '' init = ''
(setq lsp-log-io nil) (setq lsp-log-io nil)
(setq lsp-keymap-prefix "C-c l") (setq lsp-keymap-prefix "C-c l")
''; '';
config = '' config = ''
(lsp-treemacs-sync-mode 1) (lsp-treemacs-sync-mode 1)
(add-to-list 'lsp-language-id-configuration '(nix-mode . "nix")) (add-to-list 'lsp-language-id-configuration '(nix-mode . "nix"))
(lsp-register-client (lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("rnix-lsp")) (make-lsp-client :new-connection (lsp-stdio-connection '("rnix-lsp"))
:major-modes '(nix-mode) :major-modes '(nix-mode)
:server-id 'nix)) :server-id 'nix))
''; '';
hook = [ hook = [
"(lsp-mode . company-mode)" "(lsp-mode . company-mode)"
@ -367,17 +367,17 @@ in
"(javascript-mode . lsp)" "(javascript-mode . lsp)"
"(nix-mode . lsp)" "(nix-mode . lsp)"
]; ];
bind = { "C-c C-y" = "my/format-document"; }; bind = {"C-c C-y" = "my/format-document";};
}; };
lsp-treemacs = { lsp-treemacs = {
enable = true; enable = true;
command = [ "lsp-treemacs-errors-lisp" ]; command = ["lsp-treemacs-errors-lisp"];
}; };
lsp-ui = { lsp-ui = {
enable = true; enable = true;
command = [ "lsp-ui-mode" ]; command = ["lsp-ui-mode"];
}; };
magit = { magit = {
@ -475,97 +475,93 @@ in
''; '';
}; };
mu4e = mu4e = let
let smtpConfig = name: (
smtpConfig = name: let
( account = config.accounts.email.accounts.${name};
let port = builtins.toString account.smtp.port;
account = config.accounts.email.accounts.${name}; host = account.smtp.host;
port = builtins.toString account.smtp.port; in ''
host = account.smtp.host; ("${name}"
in (mu4e-drafts-folder "/${name}/${account.folders.drafts}")
'' (mu4e-sent-folder "/${name}/${account.folders.sent}")
("${name}" (mu4e-trash-folder "/${name}/${account.folders.trash}")
(mu4e-drafts-folder "/${name}/${account.folders.drafts}") ; (mu4e-maildir-shortcuts
(mu4e-sent-folder "/${name}/${account.folders.sent}") ; '( (:maildir "/${name}/${account.folders.inbox}" :key ?i)
(mu4e-trash-folder "/${name}/${account.folders.trash}") ; (:maildir "/${name}/${account.folders.sent}" :key ?s)
; (mu4e-maildir-shortcuts ; (:maildir "/${name}/${account.folders.drafts}" :key ?d)
; '( (:maildir "/${name}/${account.folders.inbox}" :key ?i) ; (:maildir "/${name}/${account.folders.trash}" :key ?t)))
; (:maildir "/${name}/${account.folders.sent}" :key ?s) (smtpmail-default-smtp-server "${host}")
; (:maildir "/${name}/${account.folders.drafts}" :key ?d) (smtpmail-smtp-server "${host}")
; (:maildir "/${name}/${account.folders.trash}" :key ?t))) (smtpmail-smtp-service ${port} )
(smtpmail-default-smtp-server "${host}") (smtpmail-smtp-user "${account.userName}")
(smtpmail-smtp-server "${host}") (user-mail-address "${account.address}"))
(smtpmail-smtp-service ${port} ) ''
(smtpmail-smtp-user "${account.userName}") );
(user-mail-address "${account.address}")) smtpAccountStrings = pkgs.lib.forEach (builtins.attrNames config.accounts.email.accounts) (account: " ${(smtpConfig account)} ");
'' smtpAccounts = "'( ${pkgs.lib.concatStrings smtpAccountStrings} )";
); in {
smtpAccountStrings = pkgs.lib.forEach (builtins.attrNames config.accounts.email.accounts) (account: " ${(smtpConfig account)} "); enable = true;
smtpAccounts = "'( ${pkgs.lib.concatStrings smtpAccountStrings} )"; after = ["async"];
in package = epkgs: pkgs.mu;
{ demand = true;
enable = true; extraPackages = [pkgs.gnutls pkgs.mu];
after = [ "async" ]; init = ''
package = epkgs: pkgs.mu; ;-*-emacs-lisp-*-
demand = true;
extraPackages = [ pkgs.gnutls pkgs.mu ];
init = ''
;-*-emacs-lisp-*-
(add-to-list 'load-path "${pkgs.mu}/share/emacs/site-lisp/mu4e") (add-to-list 'load-path "${pkgs.mu}/share/emacs/site-lisp/mu4e")
(require 'mu4e) (require 'mu4e)
(setq starttls-use-gnutls t (setq starttls-use-gnutls t
message-kill-buffer-on-exit t message-kill-buffer-on-exit t
mail-user-agent 'mu4e-user-agent) mail-user-agent 'mu4e-user-agent)
(set-variable 'read-mail-command 'mu4e) (set-variable 'read-mail-command 'mu4e)
(defvar my-mu4e-account-alist ${smtpAccounts} ) (defvar my-mu4e-account-alist ${smtpAccounts} )
(mapc #'(lambda (var) (mapc #'(lambda (var)
(set (car var) (cadr var))) (set (car var) (cadr var)))
(cdr (assoc "leitso" my-mu4e-account-alist))) (cdr (assoc "leitso" my-mu4e-account-alist)))
(defun my-mu4e-set-account () (defun my-mu4e-set-account ()
"Set the account for composing a message." "Set the account for composing a message."
(let* ((account (let* ((account
(if mu4e-compose-parent-message (if mu4e-compose-parent-message
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir))) (let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
(string-match "/\\(.*?\\)/" maildir) (string-match "/\\(.*?\\)/" maildir)
(match-string 1 maildir)) (match-string 1 maildir))
(completing-read (format "Compose with account: (%s) " (completing-read (format "Compose with account: (%s) "
(mapconcat #'(lambda (var) (car var)) (mapconcat #'(lambda (var) (car var))
my-mu4e-account-alist "/")) my-mu4e-account-alist "/"))
(mapcar #'(lambda (var) (car var)) my-mu4e-account-alist) (mapcar #'(lambda (var) (car var)) my-mu4e-account-alist)
nil t nil nil (caar my-mu4e-account-alist)))) nil t nil nil (caar my-mu4e-account-alist))))
(account-vars (cdr (assoc account my-mu4e-account-alist)))) (account-vars (cdr (assoc account my-mu4e-account-alist))))
(if account-vars (if account-vars
(mapc #'(lambda (var) (mapc #'(lambda (var)
(set (car var) (cadr var))) (set (car var) (cadr var)))
account-vars) account-vars)
(error "No email account found")))) (error "No email account found"))))
(setq mu4e-bookmarks (setq mu4e-bookmarks
'((:name "Unread messages" :query "flag:unread AND NOT (flag:trashed OR maildir:/feeds)" :key ?u) '((:name "Unread messages" :query "flag:unread AND NOT (flag:trashed OR maildir:/feeds)" :key ?u)
(:name "Today's messages" :query "date:today..now AND NOT maildir:/feeds" :key ?t) (:name "Today's messages" :query "date:today..now AND NOT maildir:/feeds" :key ?t)
(:name "Last 7 days" :query "date:7d..now AND NOT maildir:/feeds" :key ?w) (:name "Last 7 days" :query "date:7d..now AND NOT maildir:/feeds" :key ?w)
(:name "Feed" :query "maildir:/feeds" :key ?f) (:name "Feed" :query "maildir:/feeds" :key ?f)
(:name "XKCD" :query "list:xkcd.localhost" :key ?x))) (:name "XKCD" :query "list:xkcd.localhost" :key ?x)))
(add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account) (add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account)
''; '';
bind = { bind = {
"C-c C-u" = "my-mu4e-set-account"; "C-c C-u" = "my-mu4e-set-account";
};
hook = [ "(mu4e-compose-pre-hook . my-mu4e-set-account)" ];
}; };
hook = ["(mu4e-compose-pre-hook . my-mu4e-set-account)"];
};
nix-mode = { nix-mode = {
enable = true; enable = true;
extraConfig = '' extraConfig = ''
@ -579,33 +575,33 @@ in
nix-update = { nix-update = {
enable = true; enable = true;
command = [ "nix-update-fetch" ]; command = ["nix-update-fetch"];
bindLocal.nix-mode-map."C-c C-u" = "nix-update-fetch"; bindLocal.nix-mode-map."C-c C-u" = "nix-update-fetch";
}; };
ob-calc = { ob-calc = {
enable = true; enable = true;
after = [ "org" ]; after = ["org"];
}; };
ob-dot = { ob-dot = {
enable = true; enable = true;
after = [ "org" ]; after = ["org"];
}; };
ob-emacs-lisp = { ob-emacs-lisp = {
enable = true; enable = true;
after = [ "org" ]; after = ["org"];
}; };
ob-gnuplot = { ob-gnuplot = {
enable = true; enable = true;
after = [ "org" ]; after = ["org"];
}; };
ob-matlab = { ob-matlab = {
enable = true; enable = true;
after = [ "org" ]; after = ["org"];
init = '' init = ''
(setq org-babel-octave-shell-command "${pkgs.octave}/bin/octave -q") (setq org-babel-octave-shell-command "${pkgs.octave}/bin/octave -q")
''; '';
@ -613,7 +609,7 @@ in
ob-python = { ob-python = {
enable = true; enable = true;
after = [ "org" ]; after = ["org"];
init = '' init = ''
; -*-emacs-lisp-*- ; -*-emacs-lisp-*-
(setq org-babel-python-command "${pkgs.python310}/bin/python3.10") (setq org-babel-python-command "${pkgs.python310}/bin/python3.10")
@ -628,7 +624,7 @@ in
ob-shell = { ob-shell = {
enable = true; enable = true;
after = [ "org" ]; after = ["org"];
}; };
org = { org = {
@ -772,38 +768,39 @@ in
org-auctex = { org-auctex = {
enable = true; enable = true;
package = epkgs: epkgs.trivialBuild { package = epkgs:
pname = "org-auctex"; epkgs.trivialBuild {
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c"; pname = "org-auctex";
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
packageRequires = [ epkgs.auctex ]; packageRequires = [epkgs.auctex];
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "karthink"; owner = "karthink";
repo = "org-auctex"; repo = "org-auctex";
rev = "e1271557b9f36ca94cabcbac816748e7d0dc989c"; rev = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
sha256 = "sha256-cMAhwybnq5HA1wOaUqDPML3nnh5m1iwEETTPWqPbAvw="; sha256 = "sha256-cMAhwybnq5HA1wOaUqDPML3nnh5m1iwEETTPWqPbAvw=";
};
}; };
}; hook = ["(org-mode . org-auctex-mode)"];
hook = [ "(org-mode . org-auctex-mode)" ];
}; };
org-contrib.enable = true; org-contrib.enable = true;
org-download = { org-download = {
enable = true; enable = true;
after = [ "org" ]; after = ["org"];
init = '' init = ''
(require 'org-download) (require 'org-download)
(setq-default org-download-image-dir "${config.home.sessionVariables.ORGDIR}/images") (setq-default org-download-image-dir "${config.home.sessionVariables.ORGDIR}/images")
''; '';
hook = [ "(dired-mode . org-download-enable)" ]; hook = ["(dired-mode . org-download-enable)"];
}; };
org-modern = { org-modern = {
enable = true; enable = true;
after = [ "org" ]; after = ["org"];
hook = [ "(org-mode . org-modern-mode)" ]; hook = ["(org-mode . org-modern-mode)"];
}; };
pdf-tools = { pdf-tools = {
@ -838,8 +835,8 @@ in
separedit = { separedit = {
enable = true; enable = true;
bind = { "C-c '" = "separedit"; }; bind = {"C-c '" = "separedit";};
hook = [ "(separedit-buffer-creation . normal-mode)" ]; hook = ["(separedit-buffer-creation . normal-mode)"];
init = '' init = ''
; -*-emacs-lisp-*- ; -*-emacs-lisp-*-
(setq separedit-preserve-string-indentation t) (setq separedit-preserve-string-indentation t)
@ -853,7 +850,7 @@ in
swiper = { swiper = {
enable = true; enable = true;
bind = { "C-s" = "swiper"; }; bind = {"C-s" = "swiper";};
}; };
tree-sitter = { tree-sitter = {
@ -893,7 +890,7 @@ in
arduino-mode = { arduino-mode = {
enable = true; enable = true;
hook = [ "(arduino-mode . flycheck-arduino-setup)" ]; hook = ["(arduino-mode . flycheck-arduino-setup)"];
init = '' init = ''
(require 'flycheck-arduino) (require 'flycheck-arduino)
(setq arduino-executable "/Applications/Arduino.app/Contents/MacOS/Arduino") (setq arduino-executable "/Applications/Arduino.app/Contents/MacOS/Arduino")

View file

@ -1,4 +1,8 @@
{ config, pkgs, ... }: { {
config,
pkgs,
...
}: {
programs.firefox = { programs.firefox = {
enable = true; enable = true;
profiles.primary = { profiles.primary = {
@ -13,23 +17,31 @@
]; ];
engines = { engines = {
"Nix Packages" = { "Nix Packages" = {
urls = [{ urls = [
template = "https://search.nixos.org/packages"; {
params = [ template = "https://search.nixos.org/packages";
{ name = "type"; value = "packages"; } params = [
{ name = "query"; value = "{searchTerms}"; } {
]; name = "type";
}]; value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ]; definedAliases = ["@np"];
}; };
"NixOS Wiki" = { "NixOS Wiki" = {
urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }]; urls = [{template = "https://nixos.wiki/index.php?search={searchTerms}";}];
iconUpdateURL = "https://nixos.wiki/favicon.png"; iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000; # every day updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = [ "@nw" ]; definedAliases = ["@nw"];
}; };
"Bing".metaData.hidden = true; "Bing".metaData.hidden = true;

View file

@ -1,17 +1,13 @@
# MIT License # MIT License
# Copyright (c) 2019 Robert Helgesson # Copyright (c) 2019 Robert Helgesson
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights # in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is # copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: # furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all # The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software. # copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # 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, # 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 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
{
{ config, lib, pkgs, ... }: config,
lib,
with lib; pkgs,
...
let }:
with lib; let
cfg = config.programs.emacs.init; cfg = config.programs.emacs.init;
packageFunctionType = mkOptionType { packageFunctionType = mkOptionType {
@ -35,12 +31,17 @@ let
merge = mergeOneOption; merge = mergeOneOption;
}; };
usePackageType = types.submodule ({ name, config, ... }: { usePackageType = types.submodule ({
name,
config,
...
}: {
options = { options = {
enable = mkEnableOption "Emacs package ${name}"; enable = mkEnableOption "Emacs package ${name}";
package = mkOption { package = mkOption {
type = types.either (types.str // { description = "name of package"; }) type =
types.either (types.str // {description = "name of package";})
packageFunctionType; packageFunctionType;
default = name; default = name;
description = '' description = ''
@ -60,7 +61,7 @@ let
defines = mkOption { defines = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
description = '' description = ''
The entries to use for <option>:defines</option>. The entries to use for <option>:defines</option>.
''; '';
@ -76,7 +77,7 @@ let
diminish = mkOption { diminish = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
description = '' description = ''
The entries to use for <option>:diminish</option>. The entries to use for <option>:diminish</option>.
''; '';
@ -84,7 +85,7 @@ let
chords = mkOption { chords = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = {};
example = { example = {
"jj" = "ace-jump-char-mode"; "jj" = "ace-jump-char-mode";
"jk" = "ace-jump-word-mode"; "jk" = "ace-jump-word-mode";
@ -96,7 +97,7 @@ let
functions = mkOption { functions = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
description = '' description = ''
The entries to use for <option>:functions</option>. The entries to use for <option>:functions</option>.
''; '';
@ -104,7 +105,7 @@ let
mode = mkOption { mode = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
description = '' description = ''
The entries to use for <option>:mode</option>. The entries to use for <option>:mode</option>.
''; '';
@ -112,7 +113,7 @@ let
after = mkOption { after = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
description = '' description = ''
The entries to use for <option>:after</option>. The entries to use for <option>:after</option>.
''; '';
@ -120,7 +121,7 @@ let
bind = mkOption { bind = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = {};
example = { example = {
"M-<up>" = "drag-stuff-up"; "M-<up>" = "drag-stuff-up";
"M-<down>" = "drag-stuff-down"; "M-<down>" = "drag-stuff-down";
@ -132,9 +133,9 @@ let
bindLocal = mkOption { bindLocal = mkOption {
type = types.attrsOf (types.attrsOf types.str); type = types.attrsOf (types.attrsOf types.str);
default = { }; default = {};
example = { example = {
helm-command-map = { "C-c h" = "helm-execute-persistent-action"; }; helm-command-map = {"C-c h" = "helm-execute-persistent-action";};
}; };
description = '' description = ''
The entries to use for local keymaps in <option>:bind</option>. The entries to use for local keymaps in <option>:bind</option>.
@ -143,8 +144,8 @@ let
bindKeyMap = mkOption { bindKeyMap = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = {};
example = { "C-c p" = "projectile-command-map"; }; example = {"C-c p" = "projectile-command-map";};
description = '' description = ''
The entries to use for <option>:bind-keymap</option>. The entries to use for <option>:bind-keymap</option>.
''; '';
@ -152,7 +153,7 @@ let
command = mkOption { command = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
description = '' description = ''
The entries to use for <option>:commands</option>. The entries to use for <option>:commands</option>.
''; '';
@ -176,7 +177,7 @@ let
hook = mkOption { hook = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
description = '' description = ''
The entries to use for <option>:hook</option>. The entries to use for <option>:hook</option>.
''; '';
@ -204,7 +205,7 @@ let
extraPackages = mkOption { extraPackages = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = [ ]; default = [];
description = '' description = ''
Extra packages to add to <option>home.packages</option>. Extra packages to add to <option>home.packages</option>.
''; '';
@ -219,45 +220,52 @@ let
}; };
config = mkIf config.enable { config = mkIf config.enable {
assembly = assembly = let
let quoted = v: ''"${escape [''"''] v}"'';
quoted = v: ''"${escape [ ''"'' ] v}"''; mkBindHelper = cmd: prefix: bs:
mkBindHelper = cmd: prefix: bs: optionals (bs != {}) ([":${cmd} (${prefix}"]
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})"; mkAfter = vs: optional (vs != []) ":after (${toString vs})";
mkCommand = vs: optional (vs != [ ]) ":commands (${toString vs})"; mkCommand = vs: optional (vs != []) ":commands (${toString vs})";
mkDefines = vs: optional (vs != [ ]) ":defines (${toString vs})"; mkDefines = vs: optional (vs != []) ":defines (${toString vs})";
mkDiminish = vs: optional (vs != [ ]) ":diminish (${toString vs})"; mkDiminish = vs: optional (vs != []) ":diminish (${toString vs})";
mkMode = map (v: ":mode ${v}"); mkMode = map (v: ":mode ${v}");
mkFunctions = vs: optional (vs != [ ]) ":functions (${toString vs})"; mkFunctions = vs: optional (vs != []) ":functions (${toString vs})";
mkBind = mkBindHelper "bind" ""; mkBind = mkBindHelper "bind" "";
mkBindLocal = bs: mkBindLocal = bs: let
let mkMap = n: v: mkBindHelper "bind" ":map ${n}" v; 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 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 " concatStringsSep "\n "
([ "(use-package ${name}" ] (["(use-package ${name}"]
++ mkAfter config.after ++ mkBind config.bind ++ mkAfter config.after
++ mkBindKeyMap config.bindKeyMap ++ mkBindLocal config.bindLocal ++ mkBind config.bind
++ mkChords config.chords ++ mkCommand config.command ++ mkBindKeyMap config.bindKeyMap
++ mkDefer config.defer ++ mkDefines config.defines ++ mkBindLocal config.bindLocal
++ mkFunctions config.functions ++ mkDemand config.demand ++ mkChords config.chords
++ mkDiminish config.diminish ++ mkHook config.hook ++ mkCommand config.command
++ mkDefer config.defer
++ mkDefines config.defines
++ mkFunctions config.functions
++ mkDemand config.demand
++ mkDiminish config.diminish
++ mkHook config.hook
++ mkMode config.mode ++ mkMode config.mode
++ optionals (config.init != "") [ ":init" config.init ] ++ optionals (config.init != "") [":init" config.init]
++ optionals (config.config != "") [ ":config" config.config ] ++ optionals (config.config != "") [":config" config.config]
++ optional (config.extraConfig != "") config.extraConfig) + ")"; ++ optional (config.extraConfig != "") config.extraConfig)
+ ")";
}; };
}); });
@ -271,12 +279,14 @@ let
type = types.bool; type = types.bool;
default = false; default = false;
example = true; example = true;
description = '' description =
Whether to enable recommended ${type} settings. ''
'' + optionalString (extraDescription != "") '' Whether to enable recommended ${type} settings.
</para><para> ''
${extraDescription} + optionalString (extraDescription != "") ''
''; </para><para>
${extraDescription}
'';
}; };
# Recommended GC settings. # Recommended GC settings.
@ -315,37 +325,44 @@ let
''; '';
# Whether the configuration makes use of `:diminish`. # Whether the configuration makes use of `:diminish`.
hasDiminish = any (p: p.diminish != [ ]) (attrValues cfg.usePackage); hasDiminish = any (p: p.diminish != []) (attrValues cfg.usePackage);
# Whether the configuration makes use of `:bind`. # 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); (attrValues cfg.usePackage);
# Whether the configuration makes use of `:chords`. # Whether the configuration makes use of `:chords`.
hasChords = any (p: p.chords != { }) (attrValues cfg.usePackage); hasChords = any (p: p.chords != {}) (attrValues cfg.usePackage);
usePackageSetup = '' usePackageSetup =
(eval-when-compile ''
(require 'use-package) (eval-when-compile
;; To help fixing issues during startup. (require 'use-package)
(setq use-package-verbose ${ ;; To help fixing issues during startup.
if cfg.usePackageVerbose then "t" else "nil" (setq use-package-verbose ${
if cfg.usePackageVerbose
then "t"
else "nil"
})) }))
'' + optionalString hasDiminish '' ''
;; For :diminish in (use-package). + optionalString hasDiminish ''
(require 'diminish) ;; For :diminish in (use-package).
'' + optionalString hasBind '' (require 'diminish)
;; For :bind in (use-package). ''
(require 'bind-key) + optionalString hasBind ''
;; For :bind in (use-package).
(require 'bind-key)
;; Fixes "Symbols function definition is void: use-package-autoload-keymap". ;; Fixes "Symbols function definition is void: use-package-autoload-keymap".
(autoload #'use-package-autoload-keymap "use-package-bind-key") (autoload #'use-package-autoload-keymap "use-package-bind-key")
'' + optionalString hasChords '' ''
;; For :chords in (use-package). + optionalString hasChords ''
(use-package use-package-chords ;; For :chords in (use-package).
:config (key-chord-mode 1)) (use-package use-package-chords
''; :config (key-chord-mode 1))
'';
earlyInitFile = '' earlyInitFile = ''
;;; hm-early-init.el --- Emacs configuration à la Home Manager -*- lexical-binding: t; -*- ;;; hm-early-init.el --- Emacs configuration à la Home Manager -*- lexical-binding: t; -*-
@ -362,39 +379,40 @@ let
;; hm-early-init.el ends here ;; hm-early-init.el ends here
''; '';
initFile = '' initFile =
;;; hm-init.el --- Emacs configuration à la Home Manager -*- lexical-binding: t; -*- ''
;; ;;; hm-init.el --- Emacs configuration à la Home Manager -*- lexical-binding: t; -*-
;;; Commentary: ;;
;; ;;; Commentary:
;; A configuration generated from a Nix based configuration by ;;
;; Home Manager. ;; A configuration generated from a Nix based configuration by
;; ;; Home Manager.
;;; Code: ;;
;;; Code:
${optionalString cfg.startupTimer '' ${optionalString cfg.startupTimer ''
(defun hm/print-startup-stats () (defun hm/print-startup-stats ()
"Prints some basic startup statistics." "Prints some basic startup statistics."
(let ((elapsed (float-time (time-subtract after-init-time (let ((elapsed (float-time (time-subtract after-init-time
before-init-time)))) before-init-time))))
(message "Startup took %.2fs with %d GCs" elapsed gcs-done))) (message "Startup took %.2fs with %d GCs" elapsed gcs-done)))
(add-hook 'emacs-startup-hook #'hm/print-startup-stats) (add-hook 'emacs-startup-hook #'hm/print-startup-stats)
''} ''}
${cfg.prelude} ${cfg.prelude}
${usePackageSetup} ${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} ${cfg.postlude}
(provide 'hm-init) (provide 'hm-init)
;; hm-init.el ends here ;; hm-init.el ends here
''; '';
in {
in
{
options.programs.emacs.init = { options.programs.emacs.init = {
enable = mkEnableOption "Emacs configuration"; enable = mkEnableOption "Emacs configuration";
@ -453,7 +471,7 @@ in
usePackage = mkOption { usePackage = mkOption {
type = types.attrsOf usePackageType; type = types.attrsOf usePackageType;
default = { }; default = {};
example = literalExpression '' example = literalExpression ''
{ {
dhall-mode = { dhall-mode = {
@ -470,83 +488,86 @@ in
config = mkIf (config.programs.emacs.enable && cfg.enable) { config = mkIf (config.programs.emacs.enable && cfg.enable) {
# Collect the extra packages that should be included in the user profile. # Collect the extra packages that should be included in the user profile.
# These are typically tools called by Emacs packages. # 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)); (filter (getAttr "enable") (builtins.attrValues cfg.usePackage));
programs.emacs.init.earlyInit = programs.emacs.init.earlyInit = let
let standardEarlyInit = mkBefore ''
${optionalString cfg.recommendedGcSettings gcSettings}
standardEarlyInit = mkBefore '' ${
${optionalString cfg.recommendedGcSettings gcSettings} if cfg.packageQuickstart
then ''
${if cfg.packageQuickstart then ''
(setq package-quickstart t (setq package-quickstart t
package-quickstart-file "hm-package-quickstart.el") package-quickstart-file "hm-package-quickstart.el")
'' else '' ''
else ''
(setq package-enable-at-startup nil) (setq package-enable-at-startup nil)
''} ''
}
;; Avoid expensive frame resizing. Inspired by Doom Emacs. ;; Avoid expensive frame resizing. Inspired by Doom Emacs.
(setq frame-inhibit-implied-resize t) (setq frame-inhibit-implied-resize t)
''; '';
# Collect the early initialization strings for each package. # Collect the early initialization strings for each package.
packageEarlyInits = map (p: p.earlyInit) packageEarlyInits =
(filter (p: p.earlyInit != "") (builtins.attrValues cfg.usePackage)); map (p: p.earlyInit)
(filter (p: p.earlyInit != "") (builtins.attrValues cfg.usePackage));
in
mkMerge ([standardEarlyInit] ++ packageEarlyInits);
in programs.emacs.extraPackages = epkgs: let
mkMerge ([ standardEarlyInit ] ++ packageEarlyInits); getPkg = v:
if isFunction v
then [(v epkgs)]
else optional (isString v && hasAttr v epkgs) epkgs.${v};
programs.emacs.extraPackages = epkgs: packages =
let concatMap (v: getPkg (v.package))
getPkg = v: (filter (getAttr "enable") (builtins.attrValues cfg.usePackage));
if isFunction v then in [
[ (v epkgs) ] (epkgs.trivialBuild {
else pname = "hm-early-init";
optional (isString v && hasAttr v epkgs) epkgs.${v}; src = pkgs.writeText "hm-early-init.el" earlyInitFile;
packageRequires = packages;
preferLocalBuild = true;
allowSubstitutes = false;
})
packages = concatMap (v: getPkg (v.package)) (epkgs.trivialBuild {
(filter (getAttr "enable") (builtins.attrValues cfg.usePackage)); pname = "hm-init";
in src = pkgs.writeText "hm-init.el" initFile;
[ packageRequires =
(epkgs.trivialBuild { [epkgs.use-package]
pname = "hm-early-init"; ++ packages
src = pkgs.writeText "hm-early-init.el" earlyInitFile; ++ optional hasBind epkgs.bind-key
packageRequires = packages; ++ optional hasDiminish epkgs.diminish
preferLocalBuild = true; ++ optional hasChords epkgs.use-package-chords;
allowSubstitutes = false; preferLocalBuild = true;
}) allowSubstitutes = false;
preBuild = ''
# Do a bit of basic formatting of the generated init file.
emacs -Q --batch \
--eval '(find-file "hm-init.el")' \
--eval '(let ((indent-tabs-mode nil) (lisp-indent-offset 2)) (indent-region (point-min) (point-max)))' \
--eval '(write-file "hm-init.el")'
(epkgs.trivialBuild { ${optionalString cfg.packageQuickstart ''
pname = "hm-init"; # Generate a package quickstart file to make autoloads and such
src = pkgs.writeText "hm-init.el" initFile; # available.
packageRequires = [ epkgs.use-package ] ++ packages
++ optional hasBind epkgs.bind-key
++ optional hasDiminish epkgs.diminish
++ optional hasChords epkgs.use-package-chords;
preferLocalBuild = true;
allowSubstitutes = false;
preBuild = ''
# Do a bit of basic formatting of the generated init file.
emacs -Q --batch \ emacs -Q --batch \
--eval '(find-file "hm-init.el")' \ --eval "(require 'package)" \
--eval '(let ((indent-tabs-mode nil) (lisp-indent-offset 2)) (indent-region (point-min) (point-max)))' \ --eval "(setq package-quickstart-file \"hm-package-quickstart.el\")" \
--eval '(write-file "hm-init.el")' --eval "(package-quickstart-refresh)"
${optionalString cfg.packageQuickstart '' # We know what we're doing?
# Generate a package quickstart file to make autoloads and such sed -i '/no-byte-compile: t/d' hm-package-quickstart.el
# available. ''}
emacs -Q --batch \ '';
--eval "(require 'package)" \ })
--eval "(setq package-quickstart-file \"hm-package-quickstart.el\")" \ ];
--eval "(package-quickstart-refresh)"
# We know what we're doing?
sed -i '/no-byte-compile: t/d' hm-package-quickstart.el
''}
'';
})
];
home.file = { home.file = {
".emacs.d/early-init.el".text = '' ".emacs.d/early-init.el".text = ''

View file

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

View file

@ -1,7 +1,5 @@
{ pkgs, ... }: {pkgs, ...}: {
imports = [../profiles/linux-common.nix ../profiles/gnome.nix];
{
imports = [ ../profiles/linux-common.nix ../profiles/gnome.nix ];
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = false; boot.loader.efi.canTouchEfiVariables = false;

View file

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

View file

@ -1,22 +1,20 @@
{ pkgs, ... }: {pkgs, ...}: {
{
imports = [ imports = [
../profiles/desktop.nix ../profiles/desktop.nix
../profiles/gnome.nix ../profiles/gnome.nix
../profiles/linux-common.nix ../profiles/linux-common.nix
]; ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [];
boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" "usb_storage" "sr_mod" ]; boot.initrd.availableKernelModules = ["xhci_pci" "virtio_pci" "usbhid" "usb_storage" "sr_mod"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi"; boot.loader.efi.efiSysMountPoint = "/boot/efi";
environment.systemPackages = with pkgs; [ mesa ]; environment.systemPackages = with pkgs; [mesa];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-label/nixos"; device = "/dev/disk/by-label/nixos";
@ -32,5 +30,5 @@
services.spice-vdagentd.enable = true; services.spice-vdagentd.enable = true;
swapDevices = [ ]; swapDevices = [];
} }

View file

@ -1,83 +1,86 @@
# https://github.com/LnL7/nix-darwin/issues/277#issuecomment-992866471 # https://github.com/LnL7/nix-darwin/issues/277#issuecomment-992866471
{
{ config, lib, pkgs, inputs, ... }: config,
lib,
with lib; pkgs,
inputs,
let ...
}:
with lib; let
cfg = config.nix; cfg = config.nix;
nixRegistry = builtins.mapAttrs (name: value: { flake = value; }) inputs; nixRegistry = builtins.mapAttrs (name: value: {flake = value;}) inputs;
etcNixInputs = pkgs.runCommandNoCC "etc-nix-inputs" etcNixInputs =
pkgs.runCommandNoCC "etc-nix-inputs"
{ {
inputNames = builtins.attrNames inputs; inputNames = builtins.attrNames inputs;
inputPaths = builtins.map (x: x.outPath) (builtins.attrValues inputs); inputPaths = builtins.map (x: x.outPath) (builtins.attrValues inputs);
} '' } ''
mkdir -p $out mkdir -p $out
inputNames=($inputNames) inputNames=($inputNames)
inputPaths=($inputPaths) inputPaths=($inputPaths)
for (( i=0; i<''${#inputNames[@]}; i++)); do for (( i=0; i<''${#inputNames[@]}; i++)); do
source=''${inputPaths[$i]} source=''${inputPaths[$i]}
name=''${inputNames[$i]} name=''${inputNames[$i]}
if [[ -f $source/default.nix ]]; then if [[ -f $source/default.nix ]]; then
ln -s $source $out/$name ln -s $source $out/$name
fi fi
done done
''; '';
in in
# Based on flake-utils-plus#nixosModules.autoGenFromInputs
# Based on flake-utils-plus#nixosModules.autoGenFromInputs
# https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/master/lib/options.nix # 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 # 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/105 and
# https://github.com/gytis-ivaskevicius/flake-utils-plus/issues/107 # https://github.com/gytis-ivaskevicius/flake-utils-plus/issues/107
{
{ options = {
options = { nix.generateNixPathFromInputs = mkOption {
nix.generateNixPathFromInputs = mkOption { type = types.bool;
type = types.bool; description = ''
description = '' If set, NIX_PATH will be generated from available inputs.
If set, NIX_PATH will be generated from available inputs. This requires `nix.linkInputs` to be enabled, and setting this will default
This requires `nix.linkInputs` to be enabled, and setting this will default `nix.linkInputs` to true.
`nix.linkInputs` to true. '';
''; default = false;
default = false; example = true;
example = true; };
}; nix.generateRegistryFromInputs = mkOption {
nix.generateRegistryFromInputs = mkOption { type = types.bool;
type = types.bool; description = ''
description = '' If set, the system Nix registry will be generated from available inputs.
If set, the system Nix registry will be generated from available inputs. Otherwise, the registry will still include the `self` flake.
Otherwise, the registry will still include the `self` flake. '';
''; default = false;
default = false; example = true;
example = true; };
}; nix.linkInputs = mkOption {
nix.linkInputs = mkOption { type = types.bool;
type = types.bool; description = "If set, inputs will be symlinked into /etc/nix/inputs.";
description = "If set, inputs will be symlinked into /etc/nix/inputs."; example = true;
example = true; };
};
};
config = {
assertions = [{
assertion = cfg.generateNixPathFromInputs -> cfg.linkInputs;
message = "nix.generateNixPathFromInputs requires nix.linkInputs";
}];
nix.linkInputs = mkDefault cfg.generateNixPathFromInputs;
nix.registry =
if cfg.generateRegistryFromInputs
then nixRegistry
else { self.flake = inputs.self; };
environment.etc."nix/inputs" = mkIf cfg.linkInputs {
source = etcNixInputs;
}; };
nix.nixPath = mkIf cfg.generateNixPathFromInputs [ "/etc/nix/inputs" ]; config = {
}; assertions = [
} {
assertion = cfg.generateNixPathFromInputs -> cfg.linkInputs;
message = "nix.generateNixPathFromInputs requires nix.linkInputs";
}
];
nix.linkInputs = mkDefault cfg.generateNixPathFromInputs;
nix.registry =
if cfg.generateRegistryFromInputs
then nixRegistry
else {self.flake = inputs.self;};
environment.etc."nix/inputs" = mkIf cfg.linkInputs {
source = etcNixInputs;
};
nix.nixPath = mkIf cfg.generateNixPathFromInputs ["/etc/nix/inputs"];
};
}

View file

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

View file

@ -1,25 +1,25 @@
{ pkgs, ... }: {pkgs, ...}: {
imports = [./desktop.nix];
{ environment.gnome.excludePackages =
imports = [ ./desktop.nix ]; (with pkgs; [
gnome-photos
environment.gnome.excludePackages = (with pkgs; [ gnome-tour
gnome-photos ])
gnome-tour ++ (with pkgs.gnome; [
]) ++ (with pkgs.gnome; [ cheese # webcam tool
cheese # webcam tool gnome-music
gnome-music gedit # text editor
gedit # text editor epiphany # web browser
epiphany # web browser geary # email reader
geary # email reader evince # document viewer
evince # document viewer gnome-characters
gnome-characters totem # video player
totem # video player tali # poker game
tali # poker game iagno # go game
iagno # go game hitori # sudoku game
hitori # sudoku game atomix # puzzle game
atomix # puzzle game ]);
]);
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
pinentry-gnome pinentry-gnome

View file

@ -1,7 +1,5 @@
{ pkgs, ... }: {pkgs, ...}: {
imports = [./common.nix];
{
imports = [ ./common.nix ];
console.keyMap = "colemak"; console.keyMap = "colemak";
@ -23,6 +21,6 @@
users.users.willem = { users.users.willem = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = ["networkmanager" "wheel"];
}; };
} }

View file

@ -1,6 +1,9 @@
{ fetchurl, lib, mkMacBinPackage, stdenv }: {
fetchurl,
let lib,
mkMacBinPackage,
stdenv,
}: let
versions = { versions = {
aarch64-darwin = "1101351"; aarch64-darwin = "1101351";
x86_64-darwin = "1101350"; x86_64-darwin = "1101350";
@ -13,34 +16,32 @@ let
srcs = { srcs = {
aarch64-darwin = fetchurl { aarch64-darwin = fetchurl {
url = url = "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac_Arm/${version}/chrome-mac.zip";
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac_Arm/${version}/chrome-mac.zip";
sha256 = "sha256-LlbYlJmFLzyHIiygofa0Btm7NAOvWXXhmbjMHldVoGo="; sha256 = "sha256-LlbYlJmFLzyHIiygofa0Btm7NAOvWXXhmbjMHldVoGo=";
name = "${pname}_aarch64_${version}.zip"; name = "${pname}_aarch64_${version}.zip";
}; };
x86_64-darwin = fetchurl { x86_64-darwin = fetchurl {
url = url = "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/${version}/chrome-mac.zip";
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/${version}/chrome-mac.zip";
sha256 = "sha256-O+OnjakEpjCRbSjDysEA6RKKaKaSMw+LSO2ZLcxz2vM="; sha256 = "sha256-O+OnjakEpjCRbSjDysEA6RKKaKaSMw+LSO2ZLcxz2vM=";
name = "${pname}_x86_64_${version}.zip"; name = "${pname}_x86_64_${version}.zip";
}; };
}; };
src = srcs.${stdenv.hostPlatform.system}; src = srcs.${stdenv.hostPlatform.system};
in in
mkMacBinPackage { mkMacBinPackage {
inherit src pname appName version; inherit src pname appName version;
srcsubdir = "chrome-mac"; srcsubdir = "chrome-mac";
meta = with lib; { meta = with lib; {
description = "An open source web browser from Google."; description = "An open source web browser from Google.";
longDescription = '' longDescription = ''
Chromium is an open source web browser from Google that aims to build a Chromium is an open source web browser from Google that aims to build a
safer, faster, and more stable way for all Internet users to experience safer, faster, and more stable way for all Internet users to experience
the web. It has a minimalist user interface and provides the vast majority the web. It has a minimalist user interface and provides the vast majority
of source code for Google Chrome (which has some additional features). of source code for Google Chrome (which has some additional features).
''; '';
homepage = "https://www.chromium.org/"; homepage = "https://www.chromium.org/";
license = licenses.bsd3; license = licenses.bsd3;
platforms = platforms.linux; platforms = platforms.linux;
mainProgram = "chromium"; mainProgram = "chromium";
}; };
} }

View file

@ -1,32 +1,31 @@
# taken from nix-darwin repo # taken from nix-darwin repo
# https://github.com/LnL7/nix-darwin/blob/87b9d090ad39b25b2400029c64825fc2a8868943/modules/examples/lnl.nix # https://github.com/LnL7/nix-darwin/blob/87b9d090ad39b25b2400029c64825fc2a8868943/modules/examples/lnl.nix
{ runCommand }: {runCommand}:
runCommand "darwin-zsh-completions-0.0.0" runCommand "darwin-zsh-completions-0.0.0"
{ preferLocalBuild = true; } {preferLocalBuild = true;}
'' ''
mkdir -p $out/share/zsh/site-functions mkdir -p $out/share/zsh/site-functions
cat <<-'EOF' > $out/share/zsh/site-functions/_darwin-rebuild cat <<-'EOF' > $out/share/zsh/site-functions/_darwin-rebuild
#compdef darwin-rebuild #compdef darwin-rebuild
#autoload #autoload
_nix-common-options _nix-common-options
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'switch:Build, activate, and update the current generation'\ 'switch:Build, activate, and update the current generation'\
'build:Build without activating or updating the current generation'\ 'build:Build without activating or updating the current generation'\
'check:Build and run the activation sanity checks'\ 'check:Build and run the activation sanity checks'\
'changelog:Show most recent entries in the changelog'\ 'changelog:Show most recent entries in the changelog'\
) )
_arguments \ _arguments \
'--list-generations[Print a list of all generations in the active profile]'\ '--list-generations[Print a list of all generations in the active profile]'\
'--rollback[Roll back to the previous configuration]'\ '--rollback[Roll back to the previous configuration]'\
{--switch-generation,-G}'[Activate specified generation]'\ {--switch-generation,-G}'[Activate specified generation]'\
'(--profile-name -p)'{--profile-name,-p}'[Profile to use to track current and previous system configurations]:Profile:_nix_profiles'\ '(--profile-name -p)'{--profile-name,-p}'[Profile to use to track current and previous system configurations]:Profile:_nix_profiles'\
'1:: :->subcmds' && return 0 '1:: :->subcmds' && return 0
case $state in case $state in
subcmds) subcmds)
_describe -t commands 'darwin-rebuild subcommands' _1st_arguments _describe -t commands 'darwin-rebuild subcommands' _1st_arguments
;; ;;
esac esac
EOF EOF
'' ''

View file

@ -1,13 +1,13 @@
_final: prev: { _final: prev: {
chromium-mac = prev.callPackage ./chromium-mac.nix { }; chromium-mac = prev.callPackage ./chromium-mac.nix {};
darwin-zsh-completions = prev.callPackage ./darwin-zsh-completions.nix { }; darwin-zsh-completions = prev.callPackage ./darwin-zsh-completions.nix {};
firefox-mac = prev.callPackage ./firefox-mac.nix { }; firefox-mac = prev.callPackage ./firefox-mac.nix {};
freecad-mac = prev.callPackage ./freecad-mac.nix { }; freecad-mac = prev.callPackage ./freecad-mac.nix {};
mkMacBinPackage = import ./mk-mac-binpkg.nix prev; mkMacBinPackage = import ./mk-mac-binpkg.nix prev;
org-auctex = prev.callPackage ./org-auctex.nix { }; org-auctex = prev.callPackage ./org-auctex.nix {};
pinentry-mac = prev.callPackage ./pinentry-mac.nix { }; pinentry-mac = prev.callPackage ./pinentry-mac.nix {};
pinentry-touchid = prev.callPackage ./pinentry-touchid.nix { }; pinentry-touchid = prev.callPackage ./pinentry-touchid.nix {};
qbittorrent-mac = prev.callPackage ./qbittorrent-mac.nix { }; qbittorrent-mac = prev.callPackage ./qbittorrent-mac.nix {};
spotify-mac = prev.callPackage ./spotify-mac.nix { }; spotify-mac = prev.callPackage ./spotify-mac.nix {};
vlc-mac = prev.callPackage ./vlc-mac.nix { }; vlc-mac = prev.callPackage ./vlc-mac.nix {};
} }

View file

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

View file

@ -1,60 +1,63 @@
{ fetchurl, lib, makeWrapper, stdenv }: {
let fetchurl,
lib,
makeWrapper,
stdenv,
}: let
version = "0.20.2"; version = "0.20.2";
date = "2022-12-27"; date = "2022-12-27";
appName = "FreeCAD"; appName = "FreeCAD";
pname = "freecad"; pname = "freecad";
src = fetchurl { src = fetchurl {
url = url = "https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg";
"https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg";
sha256 = "sha256-OAi98HUacHcLHVYSadnQFPnEhutJvE4YfRBtPSZk00c="; sha256 = "sha256-OAi98HUacHcLHVYSadnQFPnEhutJvE4YfRBtPSZk00c=";
}; };
in in
stdenv.mkDerivation { stdenv.mkDerivation {
inherit version src; inherit version src;
name = pname; name = pname;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [makeWrapper];
dontUnpack = true; dontUnpack = true;
installPhase = '' installPhase = ''
export tempdir=$(mktemp -d -p /tmp) export tempdir=$(mktemp -d -p /tmp)
cp $src freecad.dmg cp $src freecad.dmg
/usr/bin/hdiutil attach -mountpoint "$tempdir" freecad.dmg /usr/bin/hdiutil attach -mountpoint "$tempdir" freecad.dmg
mkdir -p $out/Applications mkdir -p $out/Applications
cp -r "$tempdir/${appName}.app" $out/Applications cp -r "$tempdir/${appName}.app" $out/Applications
/usr/bin/hdiutil detach "$tempdir" /usr/bin/hdiutil detach "$tempdir"
mkdir -p $out/bin mkdir -p $out/bin
makeWrapper "$out/Applications/${appName}.app/Contents/MacOS/${appName}" "$out/bin/${pname}" makeWrapper "$out/Applications/${appName}.app/Contents/MacOS/${appName}" "$out/bin/${pname}"
runHook postInstall runHook postInstall
'';
meta = with lib; {
homepage = "https://www.freecadweb.org/";
description = "General purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler";
longDescription = ''
FreeCAD is an open-source parametric 3D modeler made primarily to design
real-life objects of any size. Parametric modeling allows you to easily
modify your design by going back into your model history and changing its
parameters.
FreeCAD allows you to sketch geometry constrained 2D shapes and use them
as a base to build other objects. It contains many components to adjust
dimensions or extract design details from 3D models to create high quality
production ready drawings.
FreeCAD is designed to fit a wide range of uses including product design,
mechanical engineering and architecture. Whether you are a hobbyist, a
programmer, an experienced CAD user, a student or a teacher, you will feel
right at home with FreeCAD.
''; '';
license = licenses.lgpl2Plus; meta = with lib; {
platforms = platforms.darwin; homepage = "https://www.freecadweb.org/";
}; description = "General purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler";
} longDescription = ''
FreeCAD is an open-source parametric 3D modeler made primarily to design
real-life objects of any size. Parametric modeling allows you to easily
modify your design by going back into your model history and changing its
parameters.
FreeCAD allows you to sketch geometry constrained 2D shapes and use them
as a base to build other objects. It contains many components to adjust
dimensions or extract design details from 3D models to create high quality
production ready drawings.
FreeCAD is designed to fit a wide range of uses including product design,
mechanical engineering and architecture. Whether you are a hobbyist, a
programmer, an experienced CAD user, a student or a teacher, you will feel
right at home with FreeCAD.
'';
license = licenses.lgpl2Plus;
platforms = platforms.darwin;
};
}

View file

@ -1,9 +1,17 @@
pkgs: { src, version, pname, appName, srcsubdir ? ".", ... }: pkgs.stdenv.mkDerivation { pkgs: {
src,
version,
pname,
appName,
srcsubdir ? ".",
...
}:
pkgs.stdenv.mkDerivation {
inherit version src; inherit version src;
name = pname; name = pname;
nativeBuildInputs = [ pkgs.undmg pkgs.unzip pkgs.makeWrapper ]; nativeBuildInputs = [pkgs.undmg pkgs.unzip pkgs.makeWrapper];
sourceRoot = "."; sourceRoot = ".";

View file

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

View file

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

View file

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

View file

@ -1,22 +1,24 @@
{ fetchurl, lib, mkMacBinPackage }: {
let fetchurl,
lib,
mkMacBinPackage,
}: let
version = "4.4.5"; version = "4.4.5";
appName = "qBittorrent"; appName = "qBittorrent";
pname = "qbittorrent"; pname = "qbittorrent";
src = fetchurl { src = fetchurl {
url = url = "https://phoenixnap.dl.sourceforge.net/project/qbittorrent/qbittorrent-mac/qbittorrent-${version}/qbittorrent-${version}.dmg";
"https://phoenixnap.dl.sourceforge.net/project/qbittorrent/qbittorrent-mac/qbittorrent-${version}/qbittorrent-${version}.dmg";
sha256 = "sha256-9h+gFAEU0tKrltOjnOKLfylbbBunGZqvPzQogdP9uQM="; sha256 = "sha256-9h+gFAEU0tKrltOjnOKLfylbbBunGZqvPzQogdP9uQM=";
}; };
in in
mkMacBinPackage { mkMacBinPackage {
inherit src pname appName version; inherit src pname appName version;
meta = with lib; { meta = with lib; {
description = "Featureful free software BitTorrent client"; description = "Featureful free software BitTorrent client";
homepage = "https://www.qbittorrent.org/"; homepage = "https://www.qbittorrent.org/";
changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog"; changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog";
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
platforms = platforms.darwin; platforms = platforms.darwin;
}; };
} }

View file

@ -1,5 +1,8 @@
{ fetchurl, lib, mkMacBinPackage }: {
let fetchurl,
lib,
mkMacBinPackage,
}: let
appName = "Spotify"; appName = "Spotify";
pname = "spotify"; pname = "spotify";
version = "sha256-JESQZtyPE9o5PW/f5GdxbqbyeHCxs/oZEW0AakMJgKg="; version = "sha256-JESQZtyPE9o5PW/f5GdxbqbyeHCxs/oZEW0AakMJgKg=";
@ -10,14 +13,13 @@ let
name = "spotify-mac.dmg"; name = "spotify-mac.dmg";
}; };
in in
mkMacBinPackage { mkMacBinPackage {
inherit src pname appName version; inherit src pname appName version;
meta = with lib; { meta = with lib; {
homepage = "https://www.spotify.com/"; homepage = "https://www.spotify.com/";
description = "Play music from the Spotify music service"; description = "Play music from the Spotify music service";
sourceProvenance = with sourceTypes; [ binaryNativeCode ]; sourceProvenance = with sourceTypes; [binaryNativeCode];
license = licenses.unfree; license = licenses.unfree;
platforms = platforms.darwin; platforms = platforms.darwin;
}; };
} }

View file

@ -1,32 +1,32 @@
{ fetchurl, lib, mkMacBinPackage, stdenv }: {
let fetchurl,
lib,
mkMacBinPackage,
stdenv,
}: let
appName = "VLC"; appName = "VLC";
pname = "vlc"; pname = "vlc";
version = "3.0.18"; version = "3.0.18";
srcs = { srcs = {
aarch64-darwin = fetchurl { aarch64-darwin = fetchurl {
url = url = "http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-arm64.dmg";
"http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-arm64.dmg";
sha256 = "sha256-mcJZvbxSIf1QgX9Ri3Dpv57hdeiQdDkDyYB7x3hmj0c="; sha256 = "sha256-mcJZvbxSIf1QgX9Ri3Dpv57hdeiQdDkDyYB7x3hmj0c=";
name = "${pname}_aarch64_${version}.dmg"; name = "${pname}_aarch64_${version}.dmg";
}; };
x86_64-darwin = fetchurl { x86_64-darwin = fetchurl {
url = url = "http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-intel64.dmg";
"http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-intel64.dmg";
sha256 = "sha256-iO3N/Os70vaANn2QCdOKDBR/p1jy3TleQ0EsHgjOHMs="; sha256 = "sha256-iO3N/Os70vaANn2QCdOKDBR/p1jy3TleQ0EsHgjOHMs=";
name = "${pname}_x86_64_${version}.dmg"; name = "${pname}_x86_64_${version}.dmg";
}; };
}; };
src = srcs.${stdenv.hostPlatform.system}; src = srcs.${stdenv.hostPlatform.system};
in in
mkMacBinPackage { mkMacBinPackage {
inherit src pname appName version; inherit src pname appName version;
meta = with lib; { meta = with lib; {
description = "Cross-platform media player and streaming server"; description = "Cross-platform media player and streaming server";
homepage = "http://www.videolan.org/vlc/"; homepage = "http://www.videolan.org/vlc/";
license = licenses.lgpl21Plus; license = licenses.lgpl21Plus;
platforms = platforms.darwin; platforms = platforms.darwin;
}; };
} }