2022-07-15 13:11:54 +02:00
|
|
|
{ config
|
|
|
|
, lib
|
|
|
|
, pkgs
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
|
|
|
with lib;
|
2023-02-24 12:04:53 +01:00
|
|
|
let
|
2023-08-26 11:35:11 +02:00
|
|
|
nom-system = pkgs.writeFishApplication {
|
2023-02-24 12:04:53 +01:00
|
|
|
name = "nom-system";
|
|
|
|
runtimeInputs = with pkgs; [ nix-output-monitor ];
|
2023-08-26 11:35:11 +02:00
|
|
|
text = /* fish */ ''
|
|
|
|
nom build --no-link "/home/moritz/.dotfiles#nixosConfigurations.$(hostname).config.system.build.toplevel" $argv
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
nom-system-command = name: command: pkgs.writeFishApplication {
|
|
|
|
inherit name;
|
|
|
|
runtimeInputs = with pkgs; [ nom-system nix ];
|
|
|
|
text = /* fish */ ''
|
|
|
|
nom-system $argv && ${command}
|
2023-02-24 12:04:53 +01:00
|
|
|
'';
|
|
|
|
};
|
2023-07-15 12:46:53 +02:00
|
|
|
|
|
|
|
f = pkgs.writeFishApplication {
|
|
|
|
name = "f";
|
|
|
|
runtimeInputs = with pkgs; [ fzf bat ];
|
2023-08-26 11:43:29 +02:00
|
|
|
text = /* fish */ ''
|
|
|
|
fzf --query "$argv" \
|
|
|
|
--multi \
|
|
|
|
--bind "enter:become($EDITOR {+})" \
|
|
|
|
--preview "bat --color=always --style=header,grid --line-range :500 {+}"
|
2023-07-15 12:46:53 +02:00
|
|
|
'';
|
|
|
|
};
|
2023-08-26 11:37:18 +02:00
|
|
|
|
2023-08-26 11:43:56 +02:00
|
|
|
which-nix = pkgs.writeFishApplication {
|
|
|
|
name = "which-nix";
|
2023-09-10 15:07:55 +02:00
|
|
|
runtimeInputs = with pkgs; [ which coreutils-full procps ];
|
2023-08-26 11:43:56 +02:00
|
|
|
text = /* fish */ ''
|
2023-09-10 15:07:55 +02:00
|
|
|
function recurse -a path;
|
|
|
|
if not test -f "$path"
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
echo $path
|
|
|
|
if test -L $path
|
|
|
|
recurse (readlink $path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for arg in $argv
|
|
|
|
recurse (which $arg)
|
|
|
|
end
|
2023-08-26 11:43:56 +02:00
|
|
|
'';
|
|
|
|
completions = /* fish */ ''
|
|
|
|
complete -c which-nix -fa '(__fish_complete_command)'
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-09-10 15:07:55 +02:00
|
|
|
gi = pkgs.writeFishApplication {
|
|
|
|
name = "gi";
|
|
|
|
runtimeInputs = with pkgs; [ fzf gum curl ];
|
|
|
|
text = /* fish */ ''
|
|
|
|
set url https://www.gitignore.io/api
|
2023-08-26 11:37:18 +02:00
|
|
|
|
2023-09-10 15:07:55 +02:00
|
|
|
if test (count $argv) -eq 0
|
|
|
|
set choice ( curl -sL $url/list \
|
|
|
|
| string split "," \
|
|
|
|
| fzf -m \
|
|
|
|
| string join "," )
|
|
|
|
else
|
|
|
|
set choice (string join "," $argv[1..])
|
|
|
|
end
|
2023-08-26 11:37:18 +02:00
|
|
|
|
2023-09-10 15:07:55 +02:00
|
|
|
if gum confirm "Overwrite current .gitignore?"
|
|
|
|
curl -sL $url/$choice > .gitignore
|
|
|
|
else
|
|
|
|
curl -sL $url/$choice >> .gitignore
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
completions = /* fish */ ''
|
|
|
|
set args (curl -sL https://www.gitignore.io/api/list | string split ",")
|
|
|
|
complete -c gi -fa "$args"
|
|
|
|
'';
|
|
|
|
};
|
2023-02-24 12:04:53 +01:00
|
|
|
in
|
2022-07-15 13:11:54 +02:00
|
|
|
{
|
|
|
|
users.users.moritz = {
|
|
|
|
isNormalUser = true;
|
|
|
|
home = "/home/moritz";
|
2022-10-06 20:19:59 +02:00
|
|
|
extraGroups = [ "wheel" "networkmanager" "video" ];
|
2022-07-15 13:11:54 +02:00
|
|
|
initialPassword = "password"; #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
|
|
};
|
|
|
|
|
|
|
|
time.timeZone = "Europe/Berlin";
|
|
|
|
|
|
|
|
my = {
|
2022-10-15 20:00:09 +02:00
|
|
|
bin.enable = true;
|
2022-07-15 13:11:54 +02:00
|
|
|
shell = {
|
|
|
|
abbreviations = {
|
|
|
|
us = "systemctl --user";
|
2022-10-09 20:49:35 +02:00
|
|
|
rs = "sudo systemctl";
|
2022-07-15 13:11:54 +02:00
|
|
|
};
|
|
|
|
aliases = {
|
|
|
|
ls = "exa -lh --icons --git";
|
|
|
|
cat = "bat";
|
|
|
|
rm = "rm -i";
|
|
|
|
mv = "mv -i";
|
2023-08-10 18:40:07 +02:00
|
|
|
cd = "__zoxide_z";
|
2022-07-15 13:11:54 +02:00
|
|
|
|
2023-01-01 15:28:13 +01:00
|
|
|
nixos-update = "pushd ~/.dotfiles && nix flake update && popd";
|
2022-07-15 13:11:54 +02:00
|
|
|
|
|
|
|
latexwatch = ''find -type f -name "*.tex" | entr -c latexmk -pdf -silent'';
|
|
|
|
};
|
|
|
|
variables = { EDITOR = "vim"; };
|
|
|
|
};
|
2022-08-20 14:21:15 +02:00
|
|
|
programs = {
|
2022-10-15 20:00:09 +02:00
|
|
|
direnv.enable = true;
|
2022-10-09 20:51:45 +02:00
|
|
|
fish.enable = true;
|
2022-10-15 20:00:09 +02:00
|
|
|
git.enable = true;
|
|
|
|
gpg.enable = true;
|
2023-05-07 13:59:01 +02:00
|
|
|
nix = {
|
|
|
|
gc.enable = true;
|
|
|
|
optimise.enable = true;
|
|
|
|
};
|
2023-04-25 18:55:15 +02:00
|
|
|
tmux.enable = true;
|
2023-04-28 08:11:44 +02:00
|
|
|
tmux.keybinds = {
|
|
|
|
prefix = {
|
|
|
|
"-" = "split-window -v";
|
|
|
|
"|" = "split-window -h";
|
|
|
|
"C-l" = "send-keys C-l";
|
|
|
|
"R" = "source-file $XDG_CONFIG_HOME/tmux/tmux.conf \\; display-message 'Reloaded tmux.conf'";
|
|
|
|
};
|
|
|
|
copy-mode-vi = {
|
|
|
|
"v" = "send -X begin-selection";
|
|
|
|
"V" = "send -X select-line";
|
|
|
|
"C-v" = "send -X rectangle-toggle";
|
|
|
|
};
|
|
|
|
};
|
2022-08-20 14:21:15 +02:00
|
|
|
};
|
2022-07-15 13:11:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
console.keyMap = "de";
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
# archives
|
2023-05-27 11:58:10 +02:00
|
|
|
ouch
|
2022-07-15 13:11:54 +02:00
|
|
|
|
|
|
|
# file management
|
|
|
|
trash-cli
|
|
|
|
|
|
|
|
# monitoring
|
|
|
|
htop
|
|
|
|
bottom
|
|
|
|
|
|
|
|
# nix
|
2023-08-26 11:35:11 +02:00
|
|
|
(nom-system-command "nixos-boot" "sudo nixos-rebuild boot --flake ~/.dotfiles")
|
|
|
|
(nom-system-command "nixos-switch" "sudo nixos-rebuild switch --flake ~/.dotfiles")
|
2023-09-10 13:35:01 +02:00
|
|
|
(nom-system-command "nixos-test" "sudo nixos-rebuild test --flake ~/.dotfiles")
|
2023-08-26 11:43:56 +02:00
|
|
|
manix
|
2022-07-15 13:11:54 +02:00
|
|
|
nix-index
|
2023-08-26 11:43:56 +02:00
|
|
|
nix-output-monitor
|
2022-07-15 13:11:54 +02:00
|
|
|
nixpkgs-fmt
|
|
|
|
statix
|
2023-08-26 11:43:56 +02:00
|
|
|
which-nix
|
2022-07-15 13:11:54 +02:00
|
|
|
|
|
|
|
# other
|
|
|
|
bat
|
|
|
|
cht-sh
|
|
|
|
du-dust
|
|
|
|
duf
|
|
|
|
entr
|
|
|
|
exa
|
2023-08-26 11:37:18 +02:00
|
|
|
f
|
|
|
|
gi
|
2022-07-15 13:11:54 +02:00
|
|
|
gparted
|
|
|
|
neofetch
|
2023-04-25 19:50:28 +02:00
|
|
|
reptyr
|
2022-12-23 12:40:37 +01:00
|
|
|
ripgrep
|
2022-07-15 13:11:54 +02:00
|
|
|
up
|
2023-08-26 11:37:18 +02:00
|
|
|
vim
|
2022-07-15 13:11:54 +02:00
|
|
|
viu
|
|
|
|
wget
|
|
|
|
];
|
|
|
|
|
2023-08-17 16:26:21 +02:00
|
|
|
fonts.packages = with pkgs; [
|
2022-07-15 13:11:54 +02:00
|
|
|
(nerdfonts.override {
|
2022-12-23 12:40:37 +01:00
|
|
|
fonts = [ "FiraCode" ];
|
2022-07-15 13:11:54 +02:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
programs = {
|
|
|
|
mtr.enable = true;
|
|
|
|
command-not-found.enable = true;
|
2022-11-24 13:47:48 +01:00
|
|
|
starship.enable = true;
|
2022-07-15 13:11:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
|
|
|
sshd.enable = true; # for agenix
|
|
|
|
btrfs.autoScrub.enable =
|
|
|
|
lib.mkDefault
|
|
|
|
(builtins.any (filesystem: filesystem.fsType == "btrfs")
|
|
|
|
(builtins.attrValues config.fileSystems));
|
|
|
|
};
|
|
|
|
|
2022-10-09 20:49:35 +02:00
|
|
|
i18n.extraLocaleSettings = {
|
2023-01-28 13:46:23 +01:00
|
|
|
# LC_NUMERIC = "de_DE.UTF-8";
|
2022-10-09 20:49:35 +02:00
|
|
|
LC_PAPER = "de_DE.UTF-8";
|
|
|
|
LC_TIME = "de_DE.UTF-8";
|
|
|
|
};
|
|
|
|
|
2022-07-15 13:11:54 +02:00
|
|
|
home-manager.users.moritz = {
|
|
|
|
programs = {
|
|
|
|
# Let Home Manager install and manage itself.
|
|
|
|
home-manager.enable = true;
|
2023-03-18 06:14:11 +01:00
|
|
|
fzf = {
|
|
|
|
enable = true;
|
|
|
|
defaultOptions = [
|
|
|
|
"--height 50%"
|
2023-07-04 11:46:02 +02:00
|
|
|
"--bind alt-j:preview-down,alt-k:preview-up"
|
2023-03-18 06:14:11 +01:00
|
|
|
];
|
|
|
|
};
|
2023-08-10 18:40:07 +02:00
|
|
|
zoxide = {
|
|
|
|
enable = true;
|
|
|
|
options = [
|
|
|
|
"--cmd c"
|
|
|
|
];
|
|
|
|
};
|
2022-07-15 13:11:54 +02:00
|
|
|
};
|
|
|
|
home = {
|
|
|
|
username = "moritz";
|
|
|
|
homeDirectory = "/home/moritz";
|
|
|
|
stateVersion = "21.05";
|
|
|
|
};
|
|
|
|
xdg.userDirs.enable = true;
|
|
|
|
};
|
2023-02-20 19:04:38 +01:00
|
|
|
|
|
|
|
system.activationScripts.diff = ''
|
|
|
|
if [ -e /run/current-system ]; then
|
|
|
|
${pkgs.nvd}/bin/nvd --nix-bin-dir ${pkgs.nix}/bin diff /run/current-system/ "$systemConfig"
|
|
|
|
fi
|
|
|
|
'';
|
2022-07-15 13:11:54 +02:00
|
|
|
}
|