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

View file

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

View file

@ -1,15 +1,12 @@
# Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/apps.nix
{ lib, ... }: {
perSystem = { pkgs, ... }:
{lib, ...}: {
perSystem = {pkgs, ...}:
lib.pipe ../apps [
lib.filesystem.listFilesRecursive
(map (file: pkgs.callPackage file { }))
(map (file: pkgs.callPackage file {}))
(map (drv: {
apps.${drv.name} = {
type = "app";
@ -17,6 +14,6 @@
};
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 (flake-parts-lib) mkTransposedPerSystemModule;
in
mkTransposedPerSystemModule
{
mkTransposedPerSystemModule
{
name = "homeConfigurations";
file = ./configurations.nix;
option = mkOption {
type = types.lazyAttrsOf types.unspecified;
default = { };
default = {};
description = "Home Manager user configurations.";
};
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,9 @@
{ self, inputs, lib, ... }:
{
self,
inputs,
lib,
...
}: {
flake.overlays = {
apps = final: prev: (
let
@ -9,6 +12,6 @@
lib.mapAttrs (name: value: value.definition self.lib prev) appsDir
);
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,28 +1,25 @@
# Copyright (c) 2018 Terje Larsen
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/packages.nix
{ self
, lib
, ...
{
self,
lib,
...
}: {
perSystem =
{ config
, pkgs
, ...
}:
let
perSystem = {
config,
pkgs,
...
}: let
overlays = [
self.overlays.default
];
pkgs' = pkgs.extend (lib.composeManyExtensions overlays);
in
{
in {
packages = {
inherit (pkgs')
inherit
(pkgs')
chromium-mac
darwin-zsh-completions
firefox-mac
@ -32,17 +29,16 @@
pinentry-touchid
qbittorrent-mac
spotify-mac
vlc-mac;
vlc-mac
;
};
legacyPackages = {
wrapPackage =
{ wrapper
, package
, exes ? [ (lib.getExe package) ]
,
}:
let
wrapPackage = {
wrapper,
package,
exes ? [(lib.getExe package)],
}: let
wrapperExe = lib.getExe wrapper;
wrapExe = exe:
pkgs.writeShellScriptBin (builtins.baseNameOf exe) ''
@ -51,11 +47,10 @@
in
pkgs.symlinkJoin {
name = "${package.name}-${wrapper.name}";
paths = (map wrapExe exes) ++ [ package ];
paths = (map wrapExe exes) ++ [package];
};
wrapPackages = pkgsWrapperFn: pkgNames: final: prev:
let
wrapPackages = pkgsWrapperFn: pkgNames: final: prev: let
wrapper = pkgsWrapperFn final;
in
builtins.listToAttrs (map

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,8 @@
{ pkgs, lib, ... }:
let
{
pkgs,
lib,
...
}: let
dracula_plus = {
"Ansi 0 Color" = {
"Alpha Component" = 1;
@ -192,7 +194,8 @@ let
"Red Component" = 0.231373;
};
};
profile_defaults = {
profile_defaults =
{
"ASCII Anti Aliased" = true;
"Ambiguous Double Width" = false;
"BM Growl" = true;
@ -204,7 +207,7 @@ let
"Flashing Bell" = false;
"Horizontal Spacing" = 1;
"Idle Code" = 0;
"Jobs to Ignore" = [ "rlogin" "ssh" "slogin" "telnet" ];
"Jobs to Ignore" = ["rlogin" "ssh" "slogin" "telnet"];
"Mouse Reporting" = true;
"Non Ascii Font" = "Monaco 12";
"Non-ASCII Anti Aliased" = true;
@ -226,9 +229,9 @@ let
"Vertical Spacing" = 1;
"Visual Bell" = true;
"Window Type" = 0;
} // dracula_plus;
in
{
}
// dracula_plus;
in {
targets.darwin.defaults."com.googlecode.iterm2" = lib.mkIf pkgs.stdenv.isDarwin {
"AlternateMouseScroll" = true;
"Default Bookmark Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106";
@ -252,9 +255,10 @@ in
"Name" = "Primary";
"Rows" = 30;
"Screen" = -1;
"Tags" = [ ];
"Tags" = [];
"Working Directory" = "/Users/willem";
} // profile_defaults)
}
// profile_defaults)
({
"Columns" = 120;
"Command" = "";
@ -266,7 +270,7 @@ in
"Guid" = "00A17AC2-1885-4AE2-B941-A47A5D8C36B4";
"Has Hotkey" = true;
"HotKey Activated By Modifier" = false;
"HotKey Alternate Shortcuts" = { };
"HotKey Alternate Shortcuts" = {};
"HotKey Characters Ignoring Modifiers" = " ";
"HotKey Characters" = " ";
"HotKey Key Code" = 49;
@ -281,9 +285,10 @@ in
"Rows" = 25;
"Screen" = -1;
"Space" = -1;
"Tags" = [ ];
"Tags" = [];
"Working Directory" = "/Users/willem";
} // profile_defaults)
}
// profile_defaults)
];
};
}

View file

@ -1,6 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}: {
launchd = lib.mkIf pkgs.stdenv.isDarwin {
enable = true;
@ -22,7 +25,7 @@
agents.offlineimap = {
enable = true;
config = {
ProgramArguments = [ "${pkgs.offlineimap}/bin/offlineimap" ];
ProgramArguments = ["${pkgs.offlineimap}/bin/offlineimap"];
UserName = "${config.home.username}";
StartInterval = 900;
StandardOutPath = "${config.home.homeDirectory}/Library/Logs/offlineimap-stdout.log";

View file

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

View file

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

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }: {
{
lib,
config,
pkgs,
...
}: {
programs = {
bash.enableCompletion = true;
@ -13,8 +18,8 @@
chromium = {
enable = true;
extensions = [
{ id = "naepdomgkenhinolocfifgehidddafch"; } # browserpass
{ id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # ublock origin
{id = "naepdomgkenhinolocfifgehidddafch";} # browserpass
{id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";} # ublock origin
];
};
@ -22,7 +27,7 @@
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
nix-direnv = { enable = true; };
nix-direnv = {enable = true;};
};
exa = {
@ -38,7 +43,7 @@
git = {
enable = true;
delta = { enable = true; };
delta = {enable = true;};
signing = {
key = "C3DE5DF6198DACBD";
signByDefault = true;
@ -82,7 +87,7 @@
password-store = {
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 = {
PASSWORD_STORE_DIR = "${config.home.homeDirectory}/.password-store";
PASSWORD_STORE_CLIP_TIME = "60";
@ -177,7 +182,8 @@
RPROMPT = "%B%F{red}%*%f%b";
};
shellAliases = rec {
shellAliases =
rec {
cd = "z";
discord = "${web} https://discord.com/channels/@me";
dotd = "cd ${config.home.sessionVariables.DOTDIR} ";
@ -193,10 +199,15 @@
ubc = "cd ${config.home.sessionVariables.UBCDIR} ";
ubcmail = "${web} https://webmail.student.ubc.ca";
web = "${pkgs.coreutils-full}/bin/nohup ${config.programs.firefox.package}/bin/firefox &> ${config.home.homeDirectory}/.firefox.log";
} // (if pkgs.stdenv.isLinux then {
}
// (
if pkgs.stdenv.isLinux
then {
nbs = "sudo nixos-rebuild build --flake ${config.home.sessionVariables.DOTDIR}#";
nrs = "sudo nixos-rebuild switch --flake ${config.home.sessionVariables.DOTDIR}#";
} else { });
}
else {}
);
};
home-manager.enable = true;

View file

@ -1,9 +1,10 @@
{ config, pkgs, ... }:
let
pcfg = config.programs.emacs.init.usePackage;
in
{
config,
pkgs,
...
}: let
pcfg = config.programs.emacs.init.usePackage;
in {
programs.emacs.enable = true;
services.emacs = pkgs.lib.mkIf pkgs.stdenv.isLinux {
@ -120,7 +121,7 @@ in
all-the-icons-dired = {
enable = true;
hook = [ "(dired-mode . all-the-icons-dired-mode)" ];
hook = ["(dired-mode . all-the-icons-dired-mode)"];
};
calibredb = {
@ -136,15 +137,15 @@ in
cdlatex = {
enable = true;
after = [ "latex" ];
hook = [ "(LaTeX-mode . turn-on-cdlatex)" ];
after = ["latex"];
hook = ["(LaTeX-mode . turn-on-cdlatex)"];
};
citeproc.enable = true;
company = {
enable = true;
defines = [ "comapny-text-icons-margin" ];
defines = ["comapny-text-icons-margin"];
init = ''
;; Align company-mode tooltips to the right hand side
(setq company-tooltip-align-annotations t)
@ -154,13 +155,12 @@ in
;; Display text icon of type in company popup
(setq company-format-margin-function #'company-text-icons-margin)
'';
hook =
[ "(sh-mode . company-mode)" "(emacs-lisp-mode . company-mode)" ];
hook = ["(sh-mode . company-mode)" "(emacs-lisp-mode . company-mode)"];
};
company-math = {
enable = true;
after = [ "company" ];
after = ["company"];
init = ''
; -*-emacs-lisp-*-
(add-to-list 'company-backends 'company-math-symbols-unicode)
@ -185,13 +185,13 @@ in
"C-S-o" = "counsel-rhythmbox";
};
bindLocal = {
minibuffer-local-map = { "C-r" = "counsel-minibuffer-history"; };
minibuffer-local-map = {"C-r" = "counsel-minibuffer-history";};
};
};
doom-modeline = {
enable = true;
hook = [ "(after-init . doom-modeline-mode)" ];
hook = ["(after-init . doom-modeline-mode)"];
config = ''
(setq doom-modeline-icon t)
'';
@ -201,11 +201,11 @@ in
edit-server = {
enable = true;
command = [ "edit-server-start" ];
command = ["edit-server-start"];
config = ''
(setq edit-server-new-frame nil)
'';
hook = [ "(after-init . edit-server-start)" ];
hook = ["(after-init . edit-server-start)"];
};
editorconfig = {
@ -227,7 +227,7 @@ in
flycheck = {
enable = true;
hook = [ "(after-init . global-flycheck-mode)" ];
hook = ["(after-init . global-flycheck-mode)"];
config = ''
(setq flycheck-disabled-checkers '(emacs-lisp-checkdoc))
'';
@ -237,7 +237,7 @@ in
format-all = {
enable = true;
command = [ "format-all-buffer" ];
command = ["format-all-buffer"];
config = ''
(setq-default format-all-formatters format-all-default-formatters)
'';
@ -265,19 +265,19 @@ in
ivy = {
enable = true;
command = [ "ivy-mode" ];
command = ["ivy-mode"];
init = ''
(setq ivy-use-virtual-buffers t)
(setq ivy-use-selectable-prompt t)
(setq enable-recursive-minibuffers t)
'';
bind = { "C-c C-r" = "ivy-resume"; };
hook = [ "(after-init . ivy-mode)" ];
bind = {"C-c C-r" = "ivy-resume";};
hook = ["(after-init . ivy-mode)"];
};
ivy-bibtex = {
enable = true;
after = [ "ivy" ];
after = ["ivy"];
init = ''
; -*-emacs-lisp-*-
;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which
@ -311,7 +311,7 @@ in
lsp-ivy = {
enable = true;
command = [ "lsp-ivy-workspace-symbol" ];
command = ["lsp-ivy-workspace-symbol"];
};
lsp-java = {
@ -325,13 +325,13 @@ in
(setq lsp-java-jdt-download-url
"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 = {
enable = true;
after = [ "format-all" ];
command = [ "lsp-format-buffer" ];
after = ["format-all"];
command = ["lsp-format-buffer"];
extraConfig = ''
:preface
(defun my/format-document ()
@ -347,7 +347,7 @@ in
(t
(format-all-buffer))))
'';
functions = [ "lsp-deferred" "lsp-feature" "lsp-register-client" ];
functions = ["lsp-deferred" "lsp-feature" "lsp-register-client"];
init = ''
(setq lsp-log-io nil)
(setq lsp-keymap-prefix "C-c l")
@ -367,17 +367,17 @@ in
"(javascript-mode . lsp)"
"(nix-mode . lsp)"
];
bind = { "C-c C-y" = "my/format-document"; };
bind = {"C-c C-y" = "my/format-document";};
};
lsp-treemacs = {
enable = true;
command = [ "lsp-treemacs-errors-lisp" ];
command = ["lsp-treemacs-errors-lisp"];
};
lsp-ui = {
enable = true;
command = [ "lsp-ui-mode" ];
command = ["lsp-ui-mode"];
};
magit = {
@ -475,16 +475,13 @@ in
'';
};
mu4e =
let
smtpConfig = name:
(
mu4e = let
smtpConfig = name: (
let
account = config.accounts.email.accounts.${name};
port = builtins.toString account.smtp.port;
host = account.smtp.host;
in
''
in ''
("${name}"
(mu4e-drafts-folder "/${name}/${account.folders.drafts}")
(mu4e-sent-folder "/${name}/${account.folders.sent}")
@ -503,13 +500,12 @@ in
);
smtpAccountStrings = pkgs.lib.forEach (builtins.attrNames config.accounts.email.accounts) (account: " ${(smtpConfig account)} ");
smtpAccounts = "'( ${pkgs.lib.concatStrings smtpAccountStrings} )";
in
{
in {
enable = true;
after = [ "async" ];
after = ["async"];
package = epkgs: pkgs.mu;
demand = true;
extraPackages = [ pkgs.gnutls pkgs.mu ];
extraPackages = [pkgs.gnutls pkgs.mu];
init = ''
;-*-emacs-lisp-*-
@ -563,7 +559,7 @@ in
"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 = {
@ -579,33 +575,33 @@ in
nix-update = {
enable = true;
command = [ "nix-update-fetch" ];
command = ["nix-update-fetch"];
bindLocal.nix-mode-map."C-c C-u" = "nix-update-fetch";
};
ob-calc = {
enable = true;
after = [ "org" ];
after = ["org"];
};
ob-dot = {
enable = true;
after = [ "org" ];
after = ["org"];
};
ob-emacs-lisp = {
enable = true;
after = [ "org" ];
after = ["org"];
};
ob-gnuplot = {
enable = true;
after = [ "org" ];
after = ["org"];
};
ob-matlab = {
enable = true;
after = [ "org" ];
after = ["org"];
init = ''
(setq org-babel-octave-shell-command "${pkgs.octave}/bin/octave -q")
'';
@ -613,7 +609,7 @@ in
ob-python = {
enable = true;
after = [ "org" ];
after = ["org"];
init = ''
; -*-emacs-lisp-*-
(setq org-babel-python-command "${pkgs.python310}/bin/python3.10")
@ -628,7 +624,7 @@ in
ob-shell = {
enable = true;
after = [ "org" ];
after = ["org"];
};
org = {
@ -772,11 +768,12 @@ in
org-auctex = {
enable = true;
package = epkgs: epkgs.trivialBuild {
package = epkgs:
epkgs.trivialBuild {
pname = "org-auctex";
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
packageRequires = [ epkgs.auctex ];
packageRequires = [epkgs.auctex];
src = pkgs.fetchFromGitHub {
owner = "karthink";
@ -785,25 +782,25 @@ in
sha256 = "sha256-cMAhwybnq5HA1wOaUqDPML3nnh5m1iwEETTPWqPbAvw=";
};
};
hook = [ "(org-mode . org-auctex-mode)" ];
hook = ["(org-mode . org-auctex-mode)"];
};
org-contrib.enable = true;
org-download = {
enable = true;
after = [ "org" ];
after = ["org"];
init = ''
(require 'org-download)
(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 = {
enable = true;
after = [ "org" ];
hook = [ "(org-mode . org-modern-mode)" ];
after = ["org"];
hook = ["(org-mode . org-modern-mode)"];
};
pdf-tools = {
@ -838,8 +835,8 @@ in
separedit = {
enable = true;
bind = { "C-c '" = "separedit"; };
hook = [ "(separedit-buffer-creation . normal-mode)" ];
bind = {"C-c '" = "separedit";};
hook = ["(separedit-buffer-creation . normal-mode)"];
init = ''
; -*-emacs-lisp-*-
(setq separedit-preserve-string-indentation t)
@ -853,7 +850,7 @@ in
swiper = {
enable = true;
bind = { "C-s" = "swiper"; };
bind = {"C-s" = "swiper";};
};
tree-sitter = {
@ -893,7 +890,7 @@ in
arduino-mode = {
enable = true;
hook = [ "(arduino-mode . flycheck-arduino-setup)" ];
hook = ["(arduino-mode . flycheck-arduino-setup)"];
init = ''
(require 'flycheck-arduino)
(setq arduino-executable "/Applications/Arduino.app/Contents/MacOS/Arduino")

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,14 +1,17 @@
# https://github.com/LnL7/nix-darwin/issues/277#issuecomment-992866471
{ config, lib, pkgs, inputs, ... }:
with lib;
let
{
config,
lib,
pkgs,
inputs,
...
}:
with lib; let
cfg = config.nix;
nixRegistry = builtins.mapAttrs (name: value: { flake = value; }) inputs;
etcNixInputs = pkgs.runCommandNoCC "etc-nix-inputs"
nixRegistry = builtins.mapAttrs (name: value: {flake = value;}) inputs;
etcNixInputs =
pkgs.runCommandNoCC "etc-nix-inputs"
{
inputNames = builtins.attrNames inputs;
inputPaths = builtins.map (x: x.outPath) (builtins.attrValues inputs);
@ -25,15 +28,13 @@ let
done
'';
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
#
# We're not using that directly because we don't need the rest of the flake, and to work around
# https://github.com/gytis-ivaskevicius/flake-utils-plus/issues/105 and
# https://github.com/gytis-ivaskevicius/flake-utils-plus/issues/107
{
{
options = {
nix.generateNixPathFromInputs = mkOption {
type = types.bool;
@ -62,22 +63,24 @@ in
};
config = {
assertions = [{
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; };
else {self.flake = inputs.self;};
environment.etc."nix/inputs" = mkIf cfg.linkInputs {
source = etcNixInputs;
};
nix.nixPath = mkIf cfg.generateNixPathFromInputs [ "/etc/nix/inputs" ];
nix.nixPath = mkIf cfg.generateNixPathFromInputs ["/etc/nix/inputs"];
};
}
}

View file

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

View file

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

View file

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

View file

@ -1,6 +1,9 @@
{ fetchurl, lib, mkMacBinPackage, stdenv }:
let
{
fetchurl,
lib,
mkMacBinPackage,
stdenv,
}: let
versions = {
aarch64-darwin = "1101351";
x86_64-darwin = "1101350";
@ -13,21 +16,19 @@ let
srcs = {
aarch64-darwin = fetchurl {
url =
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac_Arm/${version}/chrome-mac.zip";
url = "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac_Arm/${version}/chrome-mac.zip";
sha256 = "sha256-LlbYlJmFLzyHIiygofa0Btm7NAOvWXXhmbjMHldVoGo=";
name = "${pname}_aarch64_${version}.zip";
};
x86_64-darwin = fetchurl {
url =
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/${version}/chrome-mac.zip";
url = "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/${version}/chrome-mac.zip";
sha256 = "sha256-O+OnjakEpjCRbSjDysEA6RKKaKaSMw+LSO2ZLcxz2vM=";
name = "${pname}_x86_64_${version}.zip";
};
};
src = srcs.${stdenv.hostPlatform.system};
in
mkMacBinPackage {
mkMacBinPackage {
inherit src pname appName version;
srcsubdir = "chrome-mac";
meta = with lib; {
@ -43,4 +44,4 @@ mkMacBinPackage {
platforms = platforms.linux;
mainProgram = "chromium";
};
}
}

View file

@ -1,10 +1,9 @@
# taken from nix-darwin repo
# https://github.com/LnL7/nix-darwin/blob/87b9d090ad39b25b2400029c64825fc2a8868943/modules/examples/lnl.nix
{ runCommand }:
{runCommand}:
runCommand "darwin-zsh-completions-0.0.0"
{ preferLocalBuild = true; }
''
{preferLocalBuild = true;}
''
mkdir -p $out/share/zsh/site-functions
cat <<-'EOF' > $out/share/zsh/site-functions/_darwin-rebuild
#compdef darwin-rebuild
@ -29,4 +28,4 @@ runCommand "darwin-zsh-completions-0.0.0"
;;
esac
EOF
''
''

View file

@ -1,13 +1,13 @@
_final: prev: {
chromium-mac = prev.callPackage ./chromium-mac.nix { };
darwin-zsh-completions = prev.callPackage ./darwin-zsh-completions.nix { };
firefox-mac = prev.callPackage ./firefox-mac.nix { };
freecad-mac = prev.callPackage ./freecad-mac.nix { };
chromium-mac = prev.callPackage ./chromium-mac.nix {};
darwin-zsh-completions = prev.callPackage ./darwin-zsh-completions.nix {};
firefox-mac = prev.callPackage ./firefox-mac.nix {};
freecad-mac = prev.callPackage ./freecad-mac.nix {};
mkMacBinPackage = import ./mk-mac-binpkg.nix prev;
org-auctex = prev.callPackage ./org-auctex.nix { };
pinentry-mac = prev.callPackage ./pinentry-mac.nix { };
pinentry-touchid = prev.callPackage ./pinentry-touchid.nix { };
qbittorrent-mac = prev.callPackage ./qbittorrent-mac.nix { };
spotify-mac = prev.callPackage ./spotify-mac.nix { };
vlc-mac = prev.callPackage ./vlc-mac.nix { };
org-auctex = prev.callPackage ./org-auctex.nix {};
pinentry-mac = prev.callPackage ./pinentry-mac.nix {};
pinentry-touchid = prev.callPackage ./pinentry-touchid.nix {};
qbittorrent-mac = prev.callPackage ./qbittorrent-mac.nix {};
spotify-mac = prev.callPackage ./spotify-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";
pname = "firefox";
appName = "Firefox";
src = fetchurl {
url =
"https://download-installer.cdn.mozilla.net/pub/firefox/releases/${version}/mac/en-CA/Firefox%20${version}.dmg";
url = "https://download-installer.cdn.mozilla.net/pub/firefox/releases/${version}/mac/en-CA/Firefox%20${version}.dmg";
sha256 = "sha256-V/8W3qqYhJmte2tq/ZSPtYChdhv8WFQoSORYRaxva9Y=";
name = "${pname}_${version}.dmg";
};
in
mkMacBinPackage { inherit src pname appName version; }
mkMacBinPackage {inherit src pname appName version;}

View file

@ -1,22 +1,25 @@
{ fetchurl, lib, makeWrapper, stdenv }:
let
{
fetchurl,
lib,
makeWrapper,
stdenv,
}: let
version = "0.20.2";
date = "2022-12-27";
appName = "FreeCAD";
pname = "freecad";
src = fetchurl {
url =
"https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg";
url = "https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg";
sha256 = "sha256-OAi98HUacHcLHVYSadnQFPnEhutJvE4YfRBtPSZk00c=";
};
in
stdenv.mkDerivation {
stdenv.mkDerivation {
inherit version src;
name = pname;
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [makeWrapper];
dontUnpack = true;
@ -57,4 +60,4 @@ stdenv.mkDerivation {
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;
name = pname;
nativeBuildInputs = [ pkgs.undmg pkgs.unzip pkgs.makeWrapper ];
nativeBuildInputs = [pkgs.undmg pkgs.unzip pkgs.makeWrapper];
sourceRoot = ".";

View file

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

View file

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

View file

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

View file

@ -1,16 +1,18 @@
{ fetchurl, lib, mkMacBinPackage }:
let
{
fetchurl,
lib,
mkMacBinPackage,
}: let
version = "4.4.5";
appName = "qBittorrent";
pname = "qbittorrent";
src = fetchurl {
url =
"https://phoenixnap.dl.sourceforge.net/project/qbittorrent/qbittorrent-mac/qbittorrent-${version}/qbittorrent-${version}.dmg";
url = "https://phoenixnap.dl.sourceforge.net/project/qbittorrent/qbittorrent-mac/qbittorrent-${version}/qbittorrent-${version}.dmg";
sha256 = "sha256-9h+gFAEU0tKrltOjnOKLfylbbBunGZqvPzQogdP9uQM=";
};
in
mkMacBinPackage {
mkMacBinPackage {
inherit src pname appName version;
meta = with lib; {
description = "Featureful free software BitTorrent client";
@ -19,4 +21,4 @@ mkMacBinPackage {
license = licenses.gpl2Plus;
platforms = platforms.darwin;
};
}
}

View file

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

View file

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