feat: add lib override with binary path validation
This commit is contained in:
parent
cd0c57a7e1
commit
be0c1d1b4b
11 changed files with 58 additions and 35 deletions
|
@ -32,7 +32,14 @@
|
|||
|
||||
};
|
||||
|
||||
lib = nixpkgs.lib;
|
||||
lib = nixpkgs.lib.extend (
|
||||
self: super: {
|
||||
my = import ./lib {
|
||||
inherit pkgs inputs;
|
||||
lib = self;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
mkSystem =
|
||||
{
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
shellAbbrs = {
|
||||
clip = "wl-copy";
|
||||
dp = "env --chdir ~/.dotfiles/ ${pkgs.dotter}/bin/dotter deploy -v";
|
||||
l = "eza -laa";
|
||||
ls = "eza -la";
|
||||
ll = "eza -l";
|
||||
|
@ -14,25 +13,31 @@
|
|||
cp = "cp -i";
|
||||
mv = "mv -i";
|
||||
};
|
||||
functions =
|
||||
let
|
||||
rf = builtins.readFile;
|
||||
in
|
||||
{
|
||||
gitignore = "curl -sL https://www.gitignore.io/api/$argv";
|
||||
nrun = "nix run nixpkgs#$argv[1] -- $argv[2..]";
|
||||
mv-bad-creation-date = ''exiftool -if 'not $CreateDate' -p '$FileName' "$PWD/$argv[1]" | xargs -I {} mv -i "$PWD/$argv[1]/{}" "$argv[2]"'';
|
||||
rename-images = rf ./rename_images.fish;
|
||||
fish_prompt = rf ./fish_prompt.fish;
|
||||
rebuild = ''
|
||||
env --chdir $HOME/.nixconf sudo nixos-rebuild switch --flake .#$(hostname) \
|
||||
&& ${pkgs.libnotify}/bin/notify-send nixos-rebuild "Rebuild complete" \
|
||||
-a nixos-rebuild \
|
||||
-i ${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg
|
||||
'';
|
||||
revert = ''
|
||||
env --chdir $HOME/.nixconf sudo nixos-rebuild switch --flake .#$(hostname) --rollback
|
||||
'';
|
||||
};
|
||||
functions = {
|
||||
gitignore = "curl -sL https://www.gitignore.io/api/$argv";
|
||||
nrun = "nix run nixpkgs#$argv[1] -- $argv[2..]";
|
||||
mv-bad-creation-date = ''
|
||||
${lib.my.checkPath pkgs.exiftool "exiftool"} -if 'not $CreateDate' -p '$FileName' "$PWD/$argv[1]" | xargs -I {} mv -i "$PWD/$argv[1]/{}" "$argv[2]"
|
||||
'';
|
||||
rename-images = ''
|
||||
set -f input "$PWD/$argv[1]"
|
||||
|
||||
if not test -d $input
|
||||
echo "input is not a directory"
|
||||
else
|
||||
${lib.my.checkPath pkgs.exiftool "exiftool"} -if '$CreateDate' -p '$FileName' "$input" | xargs -I {} jhead -n%Y-%m-%d-%H%M%S "$input/{}"
|
||||
end
|
||||
'';
|
||||
fish_prompt = builtins.readFile ./fish_prompt.fish;
|
||||
rebuild = ''
|
||||
env --chdir $HOME/.nixconf sudo nixos-rebuild switch --flake .#$(hostname) \
|
||||
&& ${lib.my.checkPath pkgs.libnotify "notify-send"} nixos-rebuild "Rebuild complete" \
|
||||
-a nixos-rebuild \
|
||||
-i ${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg
|
||||
'';
|
||||
revert = ''
|
||||
env --chdir $HOME/.nixconf sudo nixos-rebuild switch --flake .#$(hostname) --rollback
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
set -f input "$PWD/$argv[1]"
|
||||
|
||||
if not test -d $input
|
||||
echo "input is not a directory"
|
||||
else
|
||||
exiftool -if '$CreateDate' -p '$FileName' "$input" | xargs -I {} jhead -n%Y-%m-%d-%H%M%S "$input/{}"
|
||||
end
|
|
@ -137,7 +137,7 @@ lib.mkIf osConfig.programs.hyprland.enable {
|
|||
#"$mod, S, exec, rofi -show clipboard -show-icons"
|
||||
"$mod SHIFT, Q, killactive,"
|
||||
"$mod SHIFT, P, exec, rofi -show p -modi p:${pkgs.rofi-power-menu}/bin/rofi-power-menu"
|
||||
"$mod, P, exec, cliphist wipe & ${pkgs.hyprlock}/bin/hyprlock"
|
||||
"$mod, P, exec, ${pkgs.cliphist}/bin/cliphist wipe & ${pkgs.hyprlock}/bin/hyprlock"
|
||||
"$mod SHIFT, C, exec, hyprctl reload"
|
||||
"$mod, left, movefocus, l"
|
||||
"$mod, right, movefocus, r"
|
||||
|
|
|
@ -60,8 +60,7 @@
|
|||
mod = config.wayland.windowManager.sway.config.modifier;
|
||||
in
|
||||
lib.mkOptionDefault {
|
||||
# TODO: Update to use nixpkgs version of cliphist
|
||||
"${mod}+p" = "exec cliphist wipe & ${pkgs.swaylock}/bin/swaylock";
|
||||
"${mod}+p" = "exec ${pkgs.cliphist}/bin/cliphist wipe & ${pkgs.swaylock}/bin/swaylock";
|
||||
"${mod}+Shift+p" = "exec rofi -show p -modi p:${pkgs.rofi-power-menu}/bin/rofi-power-menu";
|
||||
# Reload the config file
|
||||
"${mod}+Shift+c" = "reload";
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
}
|
||||
|
||||
* {
|
||||
font-family: "DejaVuSansMNerdFont-Regular";
|
||||
font-family: "NotoSerifNerdFont-Regular";
|
||||
border: none;
|
||||
opacity: 50;
|
||||
border-radius: 10px;
|
||||
|
|
|
@ -80,6 +80,9 @@
|
|||
};
|
||||
};
|
||||
|
||||
# Necessary for Nautilus to display trash, DVDs and for gnome-disk-utility to show file systems
|
||||
services.gvfs.enable = true;
|
||||
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
enableSSHSupport = true;
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
lazygit
|
||||
fd
|
||||
ripgrep
|
||||
wl-clipboard
|
||||
|
||||
custom.scripts.nixedit
|
||||
];
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
fd
|
||||
ripgrep
|
||||
swaybg
|
||||
wl-clipboard
|
||||
|
||||
custom.scripts.screenshot
|
||||
custom.scripts.nixedit
|
||||
|
|
12
lib/default.nix
Normal file
12
lib/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
|
||||
# Verify the existence of a binary inside of a derivation.
|
||||
# Returns the path to the binary or throws.
|
||||
checkPath =
|
||||
pkg: bin:
|
||||
let
|
||||
abs = lib.getExe' pkg bin;
|
||||
in
|
||||
if builtins.pathExists abs then abs else throw "${abs} does not exist.";
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
# Reference https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265
|
||||
# References:
|
||||
# https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265
|
||||
# https://github.com/gvolpe/nix-config/blob/6feb7e4f47e74a8e3befd2efb423d9232f522ccd/home/programs/browsers/firefox.nix
|
||||
{ lib, config, ... }:
|
||||
lib.mkIf config.programs.firefox.enable {
|
||||
programs.firefox = {
|
||||
|
|
Loading…
Add table
Reference in a new issue