format with alejandra

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,22 +1,25 @@
{ fetchurl, lib, makeWrapper, stdenv }: {
let fetchurl,
lib,
makeWrapper,
stdenv,
}: let
version = "0.20.2"; version = "0.20.2";
date = "2022-12-27"; date = "2022-12-27";
appName = "FreeCAD"; appName = "FreeCAD";
pname = "freecad"; pname = "freecad";
src = fetchurl { src = fetchurl {
url = url = "https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg";
"https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg";
sha256 = "sha256-OAi98HUacHcLHVYSadnQFPnEhutJvE4YfRBtPSZk00c="; sha256 = "sha256-OAi98HUacHcLHVYSadnQFPnEhutJvE4YfRBtPSZk00c=";
}; };
in in
stdenv.mkDerivation { stdenv.mkDerivation {
inherit version src; inherit version src;
name = pname; name = pname;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [makeWrapper];
dontUnpack = true; dontUnpack = true;
@ -57,4 +60,4 @@ stdenv.mkDerivation {
license = licenses.lgpl2Plus; license = licenses.lgpl2Plus;
platforms = platforms.darwin; platforms = platforms.darwin;
}; };
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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