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.
# 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
{
name = "homeConfigurations";
file = ./configurations.nix;
option = mkOption {
type = types.lazyAttrsOf types.unspecified;
default = { };
description = "Home Manager user configurations.";
};
}
mkTransposedPerSystemModule
{
name = "homeConfigurations";
file = ./configurations.nix;
option = mkOption {
type = types.lazyAttrsOf types.unspecified;
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.
# 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,26 +1,23 @@
# 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.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/home-manager/modules.nix
{ lib
, self
, inputs
, ...
{
lib,
self,
inputs,
...
}: {
flake.homeManagerModules =
let
modules = self.lib.importDirToAttrs ../../home-manager/modules;
in
flake.homeManagerModules = let
modules = self.lib.importDirToAttrs ../../home-manager/modules;
in
{
default = {
imports = builtins.attrValues modules;
};
nixpkgs-Config = {
nixpkgs.config.allowUnfreePredicate = (_: true);
nixpkgs.config.allowUnfreePredicate = _: true;
nixpkgs.config.allowUnsupportedSystem = true;
nixpkgs.overlays = builtins.attrValues self.overlays;
};

View file

@ -1,25 +1,33 @@
{ 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
[
self.homeManagerModules.nixpkgs-useFlakeNixpkgs
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}"))
];
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 [
self.homeManagerModules.nixpkgs-useFlakeNixpkgs
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
# 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.
# 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,30 +1,27 @@
# 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
modules = self.lib.importDirToAttrs ../../nixos/modules;
in
flake.nixosModules = let
modules = self.lib.importDirToAttrs ../../nixos/modules;
in
{
default = {
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,14 +1,17 @@
{ self, inputs, lib, ... }:
{
self,
inputs,
lib,
...
}: {
flake.overlays = {
apps = final: prev: (
let
appsDir = self.lib.importDirToAttrs ../apps;
in
lib.mapAttrs (name: value: value.definition self.lib prev) appsDir
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,72 +1,67 @@
# 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.
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/packages.nix
{ self
, lib
, ...
{
self,
lib,
...
}: {
perSystem =
{ config
, pkgs
, ...
}:
let
overlays = [
self.overlays.default
];
pkgs' = pkgs.extend (lib.composeManyExtensions overlays);
in
{
packages = {
inherit (pkgs')
chromium-mac
darwin-zsh-completions
firefox-mac
freecad-mac
org-auctex
pinentry-mac
pinentry-touchid
qbittorrent-mac
spotify-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);
};
perSystem = {
config,
pkgs,
...
}: let
overlays = [
self.overlays.default
];
pkgs' = pkgs.extend (lib.composeManyExtensions overlays);
in {
packages = {
inherit
(pkgs')
chromium-mac
darwin-zsh-completions
firefox-mac
freecad-mac
org-auctex
pinentry-mac
pinentry-touchid
qbittorrent-mac
spotify-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);
};
};
}

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;
@ -19,29 +21,35 @@ let
};
gmailAccount = address: ({
flavor = "gmail.com";
folders = {
drafts = "[Gmail].Drafts";
inbox = "INBOX";
sent = "[Gmail].Sent Mail";
trash = "[Gmail].Trash";
};
} // generalAccount address);
in
{
flavor = "gmail.com";
folders = {
drafts = "[Gmail].Drafts";
inbox = "INBOX";
sent = "[Gmail].Sent Mail";
trash = "[Gmail].Trash";
};
}
// generalAccount address);
in {
accounts.email.accounts = {
gmail = (gmailAccount "willemleitso@gmail.com") // { realName = "Willem Leitso"; };
icloud = (pkgs.lib.attrsets.recursiveUpdate
{
flavor = "plain";
imap.host = "imap.mail.me.com";
imap.port = 993;
smtp.host = "smtp.mail.me.com";
smtp.port = 587;
}
(generalAccount "coalminecraft@icloud.com")) // { folders.inbox = "INBOX"; };
leitso = (gmailAccount "willem@leit.so") // { primary = true; realName = "Willem Leitso"; };
gmail = (gmailAccount "willemleitso@gmail.com") // {realName = "Willem Leitso";};
icloud =
(pkgs.lib.attrsets.recursiveUpdate
{
flavor = "plain";
imap.host = "imap.mail.me.com";
imap.port = 993;
smtp.host = "smtp.mail.me.com";
smtp.port = 587;
}
(generalAccount "coalminecraft@icloud.com"))
// {folders.inbox = "INBOX";};
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,20 +28,20 @@ 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=";
};
};
programs.zsh.shellAliases = mkIf stdenv.isDarwin ({
drs = "darwin-rebuild switch --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)\"";
o = "open";
oa = "open -a";
pinentry = "pinentry-mac";
} // lib.attrsets.mapAttrs (name: value: "open -a '" + value + "'") appCommands);
drs = "darwin-rebuild switch --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)\"";
o = "open";
oa = "open -a";
pinentry = "pinentry-mac";
}
// 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,32 +62,36 @@ let
};
default-view-settings = {
ExtendedListViewSettingsV2 = {
columns = builtins.sort (a: b: a.index < b.index) (map
(name:
(name: value: {
identifier = "${name}";
visible = value.visible;
width = value.width;
index = value.index;
}) name
ExtendedListViewSettingsV2 =
{
columns = builtins.sort (a: b: a.index < b.index) (map
(name:
(name: value: {
identifier = "${name}";
visible = value.visible;
width = value.width;
index = value.index;
})
name
columnSettings.${name})
(builtins.attrNames columnSettings));
} // listviewsettings;
ListViewSettings = { columns = columnSettings; } // listviewsettings;
(builtins.attrNames columnSettings));
}
// listviewsettings;
ListViewSettings = {columns = columnSettings;} // listviewsettings;
};
dvs-with-ws = {
WindowState = {
ContainerShowSidebar = true;
ShowStatusBar = true;
ShowSidebar = true;
ShowToolbar = true;
ShowTabView = true;
};
} // default-view-settings;
in
{
dvs-with-ws =
{
WindowState = {
ContainerShowSidebar = true;
ShowStatusBar = true;
ShowSidebar = true;
ShowToolbar = true;
ShowTabView = true;
};
}
// 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 = {
SettingsType = "FK_StandardViewSettings";
} // default-view-settings;
FK_StandardViewSettings =
{
SettingsType = "FK_StandardViewSettings";
}
// 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 = {
SettingsType = "StandardViewSettings";
} // default-view-settings;
StandardViewSettings =
{
SettingsType = "StandardViewSettings";
}
// 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,43 +194,44 @@ let
"Red Component" = 0.231373;
};
};
profile_defaults = {
"ASCII Anti Aliased" = true;
"Ambiguous Double Width" = false;
"BM Growl" = true;
"Background Image Location" = "";
"Blinking Cursor" = false;
"Blur" = false;
"Character Encoding" = 4;
"Close Sessions On End" = true;
"Flashing Bell" = false;
"Horizontal Spacing" = 1;
"Idle Code" = 0;
"Jobs to Ignore" = [ "rlogin" "ssh" "slogin" "telnet" ];
"Mouse Reporting" = true;
"Non Ascii Font" = "Monaco 12";
"Non-ASCII Anti Aliased" = true;
"Normal Font" = "MesloLGS-NF-Regular 12";
"Option Key Sends" = 2;
"Prompt Before Closing 2" = false;
"Right Option Key Sends" = 0;
"Scrollback Lines" = 0;
"Send Code When Idle" = false;
"Silence Bell" = false;
"Sync Title" = false;
"Terminal Type" = "xterm-256color";
"Transparency" = 0;
"Unlimited Scrollback" = true;
"Use Bold Font" = true;
"Use Bright Bold" = true;
"Use Italic Font" = true;
"Use Non-ASCII Font" = false;
"Vertical Spacing" = 1;
"Visual Bell" = true;
"Window Type" = 0;
} // dracula_plus;
in
{
profile_defaults =
{
"ASCII Anti Aliased" = true;
"Ambiguous Double Width" = false;
"BM Growl" = true;
"Background Image Location" = "";
"Blinking Cursor" = false;
"Blur" = false;
"Character Encoding" = 4;
"Close Sessions On End" = true;
"Flashing Bell" = false;
"Horizontal Spacing" = 1;
"Idle Code" = 0;
"Jobs to Ignore" = ["rlogin" "ssh" "slogin" "telnet"];
"Mouse Reporting" = true;
"Non Ascii Font" = "Monaco 12";
"Non-ASCII Anti Aliased" = true;
"Normal Font" = "MesloLGS-NF-Regular 12";
"Option Key Sends" = 2;
"Prompt Before Closing 2" = false;
"Right Option Key Sends" = 0;
"Scrollback Lines" = 0;
"Send Code When Idle" = false;
"Silence Bell" = false;
"Sync Title" = false;
"Terminal Type" = "xterm-256color";
"Transparency" = 0;
"Unlimited Scrollback" = true;
"Use Bold Font" = true;
"Use Bright Bold" = true;
"Use Italic Font" = true;
"Use Non-ASCII Font" = false;
"Vertical Spacing" = 1;
"Visual Bell" = true;
"Window Type" = 0;
}
// dracula_plus;
in {
targets.darwin.defaults."com.googlecode.iterm2" = lib.mkIf pkgs.stdenv.isDarwin {
"AlternateMouseScroll" = true;
"Default Bookmark Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106";
@ -242,48 +245,50 @@ in
"VisualIndicatorForEsc" = false;
"New Bookmarks" = [
({
"Columns" = 120;
"Command" = "";
"Custom Command" = "No";
"Custom Directory" = "No";
"Default Bookmark" = "Yes";
"Description" = "Default";
"Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106";
"Name" = "Primary";
"Rows" = 30;
"Screen" = -1;
"Tags" = [ ];
"Working Directory" = "/Users/willem";
} // profile_defaults)
"Columns" = 120;
"Command" = "";
"Custom Command" = "No";
"Custom Directory" = "No";
"Default Bookmark" = "Yes";
"Description" = "Default";
"Guid" = "30FFD0AB-B2EB-4635-9469-D089C1D9E106";
"Name" = "Primary";
"Rows" = 30;
"Screen" = -1;
"Tags" = [];
"Working Directory" = "/Users/willem";
}
// profile_defaults)
({
"Columns" = 120;
"Command" = "";
"Custom Command" = "No";
"Custom Directory" = "No";
"Default Bookmark" = "No";
"Description" = "Default";
"Disable Window Resizing" = true;
"Guid" = "00A17AC2-1885-4AE2-B941-A47A5D8C36B4";
"Has Hotkey" = true;
"HotKey Activated By Modifier" = false;
"HotKey Alternate Shortcuts" = { };
"HotKey Characters Ignoring Modifiers" = " ";
"HotKey Characters" = " ";
"HotKey Key Code" = 49;
"HotKey Modifier Activation" = 3;
"HotKey Modifier Flags" = 1048576;
"HotKey Window Animates" = false;
"HotKey Window AutoHides" = true;
"HotKey Window Dock Click Action" = 0;
"HotKey Window Floats" = true;
"HotKey Window Reopens On Activation" = false;
"Name" = "Hotkey Window";
"Rows" = 25;
"Screen" = -1;
"Space" = -1;
"Tags" = [ ];
"Working Directory" = "/Users/willem";
} // profile_defaults)
"Columns" = 120;
"Command" = "";
"Custom Command" = "No";
"Custom Directory" = "No";
"Default Bookmark" = "No";
"Description" = "Default";
"Disable Window Resizing" = true;
"Guid" = "00A17AC2-1885-4AE2-B941-A47A5D8C36B4";
"Has Hotkey" = true;
"HotKey Activated By Modifier" = false;
"HotKey Alternate Shortcuts" = {};
"HotKey Characters Ignoring Modifiers" = " ";
"HotKey Characters" = " ";
"HotKey Key Code" = 49;
"HotKey Modifier Activation" = 3;
"HotKey Modifier Flags" = 1048576;
"HotKey Window Animates" = false;
"HotKey Window AutoHides" = true;
"HotKey Window Dock Click Action" = 0;
"HotKey Window Floats" = true;
"HotKey Window Reopens On Activation" = false;
"Name" = "Hotkey Window";
"Rows" = 25;
"Screen" = -1;
"Space" = -1;
"Tags" = [];
"Working Directory" = "/Users/willem";
}
// 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,28 +1,33 @@
{ 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; [
keyring
latexify-py
pyaml
requests
setuptools
]);
linux = with pkgs; [];
python-wp = pkgs.python310.withPackages (p:
with p; [
keyring
latexify-py
pyaml
requests
setuptools
]);
node-packages = with pkgs.nodePackages; [
bash-language-server
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,26 +182,32 @@
RPROMPT = "%B%F{red}%*%f%b";
};
shellAliases = rec {
cd = "z";
discord = "${web} https://discord.com/channels/@me";
dotd = "cd ${config.home.sessionVariables.DOTDIR} ";
e = "emacsclient -c -nw";
em = "emacs -nw";
email = "${ew} -n --eval '(mu4e)'";
emw = "emacs";
ew = "emacsclient -c";
l = "ls -1";
np = "nix-shell -p";
org = "cd ${config.home.sessionVariables.ORGDIR} ";
spotify = "${web} https://open.spotify.com/";
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 {
nbs = "sudo nixos-rebuild build --flake ${config.home.sessionVariables.DOTDIR}#";
nrs = "sudo nixos-rebuild switch --flake ${config.home.sessionVariables.DOTDIR}#";
} else { });
shellAliases =
rec {
cd = "z";
discord = "${web} https://discord.com/channels/@me";
dotd = "cd ${config.home.sessionVariables.DOTDIR} ";
e = "emacsclient -c -nw";
em = "emacs -nw";
email = "${ew} -n --eval '(mu4e)'";
emw = "emacs";
ew = "emacsclient -c";
l = "ls -1";
np = "nix-shell -p";
org = "cd ${config.home.sessionVariables.ORGDIR} ";
spotify = "${web} https://open.spotify.com/";
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 {
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;

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 ()
@ -344,21 +344,21 @@ in
((lsp-feature? "textDocument/rangeFormatting")
(lsp-format-buffer))
(t (format-all-buffer))))
(t
(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")
'';
config = ''
(lsp-treemacs-sync-mode 1)
(add-to-list 'lsp-language-id-configuration '(nix-mode . "nix"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("rnix-lsp"))
:major-modes '(nix-mode)
:server-id 'nix))
(lsp-treemacs-sync-mode 1)
(add-to-list 'lsp-language-id-configuration '(nix-mode . "nix"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("rnix-lsp"))
:major-modes '(nix-mode)
:server-id 'nix))
'';
hook = [
"(lsp-mode . company-mode)"
@ -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,97 +475,93 @@ in
'';
};
mu4e =
let
smtpConfig = name:
(
let
account = config.accounts.email.accounts.${name};
port = builtins.toString account.smtp.port;
host = account.smtp.host;
in
''
("${name}"
(mu4e-drafts-folder "/${name}/${account.folders.drafts}")
(mu4e-sent-folder "/${name}/${account.folders.sent}")
(mu4e-trash-folder "/${name}/${account.folders.trash}")
; (mu4e-maildir-shortcuts
; '( (:maildir "/${name}/${account.folders.inbox}" :key ?i)
; (:maildir "/${name}/${account.folders.sent}" :key ?s)
; (:maildir "/${name}/${account.folders.drafts}" :key ?d)
; (:maildir "/${name}/${account.folders.trash}" :key ?t)))
(smtpmail-default-smtp-server "${host}")
(smtpmail-smtp-server "${host}")
(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
{
enable = true;
after = [ "async" ];
package = epkgs: pkgs.mu;
demand = true;
extraPackages = [ pkgs.gnutls pkgs.mu ];
init = ''
;-*-emacs-lisp-*-
mu4e = let
smtpConfig = name: (
let
account = config.accounts.email.accounts.${name};
port = builtins.toString account.smtp.port;
host = account.smtp.host;
in ''
("${name}"
(mu4e-drafts-folder "/${name}/${account.folders.drafts}")
(mu4e-sent-folder "/${name}/${account.folders.sent}")
(mu4e-trash-folder "/${name}/${account.folders.trash}")
; (mu4e-maildir-shortcuts
; '( (:maildir "/${name}/${account.folders.inbox}" :key ?i)
; (:maildir "/${name}/${account.folders.sent}" :key ?s)
; (:maildir "/${name}/${account.folders.drafts}" :key ?d)
; (:maildir "/${name}/${account.folders.trash}" :key ?t)))
(smtpmail-default-smtp-server "${host}")
(smtpmail-smtp-server "${host}")
(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 {
enable = true;
after = ["async"];
package = epkgs: pkgs.mu;
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
message-kill-buffer-on-exit t
mail-user-agent 'mu4e-user-agent)
(setq starttls-use-gnutls t
message-kill-buffer-on-exit t
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)
(set (car var) (cadr var)))
(cdr (assoc "leitso" my-mu4e-account-alist)))
(mapc #'(lambda (var)
(set (car var) (cadr var)))
(cdr (assoc "leitso" my-mu4e-account-alist)))
(defun my-mu4e-set-account ()
"Set the account for composing a message."
(let* ((account
(if mu4e-compose-parent-message
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
(string-match "/\\(.*?\\)/" maildir)
(match-string 1 maildir))
(completing-read (format "Compose with account: (%s) "
(mapconcat #'(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))))
(account-vars (cdr (assoc account my-mu4e-account-alist))))
(if account-vars
(mapc #'(lambda (var)
(set (car var) (cadr var)))
account-vars)
(error "No email account found"))))
(defun my-mu4e-set-account ()
"Set the account for composing a message."
(let* ((account
(if mu4e-compose-parent-message
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
(string-match "/\\(.*?\\)/" maildir)
(match-string 1 maildir))
(completing-read (format "Compose with account: (%s) "
(mapconcat #'(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))))
(account-vars (cdr (assoc account my-mu4e-account-alist))))
(if account-vars
(mapc #'(lambda (var)
(set (car var) (cadr var)))
account-vars)
(error "No email account found"))))
(setq mu4e-bookmarks
'((: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 "Last 7 days" :query "date:7d..now AND NOT maildir:/feeds" :key ?w)
(:name "Feed" :query "maildir:/feeds" :key ?f)
(:name "XKCD" :query "list:xkcd.localhost" :key ?x)))
(setq mu4e-bookmarks
'((: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 "Last 7 days" :query "date:7d..now AND NOT maildir:/feeds" :key ?w)
(:name "Feed" :query "maildir:/feeds" :key ?f)
(: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 = {
"C-c C-u" = "my-mu4e-set-account";
};
hook = [ "(mu4e-compose-pre-hook . my-mu4e-set-account)" ];
bind = {
"C-c C-u" = "my-mu4e-set-account";
};
hook = ["(mu4e-compose-pre-hook . my-mu4e-set-account)"];
};
nix-mode = {
enable = true;
extraConfig = ''
@ -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,38 +768,39 @@ in
org-auctex = {
enable = true;
package = epkgs: epkgs.trivialBuild {
pname = "org-auctex";
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
package = epkgs:
epkgs.trivialBuild {
pname = "org-auctex";
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
packageRequires = [ epkgs.auctex ];
packageRequires = [epkgs.auctex];
src = pkgs.fetchFromGitHub {
owner = "karthink";
repo = "org-auctex";
rev = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
sha256 = "sha256-cMAhwybnq5HA1wOaUqDPML3nnh5m1iwEETTPWqPbAvw=";
src = pkgs.fetchFromGitHub {
owner = "karthink";
repo = "org-auctex";
rev = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
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 = [{
template = "https://search.nixos.org/packages";
params = [
{ name = "type"; value = "packages"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
urls = [
{
template = "https://search.nixos.org/packages";
params = [
{
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}"'';
mkBindHelper = cmd: prefix: bs:
optionals (bs != { }) ([ ":${cmd} (${prefix}" ]
++ mapAttrsToList (n: v: " (${quoted n} . ${v})") bs ++ [ ")" ]);
assembly = let
quoted = v: ''"${escape [''"''] v}"'';
mkBindHelper = cmd: prefix: bs:
optionals (bs != {}) ([":${cmd} (${prefix}"]
++ mapAttrsToList (n: v: " (${quoted n} . ${v})") bs
++ [")"]);
mkAfter = vs: optional (vs != [ ]) ":after (${toString vs})";
mkCommand = vs: optional (vs != [ ]) ":commands (${toString vs})";
mkDefines = vs: optional (vs != [ ]) ":defines (${toString vs})";
mkDiminish = vs: optional (vs != [ ]) ":diminish (${toString vs})";
mkMode = map (v: ":mode ${v}");
mkFunctions = vs: optional (vs != [ ]) ":functions (${toString vs})";
mkBind = mkBindHelper "bind" "";
mkBindLocal = bs:
let mkMap = n: v: mkBindHelper "bind" ":map ${n}" v;
in flatten (mapAttrsToList mkMap bs);
mkBindKeyMap = mkBindHelper "bind-keymap" "";
mkChords = mkBindHelper "chords" "";
mkHook = map (v: ":hook ${v}");
mkDefer = v:
if isBool v then
optional v ":defer t"
else
[ ":defer ${toString v}" ];
mkDemand = v: optional v ":demand t";
mkAfter = vs: optional (vs != []) ":after (${toString vs})";
mkCommand = vs: optional (vs != []) ":commands (${toString vs})";
mkDefines = vs: optional (vs != []) ":defines (${toString vs})";
mkDiminish = vs: optional (vs != []) ":diminish (${toString vs})";
mkMode = map (v: ":mode ${v}");
mkFunctions = vs: optional (vs != []) ":functions (${toString vs})";
mkBind = mkBindHelper "bind" "";
mkBindLocal = bs: let
mkMap = n: v: mkBindHelper "bind" ":map ${n}" v;
in
flatten (mapAttrsToList mkMap bs);
mkBindKeyMap = mkBindHelper "bind-keymap" "";
mkChords = mkBindHelper "chords" "";
mkHook = map (v: ":hook ${v}");
mkDefer = v:
if isBool v
then optional v ":defer t"
else [":defer ${toString v}"];
mkDemand = v: optional v ":demand t";
in
concatStringsSep "\n "
([ "(use-package ${name}" ]
++ mkAfter config.after ++ mkBind config.bind
++ mkBindKeyMap config.bindKeyMap ++ mkBindLocal config.bindLocal
++ mkChords config.chords ++ mkCommand config.command
++ mkDefer config.defer ++ mkDefines config.defines
++ mkFunctions config.functions ++ mkDemand config.demand
++ mkDiminish config.diminish ++ mkHook config.hook
(["(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,12 +279,14 @@ let
type = types.bool;
default = false;
example = true;
description = ''
Whether to enable recommended ${type} settings.
'' + optionalString (extraDescription != "") ''
</para><para>
${extraDescription}
'';
description =
''
Whether to enable recommended ${type} settings.
''
+ optionalString (extraDescription != "") ''
</para><para>
${extraDescription}
'';
};
# Recommended GC settings.
@ -315,37 +325,44 @@ 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 = ''
(eval-when-compile
(require 'use-package)
;; To help fixing issues during startup.
(setq use-package-verbose ${
if cfg.usePackageVerbose then "t" else "nil"
usePackageSetup =
''
(eval-when-compile
(require 'use-package)
;; To help fixing issues during startup.
(setq use-package-verbose ${
if cfg.usePackageVerbose
then "t"
else "nil"
}))
'' + optionalString hasDiminish ''
;; For :diminish in (use-package).
(require 'diminish)
'' + optionalString hasBind ''
;; For :bind in (use-package).
(require 'bind-key)
''
+ optionalString hasDiminish ''
;; For :diminish in (use-package).
(require 'diminish)
''
+ 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 ''
;; For :chords in (use-package).
(use-package use-package-chords
:config (key-chord-mode 1))
'';
;; Fixes "Symbols function definition is void: use-package-autoload-keymap".
(autoload #'use-package-autoload-keymap "use-package-bind-key")
''
+ optionalString hasChords ''
;; For :chords in (use-package).
(use-package use-package-chords
:config (key-chord-mode 1))
'';
earlyInitFile = ''
;;; hm-early-init.el --- Emacs configuration à la Home Manager -*- lexical-binding: t; -*-
@ -362,39 +379,40 @@ let
;; hm-early-init.el ends here
'';
initFile = ''
;;; hm-init.el --- Emacs configuration à la Home Manager -*- lexical-binding: t; -*-
;;
;;; Commentary:
;;
;; A configuration generated from a Nix based configuration by
;; Home Manager.
;;
;;; Code:
initFile =
''
;;; hm-init.el --- Emacs configuration à la Home Manager -*- lexical-binding: t; -*-
;;
;;; Commentary:
;;
;; A configuration generated from a Nix based configuration by
;; Home Manager.
;;
;;; Code:
${optionalString cfg.startupTimer ''
(defun hm/print-startup-stats ()
"Prints some basic startup statistics."
(let ((elapsed (float-time (time-subtract after-init-time
before-init-time))))
(message "Startup took %.2fs with %d GCs" elapsed gcs-done)))
(add-hook 'emacs-startup-hook #'hm/print-startup-stats)
''}
${optionalString cfg.startupTimer ''
(defun hm/print-startup-stats ()
"Prints some basic startup statistics."
(let ((elapsed (float-time (time-subtract after-init-time
before-init-time))))
(message "Startup took %.2fs with %d GCs" elapsed gcs-done)))
(add-hook 'emacs-startup-hook #'hm/print-startup-stats)
''}
${cfg.prelude}
${cfg.prelude}
${usePackageSetup}
'' + concatStringsSep "\n\n" (map (getAttr "assembly")
(filter (getAttr "enable") (attrValues cfg.usePackage))) + ''
${usePackageSetup}
''
+ 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,83 +488,86 @@ 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}
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)
'';
;; Avoid expensive frame resizing. Inspired by Doom Emacs.
(setq frame-inhibit-implied-resize t)
'';
# Collect the early initialization strings for each package.
packageEarlyInits = map (p: p.earlyInit)
(filter (p: p.earlyInit != "") (builtins.attrValues cfg.usePackage));
# Collect the early initialization strings for each package.
packageEarlyInits =
map (p: p.earlyInit)
(filter (p: p.earlyInit != "") (builtins.attrValues cfg.usePackage));
in
mkMerge ([standardEarlyInit] ++ packageEarlyInits);
in
mkMerge ([ standardEarlyInit ] ++ packageEarlyInits);
programs.emacs.extraPackages = epkgs: let
getPkg = v:
if isFunction v
then [(v epkgs)]
else optional (isString v && hasAttr v epkgs) epkgs.${v};
programs.emacs.extraPackages = epkgs:
let
getPkg = v:
if isFunction v then
[ (v epkgs) ]
else
optional (isString v && hasAttr v epkgs) epkgs.${v};
packages =
concatMap (v: getPkg (v.package))
(filter (getAttr "enable") (builtins.attrValues cfg.usePackage));
in [
(epkgs.trivialBuild {
pname = "hm-early-init";
src = pkgs.writeText "hm-early-init.el" earlyInitFile;
packageRequires = packages;
preferLocalBuild = true;
allowSubstitutes = false;
})
packages = concatMap (v: getPkg (v.package))
(filter (getAttr "enable") (builtins.attrValues cfg.usePackage));
in
[
(epkgs.trivialBuild {
pname = "hm-early-init";
src = pkgs.writeText "hm-early-init.el" earlyInitFile;
packageRequires = packages;
preferLocalBuild = true;
allowSubstitutes = false;
})
(epkgs.trivialBuild {
pname = "hm-init";
src = pkgs.writeText "hm-init.el" initFile;
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 \
--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 {
pname = "hm-init";
src = pkgs.writeText "hm-init.el" initFile;
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.
${optionalString cfg.packageQuickstart ''
# Generate a package quickstart file to make autoloads and such
# available.
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")'
--eval "(require 'package)" \
--eval "(setq package-quickstart-file \"hm-package-quickstart.el\")" \
--eval "(package-quickstart-refresh)"
${optionalString cfg.packageQuickstart ''
# Generate a package quickstart file to make autoloads and such
# 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
''}
'';
})
];
# We know what we're doing?
sed -i '/no-byte-compile: t/d' hm-package-quickstart.el
''}
'';
})
];
home.file = {
".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 {
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 = [{
HIDKeyboardModifierMappingSrc = 30064771303; # remap right command to right control.
HIDKeyboardModifierMappingDst = 30064771300;
}];
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,83 +1,86 @@
# 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);
} ''
mkdir -p $out
inputNames=($inputNames)
inputPaths=($inputPaths)
for (( i=0; i<''${#inputNames[@]}; i++)); do
source=''${inputPaths[$i]}
name=''${inputNames[$i]}
if [[ -f $source/default.nix ]]; then
ln -s $source $out/$name
fi
done
'';
mkdir -p $out
inputNames=($inputNames)
inputPaths=($inputPaths)
for (( i=0; i<''${#inputNames[@]}; i++)); do
source=''${inputPaths[$i]}
name=''${inputNames[$i]}
if [[ -f $source/default.nix ]]; then
ln -s $source $out/$name
fi
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;
description = ''
If set, NIX_PATH will be generated from available inputs.
This requires `nix.linkInputs` to be enabled, and setting this will default
`nix.linkInputs` to true.
'';
default = false;
example = true;
};
nix.generateRegistryFromInputs = mkOption {
type = types.bool;
description = ''
If set, the system Nix registry will be generated from available inputs.
Otherwise, the registry will still include the `self` flake.
'';
default = false;
example = true;
};
nix.linkInputs = mkOption {
type = types.bool;
description = "If set, inputs will be symlinked into /etc/nix/inputs.";
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;
{
options = {
nix.generateNixPathFromInputs = mkOption {
type = types.bool;
description = ''
If set, NIX_PATH will be generated from available inputs.
This requires `nix.linkInputs` to be enabled, and setting this will default
`nix.linkInputs` to true.
'';
default = false;
example = true;
};
nix.generateRegistryFromInputs = mkOption {
type = types.bool;
description = ''
If set, the system Nix registry will be generated from available inputs.
Otherwise, the registry will still include the `self` flake.
'';
default = false;
example = true;
};
nix.linkInputs = mkOption {
type = types.bool;
description = "If set, inputs will be symlinked into /etc/nix/inputs.";
example = true;
};
};
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; [
freecad
qbittorrent

View file

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

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,34 +16,32 @@ 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 {
inherit src pname appName version;
srcsubdir = "chrome-mac";
meta = with lib; {
description = "An open source web browser from Google.";
longDescription = ''
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
the web. It has a minimalist user interface and provides the vast majority
of source code for Google Chrome (which has some additional features).
'';
homepage = "https://www.chromium.org/";
license = licenses.bsd3;
platforms = platforms.linux;
mainProgram = "chromium";
};
}
mkMacBinPackage {
inherit src pname appName version;
srcsubdir = "chrome-mac";
meta = with lib; {
description = "An open source web browser from Google.";
longDescription = ''
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
the web. It has a minimalist user interface and provides the vast majority
of source code for Google Chrome (which has some additional features).
'';
homepage = "https://www.chromium.org/";
license = licenses.bsd3;
platforms = platforms.linux;
mainProgram = "chromium";
};
}

View file

@ -1,32 +1,31 @@
# 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; }
''
mkdir -p $out/share/zsh/site-functions
cat <<-'EOF' > $out/share/zsh/site-functions/_darwin-rebuild
#compdef darwin-rebuild
#autoload
_nix-common-options
local -a _1st_arguments
_1st_arguments=(
'switch:Build, activate, and update the current generation'\
'build:Build without activating or updating the current generation'\
'check:Build and run the activation sanity checks'\
'changelog:Show most recent entries in the changelog'\
)
_arguments \
'--list-generations[Print a list of all generations in the active profile]'\
'--rollback[Roll back to the previous configuration]'\
{--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'\
'1:: :->subcmds' && return 0
case $state in
subcmds)
_describe -t commands 'darwin-rebuild subcommands' _1st_arguments
;;
esac
EOF
''
{preferLocalBuild = true;}
''
mkdir -p $out/share/zsh/site-functions
cat <<-'EOF' > $out/share/zsh/site-functions/_darwin-rebuild
#compdef darwin-rebuild
#autoload
_nix-common-options
local -a _1st_arguments
_1st_arguments=(
'switch:Build, activate, and update the current generation'\
'build:Build without activating or updating the current generation'\
'check:Build and run the activation sanity checks'\
'changelog:Show most recent entries in the changelog'\
)
_arguments \
'--list-generations[Print a list of all generations in the active profile]'\
'--rollback[Roll back to the previous configuration]'\
{--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'\
'1:: :->subcmds' && return 0
case $state in
subcmds)
_describe -t commands 'darwin-rebuild subcommands' _1st_arguments
;;
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,60 +1,63 @@
{ 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 {
inherit version src;
stdenv.mkDerivation {
inherit version src;
name = pname;
name = pname;
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [makeWrapper];
dontUnpack = true;
dontUnpack = true;
installPhase = ''
export tempdir=$(mktemp -d -p /tmp)
installPhase = ''
export tempdir=$(mktemp -d -p /tmp)
cp $src freecad.dmg
/usr/bin/hdiutil attach -mountpoint "$tempdir" freecad.dmg
cp $src 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
makeWrapper "$out/Applications/${appName}.app/Contents/MacOS/${appName}" "$out/bin/${pname}"
mkdir -p $out/bin
makeWrapper "$out/Applications/${appName}.app/Contents/MacOS/${appName}" "$out/bin/${pname}"
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.
runHook postInstall
'';
license = licenses.lgpl2Plus;
platforms = platforms.darwin;
};
}
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;
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,22 +1,24 @@
{ 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 {
inherit src pname appName version;
meta = with lib; {
description = "Featureful free software BitTorrent client";
homepage = "https://www.qbittorrent.org/";
changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog";
license = licenses.gpl2Plus;
platforms = platforms.darwin;
};
}
mkMacBinPackage {
inherit src pname appName version;
meta = with lib; {
description = "Featureful free software BitTorrent client";
homepage = "https://www.qbittorrent.org/";
changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog";
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 {
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 ];
license = licenses.unfree;
platforms = platforms.darwin;
};
}
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];
license = licenses.unfree;
platforms = platforms.darwin;
};
}

View file

@ -1,32 +1,32 @@
{ 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 {
inherit src pname appName version;
meta = with lib; {
description = "Cross-platform media player and streaming server";
homepage = "http://www.videolan.org/vlc/";
license = licenses.lgpl21Plus;
platforms = platforms.darwin;
};
}
mkMacBinPackage {
inherit src pname appName version;
meta = with lib; {
description = "Cross-platform media player and streaming server";
homepage = "http://www.videolan.org/vlc/";
license = licenses.lgpl21Plus;
platforms = platforms.darwin;
};
}