refactor: Move user config into modules/
This commit is contained in:
@@ -1,24 +1,22 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.sydnix.sops;
|
||||
in {
|
||||
options = {
|
||||
sydnix.sops = {
|
||||
enable = mkEnableOption "Sops";
|
||||
keyFile = mkOption {
|
||||
enable = lib.mkEnableOption "Sops";
|
||||
keyFile = lib.mkOption {
|
||||
description = "Path to an Age key file.";
|
||||
type = types.path;
|
||||
type = lib.types.path;
|
||||
default = config.home.homeDirectory + "/key.txt";
|
||||
};
|
||||
secrets = mkOption {
|
||||
secrets = lib.mkOption {
|
||||
description = "Secrets passed directly to sops-nix.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [
|
||||
pkgs.sops
|
||||
];
|
||||
|
||||
19
modules/home/users.nix
Normal file
19
modules/home/users.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
# TODO: Move to a fucking utility library already!
|
||||
listNixFilesInDirectory = dir:
|
||||
builtins.attrNames
|
||||
(lib.filterAttrs
|
||||
(k: _v: lib.hasSuffix ".nix" k)
|
||||
(builtins.readDir dir));
|
||||
in {
|
||||
imports =
|
||||
(builtins.concatMap
|
||||
(user:
|
||||
builtins.map
|
||||
(module:
|
||||
./users/${user}/${module})
|
||||
(listNixFilesInDirectory ./users/${user}))
|
||||
(builtins.attrNames (builtins.readDir ./users)));
|
||||
}
|
||||
25
modules/home/users/crumb/age.nix
Normal file
25
modules/home/users/crumb/age.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
mutableSymlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
cfg = config.sydnix.users.crumb.age;
|
||||
in
|
||||
{
|
||||
options.sydnix.users.crumb.age.enable = lib.mkEnableOption "Age, à la crumb";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [
|
||||
# Rage supports pinentry while Age does not.
|
||||
pkgs.rage
|
||||
];
|
||||
|
||||
# We use a mutable symlink to avoid placing the key inside the
|
||||
# world-readable store.
|
||||
home.file."private-keys/age/${config.home.username}.age".source =
|
||||
mutableSymlink "/persist/private-keys/age/${config.home.username}.age";
|
||||
|
||||
home.file."public-keys/age/${config.home.username}.pub".source =
|
||||
../../../../public-keys/age/${config.home.username}.pub;
|
||||
};
|
||||
}
|
||||
|
||||
13
modules/home/users/crumb/bash.nix
Executable file
13
modules/home/users/crumb/bash.nix
Executable file
@@ -0,0 +1,13 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.users.crumb.bash;
|
||||
in {
|
||||
options.sydnix.users.crumb.bash.enable = lib.mkEnableOption "Bash, à la crumb";
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
15
modules/home/users/crumb/direnv.nix
Normal file
15
modules/home/users/crumb/direnv.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.users.crumb.direnv;
|
||||
in {
|
||||
options.sydnix.users.crumb.direnv.enable =
|
||||
lib.mkEnableOption "direnv, à la crumb";
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
132
modules/home/users/crumb/emacs.nix
Executable file
132
modules/home/users/crumb/emacs.nix
Executable file
@@ -0,0 +1,132 @@
|
||||
{ config, lib, pkgs, inputs, ... }@args:
|
||||
|
||||
let cfg = config.sydnix.users.crumb.emacs;
|
||||
in {
|
||||
options.sydnix.users.crumb.emacs.enable =
|
||||
lib.mkEnableOption ''Emacs, à la crumb'';
|
||||
config = lib.mkIf cfg.enable
|
||||
(let
|
||||
emacsBasePackage = pkgs'.emacs-unstable-pgtk;
|
||||
# Hard-coded path. }:\
|
||||
emacsConfigDir =
|
||||
"/persist/dots/modules/home/users/${config.home.username}/emacs";
|
||||
|
||||
# Create a new instance of nixpkgs with emacs-overlay applied. This is a
|
||||
# little unorthodox, but we do it
|
||||
# 1. for the sake of organisation — For pure aesthetics and a clean
|
||||
# codebase, I want everything Emacs to stay in this file;
|
||||
# 2. and, there's simply no need to leak emacs-overlay's packages into the
|
||||
# global nixpkgs instance when nothing else is using it!
|
||||
pkgs' = import inputs.nixpkgs {
|
||||
system = args.system;
|
||||
overlays = [ inputs.emacs-overlay.overlays.emacs ];
|
||||
};
|
||||
|
||||
emacsDataDir = "${config.xdg.dataHome}/emacs";
|
||||
emacsCacheDir = "${emacsDataDir}/cache";
|
||||
straightBaseDir = "${emacsDataDir}/straight";
|
||||
|
||||
fontPackages = [
|
||||
pkgs.julia-mono
|
||||
pkgs.nerd-fonts.victor-mono
|
||||
pkgs.ibm-plex
|
||||
];
|
||||
|
||||
my-aspell = pkgs.aspellWithDicts
|
||||
(dicts: with dicts; [
|
||||
en en-computers en-science
|
||||
]);
|
||||
|
||||
my-emacs =
|
||||
let ewp = (pkgs.emacsPackagesFor emacsBasePackage).emacsWithPackages
|
||||
(epkgs: with epkgs; [
|
||||
jinx
|
||||
pdf-tools
|
||||
treesit-grammars.with-all-grammars
|
||||
]);
|
||||
in pkgs.symlinkJoin {
|
||||
name = "sydmacs";
|
||||
paths = [ ewp ];
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
buildInputs = [
|
||||
pkgs.git # Dependency of Straight.el.
|
||||
my-aspell
|
||||
pkgs.direnv
|
||||
];
|
||||
postBuild = ''
|
||||
find "$out/bin" -name emacs -or -name "emacs-*" \
|
||||
| while IFS= read -r emacs; do
|
||||
echo "emacs: $emacs"
|
||||
wrapProgram "$emacs" \
|
||||
--add-flags "--init-directory \"${emacsConfigDir}\"" \
|
||||
--set EMACS_STRAIGHT_BASE_DIR "${straightBaseDir}" \
|
||||
--set EMACS_CACHE_DIR "${emacsCacheDir}" \
|
||||
--set EMACS_DATA_DIR "${emacsDataDir}" \
|
||||
--prefix PATH : "${pkgs.git}/bin" \
|
||||
--prefix PATH : "${my-aspell}/bin" \
|
||||
--prefix PATH : "${pkgs.direnv}/bin" \
|
||||
--prefix PATH : "${pkgs.texliveFull}/bin" \
|
||||
--set ASPELL_CONF "dict-dir ${my-aspell}/lib/aspell"
|
||||
done
|
||||
'';
|
||||
meta = emacsBasePackage.meta;
|
||||
version = emacsBasePackage.version;
|
||||
};
|
||||
|
||||
emacsclient-or-emacs = pkgs.writeShellScriptBin "emacsclient-or-emacs" ''
|
||||
emacsclient --alternate-editor=${config.programs.emacs.finalPackage}/bin/emacs "$@"
|
||||
'';
|
||||
in {
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
package = my-emacs;
|
||||
};
|
||||
|
||||
sydnix.impermanence.cache.directories =
|
||||
# Impermanence expects the path to be relative to ~.
|
||||
map (lib.removePrefix config.home.homeDirectory) [
|
||||
straightBaseDir
|
||||
emacsCacheDir
|
||||
emacsDataDir
|
||||
];
|
||||
|
||||
# Set emacsclient as the default editor for the time being.
|
||||
home.sessionVariables =
|
||||
let e = "${emacsclient-or-emacs}/bin/emacsclient-or-emacs";
|
||||
in {
|
||||
"EDITOR" = e;
|
||||
"VISUAL" = e;
|
||||
};
|
||||
|
||||
home.file =
|
||||
let default =
|
||||
lib.removePrefix "${config.home.homeDirectory}/"
|
||||
"${straightBaseDir}/straight/versions/default.el";
|
||||
in {
|
||||
${default}.source =
|
||||
config.lib.file.mkOutOfStoreSymlink
|
||||
"${emacsConfigDir}/straight-lockfile.el";
|
||||
};
|
||||
|
||||
home.packages = [
|
||||
emacsclient-or-emacs
|
||||
] ++ fontPackages;
|
||||
|
||||
# There's probably a better place to put this, but the current setup demands
|
||||
# Fontconfig for Emacs to find my fonts.
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
# TODO: Make sure this is using the right package for Emacs...
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
# Generate a desktop entry for emacsclient.
|
||||
client.enable = true;
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
e = "emacsclient-or-emacs";
|
||||
ec = "emacsclient";
|
||||
em = "emacs";
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -4,6 +4,22 @@
|
||||
(interactive)
|
||||
(dired default-directory))
|
||||
|
||||
(defun syd-dired-goto-file (file)
|
||||
"Like `dired-goto-file', but will act as `find-file' if FILE is inside another
|
||||
directory."
|
||||
(interactive
|
||||
(prog1 (let ((dir (dired-current-directory)))
|
||||
(list (directory-file-name
|
||||
(file-relative-name
|
||||
(read-file-name "Goto file: " dir)
|
||||
dir))))
|
||||
;; let push-mark display its message
|
||||
(push-mark))
|
||||
dired-mode)
|
||||
(if (file-name-directory file)
|
||||
(find-file file)
|
||||
(dired-goto-file (expand-file-name file))))
|
||||
|
||||
(use-package dired
|
||||
;; Built-in to Emacs.
|
||||
:straight nil
|
||||
@@ -15,6 +31,8 @@
|
||||
(:keymaps 'dired-mode-map
|
||||
:states '(normal motion)
|
||||
"g r" #'revert-buffer)
|
||||
(:keymaps 'dired-mode-map
|
||||
[remap dired-goto-file] #'syd-dired-goto-file)
|
||||
:commands dired-jump
|
||||
:custom (;; When there are other Dired windows open, suggest them as targets
|
||||
;; for renaming/copying.
|
||||
142
modules/home/users/crumb/firefox.nix
Normal file
142
modules/home/users/crumb/firefox.nix
Normal file
@@ -0,0 +1,142 @@
|
||||
{ config, lib, pkgs, inputs, ... }@args:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.users.crumb.firefox;
|
||||
in {
|
||||
options.sydnix.users.crumb.firefox.enable =
|
||||
lib.mkEnableOption "Firefox, à la crumb";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
|
||||
# Available language codes can be found on the releases page:
|
||||
# https://releases.mozilla.org/pub/firefox/releases/134.0.2/linux-x86_64/xpi/.
|
||||
# The string `134.0.2` may be substituted for any other Firefox release
|
||||
# number.
|
||||
languagePacks = [
|
||||
"en-US"
|
||||
"en-GB"
|
||||
];
|
||||
|
||||
# Available options can be found at
|
||||
# https://mozilla.github.io/policy-templates/.
|
||||
policies = {
|
||||
DisableTelemetry = true;
|
||||
DisableFirefoxStudies = false;
|
||||
EnableTrackingProtection = {
|
||||
Value = true;
|
||||
Locked = true;
|
||||
Cryptomining = true;
|
||||
Fingerprinting = true;
|
||||
};
|
||||
FirefoxHome = {
|
||||
Search = true;
|
||||
TopSites = true;
|
||||
SponsoredTopSites = false;
|
||||
Highlights = false;
|
||||
Pocket = false;
|
||||
SponsoredPocket = false;
|
||||
Snippets = false;
|
||||
Locked = false;
|
||||
};
|
||||
# Weird advertiser shit.
|
||||
FirefoxSuggest = {
|
||||
WebSuggestions = false;
|
||||
SponsoredSuggestions = false;
|
||||
ImproveSuggest = false;
|
||||
Locked = false;
|
||||
};
|
||||
# Weird advertiser shit.
|
||||
DisablePocket = true;
|
||||
DisableFirefoxAccounts = true;
|
||||
DisableAccounts = true;
|
||||
# Firefox has an in-built screenshot tool that I do not need.
|
||||
DisableFirefoxScreenshots = true;
|
||||
# Disable pop-up windows that appear after installation and updates.
|
||||
OverrideFirstRunPage = "";
|
||||
OverridePostUpdatePage = "";
|
||||
# You think you're so important, don't you, Firefox?
|
||||
DontCheckDefaultBrowser = true;
|
||||
# Only tabs not yet visiting a page. Alternatives: `always`, `never`,
|
||||
# `newtab`.
|
||||
DisplayBookmarksToolbar = "newtab";
|
||||
# Alternatives: `always`, `never`, `default-on`, `default-on`.
|
||||
DisplayMenuBar = "default-off";
|
||||
# Alternative: `unified`, `separate`.
|
||||
SearchBar = "unified";
|
||||
};
|
||||
|
||||
profiles."msyds" = {
|
||||
bookmarks = [];
|
||||
|
||||
# Check about:support for extension/add-on ID strings.
|
||||
extensions = {
|
||||
# Override non-declared settings.
|
||||
force = true;
|
||||
packages =
|
||||
let pkgs' = import inputs.nixpkgs {
|
||||
system = args.system;
|
||||
overlays = [ inputs.nur.overlays.default ];
|
||||
};
|
||||
in
|
||||
with pkgs'.nur.repos.rycee.firefox-addons; [
|
||||
ublock-origin
|
||||
darkreader
|
||||
privacy-badger
|
||||
vimium
|
||||
kagi-search
|
||||
duckduckgo-privacy-essentials
|
||||
edit-with-emacs
|
||||
copy-as-org-mode
|
||||
clearurls
|
||||
];
|
||||
};
|
||||
|
||||
search = {
|
||||
# Override non-declared settings.
|
||||
force = true;
|
||||
# Precedence of search engines.
|
||||
order = [ "Kagi" "DuckDuckGo" ];
|
||||
default = "Kagi";
|
||||
privateDefault = "DuckDuckGo";
|
||||
engines = {
|
||||
"Nixpkgs" = {
|
||||
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" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# See `about:config` in Firefox for available settings.
|
||||
settings = {
|
||||
# Disable suggestions.
|
||||
"browser.search.suggest.enabled" = false;
|
||||
# Enable dark theme for non-website UI; the URL bar and such.
|
||||
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
|
||||
"browser.theme.content-theme" = 0;
|
||||
"browser.theme.toolbar-theme" = 0;
|
||||
"browser.in-content.dark-mode" = true;
|
||||
"ui.systemUsesDarkTheme" = 1;
|
||||
# Disable sponsored suggestions.
|
||||
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
|
||||
"browser.newtabpage.activity-stream.system.showSponsored" = false;
|
||||
"browser.newtabpage.activity-stream.showSponsored" = false;
|
||||
"browser.urlbar.sponsoredTopSites" = false;
|
||||
"services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsored"
|
||||
= false;
|
||||
"services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsoredTopSites"
|
||||
= false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
83
modules/home/users/crumb/git.nix
Normal file
83
modules/home/users/crumb/git.nix
Normal file
@@ -0,0 +1,83 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.users.crumb.git;
|
||||
|
||||
options.sydnix.users.crumb.git.enable =
|
||||
lib.mkEnableOption "Git, à la crumb";
|
||||
|
||||
# TODO: Move somewhere else.
|
||||
my-email = "lomiskiam@gmail.com";
|
||||
my-name = "Madeleine Sydney";
|
||||
in {
|
||||
options.sydnix.users.crumb.git.enable =
|
||||
lib.mkEnableOption "Git, à la crumb";
|
||||
|
||||
config = lib.mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
### Git
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userEmail = my-email;
|
||||
userName = my-name;
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
ga = "git add";
|
||||
gb = "git branch";
|
||||
gc = "git commit";
|
||||
gcl = "git clone";
|
||||
gco = "git checkout";
|
||||
gd = "git diff";
|
||||
gl = "git log";
|
||||
glo = "git log --pretty=oneline";
|
||||
glol = "git log --graph --oneline --decorate";
|
||||
gp = "git push";
|
||||
gr = "git remote";
|
||||
grs = "git remote show";
|
||||
gs = "git status";
|
||||
gtd = "git tag --delete";
|
||||
};
|
||||
}
|
||||
{
|
||||
### Jujutsu
|
||||
programs.jujutsu = {
|
||||
enable = true;
|
||||
settings.user = {
|
||||
email = my-email;
|
||||
name = my-name;
|
||||
};
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
jb = "jj bookmark";
|
||||
jdi = "jj diff";
|
||||
jd = "jj describe";
|
||||
je = "jj edit";
|
||||
jgcl = "jj git clone";
|
||||
jgp = "jj git push";
|
||||
jgr = "jj git remote";
|
||||
jl = "jj log";
|
||||
jn = "jj new";
|
||||
js = "jj status";
|
||||
jsp = "jj split";
|
||||
};
|
||||
}
|
||||
{
|
||||
### Github CLI
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git_protocol = "ssh";
|
||||
};
|
||||
};
|
||||
|
||||
sydnix.sops.secrets.github-oauth = {};
|
||||
}
|
||||
{
|
||||
### Gitlab CLI
|
||||
programs.glab.enable = true;
|
||||
}
|
||||
]);
|
||||
}
|
||||
57
modules/home/users/crumb/haskell.nix
Normal file
57
modules/home/users/crumb/haskell.nix
Normal file
@@ -0,0 +1,57 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.users.crumb.haskell;
|
||||
in {
|
||||
options.sydnix.users.crumb.haskell.enable =
|
||||
lib.mkEnableOption "Haskell, à la crumb";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Convenient shorthand for quickly opening Haskell REPLs.
|
||||
programs.bash.profileExtra = ''
|
||||
# Start a GHCi REPL with the given packages made available.
|
||||
ghci-with-packages () {
|
||||
nix-shell -p "haskellPackages.ghcWithPackages (p: with p; [ $@ ])" \
|
||||
--run ghci
|
||||
}
|
||||
|
||||
# Run GHC with the given packages made available.
|
||||
ghc-with-packages () {
|
||||
getopt -o "p" -- "$@"
|
||||
while true; do
|
||||
case "$1" in
|
||||
-p)
|
||||
packages="$1"
|
||||
shift 2
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Invalid options provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$options"
|
||||
|
||||
nix-shell -p "haskellPackages.ghcWithPackages (p: with p; [ $packages ])" \
|
||||
--run "ghc $@"
|
||||
}
|
||||
'';
|
||||
|
||||
sydnix.impermanence.cache.directories =
|
||||
let xdg-cache-dir =
|
||||
config.home.cacheHome
|
||||
or "${config.home.homeDirectory}/.cache";
|
||||
in [
|
||||
# We don't want to rebuild Hackage simply due to a reboot, do we? }:)
|
||||
(lib.removePrefix "${config.home.homeDirectory}/"
|
||||
"${xdg-cache-dir}/cabal")
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
36
modules/home/users/crumb/mpd.nix
Normal file
36
modules/home/users/crumb/mpd.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.users.crumb.mpd;
|
||||
in {
|
||||
options.sydnix.users.crumb.mpd.enable =
|
||||
lib.mkEnableOption "MPD, à la crumb";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sydnix.sops.secrets = {
|
||||
lastfm-password = {};
|
||||
librefm-password = {};
|
||||
};
|
||||
|
||||
sydnix.mpd = {
|
||||
enable = true;
|
||||
scrobbling.endpoints = {
|
||||
"last.fm" = {
|
||||
passwordFile =
|
||||
"/home/crumb/.config/sops-nix/secrets/lastfm-password";
|
||||
username = "crumb1";
|
||||
};
|
||||
"libre.fm" = {
|
||||
passwordFile =
|
||||
"/home/crumb/.config/sops-nix/secrets/librefm-password";
|
||||
username = "crumbtoo";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# mpdscribble uses our password files, so it is imperative that the service
|
||||
# runs only after said password files are brought into existence. }:)
|
||||
systemd.user.services.mpdscribble.Unit.After = [ "sops-nix.service" ];
|
||||
};
|
||||
}
|
||||
|
||||
39
modules/home/users/crumb/nvim.nix
Normal file
39
modules/home/users/crumb/nvim.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.users.crumb.nvim;
|
||||
in {
|
||||
options.sydnix.users.crumb.nvim.enable =
|
||||
lib.mkEnableOption "Neovim, à la crumb";
|
||||
config = lib.mkIf cfg.enable (
|
||||
let
|
||||
my-vimrc =
|
||||
pkgs.writeTextFile {
|
||||
name = "vimrc";
|
||||
text = ''
|
||||
imap jk <ESC>
|
||||
xmap JK <ESC>
|
||||
set number
|
||||
set relativenumber
|
||||
'';
|
||||
};
|
||||
|
||||
my-neovim =
|
||||
pkgs.symlinkJoin {
|
||||
name = "neovim";
|
||||
paths = [ pkgs.neovim ];
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/nvim \
|
||||
--add-flags "-u ${my-vimrc}"
|
||||
# Symlink {v,vi,vim} to nvim.
|
||||
for i in {v,vi,vim}; do
|
||||
ln -s $out/bin/nvim $out/bin/$i
|
||||
done
|
||||
'';
|
||||
};
|
||||
in {
|
||||
home.packages = [ my-neovim ];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
homeConfiguration = { config, lib, pkgs, ... }: {
|
||||
imports = [
|
||||
./programs.nix
|
||||
# ./programs.nix
|
||||
./files.nix
|
||||
];
|
||||
|
||||
@@ -31,6 +31,18 @@
|
||||
enable = true;
|
||||
keyFile = "/persist/private-keys/age/${config.home.username}";
|
||||
};
|
||||
# Personal configurations.
|
||||
users.crumb = {
|
||||
age.enable = true;
|
||||
bash.enable = true;
|
||||
direnv.enable = true;
|
||||
firefox.enable = true;
|
||||
git.enable = true;
|
||||
haskell.enable = true;
|
||||
mpd.enable = true;
|
||||
nvim.enable = true;
|
||||
emacs.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Don't touch!
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{ config, lib, pkgs, utils, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
map (x: ./programs/${x})
|
||||
(utils.listNixFilesInDirectory ./programs);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let mutableSymlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
in {
|
||||
home.packages = [
|
||||
# Rage supports pinentry while Age does not.
|
||||
pkgs.rage
|
||||
];
|
||||
|
||||
# Private keys must be mutable symlinks since we don't want the key inside the
|
||||
# world-readable store.
|
||||
home.file."private-keys/age/crumb.age".source =
|
||||
mutableSymlink "/persist/private-keys/age/${config.home.username}.age";
|
||||
|
||||
home.file."public-keys/age/crumb.pub".source =
|
||||
../../../public-keys/age/${config.home.username}.pub;
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# High-speed Nix support. Note that Lorri has a years-old open issue
|
||||
# preventing it from starting on boot/login correctly.
|
||||
#
|
||||
# Currently unused in favour of nix-direnv.
|
||||
|
||||
# services.lorri.enable = true;
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
{ config, lib, pkgs, inputs, ... }@args:
|
||||
|
||||
let
|
||||
emacsBasePackage = pkgs'.emacs-unstable-pgtk;
|
||||
emacsConfigDir = "/persist/dots/users/crumb/programs/emacs";
|
||||
|
||||
# emacs-overlay =
|
||||
# import (builtins.fetchTarball {
|
||||
# url =
|
||||
# "https://github.com/nix-community/emacs-overlay/archive/master.tar.gz";
|
||||
# sha256 = "sha256:02aln37ch9isz8h7dlm9v6jkl60g923z0dij0rjsxq7xi61fas2j";
|
||||
# });
|
||||
|
||||
# Create a new instance of nixpkgs with emacs-overlay applied. This is a
|
||||
# little unorthodox, but we do it
|
||||
# 1. for the sake of organisation — For pure aesthetics and a clean
|
||||
# codebase, I want everything Emacs to stay in this file;
|
||||
# 2. and, there's simply no need to leak emacs-overlay's packages into the
|
||||
# global nixpkgs instance when nothing else is using it!
|
||||
pkgs' = import inputs.nixpkgs {
|
||||
system = args.system;
|
||||
overlays = [ inputs.emacs-overlay.overlays.emacs ];
|
||||
};
|
||||
|
||||
emacsDataDir = "${config.xdg.dataHome}/emacs";
|
||||
emacsCacheDir = "${emacsDataDir}/cache";
|
||||
straightBaseDir = "${emacsDataDir}/straight";
|
||||
|
||||
fontPackages = [
|
||||
pkgs.julia-mono
|
||||
pkgs.nerd-fonts.victor-mono
|
||||
pkgs.ibm-plex
|
||||
];
|
||||
|
||||
my-aspell = pkgs.aspellWithDicts
|
||||
(dicts: with dicts; [
|
||||
en en-computers en-science
|
||||
]);
|
||||
|
||||
my-emacs =
|
||||
let ewp = (pkgs.emacsPackagesFor emacsBasePackage).emacsWithPackages
|
||||
(epkgs: with epkgs; [
|
||||
jinx
|
||||
pdf-tools
|
||||
treesit-grammars.with-all-grammars
|
||||
]);
|
||||
in pkgs.symlinkJoin {
|
||||
name = "sydmacs";
|
||||
paths = [ ewp ];
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
buildInputs = [
|
||||
pkgs.git # Dependency of Straight.el.
|
||||
my-aspell
|
||||
pkgs.direnv
|
||||
];
|
||||
postBuild = ''
|
||||
find "$out/bin" -name emacs -or -name "emacs-*" \
|
||||
| while IFS= read -r emacs; do
|
||||
echo "emacs: $emacs"
|
||||
wrapProgram "$emacs" \
|
||||
--add-flags "--init-directory \"${emacsConfigDir}\"" \
|
||||
--set EMACS_STRAIGHT_BASE_DIR "${straightBaseDir}" \
|
||||
--set EMACS_CACHE_DIR "${emacsCacheDir}" \
|
||||
--set EMACS_DATA_DIR "${emacsDataDir}" \
|
||||
--prefix PATH : "${pkgs.git}/bin" \
|
||||
--prefix PATH : "${my-aspell}/bin" \
|
||||
--prefix PATH : "${pkgs.direnv}/bin" \
|
||||
--prefix PATH : "${pkgs.texliveFull}/bin" \
|
||||
--set ASPELL_CONF "dict-dir ${my-aspell}/lib/aspell"
|
||||
done
|
||||
'';
|
||||
meta = emacsBasePackage.meta;
|
||||
version = emacsBasePackage.version;
|
||||
};
|
||||
|
||||
emacsclient-or-emacs = pkgs.writeShellScriptBin "emacsclient-or-emacs" ''
|
||||
emacsclient --alternate-editor=${config.programs.emacs.finalPackage}/bin/emacs "$@"
|
||||
'';
|
||||
in {
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
package = my-emacs;
|
||||
};
|
||||
|
||||
sydnix.impermanence.cache.directories =
|
||||
# Impermanence expects the path to be relative to ~.
|
||||
map (lib.removePrefix config.home.homeDirectory) [
|
||||
straightBaseDir
|
||||
emacsCacheDir
|
||||
emacsDataDir
|
||||
];
|
||||
|
||||
# Set emacsclient as the default editor for the time being.
|
||||
home.sessionVariables =
|
||||
let e = "${emacsclient-or-emacs}/bin/emacsclient-or-emacs";
|
||||
in {
|
||||
"EDITOR" = e;
|
||||
"VISUAL" = e;
|
||||
};
|
||||
|
||||
home.file =
|
||||
let default =
|
||||
lib.removePrefix "${config.home.homeDirectory}/"
|
||||
"${straightBaseDir}/straight/versions/default.el";
|
||||
in {
|
||||
${default}.source =
|
||||
config.lib.file.mkOutOfStoreSymlink
|
||||
"/persist/dots/users/crumb/programs/emacs/straight-lockfile.el";
|
||||
};
|
||||
|
||||
home.packages = [
|
||||
emacsclient-or-emacs
|
||||
] ++ fontPackages;
|
||||
|
||||
# There's probably a better place to put this, but the current setup demands
|
||||
# Fontconfig for Emacs to find my fonts.
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
# TODO: Make sure this is using the right package for Emacs...
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
# Generate a desktop entry for emacsclient.
|
||||
client.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
{ config, lib, pkgs, inputs, ... }@args:
|
||||
|
||||
let
|
||||
pkgs' = import inputs.nixpkgs {
|
||||
system = args.system;
|
||||
overlays = [ inputs.nur.overlays.default ];
|
||||
};
|
||||
in {
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
|
||||
# Available language codes can be found on the releases page:
|
||||
# https://releases.mozilla.org/pub/firefox/releases/134.0.2/linux-x86_64/xpi/.
|
||||
# The string `134.0.2` may be substituted for any other Firefox release
|
||||
# number.
|
||||
languagePacks = [
|
||||
"en-US"
|
||||
"en-GB"
|
||||
];
|
||||
|
||||
# Available options can be found at https://mozilla.github.io/policy-templates/.
|
||||
policies = {
|
||||
DisableTelemetry = true;
|
||||
DisableFirefoxStudies = false;
|
||||
EnableTrackingProtection = {
|
||||
Value = true;
|
||||
Locked = true;
|
||||
Cryptomining = true;
|
||||
Fingerprinting = true;
|
||||
};
|
||||
FirefoxHome = {
|
||||
Search = true;
|
||||
TopSites = true;
|
||||
SponsoredTopSites = false;
|
||||
Highlights = false;
|
||||
Pocket = false;
|
||||
SponsoredPocket = false;
|
||||
Snippets = false;
|
||||
Locked = false;
|
||||
};
|
||||
# Weird advertiser shit.
|
||||
FirefoxSuggest = {
|
||||
WebSuggestions = false;
|
||||
SponsoredSuggestions = false;
|
||||
ImproveSuggest = false;
|
||||
Locked = false;
|
||||
};
|
||||
# Weird advertiser shit.
|
||||
DisablePocket = true;
|
||||
DisableFirefoxAccounts = true;
|
||||
DisableAccounts = true;
|
||||
# Firefox has an in-built screenshot tool that I do not need.
|
||||
DisableFirefoxScreenshots = true;
|
||||
# Disable pop-up windows that appear after installation and updates.
|
||||
OverrideFirstRunPage = "";
|
||||
OverridePostUpdatePage = "";
|
||||
# You think you're so important, don't you, Firefox?
|
||||
DontCheckDefaultBrowser = true;
|
||||
# Only tabs not yet visiting a page. Alternatives: `always`, `never`,
|
||||
# `newtab`.
|
||||
DisplayBookmarksToolbar = "newtab";
|
||||
# Alternatives: `always`, `never`, `default-on`, `default-on`.
|
||||
DisplayMenuBar = "default-off";
|
||||
# Alternative: `unified`, `separate`.
|
||||
SearchBar = "unified";
|
||||
};
|
||||
|
||||
profiles."msyds" = {
|
||||
bookmarks = [];
|
||||
|
||||
# Check about:support for extension/add-on ID strings.
|
||||
extensions = {
|
||||
# Override non-declared settings.
|
||||
force = true;
|
||||
packages = with pkgs'.nur.repos.rycee.firefox-addons; [
|
||||
ublock-origin
|
||||
darkreader
|
||||
privacy-badger
|
||||
vimium
|
||||
kagi-search
|
||||
duckduckgo-privacy-essentials
|
||||
edit-with-emacs
|
||||
copy-as-org-mode
|
||||
clearurls
|
||||
];
|
||||
};
|
||||
|
||||
search = {
|
||||
# Override non-declared settings.
|
||||
force = true;
|
||||
# Precedence of search engines.
|
||||
order = [ "Kagi" "DuckDuckGo" ];
|
||||
default = "Kagi";
|
||||
privateDefault = "DuckDuckGo";
|
||||
engines = {
|
||||
"Nixpkgs" = {
|
||||
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" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# See `about:config` in Firefox for available settings.
|
||||
settings = {
|
||||
# Disable suggestions.
|
||||
"browser.search.suggest.enabled" = false;
|
||||
# Enable dark theme for non-website UI; the URL bar and such.
|
||||
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
|
||||
"browser.theme.content-theme" = 0;
|
||||
"browser.theme.toolbar-theme" = 0;
|
||||
"browser.in-content.dark-mode" = true;
|
||||
"ui.systemUsesDarkTheme" = 1;
|
||||
# Disable sponsored suggestions.
|
||||
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
|
||||
"browser.newtabpage.activity-stream.system.showSponsored" = false;
|
||||
"browser.newtabpage.activity-stream.showSponsored" = false;
|
||||
"browser.urlbar.sponsoredTopSites" = false;
|
||||
"services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsored"
|
||||
= false;
|
||||
"services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsoredTopSites"
|
||||
= false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
# TODO: Move somewhere else.
|
||||
my-email = "lomiskiam@gmail.com";
|
||||
my-name = "Madeleine Sydney";
|
||||
in lib.mkMerge [
|
||||
{
|
||||
### Git
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userEmail = my-email;
|
||||
userName = my-name;
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
ga = "git add";
|
||||
gb = "git branch";
|
||||
gc = "git commit";
|
||||
gcl = "git clone";
|
||||
gco = "git checkout";
|
||||
gd = "git diff";
|
||||
gl = "git log";
|
||||
glo = "git log --pretty=oneline";
|
||||
glol = "git log --graph --oneline --decorate";
|
||||
gp = "git push";
|
||||
gr = "git remote";
|
||||
grs = "git remote show";
|
||||
gs = "git status";
|
||||
gtd = "git tag --delete";
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
### Jujutsu
|
||||
programs.jujutsu = {
|
||||
enable = true;
|
||||
settings.user = {
|
||||
email = my-email;
|
||||
name = my-name;
|
||||
};
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
jb = "jj bookmark";
|
||||
jdi = "jj diff";
|
||||
jd = "jj describe";
|
||||
je = "jj edit";
|
||||
jgcl = "jj git clone";
|
||||
jgp = "jj git push";
|
||||
jgr = "jj git remote";
|
||||
jl = "jj log";
|
||||
jn = "jj new";
|
||||
js = "jj status";
|
||||
jsp = "jj split";
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
### Github CLI
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git_protocol = "ssh";
|
||||
};
|
||||
};
|
||||
|
||||
sydnix.sops.secrets.github-oauth = {};
|
||||
}
|
||||
|
||||
{
|
||||
### Gitlab CLI
|
||||
programs.glab.enable = true;
|
||||
}
|
||||
]
|
||||
@@ -1,61 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Convenient shorthand for quickly opening Haskell REPLs.
|
||||
programs.bash.profileExtra = ''
|
||||
# Start a GHCi REPL with the given packages made available.
|
||||
ghci-with-packages () {
|
||||
nix-shell -p "haskellPackages.ghcWithPackages (p: with p; [ $@ ])" \
|
||||
--run ghci
|
||||
}
|
||||
|
||||
# Run GHC with the given packages made available.
|
||||
ghc-with-packages () {
|
||||
getopt -o "p" -- "$@"
|
||||
while true; do
|
||||
case "$1" in
|
||||
-p)
|
||||
packages="$1"
|
||||
shift 2
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Invalid options provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$options"
|
||||
|
||||
nix-shell -p "haskellPackages.ghcWithPackages (p: with p; [ $packages ])" \
|
||||
--run "ghc $@"
|
||||
}
|
||||
'';
|
||||
|
||||
sydnix.impermanence.cache.directories =
|
||||
let xdg-cache-dir =
|
||||
config.home.cacheHome
|
||||
or "${config.home.homeDirectory}/.cache";
|
||||
in [
|
||||
# We don't want to rebuild Hackage simply due to a reboot, do we? }:)
|
||||
(lib.removePrefix "${config.home.homeDirectory}/"
|
||||
"${xdg-cache-dir}/cabal")
|
||||
];
|
||||
|
||||
# # Some global Cabal configuration.
|
||||
# xdg.configFile."cabal/config".text = ''
|
||||
# repository hackage.haskell.org
|
||||
# url: http://hackage.haskell.org/
|
||||
|
||||
# nix: True
|
||||
# remote-repo-cache: /home/crumb/.cache/cabal/packages
|
||||
# build-summary: /home/crumb/.cache/cabal/logs/build.log
|
||||
# jobs: $ncpus
|
||||
# remote-build-reporting: none
|
||||
# '';
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
sydnix.sops.secrets = {
|
||||
lastfm-password = {};
|
||||
librefm-password = {};
|
||||
};
|
||||
|
||||
sydnix.mpd = {
|
||||
enable = true;
|
||||
scrobbling.endpoints = {
|
||||
"last.fm" = {
|
||||
passwordFile =
|
||||
"/home/crumb/.config/sops-nix/secrets/lastfm-password";
|
||||
username = "crumb1";
|
||||
};
|
||||
"libre.fm" = {
|
||||
passwordFile =
|
||||
"/home/crumb/.config/sops-nix/secrets/librefm-password";
|
||||
username = "crumbtoo";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# mpdscribble uses our password files, so it is imperative that the service
|
||||
# runs only after said password files are brought into existence. }:)
|
||||
systemd.user.services.mpdscribble.Unit.After = [ "sops-nix.service" ];
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
my-vimrc =
|
||||
pkgs.writeTextFile {
|
||||
name = "vimrc";
|
||||
text = ''
|
||||
imap jk <ESC>
|
||||
xmap JK <ESC>
|
||||
set number
|
||||
set relativenumber
|
||||
'';
|
||||
};
|
||||
|
||||
my-neovim =
|
||||
pkgs.symlinkJoin {
|
||||
name = "neovim";
|
||||
paths = [ pkgs.neovim ];
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/nvim \
|
||||
--add-flags "-u ${my-vimrc}"
|
||||
# Symlink {v,vi,vim} to nvim.
|
||||
for i in {v,vi,vim}; do
|
||||
ln -s $out/bin/nvim $out/bin/$i
|
||||
done
|
||||
'';
|
||||
};
|
||||
in {
|
||||
home.packages = [ my-neovim ];
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let mutableSymlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
in {
|
||||
home.packages = [ pkgs.passage ];
|
||||
|
||||
home.file.".passage/identities".source =
|
||||
mutableSymlink config.sydnix.sops.keyFile;
|
||||
|
||||
sydnix.impermanence.directories = [
|
||||
".passage/store"
|
||||
];
|
||||
|
||||
home.shellAliases."pass" = "${pkgs.passage}/bin/passage";
|
||||
|
||||
# TODO:
|
||||
# systemd.user.services.sync-password-store = {
|
||||
# Unit = {
|
||||
# Description = "Pull and push user password store.";
|
||||
# };
|
||||
# Service = {
|
||||
# Environment = "PATH=/run/current-system/sw/bin";
|
||||
# ExecStart =
|
||||
# let script = ''
|
||||
# set -xe -o pipefail
|
||||
# '';
|
||||
# in pkgs.writeShellScript "sync-password-store" script;
|
||||
# };
|
||||
# Install = {
|
||||
# WantedBy = ["default.target"];
|
||||
# };
|
||||
# };
|
||||
}
|
||||
Reference in New Issue
Block a user