ref(nix): formatted with nixfmt-rfc-style

This commit is contained in:
Léana 江 2024-03-30 21:08:07 +01:00 committed by Léana 江
parent 36a2265325
commit 23404db605
40 changed files with 574 additions and 474 deletions

View file

@ -1,7 +1,7 @@
{
programs.atuin = {
enable = true;
flags = ["--disable-up-arrow"];
flags = [ "--disable-up-arrow" ];
settings = {
history_filter = [
# privacy

View file

@ -3,7 +3,8 @@
lib,
config,
...
}: {
}:
{
home = lib.mkIf config.cmus.enable {
packages = with pkgs; [
cmus
@ -11,12 +12,11 @@
];
file.cmus = {
recursive = true;
source = let
inherit (pkgs.stdenv) isLinux;
in
if isLinux
then ./cmus-linux
else ./cmus-darwin;
source =
let
inherit (pkgs.stdenv) isLinux;
in
if isLinux then ./cmus-linux else ./cmus-darwin;
target = "${config.xdg.configHome}/cmus";
};
};

View file

@ -6,7 +6,8 @@
lib,
nix-visualize,
...
}: {
}:
{
imports = [
./fish
./direnv
@ -37,7 +38,8 @@
gpg.enable = true;
};
home.packages = with pkgs;
home.packages =
with pkgs;
[
# shell and script dependencies
figlet

View file

@ -1,10 +1,12 @@
{config, ...}: {
{ config, ... }:
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config = let
home = config.home.homeDirectory;
in
config =
let
home = config.home.homeDirectory;
in
builtins.fromTOML ''
[global]
strict_env = true

View file

@ -1,8 +1,5 @@
{
pkgs,
hostname,
...
}: let
{ pkgs, hostname, ... }:
let
abbrs = {
## Docker
dc = "docker compose";
@ -69,23 +66,14 @@
defaults write com.apple.dock persistent-apps -array-add '{tile-type="small-spacer-tile";}'; killall Dock
'';
};
in {
programs.fish = let
inherit (pkgs.stdenv) isLinux;
in {
shellAbbrs =
abbrs
// (
if isLinux
then abbrsLinux
else abbrsDarwin
);
shellAliases =
aliases
// (
if isLinux
then aliasesLinux
else aliasesDarwin
);
};
in
{
programs.fish =
let
inherit (pkgs.stdenv) isLinux;
in
{
shellAbbrs = abbrs // (if isLinux then abbrsLinux else abbrsDarwin);
shellAliases = aliases // (if isLinux then aliasesLinux else aliasesDarwin);
};
}

View file

@ -3,102 +3,115 @@
lib,
config,
...
}: {
imports = [./aliasesAbbrs.nix];
}:
{
imports = [ ./aliasesAbbrs.nix ];
programs.fish = let
readConfig = n: builtins.readFile ./conf.d/${n}.fish;
readConfigs = ns: builtins.concatStringsSep "\n" (map readConfig ns);
programs.fish =
let
readConfig = n: builtins.readFile ./conf.d/${n}.fish;
readConfigs = ns: builtins.concatStringsSep "\n" (map readConfig ns);
add_paths = ps:
lib.trivial.pipe ps [
(lib.lists.reverseList) # source paths in reverse order
(map (p: "fish_add_path -m ${p}"))
(builtins.concatStringsSep "\n")
(s: s + "\n")
];
add_paths =
ps:
lib.trivial.pipe ps [
(lib.lists.reverseList) # source paths in reverse order
(map (p: "fish_add_path -m ${p}"))
(builtins.concatStringsSep "\n")
(s: s + "\n")
];
source_completions = cs:
lib.trivial.pipe cs [
(map (c: "source ${c}/share/fish/vendor_completions.d/*.fish"))
(builtins.concatStringsSep "\n")
(s: s + "\n")
];
in {
enable = true;
shellInit =
readConfig "shellInit"
# Source packages that are not linked
+ source_completions config.fish.extraCompletions
# Just in case $PATH is broken, add them in an idempotent fashion
+ add_paths [
# Make sure wrapper comes first
# https://discourse.nixos.org/t/sudo-run-current-system-sw-bin-sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set-and-cannot-chdir-var-cron-bailing-out-var-cron-permission-denied/20463/2
"/run/wrappers/bin"
"/run/current-system/sw/bin"
"/etc/profiles/per-user/${config.home.username}/bin"
"${config.home.homeDirectory}/.nix-profile/bin"
"/nix/var/nix/profiles/default/bin"
];
interactiveShellInit =
readConfigs ["interactiveShellInit" "bind" "colorscheme" "locale"];
functions = let
makeFishFunctions = ns:
lib.trivial.pipe ns [
(map (n: {
name = n;
value = builtins.readFile ./functions/${n}.fish;
}))
builtins.listToAttrs
source_completions =
cs:
lib.trivial.pipe cs [
(map (c: "source ${c}/share/fish/vendor_completions.d/*.fish"))
(builtins.concatStringsSep "\n")
(s: s + "\n")
];
in
makeFishFunctions [
"clone_to_repos"
"file_extension"
"file_mantissa"
"fish_command_not_found"
"fish_greeting"
"fish_remove_path"
"largest-objects-in-repo"
"snakecase"
"timestamp"
"tmux_attach"
"tmux_home"
"tmux_last"
"tmux_sessionizer"
"update_dotfiles"
{
enable = true;
shellInit =
readConfig "shellInit"
# Source packages that are not linked
+ source_completions config.fish.extraCompletions
# Just in case $PATH is broken, add them in an idempotent fashion
+ add_paths [
# Make sure wrapper comes first
# https://discourse.nixos.org/t/sudo-run-current-system-sw-bin-sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set-and-cannot-chdir-var-cron-bailing-out-var-cron-permission-denied/20463/2
"/run/wrappers/bin"
"/run/current-system/sw/bin"
"/etc/profiles/per-user/${config.home.username}/bin"
"${config.home.homeDirectory}/.nix-profile/bin"
"/nix/var/nix/profiles/default/bin"
];
interactiveShellInit = readConfigs [
"interactiveShellInit"
"bind"
"colorscheme"
"locale"
];
plugins = [
{
name = "fzf-fish";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "fzf.fish";
rev = "e5d54b93cd3e096ad6c2a419df33c4f50451c900";
sha256 = "sha256-5cO5Ey7z7KMF3vqQhIbYip5JR6YiS2I9VPRd6BOmeC8=";
};
}
{
name = "colored-man-pages";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "colored_man_pages.fish";
rev = "f885c2507128b70d6c41b043070a8f399988bc7a";
sha256 = "sha256-ii9gdBPlC1/P1N9xJzqomrkyDqIdTg+iCg0mwNVq2EU=";
};
}
{
name = "sponge";
src = pkgs.fetchFromGitHub {
owner = "meaningful-ooo";
repo = "sponge";
rev = "384299545104d5256648cee9d8b117aaa9a6d7be";
sha256 = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w=";
};
}
];
};
functions =
let
makeFishFunctions =
ns:
lib.trivial.pipe ns [
(map (
n: {
name = n;
value = builtins.readFile ./functions/${n}.fish;
}
))
builtins.listToAttrs
];
in
makeFishFunctions [
"clone_to_repos"
"file_extension"
"file_mantissa"
"fish_command_not_found"
"fish_greeting"
"fish_remove_path"
"largest-objects-in-repo"
"snakecase"
"timestamp"
"tmux_attach"
"tmux_home"
"tmux_last"
"tmux_sessionizer"
"update_dotfiles"
];
plugins = [
{
name = "fzf-fish";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "fzf.fish";
rev = "e5d54b93cd3e096ad6c2a419df33c4f50451c900";
sha256 = "sha256-5cO5Ey7z7KMF3vqQhIbYip5JR6YiS2I9VPRd6BOmeC8=";
};
}
{
name = "colored-man-pages";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "colored_man_pages.fish";
rev = "f885c2507128b70d6c41b043070a8f399988bc7a";
sha256 = "sha256-ii9gdBPlC1/P1N9xJzqomrkyDqIdTg+iCg0mwNVq2EU=";
};
}
{
name = "sponge";
src = pkgs.fetchFromGitHub {
owner = "meaningful-ooo";
repo = "sponge";
rev = "384299545104d5256648cee9d8b117aaa9a6d7be";
sha256 = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w=";
};
}
];
};
}

View file

@ -4,12 +4,14 @@
lib,
neovim-pin,
...
}: {
}:
{
programs.neovim = {
package = neovim-pin.neovim-unwrapped;
enable = true;
defaultEditor = true;
extraPackages = with pkgs;
extraPackages =
with pkgs;
[
lua-language-server
stylua
@ -29,17 +31,19 @@
];
};
home.file = let
fr_utf-8_spl = builtins.fetchurl {
url = "http://ftp.vim.org/vim/runtime/spell/fr.utf-8.spl";
sha256 = "abfb9702b98d887c175ace58f1ab39733dc08d03b674d914f56344ef86e63b61";
home.file =
let
fr_utf-8_spl = builtins.fetchurl {
url = "http://ftp.vim.org/vim/runtime/spell/fr.utf-8.spl";
sha256 = "abfb9702b98d887c175ace58f1ab39733dc08d03b674d914f56344ef86e63b61";
};
fr_utf-8_sug = builtins.fetchurl {
url = "http://ftp.vim.org/vim/runtime/spell/fr.utf-8.sug";
sha256 = "0294bc32b42c90bbb286a89e23ca3773b7ef50eff1ab523b1513d6a25c6b3f58";
};
in
{
"${config.xdg.configHome}/nvim/spell/fr.utf-8.spl".source = fr_utf-8_spl;
"${config.xdg.configHome}/nvim/spell/fr.utf-8.sug".source = fr_utf-8_sug;
};
fr_utf-8_sug = builtins.fetchurl {
url = "http://ftp.vim.org/vim/runtime/spell/fr.utf-8.sug";
sha256 = "0294bc32b42c90bbb286a89e23ca3773b7ef50eff1ab523b1513d6a25c6b3f58";
};
in {
"${config.xdg.configHome}/nvim/spell/fr.utf-8.spl".source = fr_utf-8_spl;
"${config.xdg.configHome}/nvim/spell/fr.utf-8.sug".source = fr_utf-8_sug;
};
}

View file

@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
programs.tmux = {
enable = true;
extraConfig =

View file

@ -1,18 +1,21 @@
{pkgs, ...}: {
programs.vim = let
inherit (builtins) readFile;
in {
enable = true;
extraConfig = readFile ./vimrc;
plugins = with pkgs.vimPlugins; [
vim-sleuth
vim-surround
vim-fugitive
vim-commentary
undotree
tabular
vim-wakatime
vim-caddyfile
];
};
{ pkgs, ... }:
{
programs.vim =
let
inherit (builtins) readFile;
in
{
enable = true;
extraConfig = readFile ./vimrc;
plugins = with pkgs.vimPlugins; [
vim-sleuth
vim-surround
vim-fugitive
vim-commentary
undotree
tabular
vim-wakatime
vim-caddyfile
];
};
}