c: Move into own file
This commit is contained in:
parent
881b22c9b2
commit
42bc007ed4
|
@ -1,22 +1,4 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{ pkgs, config, lib, ... }:
|
||||||
let
|
|
||||||
direnv = {
|
|
||||||
# Environment variables making programs stay out of $HOME, but also needing we create a directory for them
|
|
||||||
CARGOHOME = "${config.xdg.cacheHome}/cargo"; # There are config in there that we can version if one want
|
|
||||||
CCACHE_DIR = "${config.xdg.cacheHome}/ccache"; # The config file alone seems to be not enough
|
|
||||||
DASHT_DOCSETS_DIR = "${config.xdg.cacheHome}/dash_docsets";
|
|
||||||
GOPATH = "${config.xdg.cacheHome}/go";
|
|
||||||
GRADLE_USER_HOME = "${config.xdg.cacheHome}/gradle";
|
|
||||||
MIX_ARCHIVES = "${config.xdg.cacheHome}/mix/archives";
|
|
||||||
MONO_GAC_PREFIX = "${config.xdg.cacheHome}/mono";
|
|
||||||
npm_config_cache = "${config.xdg.cacheHome}/npm";
|
|
||||||
PARALLEL_HOME = "${config.xdg.cacheHome}/parallel";
|
|
||||||
TERMINFO = "${config.xdg.configHome}/terminfo";
|
|
||||||
WINEPREFIX = "${config.xdg.stateHome}/wineprefix/default";
|
|
||||||
YARN_CACHE_FOLDER = "${config.xdg.cacheHome}/yarn";
|
|
||||||
# TODO Some of that stuff is not really relavant any more
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
@ -30,7 +12,6 @@ in
|
||||||
|
|
||||||
programs =
|
programs =
|
||||||
let
|
let
|
||||||
commonRc = lib.strings.concatLines (map (d: "mkdir -p ${d}") (builtins.attrValues direnv));
|
|
||||||
# TODO Those directory creations should probably done on home-manager activation
|
# TODO Those directory creations should probably done on home-manager activation
|
||||||
commonSessionVariables = {
|
commonSessionVariables = {
|
||||||
TIME_STYLE = "+%Y-%m-%d %H:%M:%S";
|
TIME_STYLE = "+%Y-%m-%d %H:%M:%S";
|
||||||
|
@ -46,22 +27,6 @@ in
|
||||||
# Fzf
|
# Fzf
|
||||||
FZF_COMPLETION_OPTS = "${lib.strings.concatStringsSep " " config.programs.fzf.fileWidgetOptions}";
|
FZF_COMPLETION_OPTS = "${lib.strings.concatStringsSep " " config.programs.fzf.fileWidgetOptions}";
|
||||||
};
|
};
|
||||||
treatsHomeAsJunk = [
|
|
||||||
# Programs that think $HOME is a reasonable place to put their junk
|
|
||||||
# and don't allow the user to change those questionable choices
|
|
||||||
"adb"
|
|
||||||
"audacity"
|
|
||||||
"binwalk" # Should use .config according to the GitHub code though
|
|
||||||
"cabal" # TODO May have options but last time I tried it it crashed
|
|
||||||
"cmake"
|
|
||||||
"ddd"
|
|
||||||
"ghidra"
|
|
||||||
"itch"
|
|
||||||
"simplescreenrecorder" # Easy fix https://github.com/MaartenBaert/ssr/blob/1556ae456e833992fb6d39d40f7c7d7c337a4160/src/Main.cpp#L252
|
|
||||||
"vd"
|
|
||||||
"wpa_cli"
|
|
||||||
# TODO Maybe we can do something about node-gyp
|
|
||||||
];
|
|
||||||
commonShellAliases = {
|
commonShellAliases = {
|
||||||
# Replacement commands
|
# Replacement commands
|
||||||
ls = "lsd";
|
ls = "lsd";
|
||||||
|
@ -96,7 +61,6 @@ in
|
||||||
|
|
||||||
# Give additional config to those programs, and not have them in my path
|
# Give additional config to those programs, and not have them in my path
|
||||||
bower = "bower --config.storage.packages=${config.xdg.cacheHome}/bower/packages --config.storage.registry=${config.xdg.cacheHome}/bower/registry --config.storage.links=${config.xdg.cacheHome}/bower/links";
|
bower = "bower --config.storage.packages=${config.xdg.cacheHome}/bower/packages --config.storage.registry=${config.xdg.cacheHome}/bower/registry --config.storage.links=${config.xdg.cacheHome}/bower/links";
|
||||||
gdb = "gdb -x ${config.xdg.configHome}/gdbinit";
|
|
||||||
iftop = "iftop -c ${config.xdg.configHome}/iftoprc";
|
iftop = "iftop -c ${config.xdg.configHome}/iftoprc";
|
||||||
lmms = "lmms --config ${config.xdg.configHome}/lmmsrc.xml";
|
lmms = "lmms --config ${config.xdg.configHome}/lmmsrc.xml";
|
||||||
|
|
||||||
|
@ -122,9 +86,7 @@ in
|
||||||
newestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | tail'';
|
newestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | tail'';
|
||||||
oldestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | head'';
|
oldestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | head'';
|
||||||
tracefiles = ''${pkgs.strace}/bin/strace -f -t -e trace=file'';
|
tracefiles = ''${pkgs.strace}/bin/strace -f -t -e trace=file'';
|
||||||
} // lib.attrsets.mergeAttrsList (map (p: { "${p}" = "HOME=${config.xdg.cacheHome}/junkhome ${p}"; }) treatsHomeAsJunk);
|
};
|
||||||
# TODO Maybe make nixpkg wrapper instead? So it also works from dmenu
|
|
||||||
# Could also accept my fate... Home-manager doesn't necessarily make it easy to put things out of the home directory
|
|
||||||
historySize = 100000;
|
historySize = 100000;
|
||||||
historyFile = "${config.xdg.stateHome}/shell_history";
|
historyFile = "${config.xdg.stateHome}/shell_history";
|
||||||
in
|
in
|
||||||
|
@ -133,13 +95,10 @@ in
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
bash = {
|
bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
bashrcExtra = lib.strings.concatLines [
|
bashrcExtra = ''
|
||||||
commonRc
|
shopt -s expand_aliases
|
||||||
''
|
shopt -s histappend
|
||||||
shopt -s expand_aliases
|
'';
|
||||||
shopt -s histappend
|
|
||||||
''
|
|
||||||
];
|
|
||||||
sessionVariables = commonSessionVariables;
|
sessionVariables = commonSessionVariables;
|
||||||
historySize = historySize;
|
historySize = historySize;
|
||||||
historyFile = historyFile;
|
historyFile = historyFile;
|
||||||
|
@ -153,10 +112,7 @@ in
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
syntaxHighlighting.enable = true;
|
syntaxHighlighting.enable = true;
|
||||||
historySubstringSearch.enable = true;
|
historySubstringSearch.enable = true;
|
||||||
initExtra = lib.strings.concatLines [
|
initExtra = builtins.readFile ./zshrc.sh;
|
||||||
commonRc
|
|
||||||
(builtins.readFile ./zshrc.sh)
|
|
||||||
];
|
|
||||||
defaultKeymap = "viins";
|
defaultKeymap = "viins";
|
||||||
history = {
|
history = {
|
||||||
size = historySize;
|
size = historySize;
|
||||||
|
@ -179,7 +135,8 @@ in
|
||||||
settings = {
|
settings = {
|
||||||
size = "short";
|
size = "short";
|
||||||
};
|
};
|
||||||
colors = { # Base16 only, so it reuses the current theme.
|
colors = {
|
||||||
|
# Base16 only, so it reuses the current theme.
|
||||||
date = { day-old = 4; hour-old = 6; older = 5; };
|
date = { day-old = 4; hour-old = 6; older = 5; };
|
||||||
git-status = { conflicted = 14; default = 13; deleted = 1; ignored = 13; modified = 3; new-in-index = 2; new-in-workdir = 2; renamed = 4; typechange = 3; unmodified = 13; };
|
git-status = { conflicted = 14; default = 13; deleted = 1; ignored = 13; modified = 3; new-in-index = 2; new-in-workdir = 2; renamed = 4; typechange = 3; unmodified = 13; };
|
||||||
group = 6;
|
group = 6;
|
||||||
|
@ -264,16 +221,6 @@ in
|
||||||
};
|
};
|
||||||
xdg = {
|
xdg = {
|
||||||
configFile = {
|
configFile = {
|
||||||
"ccache.conf" = {
|
|
||||||
text = "ccache_dir = ${config.xdg.cacheHome}/ccache";
|
|
||||||
};
|
|
||||||
"gdbinit" = {
|
|
||||||
text = ''
|
|
||||||
define hook-quit
|
|
||||||
set confirm off
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
"iftoprc" = {
|
"iftoprc" = {
|
||||||
text = ''
|
text = ''
|
||||||
port-resolution: no
|
port-resolution: no
|
||||||
|
@ -390,7 +337,7 @@ in
|
||||||
# Extra config
|
# Extra config
|
||||||
RXVT_SOCKET = "${config.xdg.stateHome}/urxvtd"; # Used to want -$HOME suffix, hopefullt this isn't needed
|
RXVT_SOCKET = "${config.xdg.stateHome}/urxvtd"; # Used to want -$HOME suffix, hopefullt this isn't needed
|
||||||
# XAUTHORITY = "${config.xdg.configHome}/Xauthority"; # Disabled as this causes lock-ups with DMs
|
# XAUTHORITY = "${config.xdg.configHome}/Xauthority"; # Disabled as this causes lock-ups with DMs
|
||||||
} // direnv;
|
};
|
||||||
# TODO Session variables only get reloaded on login I think.
|
# TODO Session variables only get reloaded on login I think.
|
||||||
sessionPath = [
|
sessionPath = [
|
||||||
"${config.home.homeDirectory}/.local/bin"
|
"${config.home.homeDirectory}/.local/bin"
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
../options.nix
|
../options.nix
|
||||||
./common.nix
|
./common.nix
|
||||||
./desktop
|
./desktop
|
||||||
./dev.nix
|
./dev
|
||||||
./extra.nix
|
./extra.nix
|
||||||
./gaming
|
./gaming
|
||||||
./git
|
./git
|
||||||
./gpg
|
./gpg
|
||||||
|
./homealone.nix
|
||||||
./rebuild
|
./rebuild
|
||||||
./ssh.nix
|
./ssh.nix
|
||||||
./style.nix
|
./style.nix
|
||||||
|
|
67
hm/dev.nix
67
hm/dev.nix
|
@ -1,67 +0,0 @@
|
||||||
{ pkgs, config, ... }: {
|
|
||||||
# TODO Maybe should be per-directory dotenv
|
|
||||||
# Or not, for neovim
|
|
||||||
|
|
||||||
# Always on
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
# Common
|
|
||||||
perf-tools
|
|
||||||
jq
|
|
||||||
yq
|
|
||||||
universal-ctags
|
|
||||||
highlight
|
|
||||||
|
|
||||||
# Network
|
|
||||||
socat
|
|
||||||
dig
|
|
||||||
whois
|
|
||||||
nmap
|
|
||||||
tcpdump
|
|
||||||
|
|
||||||
# nix
|
|
||||||
nix
|
|
||||||
|
|
||||||
# Always on (graphical)
|
|
||||||
] ++ lib.optionals config.frogeye.desktop.xorg [
|
|
||||||
# Common
|
|
||||||
zeal-qt6 # Offline documentation
|
|
||||||
|
|
||||||
# Network
|
|
||||||
wireshark-qt
|
|
||||||
|
|
||||||
# Ansible
|
|
||||||
] ++ lib.optionals config.frogeye.dev.ansible [
|
|
||||||
ansible
|
|
||||||
ansible-lint
|
|
||||||
|
|
||||||
# C/C++
|
|
||||||
] ++ lib.optionals config.frogeye.dev.c [
|
|
||||||
cmake
|
|
||||||
clang
|
|
||||||
ccache
|
|
||||||
gdb
|
|
||||||
|
|
||||||
# Docker
|
|
||||||
] ++ lib.optionals config.frogeye.dev.docker [
|
|
||||||
docker
|
|
||||||
docker-compose
|
|
||||||
|
|
||||||
# FPGA
|
|
||||||
] ++ lib.optionals config.frogeye.dev.fpga [
|
|
||||||
verilog
|
|
||||||
|
|
||||||
] ++ lib.optionals (config.frogeye.dev.fpga && pkgs.stdenv.isx86_64) [
|
|
||||||
ghdl
|
|
||||||
|
|
||||||
# FPGA (graphical)
|
|
||||||
] ++ lib.optionals (config.frogeye.desktop.xorg && config.frogeye.dev.fpga) [
|
|
||||||
yosys
|
|
||||||
gtkwave
|
|
||||||
|
|
||||||
# Python
|
|
||||||
] ++ lib.optionals config.frogeye.dev.python [
|
|
||||||
python3Packages.ipython
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
|
40
hm/dev/c.nix
Normal file
40
hm/dev/c.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
{
|
||||||
|
config = lib.mkIf config.frogeye.dev.c {
|
||||||
|
frogeye = {
|
||||||
|
direnv = {
|
||||||
|
CCACHE_DIR = "${config.xdg.cacheHome}/ccache"; # The config file alone seems to be not enough
|
||||||
|
};
|
||||||
|
junkhome = [
|
||||||
|
"binwalk" # Should use .config according to the GitHub code though
|
||||||
|
"cmake"
|
||||||
|
"ddd"
|
||||||
|
"ghidra"
|
||||||
|
];
|
||||||
|
shellAliases = {
|
||||||
|
gdb = "gdb -x ${config.xdg.configHome}/gdbinit";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
binwalk
|
||||||
|
ccache
|
||||||
|
clang
|
||||||
|
cmake
|
||||||
|
ddd
|
||||||
|
gdb
|
||||||
|
];
|
||||||
|
programs.nixvim.extraPlugins = [ pkgs.vimPlugins.nvim-dap ]; # Debug Adapter Protocol client
|
||||||
|
xdg.configFile = {
|
||||||
|
"ccache.conf" = {
|
||||||
|
text = "ccache_dir = ${config.xdg.cacheHome}/ccache";
|
||||||
|
};
|
||||||
|
gdbinit = {
|
||||||
|
text = ''
|
||||||
|
define hook-quit
|
||||||
|
set confirm off
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
60
hm/dev/common.nix
Normal file
60
hm/dev/common.nix
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
{ pkgs, config, ... }: {
|
||||||
|
# TODO Maybe should be per-directory dotenv
|
||||||
|
# Or not, for neovim
|
||||||
|
config = {
|
||||||
|
# Always on
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# Common
|
||||||
|
perf-tools
|
||||||
|
jq
|
||||||
|
yq
|
||||||
|
universal-ctags
|
||||||
|
highlight
|
||||||
|
|
||||||
|
# Network
|
||||||
|
socat
|
||||||
|
dig
|
||||||
|
whois
|
||||||
|
nmap
|
||||||
|
tcpdump
|
||||||
|
|
||||||
|
# nix
|
||||||
|
nix
|
||||||
|
|
||||||
|
# Always on (graphical)
|
||||||
|
] ++ lib.optionals config.frogeye.desktop.xorg [
|
||||||
|
# Common
|
||||||
|
zeal-qt6 # Offline documentation
|
||||||
|
|
||||||
|
# Network
|
||||||
|
wireshark-qt
|
||||||
|
|
||||||
|
# Ansible
|
||||||
|
] ++ lib.optionals config.frogeye.dev.ansible [
|
||||||
|
ansible
|
||||||
|
ansible-lint
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
] ++ lib.optionals config.frogeye.dev.docker [
|
||||||
|
docker
|
||||||
|
docker-compose
|
||||||
|
|
||||||
|
# FPGA
|
||||||
|
] ++ lib.optionals config.frogeye.dev.fpga [
|
||||||
|
verilog
|
||||||
|
|
||||||
|
] ++ lib.optionals (config.frogeye.dev.fpga && pkgs.stdenv.isx86_64) [
|
||||||
|
ghdl
|
||||||
|
|
||||||
|
# FPGA (graphical)
|
||||||
|
] ++ lib.optionals (config.frogeye.desktop.xorg && config.frogeye.dev.fpga) [
|
||||||
|
yosys
|
||||||
|
gtkwave
|
||||||
|
|
||||||
|
# Python
|
||||||
|
] ++ lib.optionals config.frogeye.dev.python [
|
||||||
|
python3Packages.ipython
|
||||||
|
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
6
hm/dev/default.nix
Normal file
6
hm/dev/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{ pkgs, config, ... }: {
|
||||||
|
imports = [
|
||||||
|
./c.nix
|
||||||
|
./common.nix
|
||||||
|
];
|
||||||
|
}
|
|
@ -36,5 +36,4 @@
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
64
hm/homealone.nix
Normal file
64
hm/homealone.nix
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
frogeye = {
|
||||||
|
# TODO Move to relevant config file. Rest can probably removed.
|
||||||
|
direnv = {
|
||||||
|
CARGOHOME = "${config.xdg.cacheHome}/cargo"; # There are config in there that we can version if one want
|
||||||
|
DASHT_DOCSETS_DIR = "${config.xdg.cacheHome}/dash_docsets";
|
||||||
|
GOPATH = "${config.xdg.cacheHome}/go";
|
||||||
|
GRADLE_USER_HOME = "${config.xdg.cacheHome}/gradle";
|
||||||
|
MIX_ARCHIVES = "${config.xdg.cacheHome}/mix/archives";
|
||||||
|
MONO_GAC_PREFIX = "${config.xdg.cacheHome}/mono";
|
||||||
|
npm_config_cache = "${config.xdg.cacheHome}/npm";
|
||||||
|
PARALLEL_HOME = "${config.xdg.cacheHome}/parallel";
|
||||||
|
TERMINFO = "${config.xdg.configHome}/terminfo";
|
||||||
|
WINEPREFIX = "${config.xdg.stateHome}/wineprefix/default";
|
||||||
|
YARN_CACHE_FOLDER = "${config.xdg.cacheHome}/yarn";
|
||||||
|
};
|
||||||
|
junkhome = [
|
||||||
|
"adb"
|
||||||
|
"audacity"
|
||||||
|
"cabal" # TODO May have options but last time I tried it it crashed
|
||||||
|
"itch"
|
||||||
|
"simplescreenrecorder" # Easy fix https://github.com/MaartenBaert/ssr/blob/1556ae456e833992fb6d39d40f7c7d7c337a4160/src/Main.cpp#L252
|
||||||
|
"vd"
|
||||||
|
"wpa_cli"
|
||||||
|
# TODO Maybe we can do something about node-gyp
|
||||||
|
];
|
||||||
|
shellAliases = lib.attrsets.mergeAttrsList (map (p: { "${p}" = "HOME=${config.xdg.cacheHome}/junkhome ${p}"; }) config.frogeye.junkhome);
|
||||||
|
};
|
||||||
|
home = {
|
||||||
|
activation.createDirenvFolders = lib.hm.dag.entryAfter [ "writeBoundary" ]
|
||||||
|
(lib.strings.concatLines (map (d: "mkdir -p ${d}") (
|
||||||
|
(builtins.attrValues config.frogeye.direnv) ++ [ "${config.xdg.cacheHome}/junkhome" ]
|
||||||
|
)));
|
||||||
|
|
||||||
|
sessionVariables = config.frogeye.direnv;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
options.frogeye = {
|
||||||
|
direnv = lib.mkOption {
|
||||||
|
default = { };
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
DASHT_DOCSETS_DIR = "''${config.xdg.cacheHome}/dash_docsets";
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Environment variables for which the value is a folder that will be automatically created.
|
||||||
|
Useful for keeping programs data out of $HOME for programs that won't create the directory themselves.
|
||||||
|
'';
|
||||||
|
type = lib.types.attrsOf lib.types.str;
|
||||||
|
};
|
||||||
|
junkhome = lib.mkOption {
|
||||||
|
default = [ ];
|
||||||
|
description = ''
|
||||||
|
Program names that will be run with a different HOME so they don't clutter the real one.
|
||||||
|
Useful for programs that don't follow the XDG specification and tend to advertise themselves.
|
||||||
|
'';
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
};
|
||||||
|
# TODO Should make a nix package wrapper instead, so it also works from dmenu
|
||||||
|
};
|
||||||
|
}
|
|
@ -283,8 +283,6 @@ in
|
||||||
] ++ lib.optionals config.programs.pandoc.enable [
|
] ++ lib.optionals config.programs.pandoc.enable [
|
||||||
vim-pandoc # Pandoc-specific stuff because there's no LSP for it
|
vim-pandoc # Pandoc-specific stuff because there's no LSP for it
|
||||||
vim-pandoc-syntax
|
vim-pandoc-syntax
|
||||||
] ++ lib.optionals config.frogeye.dev.c [
|
|
||||||
nvim-dap # Debug Adapter Protocol client
|
|
||||||
] ++ lib.optionals config.frogeye.dev.ansible [
|
] ++ lib.optionals config.frogeye.dev.ansible [
|
||||||
ansible-vim # TODO Doesn't have snippets
|
ansible-vim # TODO Doesn't have snippets
|
||||||
];
|
];
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
php = lib.mkEnableOption "PHP dev stuff";
|
php = lib.mkEnableOption "PHP dev stuff";
|
||||||
python = lib.mkEnableOption "Python dev stuff";
|
python = lib.mkEnableOption "Python dev stuff";
|
||||||
};
|
};
|
||||||
shellAliases = lib.mkOption {
|
shellAliases = lib.mkOption { # TODO Just use bash option and copy it for zsh
|
||||||
default = { };
|
default = { };
|
||||||
example = lib.literalExpression ''
|
example = lib.literalExpression ''
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue