+10
.editorconfig
+10
.editorconfig
+1
-1
.github/CODEOWNERS
+1
-1
.github/CODEOWNERS
+16
external/scripts/ff.sh
+16
external/scripts/ff.sh
···
1
+
#! /usr/bin/env bash
2
+
3
+
set -eo pipefail
4
+
5
+
if [[ -n $FF_SKIP ]]; then
6
+
FF_SKIP=
7
+
exit 0
8
+
fi
9
+
10
+
if [[ -n $FF_NO_KITGET ]] || [[ ! $(kitget --square -o "$kitget_output" &>/dev/null) ]]; then
11
+
fastfetch --logo nixos_small --logo-padding-top 3 "$@"
12
+
else
13
+
kitget_output="/tmp/$(date +%s)"
14
+
fastfetch --kitty "$kitget_output" "$@"
15
+
rm -f "$kitget_output"
16
+
fi
+58
external/scripts/nix-shell-generate.sh
+58
external/scripts/nix-shell-generate.sh
···
1
+
#! /usr/bin/env bash
2
+
3
+
# Copyright (c) 2025 Sebaguardian
4
+
5
+
set -euo pipefail
6
+
7
+
nix-shell-generate() {
8
+
local filename=${filename:-shell.nix}
9
+
10
+
if [[ -e $filename ]]; then
11
+
echo "$filename already exists"
12
+
return 1
13
+
fi
14
+
15
+
cat >"$filename" <<'EOF'
16
+
{
17
+
pkgs ? import <nixpkgs> { },
18
+
}:
19
+
20
+
let
21
+
mainPkg = if builtins.pathExists ./default.nix then pkgs.callPackage ./default.nix { } else { };
22
+
EOF
23
+
24
+
if [[ $# -eq 0 ]]; then
25
+
echo -n ' pkgInputs = [ ] ' >>"$filename"
26
+
else
27
+
{
28
+
echo " pkgInputs ="
29
+
echo " with pkgs;"
30
+
echo " ["
31
+
for pkg in "$@"; do
32
+
echo " $pkg"
33
+
done
34
+
echo " ]"
35
+
echo -n " "
36
+
} >>"$filename"
37
+
fi
38
+
39
+
cat >>"$filename" <<'EOF'
40
+
++ (mainPkg.nativeBuildInputs or [ ]);
41
+
in
42
+
pkgs.mkShell {
43
+
packages = pkgInputs;
44
+
45
+
shellHook = ''
46
+
echo -ne "-----------------------------------\n "
47
+
48
+
echo -n "${toString (map (pkg: "• ${pkg.name}\n") pkgInputs)}"
49
+
50
+
echo "-----------------------------------"
51
+
'';
52
+
}
53
+
EOF
54
+
55
+
echo "$filename generated"
56
+
}
57
+
58
+
nix-shell-generate "$@"
+11
external/scripts/nixdev.sh
+11
external/scripts/nixdev.sh
+6
external/scripts/shreddir.sh
+6
external/scripts/shreddir.sh
+4
-37
external/zsh/functions.zsh
+4
-37
external/zsh/functions.zsh
···
1
-
function shreddir() {
2
-
find "$1" -type f -exec shred -uvz {} \; rm -rf "$1"
3
-
}
4
-
5
-
function nixrs() {
6
-
sudo nixos-rebuild switch --flake ~/dotfiles\#$(hostname)
7
-
}
8
-
9
-
function nixdev() {
10
-
export FF_SKIP=1
11
-
12
-
if [ $(nix flake show | grep 'devShells') ]; then
13
-
nix develop -c zsh
14
-
else
15
-
nix-shell --run zsh $@
16
-
fi
17
-
}
18
-
19
1
function nixpkgs-build() {
20
2
nix-build -E "with import <nixpkgs> {}; callPackage ./$1 {}"
21
3
}
···
25
7
}
26
8
27
9
function cd() {
28
-
{ z "$@" 2>/dev/null && lsd -hN; } || { echo "dir \e[91m$*\e[0m not found!! \e[91mSTUPID! BONK!\e[0m :3"; return 1; }
10
+
{ z "$@" 2>/dev/null && lsd -hN; } || {
11
+
echo "dir \e[91m$*\e[0m not found!! \e[91mSTUPID! BONK!\e[0m :3"
12
+
return 1
13
+
}
29
14
}
30
15
31
16
function command_not_found_handler() {
32
17
echo "command \e[91m$1\e[0m not found!! \e[91mSTUPID! BONK!\e[0m :3"
33
18
return 127
34
19
}
35
-
36
-
. "$DOTFILES/external/zsh/nix-shell-generate.zsh"
37
-
38
-
function ff() {
39
-
if [ -n "$FF_SKIP" ]; then
40
-
FF_SKIP=
41
-
return
42
-
fi
43
-
44
-
kitget_output="/tmp/$(date +%s)"
45
-
if [ -n "$FF_NO_KITGET" ] || ! $(kitget --square -o "$kitget_output" &> /dev/null); then
46
-
fastfetch --logo nixos_small --logo-padding-top 3 "$@"
47
-
else
48
-
fastfetch --kitty "$kitget_output" "$@"
49
-
fi
50
-
51
-
rm -f "$kitget_output"
52
-
}
-50
external/zsh/nix-shell-generate.zsh
-50
external/zsh/nix-shell-generate.zsh
···
1
-
# Copyright (c) 2025 Sebaguardian
2
-
3
-
function nix-shell-generate() {
4
-
if [ -z "$filename" ]; then
5
-
filename='shell.nix'
6
-
fi
7
-
8
-
if [ -e "$filename" ]; then
9
-
echo "$filename already exists"
10
-
return 1
11
-
fi
12
-
13
-
touch "$filename"
14
-
{ tee "$filename" << EOF
15
-
{
16
-
pkgs ? import <nixpkgs> { },
17
-
}:
18
-
19
-
let
20
-
mainPkg = if builtins.pathExists ./default.nix then pkgs.callPackage ./default.nix { } else { };
21
-
EOF
22
-
} > /dev/null
23
-
24
-
if [ "$#" -eq 0 ]; then
25
-
echo -n ' pkgInputs = [ ] ' >> "$filename"
26
-
else
27
-
echo -e " pkgInputs =\n with pkgs;\n [" >> "$filename"
28
-
printf " %s\n" "$@" >> "$filename"
29
-
echo -ne " ]\n " >> "$filename"
30
-
fi
31
-
32
-
{ tee -a "$filename" << EOF
33
-
++ (mainPkg.nativeBuildInputs or [ ]);
34
-
in
35
-
pkgs.mkShell {
36
-
packages = pkgInputs;
37
-
38
-
shellHook = ''
39
-
echo -ne "-----------------------------------\\n "
40
-
41
-
echo -n "\${toString (map (pkg: "• \${pkg.name}\\n") pkgInputs)}"
42
-
43
-
echo "-----------------------------------"
44
-
'';
45
-
}
46
-
EOF
47
-
} > /dev/null
48
-
49
-
echo "$filename generated"
50
-
}
+1
-1
flake.nix
+1
-1
flake.nix
+32
formatter.nix
+32
formatter.nix
···
1
+
{ pkgs }:
2
+
3
+
pkgs.treefmt.withConfig {
4
+
runtimeInputs = with pkgs; [
5
+
nixfmt-rfc-style
6
+
shfmt
7
+
];
8
+
9
+
settings = {
10
+
on-unmatched = "info";
11
+
tree-root-file = "flake.nix";
12
+
13
+
formatter = {
14
+
nixfmt = {
15
+
command = "nixfmt";
16
+
includes = [ "*.nix" ];
17
+
};
18
+
19
+
shfmt = {
20
+
command = "shfmt";
21
+
options = [
22
+
"-w"
23
+
];
24
+
includes = [
25
+
"*.sh"
26
+
# "*.zsh" # https://github.com/mvdan/sh/issues/120
27
+
"*.bash"
28
+
];
29
+
};
30
+
};
31
+
};
32
+
}
+2
-1
home/adam.nix
+2
-1
home/adam.nix
+2
home/modules/programs/zsh.nix
+2
home/modules/programs/zsh.nix
+14
home/modules/scripts.nix
+14
home/modules/scripts.nix
···
1
+
let
2
+
scripts = ../../external/scripts;
3
+
in
4
+
{
5
+
home.file = builtins.listToAttrs (
6
+
map (name: {
7
+
name = ".local/bin/${builtins.replaceStrings [ ".sh" ] [ "" ] name}";
8
+
value = {
9
+
source = scripts + "/${name}";
10
+
executable = true;
11
+
};
12
+
}) (builtins.attrNames (builtins.readDir scripts))
13
+
);
14
+
}
+5
-13
home/modules/xdg.nix
+5
-13
home/modules/xdg.nix
···
1
-
{ config, ... }:
2
-
3
1
let
4
-
dotfiles = "${config.home.homeDirectory}/dotfiles/external/config";
5
-
create_symlink = path: config.lib.file.mkOutOfStoreSymlink path;
6
-
7
-
configs = {
8
-
hypr = "hypr";
9
-
fastfetch = "fastfetch";
10
-
lsd = "lsd";
11
-
};
2
+
configs = ../../external/config;
12
3
in
13
4
{
14
5
xdg.mimeApps.enable = true;
15
-
xdg.configFile = builtins.mapAttrs (name: subpath: {
16
-
source = create_symlink "${dotfiles}/${subpath}";
6
+
7
+
xdg.configFile = builtins.mapAttrs (name: _: {
8
+
source = configs + "/${name}";
17
9
recursive = true;
18
-
}) configs;
10
+
}) (builtins.readDir configs);
19
11
}