Auto: cleanup-2026-05-24T10-18-36Z

This commit is contained in:
2026-05-24 12:18:49 +02:00
parent 4dc460dc0c
commit 16c01a5e67
71 changed files with 1770 additions and 1731 deletions
+23 -23
View File
@@ -23,28 +23,28 @@
}; };
import-tree.url = "github:vic/import-tree"; # imports ./modules recursively import-tree.url = "github:vic/import-tree"; # imports ./modules recursively
}; };
outputs = inputs @ { flake-parts, ... }: outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake { inherit inputs; } flake-parts.lib.mkFlake {inherit inputs;}
({ ({
flake = let flake = let
system = "x86_64-linux"; system = "x86_64-linux";
unfreePkgs = [ unfreePkgs = [
"hplip" "hplip"
"vivify.vim" "vivify.vim"
"cheatsheet.nvim" "cheatsheet.nvim"
]; ];
mkUnfreePredicate = pkg: mkUnfreePredicate = pkg:
builtins.elem (inputs.nixpkgs.lib.getName pkg) unfreePkgs; builtins.elem (inputs.nixpkgs.lib.getName pkg) unfreePkgs;
mkPkgs = nixpkgsInput: mkPkgs = nixpkgsInput:
import nixpkgsInput { import nixpkgsInput {
inherit system; inherit system;
config.allowUnfreePredicate = mkUnfreePredicate; config.allowUnfreePredicate = mkUnfreePredicate;
};
pkgs = mkPkgs inputs.nixpkgs;
pkgs-unstable = mkPkgs inputs.nixpkgs-unstable;
in {
inherit pkgs pkgs-unstable;
}; };
pkgs = mkPkgs inputs.nixpkgs; }
pkgs-unstable = mkPkgs inputs.nixpkgs-unstable; // (inputs.import-tree ./modules));
in { }
inherit pkgs pkgs-unstable;
};
}
// (inputs.import-tree ./modules));
}
+52 -52
View File
@@ -1,58 +1,58 @@
{ ... }: { _: {
flake.nixosModules.anki = { pkgs, ... }: { flake.nixosModules.anki = {pkgs, ...}: {
environment.systemPackages = [ environment.systemPackages = [
(pkgs.anki.withAddons [ (pkgs.anki.withAddons [
(pkgs.ankiAddons.recolor.withConfig { (pkgs.ankiAddons.recolor.withConfig {
config = { config = {
# we must specify all the colors or it crashes as this overwrite the whole colors set # we must specify all the colors or it crashes as this overwrite the whole colors set
colors = { colors = {
# ===== Foregrounds ===== # ===== Foregrounds =====
FG = ["Foreground" "#ebdbb2" "#ebdbb2" ""]; FG = ["Foreground" "#ebdbb2" "#ebdbb2" ""];
FG_SUBTLE = ["Subtle FG" "#d5c4a1" "#d5c4a1" ""]; FG_SUBTLE = ["Subtle FG" "#d5c4a1" "#d5c4a1" ""];
FG_FAINT = ["Faint FG" "#a89984" "#a89984" ""]; FG_FAINT = ["Faint FG" "#a89984" "#a89984" ""];
FG_DISABLED = ["Disabled FG" "#928374" "#928374" ""]; FG_DISABLED = ["Disabled FG" "#928374" "#928374" ""];
# ===== Main Background Layers ===== # ===== Main Background Layers =====
BG = ["Background" "#1d2021" "#1d2021" ""]; BG = ["Background" "#1d2021" "#1d2021" ""];
MAIN_BG = ["Main Background" "#1d2021" "#1d2021" ""]; MAIN_BG = ["Main Background" "#1d2021" "#1d2021" ""];
VIEW_BG = ["View Background" "#282828" "#282828" ""]; VIEW_BG = ["View Background" "#282828" "#282828" ""];
EDITOR_BG = ["Editor Background" "#282828" "#282828" ""]; EDITOR_BG = ["Editor Background" "#282828" "#282828" ""];
CANVAS = ["Canvas" "#282828" "#282828" ""]; CANVAS = ["Canvas" "#282828" "#282828" ""];
CANVAS_ELEVATED = ["Elevated Canvas" "#32302f" "#32302f" ""]; CANVAS_ELEVATED = ["Elevated Canvas" "#32302f" "#32302f" ""];
# ===== Tables & Lists ===== # ===== Tables & Lists =====
TABLE_BG = ["Table Background" "#282828" "#282828" ""]; TABLE_BG = ["Table Background" "#282828" "#282828" ""];
TABLE_ALT_BG = ["Table Alt Background" "#32302f" "#32302f" ""]; TABLE_ALT_BG = ["Table Alt Background" "#32302f" "#32302f" ""];
HEADER_BG = ["Header Background" "#3c3836" "#3c3836" ""]; HEADER_BG = ["Header Background" "#3c3836" "#3c3836" ""];
SELECTED_BG = ["Selected Background" "#504945" "#504945" ""]; SELECTED_BG = ["Selected Background" "#504945" "#504945" ""];
# ===== Borders ===== # ===== Borders =====
BORDER = ["Border" "#504945" "#504945" ""]; BORDER = ["Border" "#504945" "#504945" ""];
FAINT_BORDER = ["Faint Border" "#3c3836" "#3c3836" ""]; FAINT_BORDER = ["Faint Border" "#3c3836" "#3c3836" ""];
# ===== Buttons ===== # ===== Buttons =====
BUTTON_GRADIENT_START = ["Button Start" "#3c3836" "#3c3836" ""]; BUTTON_GRADIENT_START = ["Button Start" "#3c3836" "#3c3836" ""];
BUTTON_GRADIENT_END = ["Button End" "#3c3836" "#3c3836" ""]; BUTTON_GRADIENT_END = ["Button End" "#3c3836" "#3c3836" ""];
BUTTON_HOVER = ["Button Hover" "#665c54" "#665c54" ""]; BUTTON_HOVER = ["Button Hover" "#665c54" "#665c54" ""];
# ===== Accent & Links ===== # ===== Accent & Links =====
ACCENT = ["Accent" "#458588" "#458588" ""]; ACCENT = ["Accent" "#458588" "#458588" ""];
LINK = ["Link" "#83a598" "#83a598" ""]; LINK = ["Link" "#83a598" "#83a598" ""];
LINK_HOVER = ["Link Hover" "#8ec07c" "#8ec07c" ""]; LINK_HOVER = ["Link Hover" "#8ec07c" "#8ec07c" ""];
# ===== Status ===== # ===== Status =====
WARNING = ["Warning" "#fe8019" "#fe8019" ""]; WARNING = ["Warning" "#fe8019" "#fe8019" ""];
ERROR = ["Error" "#fb4934" "#fb4934" ""]; ERROR = ["Error" "#fb4934" "#fb4934" ""];
SUCCESS = ["Success" "#8ec07c" "#8ec07c" ""]; SUCCESS = ["Success" "#8ec07c" "#8ec07c" ""];
};
}; };
# version = { major = 3; minor = 1; }; };
# let nixpkgs handle the version # version = { major = 3; minor = 1; };
}) # let nixpkgs handle the version
]) })
]; ])
];
}; };
flake.homeModules.anki = { ... }: { flake.homeModules.anki = _: {
programs.anki = { programs.anki = {
# we enable system wide with nixpkgs because it offers some addon configuration. We just use this for some config # we enable system wide with nixpkgs because it offers some addon configuration. We just use this for some config
#enable = true; #enable = true;
+2 -2
View File
@@ -1,6 +1,6 @@
{ ... }: { _: {
# unused at the moment see ../hardware/battery.nix # unused at the moment see ../hardware/battery.nix
flake.homeModules.batsignal = { ... }: { flake.homeModules.batsignal = _: {
services.batsignal.enable = true; services.batsignal.enable = true;
}; };
} }
+33 -29
View File
@@ -1,12 +1,16 @@
{ self, ...}: { {self, ...}: {
flake.nixosModules.browsers = { pkgs, pkgs-unstable, ...}: { flake.nixosModules.browsers = {
pkgs,
pkgs-unstable,
...
}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
chromium # used only to flash the firmware on my framework laptop 16 (keyboard.frame.work) as only chromium based browser support webHID. chromium # used only to flash the firmware on my framework laptop 16 (keyboard.frame.work) as only chromium based browser support webHID.
pkgs-unstable.tor-browser pkgs-unstable.tor-browser
self.packages.${pkgs.system}.custom-librewolfprofiles self.packages.${pkgs.system}.custom-librewolfprofiles
]; ];
}; };
flake.homeModules.librewolf = { ... }: { flake.homeModules.librewolf = _: {
# adapted from https://github.com/contre95/dotfiles/blob/main/dotfiles/nixos/programs/librewolf.nix # adapted from https://github.com/contre95/dotfiles/blob/main/dotfiles/nixos/programs/librewolf.nix
home.sessionVariables = { home.sessionVariables = {
MOZ_ENABLE_WAYLAND = 1; MOZ_ENABLE_WAYLAND = 1;
@@ -45,7 +49,7 @@
"browser.toolbars.bookmarks.visibility" = "newtab"; # hide bookmarks toolbar; always, never, newtab "browser.toolbars.bookmarks.visibility" = "newtab"; # hide bookmarks toolbar; always, never, newtab
"browser.aboutConfig.showWarning" = false; # disable warning about about:config "browser.aboutConfig.showWarning" = false; # disable warning about about:config
"media.videocontrols.picture-in-picture.video-toggle.enabled" = false; # disable picture in picture button "media.videocontrols.picture-in-picture.video-toggle.enabled" = false; # disable picture in picture button
# Privacy # Privacy
"privacy.resistFingerprinting" = true; "privacy.resistFingerprinting" = true;
# "privacy.clearOnShutdown.cache" = false; # "privacy.clearOnShutdown.cache" = false;
@@ -69,12 +73,12 @@
"browser.contentblocking.category" = "standart"; # set tracking protection to standart to not interfer with adnauseam "browser.contentblocking.category" = "standart"; # set tracking protection to standart to not interfer with adnauseam
"dom.private-attribution.submission.enabled" = false; # stop doing dumb stuff mozilla "dom.private-attribution.submission.enabled" = false; # stop doing dumb stuff mozilla
"browser.protections_panel.infoMessage.seen" = true; # disable tracking protection info "browser.protections_panel.infoMessage.seen" = true; # disable tracking protection info
# Theme # Theme
"toolkit.legacyUserProfileCustomizations.stylesheets" = true; "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"svg.context-properties.content.enabled" = true; "svg.context-properties.content.enabled" = true;
"layout.css.color-mix.enabled" = true; "layout.css.color-mix.enabled" = true;
# Disable telemetry # Disable telemetry
"toolkit.telemetry.enabled" = false; "toolkit.telemetry.enabled" = false;
"toolkit.telemetry.unified" = false; "toolkit.telemetry.unified" = false;
@@ -90,7 +94,7 @@
"browser.newtabpage.activity-stream.telemetry" = false; "browser.newtabpage.activity-stream.telemetry" = false;
"toolkit.telemetry.shutdownPingSender.enabled" = false; "toolkit.telemetry.shutdownPingSender.enabled" = false;
"browser.newtabpage.activity-stream.feeds.telemetry" = false; "browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.tabs.loadInBackground" = true; # open new tab in background "browser.tabs.loadInBackground" = true; # open new tab in background
"browser.tabs.loadBookmarksInTabs" = true; # open bookmarks in new tab "browser.tabs.loadBookmarksInTabs" = true; # open bookmarks in new tab
"browser.tabs.warnOnOpen" = false; # don't warn when opening multiple tabs "browser.tabs.warnOnOpen" = false; # don't warn when opening multiple tabs
@@ -99,7 +103,7 @@
"browser.tabs.loadDivertedInBackground" = false; # open new tab in background "browser.tabs.loadDivertedInBackground" = false; # open new tab in background
"browser.tabs.warnOnCloseOtherTabs" = false; # don't warn when closing multiple tabs "browser.tabs.warnOnCloseOtherTabs" = false; # don't warn when closing multiple tabs
"browser.tabs.closeWindowWithLastTab" = false; # don't close window when last tab is closed "browser.tabs.closeWindowWithLastTab" = false; # don't close window when last tab is closed
# other # other
"media.autoplay.default" = 0; # enable autoplay on open "media.autoplay.default" = 0; # enable autoplay on open
"devtools.toolbox.host" = "right"; # move devtools to right "devtools.toolbox.host" = "right"; # move devtools to right
@@ -108,7 +112,7 @@
"media.rdd-vpx.enabled" = true; # enable hardware acceleration "media.rdd-vpx.enabled" = true; # enable hardware acceleration
"devtools.cache.disabled" = true; # disable caching in devtools "devtools.cache.disabled" = true; # disable caching in devtools
"media.ffmpeg.vaapi.enabled" = true; # enable hardware acceleration "media.ffmpeg.vaapi.enabled" = true; # enable hardware acceleration
# Fonts # Fonts
"font.size.fixed.x-western" = 15; "font.size.fixed.x-western" = 15;
"font.minimum-size.x-western" = 13; "font.minimum-size.x-western" = 13;
@@ -130,12 +134,12 @@
installation_mode = "normal_installed"; installation_mode = "normal_installed";
install_url = "https://addons.mozilla.org/firefox/downloads/latest/enhancer-for-youtube/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/enhancer-for-youtube/latest.xpi";
}; };
"sponsorBlocker@ajay.app" = { "sponsorBlocker@ajay.app" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
}; };
"adnauseam@rednoise.org" = { "adnauseam@rednoise.org" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/adnauseam/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/adnauseam/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
@@ -215,23 +219,23 @@
# }; # };
# "trackmenot@mrl.nyu.edu".settings = { # "trackmenot@mrl.nyu.edu".settings = {
# enabled = true; # enabled = true;
# # Query behavior # # Query behavior
# runAtStartup = true; # runAtStartup = true;
# useTab = false; # don't open visible tab # useTab = false; # don't open visible tab
# showQueries = false; # don't display fake queries # showQueries = false; # don't display fake queries
# # Frequency (seconds between bursts) # # Frequency (seconds between bursts)
# timeout = 600; # 10 minutes # timeout = 600; # 10 minutes
# burstEnabled = true; # burstEnabled = true;
# burstTimeout = 20; # burst interval # burstTimeout = 20; # burst interval
# burstCount = 5; # burstCount = 5;
# # Query source # # Query source
# useRssFeeds = true; # use dynamic trending feeds # useRssFeeds = true; # use dynamic trending feeds
# useUserQueries = false; # don't mix your real queries # useUserQueries = false; # don't mix your real queries
# useBlackList = true; # useBlackList = true;
# # Search engines to generate noise for # # Search engines to generate noise for
# searchEngines = { # searchEngines = {
# google = true; # google = true;
@@ -240,12 +244,12 @@
# baidu = false; # baidu = false;
# duckduckgo = false; # duckduckgo = false;
# }; # };
# # Logging # # Logging
# enableLogging = false; # enableLogging = false;
# }; # };
# "sponsorBlocker@ajay.app".settings = { # "sponsorBlocker@ajay.app".settings = {
# # Core behavior # # Core behavior
# isEnabled = true; # isEnabled = true;
# autoSkip = false; # autoSkip = false;
@@ -282,15 +286,15 @@
# actionType = 0; # actionType = 0;
# }; # };
# }; # };
# # Privacy # # Privacy
# disableTelemetry = true; # disableTelemetry = true;
# showDonationLink = false; # showDonationLink = false;
# # UX # # UX
# showUpsells = false; # showUpsells = false;
# hideSkipButtonPlayerControls = false; # hideSkipButtonPlayerControls = false;
# # Advanced # # Advanced
# useLocalCache = true; # useLocalCache = true;
# trackViewCount = false; # trackViewCount = false;
@@ -496,23 +500,23 @@
# }; # };
# "trackmenot@mrl.nyu.edu".settings = { # "trackmenot@mrl.nyu.edu".settings = {
# enabled = true; # enabled = true;
# # Query behavior # # Query behavior
# runAtStartup = true; # runAtStartup = true;
# useTab = false; # don't open visible tab # useTab = false; # don't open visible tab
# showQueries = false; # don't display fake queries # showQueries = false; # don't display fake queries
# # Frequency (seconds between bursts) # # Frequency (seconds between bursts)
# timeout = 600; # 10 minutes # timeout = 600; # 10 minutes
# burstEnabled = true; # burstEnabled = true;
# burstTimeout = 20; # burst interval # burstTimeout = 20; # burst interval
# burstCount = 5; # burstCount = 5;
# # Query source # # Query source
# useRssFeeds = true; # use dynamic trending feeds # useRssFeeds = true; # use dynamic trending feeds
# useUserQueries = false; # don't mix your real queries # useUserQueries = false; # don't mix your real queries
# useBlackList = true; # useBlackList = true;
# # Search engines to generate noise for # # Search engines to generate noise for
# searchEngines = { # searchEngines = {
# google = true; # google = true;
@@ -521,12 +525,12 @@
# baidu = false; # baidu = false;
# duckduckgo = false; # duckduckgo = false;
# }; # };
# # Logging # # Logging
# enableLogging = false; # enableLogging = false;
# }; # };
# "sponsorBlocker@ajay.app".settings = { # "sponsorBlocker@ajay.app".settings = {
# # Core behavior # # Core behavior
# isEnabled = true; # isEnabled = true;
# autoSkip = false; # autoSkip = false;
@@ -563,15 +567,15 @@
# actionType = 0; # actionType = 0;
# }; # };
# }; # };
# # Privacy # # Privacy
# disableTelemetry = true; # disableTelemetry = true;
# showDonationLink = false; # showDonationLink = false;
# # UX # # UX
# showUpsells = false; # showUpsells = false;
# hideSkipButtonPlayerControls = false; # hideSkipButtonPlayerControls = false;
# # Advanced # # Advanced
# useLocalCache = true; # useLocalCache = true;
# trackViewCount = false; # trackViewCount = false;
+3 -4
View File
@@ -1,17 +1,16 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.caelestia = { pkgs, ... }: { flake.nixosModules.caelestia = {pkgs, ...}: {
qt.enable = true; qt.enable = true;
# to resolve this https://wiki.nixos.org/wiki/Home_Manager#I_cannot_set_GNOME_or_Gtk_themes_via_Home_Manager # to resolve this https://wiki.nixos.org/wiki/Home_Manager#I_cannot_set_GNOME_or_Gtk_themes_via_Home_Manager
programs.dconf.enable = true; programs.dconf.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
self.packages.${pkgs.system}.qtbatticon self.packages.${pkgs.system}.qtbatticon
kdePackages.qtdeclarative # provides qmlls and other things kdePackages.qtdeclarative # provides qmlls and other things
quickshell # we have it but adding it there solves "WARN qt.qpa.services: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: App info not found for 'org.quickshell'")" quickshell # we have it but adding it there solves "WARN qt.qpa.services: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: App info not found for 'org.quickshell'")"
]; ];
}; };
flake.homeModules.caelestia = { ... }: let flake.homeModules.caelestia = _: let
sisyphe = ../../assets/sisyphe.gif; sisyphe = ../../assets/sisyphe.gif;
pepe-music = ../../assets/pepe-music.gif; pepe-music = ../../assets/pepe-music.gif;
in { in {
+4 -4
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.eza = { ... }: { flake.homeModules.eza = _: {
# ls replacement # ls replacement
# see ./zsh.nix for the alias (usefull to se default flags) # see ./zsh.nix for the alias (usefull to se default flags)
programs.eza = { programs.eza = {
@@ -8,7 +8,7 @@
theme = { theme = {
# from https://github.com/eza-community/eza-themes/blob/main/themes/gruvbox-dark.yml # from https://github.com/eza-community/eza-themes/blob/main/themes/gruvbox-dark.yml
colourful = true; colourful = true;
filekinds = { filekinds = {
normal = {foreground = "#ebdbb2";}; normal = {foreground = "#ebdbb2";};
directory = {foreground = "#83a598";}; directory = {foreground = "#83a598";};
@@ -103,7 +103,7 @@
header = {foreground = "#ebdbb2";}; header = {foreground = "#ebdbb2";};
octal = {foreground = "#8ec07c";}; octal = {foreground = "#8ec07c";};
flags = {foreground = "#d3869b";}; flags = {foreground = "#d3869b";};
symlink_path = {foreground = "#8ec07c";}; symlink_path = {foreground = "#8ec07c";};
control_char = {foreground = "#83a598";}; control_char = {foreground = "#83a598";};
broken_symlink = {foreground = "#fb4934";}; broken_symlink = {foreground = "#fb4934";};
+29 -29
View File
@@ -1,42 +1,42 @@
{ ... }: { _: {
flake.homeModules.fastfetch = { ... }: { flake.homeModules.fastfetch = _: {
# Adapted from https://github.com/dacrab/fastfetch-config/blob/main/config.jsonc # Adapted from https://github.com/dacrab/fastfetch-config/blob/main/config.jsonc
programs.fastfetch = { programs.fastfetch = {
enable = true; enable = true;
settings = { settings = {
logo = { logo = {
type = "none"; type = "none";
#source = "nixos"; #source = "nixos";
}; };
modules = [ modules = [
# ───────────── Hardware ───────────── # ───────────── Hardware ─────────────
{ {
type = "custom"; type = "custom";
format = " Hardware "; format = " Hardware ";
outputColor = "blue"; outputColor = "blue";
} }
{ {
type = "title"; type = "title";
key = " PC"; key = " PC";
keyColor = "green"; keyColor = "green";
} }
{ {
type = "host"; type = "host";
key = " 󰇅 Laptop"; key = " 󰇅 Laptop";
keyColor = "green"; keyColor = "green";
} }
{ {
type = "display"; type = "display";
key = " 󰍹 Display"; key = " 󰍹 Display";
keyColor = "green"; keyColor = "green";
} }
{ {
type = "cpu"; type = "cpu";
key = " 󰍛 CPU"; key = " 󰍛 CPU";
@@ -44,63 +44,63 @@
format = "{1}"; format = "{1}";
keyColor = "green"; keyColor = "green";
} }
{ {
type = "gpu"; type = "gpu";
key = " 󰍛 GPU"; key = " 󰍛 GPU";
keyColor = "green"; keyColor = "green";
} }
{ {
type = "memory"; type = "memory";
key = " 󰍛 Memory"; key = " 󰍛 Memory";
keyColor = "green"; keyColor = "green";
} }
{ {
type = "custom"; type = "custom";
format = ""; format = "";
outputColor = "blue"; outputColor = "blue";
} }
# ───────────── Software ───────────── # ───────────── Software ─────────────
{ {
type = "custom"; type = "custom";
format = " Software "; format = " Software ";
outputColor = "blue"; outputColor = "blue";
} }
{ {
type = "os"; type = "os";
key = " OS"; key = " OS";
keyColor = "cyan"; keyColor = "cyan";
} }
{ {
type = "kernel"; type = "kernel";
key = " Kernel"; key = " Kernel";
keyColor = "cyan"; keyColor = "cyan";
} }
{ {
type = "packages"; type = "packages";
key = " 󰏖 Packages"; key = " 󰏖 Packages";
keyColor = "cyan"; keyColor = "cyan";
} }
{ {
type = "shell"; type = "shell";
key = " Shell"; key = " Shell";
keyColor = "cyan"; keyColor = "cyan";
} }
{ {
type = "terminal"; type = "terminal";
key = " Terminal"; key = " Terminal";
keyColor = "cyan"; keyColor = "cyan";
} }
{ {
type = "command"; type = "command";
key = " OS Age"; key = " OS Age";
@@ -113,50 +113,50 @@
echo $days_difference days echo $days_difference days
''; '';
} }
{ {
type = "uptime"; type = "uptime";
key = " Uptime"; key = " Uptime";
keyColor = "cyan"; keyColor = "cyan";
} }
{ {
type = "de"; type = "de";
key = " DE"; key = " DE";
keyColor = "blue"; keyColor = "blue";
} }
{ {
type = "wm"; type = "wm";
key = " WM"; key = " WM";
keyColor = "magenta"; keyColor = "magenta";
} }
{ {
type = "gpu"; type = "gpu";
key = " 󰍛 GPU Driver"; key = " 󰍛 GPU Driver";
format = "{3}"; format = "{3}";
keyColor = "magenta"; keyColor = "magenta";
} }
{ {
type = "brightness"; type = "brightness";
key = " 󰃟 Brightness"; key = " 󰃟 Brightness";
keyColor = "magenta"; keyColor = "magenta";
} }
{ {
type = "version"; type = "version";
key = " FastFetch"; key = " FastFetch";
keyColor = "magenta"; keyColor = "magenta";
} }
{ {
type = "custom"; type = "custom";
format = ""; format = "";
outputColor = "blue"; outputColor = "blue";
} }
#{ #{
# type = "custom"; # type = "custom";
# format = '' # format = ''
@@ -167,7 +167,7 @@
type = "colors"; type = "colors";
symbol = "diamond"; symbol = "diamond";
} }
"break" "break"
]; ];
}; };
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.games = {pkgs, ...}: { flake.nixosModules.games = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
supertux # fuck mario supertux # fuck mario
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.git = { ... }: { flake.homeModules.git = _: {
programs.git = { programs.git = {
enable = true; enable = true;
settings = { settings = {
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.homeModules.gtk = {pkgs, ...}: { flake.homeModules.gtk = {pkgs, ...}: {
# gtk config # gtk config
gtk.theme = { gtk.theme = {
+3 -3
View File
@@ -1,6 +1,6 @@
{ ... }: { _: {
# this was in my home-manager config, but looks like more # this was in my home-manager config, but looks like more
flake.nixosModules.hypridle = { ... }: { flake.nixosModules.hypridle = _: {
services.hypridle = { services.hypridle = {
enable = true; enable = true;
settings = { settings = {
+27 -23
View File
@@ -1,5 +1,9 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.hyprland = { pkgs, pkgs-unstable, ... }: { flake.nixosModules.hyprland = {
pkgs,
pkgs-unstable,
...
}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
swww #wallpaper daemon swww #wallpaper daemon
gruvbox-gtk-theme gruvbox-gtk-theme
@@ -31,10 +35,10 @@
# removes uxterm # removes uxterm
services.xserver.excludePackages = [pkgs.xterm]; services.xserver.excludePackages = [pkgs.xterm];
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver.enable = true; services.xserver.enable = true;
}; };
flake.homeModules.hyprland-laptop = { ... }: { flake.homeModules.hyprland-laptop = _: {
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
exec-once = [ exec-once = [
"qtbatticon" # custom battery tray "qtbatticon" # custom battery tray
@@ -84,10 +88,10 @@
"workspaces, 1, 5, wind" "workspaces, 1, 5, wind"
]; ];
}; };
# █▀▀ █▄░█ █░█ # █▀▀ █▄░█ █░█
# ██▄ █░▀█ ▀▄▀ # ██▄ █░▀█ ▀▄▀
# See https://wiki.hyprland.org/Configuring/Environment-variables/ # See https://wiki.hyprland.org/Configuring/Environment-variables/
env = [ env = [
"PATH, $PATH:$scrPath" "PATH, $PATH:$scrPath"
@@ -100,22 +104,22 @@
"MOZ_ENABLE_WAYLAND,1" "MOZ_ENABLE_WAYLAND,1"
"GDK_SCALE,1" "GDK_SCALE,1"
]; ];
# █ █▄░█ █▀█ █░█ ▀█▀ # █ █▄░█ █▀█ █░█ ▀█▀
# █ █░▀█ █▀▀ █▄█ ░█░ # █ █░▀█ █▀▀ █▄█ ░█░
input = { input = {
kb_layout = ["ch"]; kb_layout = ["ch"];
follow_mouse = 1; follow_mouse = 1;
sensitivity = 0; sensitivity = 0;
force_no_accel = 1; force_no_accel = 1;
}; };
# █▄▀ █▀▀ █▄█ █▄▄ █ █▄░█ █▀▄ █ █▄░█ █▀▀ █▀ # █▄▀ █▀▀ █▄█ █▄▄ █ █▄░█ █▀▄ █ █▄░█ █▀▀ █▀
# █░█ ██▄ ░█░ █▄█ █ █░▀█ █▄▀ █ █░▀█ █▄█ ▄█ # █░█ ██▄ ░█░ █▄█ █ █░▀█ █▄▀ █ █░▀█ █▄█ ▄█
# caelestia shell drawers toggle dashboard # caelestia shell drawers toggle dashboard
# caelestia shell drawers toggle utilities # caelestia shell drawers toggle utilities
bind = [ bind = [
#hyprland/utility keybindings #hyprland/utility keybindings
"$mod, W, togglefloating" "$mod, W, togglefloating"
@@ -210,7 +214,7 @@
"Ctrl+Alt, 9, exec, anki" "Ctrl+Alt, 9, exec, anki"
# if hyprexpo plugin enabled bind = $mainMod, Space, hyprexpo:expo, toggle # if hyprexpo plugin enabled bind = $mainMod, Space, hyprexpo:expo, toggle
# maybe exec sudo framework-tools-tui # maybe exec sudo framework-tools-tui
#plugins keybindings #plugins keybindings
#"$mod, SPACE, overview:toggle, " #"$mod, SPACE, overview:toggle, "
]; ];
@@ -285,20 +289,20 @@
"3, right, move, +col" "3, right, move, +col"
"3, left, move, -col" "3, left, move, -col"
]; ];
# █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀ # █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀
# █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█ # █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█
dwindle = { dwindle = {
preserve_split = true; preserve_split = true;
}; };
scrolling = { scrolling = {
column_width = 0.45; column_width = 0.45;
}; };
# █▀▄▀█ █ █▀ █▀▀ # █▀▄▀█ █ █▀ █▀▀
# █░▀░█ █ ▄█ █▄▄ # █░▀░█ █ ▄█ █▄▄
misc = { misc = {
vrr = 0; vrr = 0;
force_default_wallpaper = 0; force_default_wallpaper = 0;
@@ -306,7 +310,7 @@
xwayland = { xwayland = {
force_zero_scaling = true; force_zero_scaling = true;
}; };
# █▀▄▀█ █▀█ █▄░█ █ ▀█▀ █▀█ █▀█ # █▀▄▀█ █▀█ █▄░█ █ ▀█▀ █▀█ █▀█
# █░▀░█ █▄█ █#░▀█ █ ░█░ █▄█ █▀▄ # █░▀░█ █▄█ █#░▀█ █ ░█░ █▄█ █▀▄
monitor = [ monitor = [
@@ -343,17 +347,17 @@
speed = 4.0; speed = 4.0;
# how much the speed is influenced by the current shake intensitiy # how much the speed is influenced by the current shake intensitiy
influence = 0.0; influence = 0.0;
# maximal magnification the cursor can reach # maximal magnification the cursor can reach
# values below 1 disable the limit (e.g. 0) # values below 1 disable the limit (e.g. 0)
limit = 0.0; limit = 0.0;
# time in millseconds the cursor will stay magnified after a shake has ended # time in millseconds the cursor will stay magnified after a shake has ended
timeout = 2000; timeout = 2000;
# show cursor behaviour `tilt`, `rotate`, etc. while shaking # show cursor behaviour `tilt`, `rotate`, etc. while shaking
effects = true; effects = true;
# enable ipc events for shake # enable ipc events for shake
ipc = false; ipc = false;
}; };
@@ -364,7 +368,7 @@
workspaceActiveBorder = "rgb(ab7746)"; workspaceActiveBorder = "rgb(ab7746)";
disableBlur = true; disableBlur = true;
}; };
##################################################### #####################################################
##################################################### #####################################################
# theme # theme
@@ -397,7 +401,7 @@
}; };
#################################################### ####################################################
################################################## ##################################################
# /$$ /$$ /$$ # /$$ /$$ /$$
#| $$ /$ | $$ | $$ #| $$ /$ | $$ | $$
#| $$ /$$$| $$ /$$$$$$ /$$$$$$ | $$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ #| $$ /$$$| $$ /$$$$$$ /$$$$$$ | $$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$
@@ -418,7 +422,7 @@
#"w[tv1], gapsout:1, gapsin:1" #"w[tv1], gapsout:1, gapsin:1"
#"f[1], gapsout:1, gapsin:1" #"f[1], gapsout:1, gapsin:1"
]; ];
# █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█   █▀█ █░█ █░░ █▀▀ █▀ # █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█   █▀█ █░█ █░░ █▀▀ █▀
# ▀▄▀▄▀ █ █░▀█ █▄▀ █▄█ ▀▄▀▄▀   █▀▄ █▄█ █▄▄ ██▄ ▄█ # ▀▄▀▄▀ █ █░▀█ █▄▀ █▄█ ▀▄▀▄▀   █▀▄ █▄█ █▄▄ ██▄ ▄█
windowrule = [ windowrule = [
+58 -56
View File
@@ -1,50 +1,51 @@
{ ...}: { # for some reason perSystem can't expose pkgs-unstable so we need to expose it here _: {
# ----------------------------------------------------- # for some reason perSystem can't expose pkgs-unstable so we need to expose it here
# Here are a bunch of scripts that interact with hyprland # -----------------------------------------------------
# Some are still used. Some are broken. Some are deprecated. But I do still keep them in case I want to go back to old tools # Here are a bunch of scripts that interact with hyprland
# ----------------------------------------------------- # Some are still used. Some are broken. Some are deprecated. But I do still keep them in case I want to go back to old tools
perSystem = { pkgs, ... }: let # -----------------------------------------------------
perSystem = {pkgs, ...}: let
wallpaper1 = ../../assets/wallpaper1.jpg; wallpaper1 = ../../assets/wallpaper1.jpg;
wallpaper2 = ../../assets/wallpaper2.jpg; wallpaper2 = ../../assets/wallpaper2.jpg;
wallpaper3 = ../../assets/wallpaper3.jpg; wallpaper3 = ../../assets/wallpaper3.jpg;
wallpaper4 = ../../assets/wallpaper4.jpg; wallpaper4 = ../../assets/wallpaper4.jpg;
wallpaper5 = ../../assets/wallpaper5.jpg; wallpaper5 = ../../assets/wallpaper5.jpg;
in { in {
# kills the app, but when it's steam or custom-pomodoro # kills the app, but when it's steam or custom-pomodoro
packages.custom-dontkillsteam = pkgs.writeShellApplication { packages.custom-dontkillsteam = pkgs.writeShellApplication {
name = "custom-dontkillsteam"; name = "custom-dontkillsteam";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
hyprland hyprland
jq jq
]; ];
text = '' text = ''
class=$(hyprctl activewindow -j | jq -r ".class") class=$(hyprctl activewindow -j | jq -r ".class")
if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then
hyprctl dispatch movetoworkspacesilent special hyprctl dispatch movetoworkspacesilent special
else else
hyprctl dispatch killactive "" hyprctl dispatch killactive ""
fi fi
''; '';
}; };
packages.custom-killall = pkgs.writeShellApplication { packages.custom-killall = pkgs.writeShellApplication {
name = "custom-killall"; name = "custom-killall";
runtimeInputs = [ runtimeInputs = [
pkgs.hyprland # for some reason pkgs-unstable doesn't work here pkgs.hyprland # for some reason pkgs-unstable doesn't work here
pkgs.jq pkgs.jq
]; ];
text = '' text = ''
active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id') active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id')
hyprctl clients -j | hyprctl clients -j |
jq -r ".[] jq -r ".[]
| select(.workspace.id==''${active_workspace_id}) | select(.workspace.id==''${active_workspace_id})
| select(.focusHistoryID!=0) | select(.focusHistoryID!=0)
| .pid" | | .pid" |
xargs -r kill xargs -r kill
''; '';
}; };
packages.custom-wallpaper = pkgs.writeShellApplication { packages.custom-wallpaper = pkgs.writeShellApplication {
name = "custom-wallpaper"; name = "custom-wallpaper";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
socat socat
@@ -77,21 +78,22 @@
;; ;;
esac esac
} }
socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done
''; '';
};
packages.custom-launch = pkgs.writeShellApplication {
# used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized
# unused
name = "custom-launch";
runtimeInputs = with pkgs; [
zsh
];
text = ''
sleep 2
clear
zsh
'';
};
}; };
packages.custom-launch = pkgs.writeShellApplication { }
# used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized
# unused
name = "custom-launch";
runtimeInputs = with pkgs; [
zsh
];
text = ''
sleep 2
clear
zsh
'';
};
};}
+28 -27
View File
@@ -1,5 +1,5 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.kdrive = { pkgs-unstable, ... }: { flake.nixosModules.kdrive = {pkgs-unstable, ...}: {
environment.systemPackages = with pkgs-unstable; [ environment.systemPackages = with pkgs-unstable; [
rclone rclone
self.packages.${pkgs.system}.custom-checkKdrive self.packages.${pkgs.system}.custom-checkKdrive
@@ -11,7 +11,7 @@
enable = true; enable = true;
}; };
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-checkKdrive = pkgs.writeShellApplication { packages.custom-checkKdrive = pkgs.writeShellApplication {
name = "custom-checkKdrive"; name = "custom-checkKdrive";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
@@ -20,21 +20,21 @@
libnotify libnotify
]; ];
text = '' text = ''
# waits for an internet connection. It pings both Google DNS and Cloudfare dns in case one of them is down # waits for an internet connection. It pings both Google DNS and Cloudfare dns in case one of them is down
until ping -c1 -W1 1.1.1.1 >/dev/null 2>&1 || \ until ping -c1 -W1 1.1.1.1 >/dev/null 2>&1 || \
ping -c1 -W1 8.8.8.8 >/dev/null 2>&1 ping -c1 -W1 8.8.8.8 >/dev/null 2>&1
do do
sleep 1 sleep 1
done done
set +e set +e
output=$(rclone lsd kdrive: 2>&1) output=$(rclone lsd kdrive: 2>&1)
status=$? status=$?
set -e set -e
if [ $status -eq 0 ]; then if [ $status -eq 0 ]; then
echo "kdrive OK" echo "kdrive OK"
else else
@@ -47,23 +47,24 @@
''; '';
}; };
packages.custom-mountkdrive = pkgs.writeShellApplication { packages.custom-mountkdrive = pkgs.writeShellApplication {
name = "custom-mountkdrive"; name = "custom-mountkdrive";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
rclone rclone
libnotify libnotify
]; ];
text = '' text = ''
REMOTE_NAME="kdrive" REMOTE_NAME="kdrive"
MOUNT_POINT="$HOME/kdrive" MOUNT_POINT="$HOME/kdrive"
if rclone listremotes | rg "^''${REMOTE_NAME}:"; then if rclone listremotes | rg "^''${REMOTE_NAME}:"; then
echo "Mounting ''${REMOTE_NAME}..." echo "Mounting ''${REMOTE_NAME}..."
rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes --allow-non-empty & rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes --allow-non-empty &
else else
notify-send "rclone mount failed" \ notify-send "rclone mount failed" \
"Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/kdrive/ or comment out the exec line in hyprland.nix." "Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/kdrive/ or comment out the exec line in hyprland.nix."
echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix." echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix."
fi fi
''; '';
};
}; };
};} }
+24 -24
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.kitty = { ... }: { flake.homeModules.kitty = _: {
programs.kitty = { programs.kitty = {
enable = true; enable = true;
#font.name = nerd-fonts._0xproto; #font.name = nerd-fonts._0xproto;
@@ -11,53 +11,53 @@
bold_font auto bold_font auto
italic_font auto italic_font auto
bold_italic_font auto bold_italic_font auto
window_padding_width 25 window_padding_width 25
# --- Core --- # --- Core ---
foreground #ece0d9 foreground #ece0d9
background #18120e background #18120e
selection_foreground #18120e selection_foreground #18120e
selection_background #ece0d9 selection_background #ece0d9
cursor #ffb878 cursor #ffb878
cursor_text_color #18120e cursor_text_color #18120e
# --- Tabs --- # --- Tabs ---
active_tab_foreground #18120e active_tab_foreground #18120e
active_tab_background #5c412a active_tab_background #5c412a
inactive_tab_foreground #d6c3b5 inactive_tab_foreground #d6c3b5
inactive_tab_background #241e1a inactive_tab_background #241e1a
# --- Black / Gray --- # --- Black / Gray ---
color0 #353433 color0 #353433
color8 #b29f91 color8 #b29f91
# --- Red --- # --- Red ---
color1 #e17300 color1 #e17300
color9 #ff8a20 color9 #ff8a20
# --- Green --- # --- Green ---
color2 #ffc071 color2 #ffc071
color10 #ffd6a8 color10 #ffd6a8
# --- Yellow --- # --- Yellow ---
color3 #ffe0c6 color3 #ffe0c6
color11 #fff2e8 color11 #fff2e8
# --- Blue --- # --- Blue ---
color4 #b9ab66 color4 #b9ab66
color12 #d7be91 color12 #d7be91
# --- Magenta --- # --- Magenta ---
color5 #ed9562 color5 #ed9562
color13 #fcad7e color13 #fcad7e
# --- Cyan --- # --- Cyan ---
color6 #f4c16d color6 #f4c16d
color14 #ffd497 color14 #ffd497
# --- White --- # --- White ---
color7 #ebd4c1 color7 #ebd4c1
color15 #FFFFFF color15 #FFFFFF
@@ -76,43 +76,43 @@
selection_background #FFFFFF selection_background #FFFFFF
cursor #C3AC76 cursor #C3AC76
cursor_text_color #0F1010 cursor_text_color #0F1010
active_tab_foreground #1B1D1C active_tab_foreground #1B1D1C
active_tab_background #6B5540 active_tab_background #6B5540
inactive_tab_foreground #6B5540 inactive_tab_foreground #6B5540
inactive_tab_background #1B1D1C inactive_tab_background #1B1D1C
# black # black
color0 #29523D color0 #29523D
color8 #578F73 color8 #578F73
# red # red
#color1 #FFF0CC #color1 #FFF0CC
#color9 #F0DBAA #color9 #F0DBAA
# we need actual red colors # we need actual red colors
color1 #CC241D color1 #CC241D
color9 #9D0006 color9 #9D0006
# green # green
color2 #FFEECC color2 #FFEECC
color10 #F0D9AA color10 #F0D9AA
# yellow # yellow
color3 #FFE5CC color3 #FFE5CC
color11 #F0CCAA color11 #F0CCAA
# blue # blue
color4 #9AE6C0 color4 #9AE6C0
color12 #9AE6C0 color12 #9AE6C0
# magenta # magenta
color5 #E6CC9A color5 #E6CC9A
color13 #E6CC9A color13 #E6CC9A
# cyan # cyan
color6 #E6BF9A color6 #E6BF9A
color14 #E6BF9A color14 #E6BF9A
# white # white
color7 #FFF0CC color7 #FFF0CC
color15 #F0DBAA color15 #F0DBAA
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.nixosModules.ly = { ... }: { flake.nixosModules.ly = _: {
# a minimal ly config as the big config (ly.nix) didnt worked # a minimal ly config as the big config (ly.nix) didnt worked
services.displayManager.ly = { services.displayManager.ly = {
enable = true; enable = true;
+6 -6
View File
@@ -1,5 +1,5 @@
{ inputs, ... }: { {inputs, ...}: {
flake.hostModules.micro = { pkgs-unstable, ... }: { flake.hostModules.micro = {pkgs-unstable, ...}: {
programs.micro = { programs.micro = {
enable = true; enable = true;
package = pkgs-unstable.micro-full; package = pkgs-unstable.micro-full;
@@ -18,19 +18,19 @@
text = '' text = ''
local buffer = import("micro/buffer") local buffer = import("micro/buffer")
local shell = import("micro/shell") local shell = import("micro/shell")
function vivifyOpen(buf) function vivifyOpen(buf)
local cursor = buf:GetActiveCursor() local cursor = buf:GetActiveCursor()
local line = cursor.Loc.Y + 1 local line = cursor.Loc.Y + 1
shell.ExecCommand("viv", string.format("%s:%d", buf.AbsPath, line)) shell.ExecCommand("viv", string.format("%s:%d", buf.AbsPath, line))
end end
function onBufferOpen(buf) function onBufferOpen(buf)
if os.getenv("MICRO_VIVIFY") ~= "1" then if os.getenv("MICRO_VIVIFY") ~= "1" then
return return
end end
-- only run for real files (not help/log/etc) -- only run for real files (not help/log/etc)
if buf.Type.Kind == buffer.BTDefault then if buf.Type.Kind == buffer.BTDefault then
vivifyOpen(buf) vivifyOpen(buf)
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.mullvad = {pkgs-unstable, ...}: { flake.nixosModules.mullvad = {pkgs-unstable, ...}: {
services.mullvad-vpn = { services.mullvad-vpn = {
enable = true; enable = true;
+48 -48
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.homeModules.neovim = {pkgs-unstable, ...}: { flake.homeModules.neovim = {pkgs-unstable, ...}: {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
@@ -64,9 +64,9 @@
pkgs-unstable.vimPlugins.garbage-day-nvim pkgs-unstable.vimPlugins.garbage-day-nvim
]; ];
extraLuaConfig = '' extraLuaConfig = ''
local vim = vim local vim = vim
-- ========================= -- =========================
-- LEADER & KEY DISABLE -- LEADER & KEY DISABLE
-- ========================= -- =========================
@@ -125,40 +125,40 @@
vim.opt.inccommand = 'split' vim.opt.inccommand = 'split'
vim.opt.cursorline = true vim.opt.cursorline = true
vim.opt.scrolloff = 10 vim.opt.scrolloff = 10
-- ========================= -- =========================
-- BASIC KEYMAPS -- BASIC KEYMAPS
-- ========================= -- =========================
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- Disable arrow keys in normal mode -- Disable arrow keys in normal mode
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>') vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>') vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>') vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>') vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Window navigation -- Window navigation
vim.keymap.set('n', '<C-Left>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) vim.keymap.set('n', '<C-Left>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-Right>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) vim.keymap.set('n', '<C-Right>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-Down>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '<C-Down>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-Up>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) vim.keymap.set('n', '<C-Up>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- Cheatsheet -- Cheatsheet
vim.keymap.set("n","§", "<cmd>Cheatsheet<CR>") vim.keymap.set("n","§", "<cmd>Cheatsheet<CR>")
require("cheatsheet").setup({ require("cheatsheet").setup({
bundled_cheatsheets = { enabled = { "default" } }, bundled_cheatsheets = { enabled = { "default" } },
bundled_plugin_cheatsheets = { disabled = { "gitsigns.nvim" } } bundled_plugin_cheatsheets = { disabled = { "gitsigns.nvim" } }
}) })
-- Highlight yanked text -- Highlight yanked text
vim.api.nvim_create_autocmd('TextYankPost', { vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight on yank', desc = 'Highlight on yank',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function() vim.highlight.on_yank() end, callback = function() vim.highlight.on_yank() end,
}) })
-- ======================== -- ========================
-- terminal -- terminal
-- ======================= -- =======================
@@ -166,10 +166,10 @@
position = 'right', -- position of the terminal window when using the shell_handler position = 'right', -- position of the terminal window when using the shell_handler
-- can be: top, left, right, bottom -- can be: top, left, right, bottom
-- will be overwritten when using the telescope mapping to open horizontally or vertically -- will be overwritten when using the telescope mapping to open horizontally or vertically
width = 80, -- width of window when position is left or right width = 80, -- width of window when position is left or right
height = 10, -- height of window when position is top or bottom height = 10, -- height of window when position is top or bottom
handlers = { handlers = {
lua = function(bufnr) lua = function(bufnr)
vim.print('Running lua file in buffer ' .. bufnr) vim.print('Running lua file in buffer ' .. bufnr)
@@ -177,13 +177,13 @@
end end
} }
}) })
vim.keymap.set("n", "<leader><leader>", function() require("runner-nvim").run() end) vim.keymap.set("n", "<leader><leader>", function() require("runner-nvim").run() end)
-- ========================= -- =========================
-- SCROLLBAR -- SCROLLBAR
-- ========================= -- =========================
require("scrollbar").setup() require("scrollbar").setup()
-- ========================= -- =========================
-- UFO FOLDING -- UFO FOLDING
-- ========================= -- =========================
@@ -196,7 +196,7 @@
require('ufo').setup({ require('ufo').setup({
provider_selector = function() return {'treesitter', 'indent'} end provider_selector = function() return {'treesitter', 'indent'} end
}) })
-- ========================= -- =========================
-- treesitter -- treesitter
-- ======================== -- ========================
@@ -219,7 +219,7 @@
renderer = { group_empty = true }, renderer = { group_empty = true },
filters = { dotfiles = true }, filters = { dotfiles = true },
}) })
-- ========================= -- =========================
-- CMP CONFIGURATION -- CMP CONFIGURATION
-- ========================= -- =========================
@@ -235,25 +235,25 @@
}), }),
sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'vsnip' } }, { { name = 'buffer' } }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'vsnip' } }, { { name = 'buffer' } }),
}) })
cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } }) cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } })
cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } }) cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } })
-- ========================= -- =========================
-- LSP CONFIGURATION -- LSP CONFIGURATION
-- ========================= -- =========================
local capabilities = require('cmp_nvim_lsp').default_capabilities() local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Diagnostics -- Diagnostics
vim.keymap.set("n", "<leader>e4", function() vim.diagnostic.jump({ prev=true, count = 1 }) end, { desc = "Previous diagnostic" }) vim.keymap.set("n", "<leader>e4", function() vim.diagnostic.jump({ prev=true, count = 1 }) end, { desc = "Previous diagnostic" })
vim.keymap.set("n", "<leader>e5", function() vim.diagnostic.jump({ prev=false, count = 1 }) end, { desc = "Next diagnostic" }) vim.keymap.set("n", "<leader>e5", function() vim.diagnostic.jump({ prev=false, count = 1 }) end, { desc = "Next diagnostic" })
vim.keymap.set("n", "<leader>e1", vim.diagnostic.open_float, { desc = "Show diagnostic" }) vim.keymap.set("n", "<leader>e1", vim.diagnostic.open_float, { desc = "Show diagnostic" })
vim.keymap.set("n", "<leader>e3", vim.diagnostic.setloclist, { desc = "Diagnostic list" }) vim.keymap.set("n", "<leader>e3", vim.diagnostic.setloclist, { desc = "Diagnostic list" })
vim.keymap.set("n", "<leader>e2", vim.lsp.buf.code_action, { desc = "Show correction" }) vim.keymap.set("n", "<leader>e2", vim.lsp.buf.code_action, { desc = "Show correction" })
vim.keymap.set("n", "<leader>e<Tab>", function() vim.keymap.set("n", "<leader>e<Tab>", function()
local clients = vim.lsp.get_clients({ name = "ltex" }) local clients = vim.lsp.get_clients({ name = "ltex" })
if #clients > 0 then if #clients > 0 then
-- Stop LTeX -- Stop LTeX
for _, client in ipairs(clients) do for _, client in ipairs(clients) do
@@ -266,7 +266,7 @@
print("LTeX ON") print("LTeX ON")
end end
end, { desc = "Toggle LTeX" }) end, { desc = "Toggle LTeX" })
vim.diagnostic.config({ vim.diagnostic.config({
update_in_insert = false, -- i don't get any new error when in insert update_in_insert = false, -- i don't get any new error when in insert
}) })
@@ -282,17 +282,17 @@
}, },
priority = 2003, -- the priority of virtual text priority = 2003, -- the priority of virtual text
inline = false, inline = false,
}) })
-- LSP functionality -- LSP functionality
vim.keymap.set("n", "<leader>g1", vim.lsp.buf.hover, { desc = "Hover documentation" }) vim.keymap.set("n", "<leader>g1", vim.lsp.buf.hover, { desc = "Hover documentation" })
vim.keymap.set("n", "<leader>g2", vim.lsp.buf.definition, { desc = "Go to definition" }) vim.keymap.set("n", "<leader>g2", vim.lsp.buf.definition, { desc = "Go to definition" })
vim.keymap.set("n", "<leader>g3", vim.lsp.buf.declaration, { desc = "Go to declaration" }) vim.keymap.set("n", "<leader>g3", vim.lsp.buf.declaration, { desc = "Go to declaration" })
vim.keymap.set("n", "<leader>g4", vim.lsp.buf.implementation, { desc = "Go to implementation" }) vim.keymap.set("n", "<leader>g4", vim.lsp.buf.implementation, { desc = "Go to implementation" })
vim.keymap.set("n", "<leader>g5", vim.lsp.buf.references, { desc = "Show references" }) vim.keymap.set("n", "<leader>g5", vim.lsp.buf.references, { desc = "Show references" })
-- LSP server setup -- LSP server setup
vim.lsp.config("lua_ls", { cmd = { "lua-language-server" }, filetypes = { "lua" }, root_dir = vim.fs.dirname, on_attach = on_attach }) vim.lsp.config("lua_ls", { cmd = { "lua-language-server" }, filetypes = { "lua" }, root_dir = vim.fs.dirname, on_attach = on_attach })
vim.lsp.config("clangd", { vim.lsp.config("clangd", {
@@ -300,7 +300,7 @@
filetypes = { "c","cpp","objc","objcpp" }, filetypes = { "c","cpp","objc","objcpp" },
on_attach = on_attach , on_attach = on_attach ,
init_options = { init_options = {
clangdFileStatus = true, clangdFileStatus = true,
usePlaceholders = true, usePlaceholders = true,
completeUnimported = false, -- this adds a bunch of #include even thought they are #included in another header file completeUnimported = false, -- this adds a bunch of #include even thought they are #included in another header file
@@ -332,26 +332,26 @@
cmd = { "ltex-ls-plus" }, cmd = { "ltex-ls-plus" },
filetypes = { "markdown", "text", "tex", "plaintex" }, filetypes = { "markdown", "text", "tex", "plaintex" },
on_attach = on_attach, on_attach = on_attach,
settings = { settings = {
ltex = { ltex = {
language = "fr", language = "fr",
enabled = { enabled = {
"markdown", "markdown",
"text", "text",
"tex", "tex",
"plaintex", "plaintex",
}, },
completionEnabled = true, completionEnabled = true,
diagnosticSeverity = "information", diagnosticSeverity = "information",
additionalRules = { additionalRules = {
enablePickyRules = false, enablePickyRules = false,
motherTongue = "fr", motherTongue = "fr",
}, },
dictionary = { dictionary = {
["fr"] = { ["fr"] = {
"icelle", "icelle",
@@ -367,7 +367,7 @@
}, },
}, },
}) })
vim.lsp.enable({ "lua_ls", "clangd", "pylsp", "texlab", "nixd", "ltex"}) vim.lsp.enable({ "lua_ls", "clangd", "pylsp", "texlab", "nixd", "ltex"})
-- ========================= -- =========================
-- DASHBOARD -- DASHBOARD
@@ -400,41 +400,41 @@
footer = {}, footer = {},
} }
} }
-- jumps cursor when was last cursor last time -- jumps cursor when was last cursor last time
require("nvim-lastplace").setup({ require("nvim-lastplace").setup({
-- Filetypes to ignore -- Filetypes to ignore
ignore_filetypes = { ignore_filetypes = {
"gitcommit", "gitrebase", "svn", "hgcommit", "xxd", "COMMIT_EDITMSG" "gitcommit", "gitrebase", "svn", "hgcommit", "xxd", "COMMIT_EDITMSG"
}, },
-- Buffer types to ignore -- Buffer types to ignore
ignore_buftypes = { ignore_buftypes = {
"quickfix", "nofile", "help", "terminal" "quickfix", "nofile", "help", "terminal"
}, },
-- Center cursor after jumping -- Center cursor after jumping
center_on_jump = true, center_on_jump = true,
-- Only jump if target line is not visible -- Only jump if target line is not visible
jump_only_if_not_visible = false, jump_only_if_not_visible = false,
-- Minimum lines required to enable jumping -- Minimum lines required to enable jumping
min_lines = 10, min_lines = 10,
-- Maximum line to jump to (0 = no limit) -- Maximum line to jump to (0 = no limit)
max_line = 0, max_line = 0,
-- Open folds after jumping -- Open folds after jumping
open_folds = true, open_folds = true,
-- Enable debug messages -- Enable debug messages
debug = false, debug = false,
}) })
-- ====================== -- ======================
-- gruvbox -- gruvbox
-- ====================== -- ======================
require("gruvbox").setup({ require("gruvbox").setup({
terminal_colors = false, -- add neovim terminal colors terminal_colors = false, -- add neovim terminal colors
undercurl = true, undercurl = true,
@@ -470,18 +470,18 @@
-- LUALINE -- LUALINE
-- ========================= -- =========================
require('lualine').setup { options = { theme = "gruvbox_dark" } } require('lualine').setup { options = { theme = "gruvbox_dark" } }
--==================0 --==================0
-- Some utils -- Some utils
--================== --==================
vim.keymap.set('n', '<leader>r1', '<cmd>Fugit2<CR>', { desc = 'Open git helper' }) vim.keymap.set('n', '<leader>r1', '<cmd>Fugit2<CR>', { desc = 'Open git helper' })
vim.keymap.set("n", "t", function() vim.keymap.set("n", "t", function()
local line = vim.api.nvim_get_current_line() local line = vim.api.nvim_get_current_line()
local result = vim.fn.system({ "custom-syllabes" }, line) local result = vim.fn.system({ "custom-syllabes" }, line)
print(vim.trim(result)) print(vim.trim(result))
end, { desc = "Count syllables (current line)" }) end, { desc = "Count syllables (current line)" })
-- ========================= -- =========================
@@ -492,7 +492,7 @@
vim.keymap.set('n', '<leader>f2', builtin.live_grep, { desc = 'Telescope live grep' }) vim.keymap.set('n', '<leader>f2', builtin.live_grep, { desc = 'Telescope live grep' })
vim.keymap.set('n', '<leader>f3', builtin.buffers, { desc = 'Telescope buffers' }) vim.keymap.set('n', '<leader>f3', builtin.buffers, { desc = 'Telescope buffers' })
vim.keymap.set('n', '<leader>f4', builtin.help_tags, { desc = 'Telescope help tags' }) vim.keymap.set('n', '<leader>f4', builtin.help_tags, { desc = 'Telescope help tags' })
-- Disable relative numbers even if plugins override -- Disable relative numbers even if plugins override
vim.api.nvim_create_autocmd("VimEnter", { callback = function() vim.opt.colorcolumn = ""; vim.opt.relativenumber = false end }) vim.api.nvim_create_autocmd("VimEnter", { callback = function() vim.opt.colorcolumn = ""; vim.opt.relativenumber = false end })
''; '';
+98 -97
View File
@@ -1,6 +1,6 @@
{ ... }: { _: {
# obsidian is unused -> see my project https://github.com/tomasriveral/NoteWrapper # obsidian is unused -> see my project https://github.com/tomasriveral/NoteWrapper
flake.homeModules.obsidian = { ... }: { flake.homeModules.obsidian = _: {
programs.obsidian = { programs.obsidian = {
enable = true; enable = true;
@@ -27,99 +27,100 @@
}; };
}; };
perSystem = {pkgs, ...}: { perSystem = {pkgs, ...}: {
packages.custom-obsidianbackup = pkgs.writeShellApplication { packages.custom-obsidianbackup = pkgs.writeShellApplication {
name = "custom-obsidianbackup"; name = "custom-obsidianbackup";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
rclone rclone
libnotify libnotify
rsync rsync
]; ];
text = '' text = ''
#!/usr/bin/env bash #!/usr/bin/env bash
SOURCE_DIR="$HOME/Documents/Notes" SOURCE_DIR="$HOME/Documents/Notes"
DEST_DIR="$HOME/kdrive/Notes" DEST_DIR="$HOME/kdrive/Notes"
BACKUP_DIR="$HOME/.Notes.backup" BACKUP_DIR="$HOME/.Notes.backup"
mkdir -p "$DEST_DIR" mkdir -p "$DEST_DIR"
mkdir -p "$BACKUP_DIR" mkdir -p "$BACKUP_DIR"
while true; do while true; do
# Timestamp for this run # Timestamp for this run
TIMESTAMP=$(date +%Y-%m-%d_%H-%M) TIMESTAMP=$(date +%Y-%m-%d_%H-%M)
TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP" TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP"
mkdir -p "$TIMESTAMPED_BACKUP" mkdir -p "$TIMESTAMPED_BACKUP"
echo "[$(date)] Starting Obsidian backup..." echo "[$(date)] Starting Obsidian backup..."
# Check rclone mount # Check rclone mount
status=$(rclone about kdrive: 2>&1 || true) status=$(rclone about kdrive: 2>&1 || true)
if [[ "$status" =~ .*CRITICAL.* ]]; then if [[ "$status" =~ .*CRITICAL.* ]]; then
echo "[$(date)] rclone failed:" echo "[$(date)] rclone failed:"
echo "$status" echo "$status"
notify-send -u critical "rclone failed" \ notify-send -u critical "rclone failed" \
"rclone might be broken or you need to deactivate this script in HomeManager." "rclone might be broken or you need to deactivate this script in HomeManager."
else else
# Run rsync with verbose debugging # Run rsync with verbose debugging
echo "[$(date)] Running rsync..." echo "[$(date)] Running rsync..."
rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \ rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \
--exclude='.obsidian/cache/**' \ --exclude='.obsidian/cache/**' \
"$SOURCE_DIR/" "$DEST_DIR/" "$SOURCE_DIR/" "$DEST_DIR/"
echo "[$(date)] Backup completed for this run." echo "[$(date)] Backup completed for this run."
fi fi
# Safely remove backups older than 30 days # Safely remove backups older than 30 days
if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then
echo "[$(date)] Cleaning old backups..." echo "[$(date)] Cleaning old backups..."
find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \; find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \;
else else
echo "[$(date)] Backup directory not safe. Skipping cleanup." echo "[$(date)] Backup directory not safe. Skipping cleanup."
fi fi
# Wait 1 hour # Wait 1 hour
echo "[$(date)] Sleeping for 1 hour..." echo "[$(date)] Sleeping for 1 hour..."
sleep 3600 sleep 3600
done done
''; '';
};
# this might be broken after dendritic nix. As it searched for the obsidian.nix to get list of vaults
packages.custom-obsidianbvaults = pkgs.writeShellApplication {
name = "custom-obsidianvaults";
runtimeInputs = with pkgs; [
zsh
fzf
ripgrep
];
text = ''
# Path to your obsidian.nix
obsidian_nix="$HOME/nixos/modules/home-manager/obsidian.nix"
# Extract vault names without line numbers and colors
mapfile -t vaults < <(rg -N --color=never -Po 'vaults\.\K[[:alnum:]_]+' "$obsidian_nix")
# Let user select a vault with fzf
selected=$(printf "%s\n" "''${vaults[@]}" \
| fzf --height 6 --reverse --prompt="Select Obsidian vault:")
# Exit if user cancels
[[ -z "$selected" ]] && exit 0
# Remove any stray ANSI codes (optional)
selected=$(echo "$selected" | sed -r 's/\x1B\[[0-9;]*[mK]//g')
# Find the target path of the selected vault
vault_path=$(rg -N --color=never -A2 "vaults.$selected" "$obsidian_nix" \
| rg 'target =' | sed -E 's/.*"([^"]+)".*/\1/')
# Expand ~ if present
vault_path="''${vault_path/#\~/$HOME}"
# Launch Obsidian with the selected vault using URI
[[ -n "$vault_path" ]] && setsid xdg-open "obsidian://open?vault=$selected" >/dev/null 2>&1 &
# Exit the kitty terminal after selection
pkill -f "kitty.*Select Obsidian vault"
exit
'';
};
}; };
# this might be broken after dendritic nix. As it searched for the obsidian.nix to get list of vaults }
packages.custom-obsidianbvaults = pkgs.writeShellApplication {
name = "custom-obsidianvaults";
runtimeInputs = with pkgs; [
zsh
fzf
ripgrep
];
text = ''
# Path to your obsidian.nix
obsidian_nix="$HOME/nixos/modules/home-manager/obsidian.nix"
# Extract vault names without line numbers and colors
mapfile -t vaults < <(rg -N --color=never -Po 'vaults\.\K[[:alnum:]_]+' "$obsidian_nix")
# Let user select a vault with fzf
selected=$(printf "%s\n" "''${vaults[@]}" \
| fzf --height 6 --reverse --prompt="Select Obsidian vault:")
# Exit if user cancels
[[ -z "$selected" ]] && exit 0
# Remove any stray ANSI codes (optional)
selected=$(echo "$selected" | sed -r 's/\x1B\[[0-9;]*[mK]//g')
# Find the target path of the selected vault
vault_path=$(rg -N --color=never -A2 "vaults.$selected" "$obsidian_nix" \
| rg 'target =' | sed -E 's/.*"([^"]+)".*/\1/')
# Expand ~ if present
vault_path="''${vault_path/#\~/$HOME}"
# Launch Obsidian with the selected vault using URI
[[ -n "$vault_path" ]] && setsid xdg-open "obsidian://open?vault=$selected" >/dev/null 2>&1 &
# Exit the kitty terminal after selection
pkill -f "kitty.*Select Obsidian vault"
exit
'';
};
};}
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.oh-my-posh = { ... }: { flake.homeModules.oh-my-posh = _: {
programs.oh-my-posh = { programs.oh-my-posh = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
+117 -117
View File
@@ -1,123 +1,123 @@
{ ... }: _: {
{ flake.homeModules.quickshell = _: {
flake.homeModules.quickshell = { ... }: {
# pulled from https://codeberg.org/zacoons/rivendell-hyprdots # pulled from https://codeberg.org/zacoons/rivendell-hyprdots
# replaced by caelestia-shell # replaced by caelestia-shell
qt.enable = true; qt.enable = true;
programs.quickshell = { programs.quickshell = {
systemd.enable = true; systemd.enable = true;
enable = true; enable = true;
}; };
home.file.".config/quickshell" = { home.file.".config/quickshell" = {
source = ../../other/quickshell; source = ../../other/quickshell;
recursive = true; recursive = true;
}; };
}; };
perSystem = {pkgs, ...}: { perSystem = {pkgs, ...}: {
# creates and maintains cache file for the notification history # creates and maintains cache file for the notification history
packages.QS-notifycache = pkgs.writeShellApplication { packages.QS-notifycache = pkgs.writeShellApplication {
name = "QS-notifycache"; name = "QS-notifycache";
text = '' text = ''
CACHE="$HOME/.cache/notify_history" CACHE="$HOME/.cache/notify_history"
# Create or erase existing cache # Create or erase existing cache
mkdir -p "$(dirname "$CACHE")" mkdir -p "$(dirname "$CACHE")"
: > "$CACHE" # truncate file : > "$CACHE" # truncate file
echo "Notification history initialized at $(date)" >> "$CACHE" echo "Notification history initialized at $(date)" >> "$CACHE"
''; '';
};
packages.QS-notifyhistory = pkgs.writeShellApplication {
name = "QS-notifyhistory";
text = ''
app="$1"
title="$2"
body="$3"
date="$(date +%T)"
urgency="$4"
case "$urgency" in
0) urgency_text="low";;
1) urgency_text="normal";;
2) urgency_text="critical";;
*) urgency_text="unknown";;
esac
{
echo "$app"
echo "$title"
echo "$body"
echo "$date"
echo "$urgency_text"
} >> "$HOME/.cache/notify_history"
'';
};
packages.QS-sysinfo = pkgs.writeShellApplication {
name = "QS-sysinfo";
runtimeInputs = with pkgs; [
ripgrep
gawkInteractive
iproute2
coreutils
procps
upower
];
text = ''
# Pad CPU, MEM, DISK to 2 chars (right-aligned)
cpu=$(awk '/^cpu /{printf("%.0f", ($2+$4)*100/($2+$4+$5))}' /proc/stat)
cpu=$(printf "%2s" "$cpu")
sum=0
count=0
for f in /sys/class/hwmon/hwmon*/temp*_input; do
if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val))
count=$((count + 1))
fi
done
temp=$(( sum / count / 1000 ))
sum=0
count=0
for f in /sys/class/hwmon/hwmon*/fan*_input; do
if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val))
count=$((count + 1))
fi
done
fan=$(( sum / count ))
fan=$(printf "%4s" "$fan")
mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}')
mem=$(printf "%2s" "$mem")
disk=$(df / | awk 'NR==2 {gsub("%",""); print $5}')
disk=$(printf "%2s" "$disk")
# Pad POWER to 5 chars (XX.XX)
power=$(upower -b | awk -F: '/energy-rate/ {gsub(/^[ \t]+/, "", $2); split($2,a," "); printf("%.2f", a[1])}')
power=$(printf "%5s" "$power")
# network calculations
iface=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
rx1=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx1=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
sleep 1
rx2=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx2=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
down_speed=$(( (rx2 - rx1) / 1024 ))
up_speed=$(( (tx2 - tx1) / 1024 ))
# Output JSON
echo "{\"cpu\":\"$cpu\",\"temp\":\"$temp\",\"fan\":\"$fan\",\"mem\":\"$mem\",\"disk\":\"$disk\",\"power\":\"$power\",\"down\":\"$down_speed\",\"up\":\"$up_speed\"}"
'';
};
}; };
packages.QS-notifyhistory = pkgs.writeShellApplication { }
name = "QS-notifyhistory";
text = ''
app="$1"
title="$2"
body="$3"
date="$(date +%T)"
urgency="$4"
case "$urgency" in
0) urgency_text="low";;
1) urgency_text="normal";;
2) urgency_text="critical";;
*) urgency_text="unknown";;
esac
{
echo "$app"
echo "$title"
echo "$body"
echo "$date"
echo "$urgency_text"
} >> "$HOME/.cache/notify_history"
'';
};
packages.QS-sysinfo = pkgs.writeShellApplication {
name = "QS-sysinfo";
runtimeInputs = with pkgs; [
ripgrep
gawkInteractive
iproute2
coreutils
procps
upower
];
text = ''
# Pad CPU, MEM, DISK to 2 chars (right-aligned)
cpu=$(awk '/^cpu /{printf("%.0f", ($2+$4)*100/($2+$4+$5))}' /proc/stat)
cpu=$(printf "%2s" "$cpu")
sum=0
count=0
for f in /sys/class/hwmon/hwmon*/temp*_input; do
if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val))
count=$((count + 1))
fi
done
temp=$(( sum / count / 1000 ))
sum=0
count=0
for f in /sys/class/hwmon/hwmon*/fan*_input; do
if [ -r "$f" ]; then
val=$(cat "$f" 2>/dev/null) || continue
sum=$((sum + val))
count=$((count + 1))
fi
done
fan=$(( sum / count ))
fan=$(printf "%4s" "$fan")
mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}')
mem=$(printf "%2s" "$mem")
disk=$(df / | awk 'NR==2 {gsub("%",""); print $5}')
disk=$(printf "%2s" "$disk")
# Pad POWER to 5 chars (XX.XX)
power=$(upower -b | awk -F: '/energy-rate/ {gsub(/^[ \t]+/, "", $2); split($2,a," "); printf("%.2f", a[1])}')
power=$(printf "%5s" "$power")
# network calculations
iface=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
rx1=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx1=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
sleep 1
rx2=$(cat "/sys/class/net/$iface/statistics/rx_bytes")
tx2=$(cat "/sys/class/net/$iface/statistics/tx_bytes")
down_speed=$(( (rx2 - rx1) / 1024 ))
up_speed=$(( (tx2 - tx1) / 1024 ))
# Output JSON
echo "{\"cpu\":\"$cpu\",\"temp\":\"$temp\",\"fan\":\"$fan\",\"mem\":\"$mem\",\"disk\":\"$disk\",\"power\":\"$power\",\"down\":\"$down_speed\",\"up\":\"$up_speed\"}"
'';
};
};}
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.ripgrep = { ... }: { flake.homeModules.ripgrep = _: {
programs.ripgrep = { programs.ripgrep = {
enable = true; enable = true;
arguments = [ arguments = [
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.rofi = { ... }: { flake.homeModules.rofi = _: {
programs.rofi = { programs.rofi = {
enable = true; enable = true;
theme = "gruvbox-dark-hard"; theme = "gruvbox-dark-hard";
+4 -4
View File
@@ -1,7 +1,7 @@
{ ... }: { _: {
flake.homeModules.sbb-tui = { pkgs-unstable, ... }: { flake.homeModules.sbb-tui = {pkgs-unstable, ...}: {
home.packages = [ home.packages = [
pkgs-unstable.sbb-tui pkgs-unstable.sbb-tui
]; ];
home.file.".config/sbb-tui/config.yaml" = { home.file.".config/sbb-tui/config.yaml" = {
enable = true; enable = true;
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.ssh = { ... }: { flake.homeModules.ssh = _: {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
enableDefaultConfig = false; # will be removed in the futur. Removes evaluation warning enableDefaultConfig = false; # will be removed in the futur. Removes evaluation warning
+3 -3
View File
@@ -1,11 +1,11 @@
{ ... }: { _: {
# replaced by caelestia # replaced by caelestia
flake.homeModules.swaync = { ... }: { flake.homeModules.swaync = _: {
services.swaync = { services.swaync = {
enable = true; enable = true;
}; };
}; };
flake.homeModules.swaylock = { ... }: { flake.homeModules.swaylock = _: {
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;
settings = { settings = {
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.thunderbird = { ... }: { flake.homeModules.thunderbird = _: {
programs.thunderbird = { programs.thunderbird = {
enable = true; enable = true;
profiles.tomasr = { profiles.tomasr = {
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.homeModules.vivify = {pkgs-unstable, ...}: { flake.homeModules.vivify = {pkgs-unstable, ...}: {
home.file.".config/vivify/config.json" = { home.file.".config/vivify/config.json" = {
enable = true; enable = true;
+69 -69
View File
@@ -1,6 +1,5 @@
{ ... }: _: {
{ flake.homeModules.waybar = _: {
flake.homeModules.waybar = { ... }: {
# replaced by caelestia # replaced by caelestia
programs.waybar = { programs.waybar = {
enable = true; enable = true;
@@ -372,7 +371,7 @@
@define-color foreground #c5c5c5; @define-color foreground #c5c5c5;
@define-color background #191919; @define-color background #191919;
@define-color cursor #c5c5c5; @define-color cursor #c5c5c5;
@define-color color0 #191919; @define-color color0 #191919;
@define-color color1 #3a3632; @define-color color1 #3a3632;
@define-color color2 #582c1e; @define-color color2 #582c1e;
@@ -389,9 +388,9 @@
@define-color color13 #855f2f; @define-color color13 #855f2f;
@define-color color14 #796d62; @define-color color14 #796d62;
@define-color color15 #c5c5c5; @define-color color15 #c5c5c5;
@define-color active @color6; @define-color active @color6;
* { * {
font-size: 23px; font-size: 23px;
font-family: "0xProto Nerd Font"; font-family: "0xProto Nerd Font";
@@ -403,9 +402,9 @@
text-shadow: none; text-shadow: none;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
window#waybar { window#waybar {
transition-property: background-color; transition-property: background-color;
transition-duration: 0.5s; transition-duration: 0.5s;
@@ -415,23 +414,23 @@
background: alpha(@background, 0.7); background: alpha(@background, 0.7);
color: lighter(@active); color: lighter(@active);
} }
menu, menu,
tooltip { tooltip {
border-radius: 8px; border-radius: 8px;
padding: 2px; padding: 2px;
border: 1px solid lighter(@active); border: 1px solid lighter(@active);
background: alpha(@background, 0.6); background: alpha(@background, 0.6);
color: lighter(@active); color: lighter(@active);
} }
menu label, menu label,
tooltip label { tooltip label {
font-size: 20px; font-size: 20px;
color: lighter(@active); color: lighter(@active);
} }
#submap, #submap,
#tray>.needs-attention { #tray>.needs-attention {
animation-name: blink-active; animation-name: blink-active;
@@ -440,14 +439,14 @@
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-direction: alternate; animation-direction: alternate;
} }
.modules-right { .modules-right {
margin: 0px 6px 6px 6px; margin: 0px 6px 6px 6px;
border-radius: 4px; border-radius: 4px;
background: alpha(@background, 0.4); background: alpha(@background, 0.4);
color: lighter(@active); color: lighter(@active);
} }
.modules-left { .modules-left {
transition-property: background-color; transition-property: background-color;
transition-duration: 0.5s; transition-duration: 0.5s;
@@ -456,7 +455,7 @@
background: alpha(@background, 0.4); background: alpha(@background, 0.4);
color: lighter(@active); color: lighter(@active);
} }
#gcpu, #gcpu,
#custom-github, #custom-github,
#memory, #memory,
@@ -466,7 +465,7 @@
#custom-weather { #custom-weather {
font-size: 17px; font-size: 17px;
} }
#custom-recorder, #custom-recorder,
#connection, #connection,
#cnoti, #cnoti,
@@ -481,38 +480,38 @@
margin: 2px 2px 4px 2px; margin: 2px 2px 4px 2px;
background: alpha(darker(@active), 0.3); background: alpha(darker(@active), 0.3);
} }
#custom-notifications { #custom-notifications {
padding-left: 4px; padding-left: 4px;
} }
#custom-hotspot, #custom-hotspot,
#custom-github, #custom-github,
#custom-notifications { #custom-notifications {
font-size: 20px; font-size: 20px;
} }
#custom-hotspot { #custom-hotspot {
padding-right: 2px; padding-right: 2px;
} }
#custom-vpn, #custom-vpn,
#custom-hotspot { #custom-hotspot {
background: alpha(darker(@active), 0.3); background: alpha(darker(@active), 0.3);
} }
#privacy-item { #privacy-item {
padding: 6px 0px 6px 6px; padding: 6px 0px 6px 6px;
} }
#gcpu { #gcpu {
padding: 8px 0px 8px 0px; padding: 8px 0px 8px 0px;
} }
#custom-cpu-icon { #custom-cpu-icon {
font-size: 36px; font-size: 36px;
} }
#custom-cputemp, #custom-cputemp,
#temperature { #temperature {
font-size: 17px; font-size: 17px;
@@ -523,30 +522,30 @@
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
} }
#custom-github { #custom-github {
padding-top: 2px; padding-top: 2px;
padding-right: 4px; padding-right: 4px;
} }
#custom-dmark { #custom-dmark {
color: alpha(@foreground, 0.3); color: alpha(@foreground, 0.3);
} }
#submap { #submap {
margin-bottom: 0px; margin-bottom: 0px;
} }
#hyprland.window { #hyprland.window {
margin-left: 20px; margin-left: 20px;
} }
#workspaces { #workspaces {
margin: 0px 2px; margin: 0px 2px;
padding: 4px 0px 0px 0px; padding: 4px 0px 0px 0px;
border-radius: 8px; border-radius: 8px;
} }
#workspaces button { #workspaces button {
transition-property: background-color; transition-property: background-color;
transition-duration: 0.5s; transition-duration: 0.5s;
@@ -555,49 +554,49 @@
border-radius: 4px; border-radius: 4px;
color: alpha(@foreground, 0.3); color: alpha(@foreground, 0.3);
} }
#workspaces button.urgent { #workspaces button.urgent {
font-weight: bold; font-weight: bold;
color: @foreground; color: @foreground;
} }
#workspaces button.active { #workspaces button.active {
padding: 4px 2px; padding: 4px 2px;
background: alpha(@active, 0.4); background: alpha(@active, 0.4);
color: lighter(@active); color: lighter(@active);
border-radius: 4px; border-radius: 4px;
} }
#network.wifi { #network.wifi {
padding-right: 4px; padding-right: 4px;
} }
#submap { #submap {
min-width: 0px; min-width: 0px;
margin: 4px 6px 4px 6px; margin: 4px 6px 4px 6px;
} }
#tray { #tray {
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
} }
#bluetooth { #bluetooth {
padding-top: 2px; padding-top: 2px;
} }
#window { #window {
border-radius: 8px; border-radius: 8px;
padding: 4px 14px; padding: 4px 14px;
margin: 4px 2px 4px 2px; margin: 4px 2px 4px 2px;
} }
#battery { #battery {
font-size: 17px; font-size: 17px;
border-radius: 8px; border-radius: 8px;
padding: 4px 0px; padding: 4px 0px;
margin: 4px 2px 4px 2px; margin: 4px 2px 4px 2px;
} }
#battery.discharging.warning { #battery.discharging.warning {
animation-name: blink-yellow; animation-name: blink-yellow;
animation-duration: 1s; animation-duration: 1s;
@@ -605,7 +604,7 @@
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-direction: alternate; animation-direction: alternate;
} }
#battery.discharging.critical { #battery.discharging.critical {
animation-name: blink-red; animation-name: blink-red;
animation-duration: 1s; animation-duration: 1s;
@@ -613,7 +612,7 @@
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-direction: alternate; animation-direction: alternate;
} }
#battery.powerdraw { #battery.powerdraw {
font-size: 17px; font-size: 17px;
padding: 0; padding: 0;
@@ -626,25 +625,25 @@
margin-left: -20px; margin-left: -20px;
margin-right: -20px; margin-right: -20px;
} }
#clock { #clock {
font-weight: bold; font-weight: bold;
padding: 4px 2px 2px 2px; padding: 4px 2px 2px 2px;
} }
#pulseaudio.mic { #pulseaudio.mic {
border-radius: 4px; border-radius: 4px;
color: @background; color: @background;
background: alpha(darker(@foreground), 0.6); background: alpha(darker(@foreground), 0.6);
padding-left: 4px; padding-left: 4px;
} }
#backlight-slider slider, #backlight-slider slider,
#pulseaudio-slider slider { #pulseaudio-slider slider {
background-color: transparent; background-color: transparent;
box-shadow: none; box-shadow: none;
} }
#backlight-slider trough, #backlight-slider trough,
#pulseaudio-slider trough { #pulseaudio-slider trough {
margin-top: 4px; margin-top: 4px;
@@ -653,13 +652,13 @@
border-radius: 8px; border-radius: 8px;
background-color: alpha(@background, 0.6); background-color: alpha(@background, 0.6);
} }
#backlight-slider highlight, #backlight-slider highlight,
#pulseaudio-slider highlight { #pulseaudio-slider highlight {
border-radius: 8px; border-radius: 8px;
background-color: lighter(@active); background-color: lighter(@active);
} }
#bluetooth.discoverable, #bluetooth.discoverable,
#bluetooth.discovering, #bluetooth.discovering,
#bluetooth.pairable { #bluetooth.pairable {
@@ -670,21 +669,21 @@
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-direction: alternate; animation-direction: alternate;
} }
@keyframes blink-active { @keyframes blink-active {
to { to {
background-color: @active; background-color: @active;
color: @foreground; color: @foreground;
} }
} }
@keyframes blink-red { @keyframes blink-red {
to { to {
background-color: #c64d4f; background-color: #c64d4f;
color: @foreground; color: @foreground;
} }
} }
@keyframes blink-yellow { @keyframes blink-yellow {
to { to {
background-color: #cf9022; background-color: #cf9022;
@@ -694,23 +693,24 @@
''; '';
}; };
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-weatherwaybar = pkgs.writeShellApplication { packages.custom-weatherwaybar = pkgs.writeShellApplication {
name = "custom-weatherwaybar"; name = "custom-weatherwaybar";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
curl curl
]; ];
text = '' text = ''
PATTERN="C" PATTERN="C"
PATTERN2=" " PATTERN2=" "
TEXT1="''$(curl -s "https://wttr.in/?format=%c")" TEXT1="''$(curl -s "https://wttr.in/?format=%c")"
TEXT1=''${TEXT1/$PATTERN2/} TEXT1=''${TEXT1/$PATTERN2/}
TEXT2="''$(curl -s "https://wttr.in/?format=%t")" TEXT2="''$(curl -s "https://wttr.in/?format=%t")"
TEXT2=''${TEXT2/$PATTERN/} TEXT2=''${TEXT2/$PATTERN/}
TEXT3="''$(curl -s "https://wttr.in/?format=%f")" TEXT3="''$(curl -s "https://wttr.in/?format=%f")"
TEXT3=''${TEXT3/$PATTERN/} TEXT3=''${TEXT3/$PATTERN/}
printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \ printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \
"$TEXT1" "$TEXT2" "$TEXT3" "$TEXT1" "$TEXT2" "$TEXT3"
''; '';
};
}; };
};} }
+10 -10
View File
@@ -1,6 +1,6 @@
{ ... }: { _: {
# replaced by wlogout # replaced by wlogout
flake.homeModules.wlogout = { ... }: let flake.homeModules.wlogout = _: let
wallpaper = ../../assets/wallpaper1.jpg; wallpaper = ../../assets/wallpaper1.jpg;
lock = ../../assets/lock.png; lock = ../../assets/lock.png;
lock-hover = ../../assets/lock-hover.png; lock-hover = ../../assets/lock-hover.png;
@@ -46,7 +46,7 @@
color: #000000; /* text */ color: #000000; /* text */
background-color: rgba(40, 40, 40, 0.76); background-color: rgba(40, 40, 40, 0.76);
} }
button { button {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
@@ -61,17 +61,17 @@
box-shadow 0.3s ease-in-out, box-shadow 0.3s ease-in-out,
background-color 0.3s ease-in-out; background-color 0.3s ease-in-out;
} }
button:hover { button:hover {
background-color: rgba(250, 137, 26, 0.3); background-color: rgba(250, 137, 26, 0.3);
color: #282828; color: #282828;
} }
button:focus { button:focus {
background-color: #ebdbb2; background-color: #ebdbb2;
color: #282828; color: #282828;
} }
#lock { #lock {
background-image: image(url("${lock}")); background-image: image(url("${lock}"));
} }
@@ -81,7 +81,7 @@
#lock:hover { #lock:hover {
background-image: image(url("${lock-hover}")); background-image: image(url("${lock-hover}"));
} }
#logout { #logout {
background-image: image(url("${logout}")); background-image: image(url("${logout}"));
} }
@@ -91,8 +91,8 @@
#logout:hover { #logout:hover {
background-image: image(url("${logout-hover}")); background-image: image(url("${logout-hover}"));
} }
#shutdown { #shutdown {
background-image: image(url("${shutdown}")); background-image: image(url("${shutdown}"));
} }
@@ -102,7 +102,7 @@
#shutdown:hover { #shutdown:hover {
background-image: image(url("${shutdown-hover}")); background-image: image(url("${shutdown-hover}"));
} }
#reboot { #reboot {
background-image: image(url("${reboot}")); background-image: image(url("${reboot}"));
} }
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.homeModules.zoxide = { ... }: { flake.homeModules.zoxide = _: {
programs.zoxide = { programs.zoxide = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
+6 -6
View File
@@ -1,5 +1,5 @@
{ self, ... }: { {self, ...}: {
flake.homeModules.zsh-laptop = { ... }: { flake.homeModules.zsh-laptop = _: {
programs.zsh = { programs.zsh = {
shellAliases = { shellAliases = {
snrt = "git -C ~/nixos add -A && time sudo nixos-rebuild test --flake ~/nixos/#laptop && pkill shell || true && pkill caelestia-shell || true && caelestia-shell -n > /dev/null 2>&1 & disown"; snrt = "git -C ~/nixos add -A && time sudo nixos-rebuild test --flake ~/nixos/#laptop && pkill shell || true && pkill caelestia-shell || true && caelestia-shell -n > /dev/null 2>&1 & disown";
@@ -7,12 +7,12 @@
}; };
}; };
}; };
flake.homeModules.zsh = {pkgs,...}: { flake.homeModules.zsh = {pkgs, ...}: {
home.packages = [ home.packages = [
self.packages.${pkgs.system}.dejaManuallyDerived self.packages.${pkgs.system}.dejaManuallyDerived
#pkgs-unstable.deja #pkgs-unstable.deja
]; ];
programs.zsh = { programs.zsh = {
enable = true; enable = true;
autosuggestion.enable = false; # zsh-autocomplete is replaced by deja autosuggestion.enable = false; # zsh-autocomplete is replaced by deja
@@ -25,7 +25,7 @@
command cat "$@" command cat "$@"
fi fi
} }
custom-eza() { # behaves differently if we just call it or if we pipe initContent custom-eza() { # behaves differently if we just call it or if we pipe initContent
if [[ -t 1 ]]; then if [[ -t 1 ]]; then
eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@" eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@"
@@ -67,7 +67,7 @@
}; };
}; };
}; };
flake.homeModules.oh-my-zsh = { ... }: { flake.homeModules.oh-my-zsh = _: {
programs.zsh.oh-my-zsh = { programs.zsh.oh-my-zsh = {
enable = true; enable = true;
theme = "jonathan"; theme = "jonathan";
+151 -150
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.battery-laptop = { flake.nixosModules.battery-laptop = {
lib, lib,
config, config,
@@ -20,7 +20,7 @@
# type = lib.types.bool; # type = lib.types.bool;
# }; # };
# }; # };
# config = lib.mkIf cfg.battery.enable { # config = lib.mkIf cfg.battery.enable {
powerManagement.powertop.enable = true; # enable powertop auto tuning on startup. powerManagement.powertop.enable = true; # enable powertop auto tuning on startup.
# Acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12 # Acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12
@@ -53,7 +53,7 @@
}; };
# }; # };
}; };
perSystem = { pkgs, ... }: let perSystem = {pkgs, ...}: let
NotifySound = ../../assets/battery_notify.mp3; NotifySound = ../../assets/battery_notify.mp3;
in { in {
packages.custom-batterynotify = pkgs.writeShellApplication { packages.custom-batterynotify = pkgs.writeShellApplication {
@@ -65,33 +65,33 @@
brightnessctl brightnessctl
]; ];
text = '' text = ''
# Delay for startup # Delay for startup
sleep 5 sleep 5
# Change your sound path here # Change your sound path here
playsound() { playsound() {
mplayer ${NotifySound} mplayer ${NotifySound}
} }
adjustBrightness() { adjustBrightness() {
local adjustment="$1" local adjustment="$1"
brightnessctl set "$adjustment" brightnessctl set "$adjustment"
} }
sendNotification() { sendNotification() {
local title="$1" local title="$1"
local message="$2" local message="$2"
notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u low "$title" "$message" notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u low "$title" "$message"
} }
# Runs full time in background # Runs full time in background
x=0 x=0
while true; do while true; do
Battery_Status="$(\cat /sys/class/power_supply/BAT*/status)" Battery_Status="$(\cat /sys/class/power_supply/BAT*/status)"
Battery_Capacity=$(\cat /sys/class/power_supply/BAT*/capacity) Battery_Capacity=$(\cat /sys/class/power_supply/BAT*/capacity)
case "$Battery_Status" in case "$Battery_Status" in
"Discharging") "Discharging")
if [ $x -eq 1 ]; then if [ $x -eq 1 ]; then
@@ -117,7 +117,7 @@
fi fi
;; ;;
esac esac
sleep 1 sleep 1
done done
''; '';
@@ -130,27 +130,27 @@
brightnessctl brightnessctl
]; ];
text = '' text = ''
# Delay for startup # Delay for startup
sleep 5 sleep 5
playsound() { playsound() {
mplayer ${NotifySound} mplayer ${NotifySound}
} }
while true; do while true; do
Battery_Status="$(cat /sys/class/power_supply/BAT*/status)" Battery_Status="$(cat /sys/class/power_supply/BAT*/status)"
Battery_Capacity="$(cat /sys/class/power_supply/BAT*/capacity)" Battery_Capacity="$(cat /sys/class/power_supply/BAT*/capacity)"
if [ "$Battery_Status" == "Discharging" ]; then if [ "$Battery_Status" == "Discharging" ]; then
if [ "$Battery_Capacity" -le 20 ] && [ "$Battery_Capacity" -ge 10 ]; then if [ "$Battery_Capacity" -le 20 ] && [ "$Battery_Capacity" -ge 10 ]; then
notify-send -e -u critical "Battery Low!" "Power running out: <b>''${Battery_Capacity}%</b>" notify-send -e -u critical "Battery Low!" "Power running out: <b>''${Battery_Capacity}%</b>"
playsound playsound
sleep 180 sleep 180
elif [ "$Battery_Capacity" -lt 10 ]; then elif [ "$Battery_Capacity" -lt 10 ]; then
notify-send -e -u critical "Battery Low!" "<b>Save your works</b> before immediate shutdown." notify-send -e -u critical "Battery Low!" "<b>Save your works</b> before immediate shutdown."
playsound playsound
@@ -170,7 +170,7 @@
packages.qtbatticon = pkgs.stdenv.mkDerivation { packages.qtbatticon = pkgs.stdenv.mkDerivation {
pname = "qtbatticon"; pname = "qtbatticon";
version = "1.0"; version = "1.0";
src = pkgs.writeTextFile { src = pkgs.writeTextFile {
name = "qtbatticon.cpp"; name = "qtbatticon.cpp";
text = '' text = ''
@@ -183,252 +183,253 @@
#include <QString> #include <QString>
#include <QDebug> #include <QDebug>
#include <cstdlib> #include <cstdlib>
QString readFile(const QString &path) { QString readFile(const QString &path) {
QFile f(path); QFile f(path);
if (!f.open(QIODevice::ReadOnly)) return ""; if (!f.open(QIODevice::ReadOnly)) return "";
QTextStream in(&f); QTextStream in(&f);
return in.readAll().trimmed(); return in.readAll().trimmed();
} }
int readInt(const QString &path) { int readInt(const QString &path) {
return readFile(path).toInt(); return readFile(path).toInt();
} }
double readDouble(const QString &path) { double readDouble(const QString &path) {
QFile f(path); QFile f(path);
if (!f.open(QIODevice::ReadOnly)) return 0; if (!f.open(QIODevice::ReadOnly)) return 0;
QTextStream in(&f); QTextStream in(&f);
return in.readAll().trimmed().toDouble(); return in.readAll().trimmed().toDouble();
} }
int toStep(int capacity) { int toStep(int capacity) {
return (capacity / 10) * 10; return (capacity / 10) * 10;
} }
QString pad3(int n) { QString pad3(int n) {
return QString("%1").arg(n, 3, 10, QChar('0')); return QString("%1").arg(n, 3, 10, QChar('0'));
} }
double getPowerW(const QString &batPath) { double getPowerW(const QString &batPath) {
double current_uA = readDouble(batPath + "/current_now"); double current_uA = readDouble(batPath + "/current_now");
double voltage_uV = readDouble(batPath + "/voltage_now"); double voltage_uV = readDouble(batPath + "/voltage_now");
if (current_uA > 0 && voltage_uV > 0) { if (current_uA > 0 && voltage_uV > 0) {
return (current_uA * voltage_uV) / 1e12; return (current_uA * voltage_uV) / 1e12;
} }
return -1; return -1;
} }
QIcon batteryIcon(int capacity, bool charging) { QIcon batteryIcon(int capacity, bool charging) {
int step = toStep(capacity); int step = toStep(capacity);
QString num = pad3(step); QString num = pad3(step);
QString base = "/run/current-system/sw/share/icons/Papirus/24x24/panel/"; QString base = "/run/current-system/sw/share/icons/Papirus/24x24/panel/";
QString file; QString file;
if (charging) { if (charging) {
file = base + "battery-" + num + "-charging.svg"; file = base + "battery-" + num + "-charging.svg";
} else { } else {
file = base + "battery-" + num + ".svg"; file = base + "battery-" + num + ".svg";
} }
QIcon icon(file); QIcon icon(file);
if (icon.isNull()) { if (icon.isNull()) {
qDebug() << "FAILED icon:" << file; qDebug() << "FAILED icon:" << file;
icon = QIcon(base + "battery-100.svg"); icon = QIcon(base + "battery-100.svg");
} }
return icon; return icon;
} }
void sendNotification(const QString &title, const QString &body) { void sendNotification(const QString &title, const QString &body) {
QString cmd = "notify-send \"" + title + "\" \"" + body + "\""; QString cmd = "notify-send \"" + title + "\" \"" + body + "\"";
system(cmd.toUtf8().constData()); system(cmd.toUtf8().constData());
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
QApplication app(argc, argv); QApplication app(argc, argv);
QString batPath = "/sys/class/power_supply/BAT1"; QString batPath = "/sys/class/power_supply/BAT1";
QSystemTrayIcon tray; QSystemTrayIcon tray;
auto updateIcon = [&]() { auto updateIcon = [&]() {
int capacity = readInt(batPath + "/capacity"); int capacity = readInt(batPath + "/capacity");
QString status = readFile(batPath + "/status"); QString status = readFile(batPath + "/status");
bool charging = status.contains("Charging"); bool charging = status.contains("Charging");
tray.setIcon(batteryIcon(capacity, charging)); tray.setIcon(batteryIcon(capacity, charging));
}; };
auto notify = [&]() { auto notify = [&]() {
int capacity = readInt(batPath + "/capacity"); int capacity = readInt(batPath + "/capacity");
QString status = readFile(batPath + "/status"); QString status = readFile(batPath + "/status");
bool charging = status.contains("Charging"); bool charging = status.contains("Charging");
bool discharging = status.contains("Discharging"); bool discharging = status.contains("Discharging");
double power = getPowerW(batPath); double power = getPowerW(batPath);
QString state; QString state;
if (charging) state = "Charging"; if (charging) state = "Charging";
else if (discharging) state = "Discharging"; else if (discharging) state = "Discharging";
else state = status; else state = status;
QString powerStr = (power > 0.01) QString powerStr = (power > 0.01)
? QString::number(power, 'f', 2) + " W" ? QString::number(power, 'f', 2) + " W"
: "N/A"; : "N/A";
QString msg = QString msg =
QString("%1\n%2%\n%3") QString("%1\n%2%\n%3")
.arg(state) .arg(state)
.arg(capacity) .arg(capacity)
.arg(powerStr); .arg(powerStr);
sendNotification("Battery status", msg); sendNotification("Battery status", msg);
}; };
QObject::connect(&tray, &QSystemTrayIcon::activated, QObject::connect(&tray, &QSystemTrayIcon::activated,
[&](QSystemTrayIcon::ActivationReason r) { [&](QSystemTrayIcon::ActivationReason r) {
if (r == QSystemTrayIcon::Trigger) { if (r == QSystemTrayIcon::Trigger) {
notify(); notify();
} }
}); });
updateIcon(); updateIcon();
tray.setVisible(true); tray.setVisible(true);
QTimer timer; QTimer timer;
QObject::connect(&timer, &QTimer::timeout, updateIcon); QObject::connect(&timer, &QTimer::timeout, updateIcon);
timer.start(5000); timer.start(5000);
return app.exec(); return app.exec();
} }
''; '';
}; };
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
qt6.wrapQtAppsHook qt6.wrapQtAppsHook
]; ];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
qt6.qtbase qt6.qtbase
qt6.qtsvg qt6.qtsvg
papirus-icon-theme papirus-icon-theme
]; ];
dontUnpack = true; dontUnpack = true;
buildPhase = '' buildPhase = ''
g++ $src -o qtbatticon \ g++ $src -o qtbatticon \
$(pkg-config --cflags --libs Qt6Widgets) $(pkg-config --cflags --libs Qt6Widgets)
''; '';
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
install -m755 qtbatticon $out/bin/ install -m755 qtbatticon $out/bin/
''; '';
}; };
# This was replaced by caelestia shell's Game Mode # This was replaced by caelestia shell's Game Mode
packages.custom-performance = pkgs.writeShellApplication { packages.custom-performance = pkgs.writeShellApplication {
name = "custom-performance"; name = "custom-performance";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
hyprland hyprland
gawk gawk
libnotify libnotify
]; ];
text = '' text = ''
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
if [ "$HYPRGAMEMODE" = 1 ] ; then if [ "$HYPRGAMEMODE" = 1 ] ; then
hyprctl --batch "\ hyprctl --batch "\
keyword animations:enabled 0;\ keyword animations:enabled 0;\
keyword animation borderangle,0; \ keyword animation borderangle,0; \
keyword decoration:shadow:enabled 0;\ keyword decoration:shadow:enabled 0;\
keyword decoration:blur:enabled 0;\ keyword decoration:blur:enabled 0;\
keyword decoration:fullscreen_opacity 1;\ keyword decoration:fullscreen_opacity 1;\
keyword general:gaps_in 0;\ keyword general:gaps_in 0;\
keyword general:gaps_out 0;\ keyword general:gaps_out 0;\
keyword general:border_size 1;\ keyword general:border_size 1;\
keyword decoration:rounding 0" keyword decoration:rounding 0"
notify-send -u critical -t 5000 "Performance mode [ON]" notify-send -u critical -t 5000 "Performance mode [ON]"
exit exit
else
notify-send -u critical -t 5000 "Performance mode [OFF]"
hyprctl reload
exit 0
fi
'';
};
# Old script that was used for the battery. Might not work.
packages.custom-olddeprecatedbatterynotify = pkgs.writeShellApplication {
name = "custom-olddeprecatedbatterynotify";
runtimeInputs = with pkgs; [
libnotify # provides notify-send
systemd # provides systemctl
];
text = ''
set -euo pipefail
LOW="''${BATTERY_LOW_THRESHOLD:-20}"
CRITICAL="''${BATTERY_CRITICAL_THRESHOLD:-5}"
FULL="''${BATTERY_FULL_THRESHOLD:-95}"
INTERVAL="''${BATTERY_INTERVAL:-30}"
ACTION="''${BATTERY_CRITICAL_ACTION:-systemctl suspend}"
notify() {
notify-send -a "Battery" -u "$1" "$2" "$3"
}
get_info() {
total=0
count=0
for bat in /sys/class/power_supply/BAT*; do
[ -f "$bat/capacity" ] || continue
capacity=$(<"$bat/capacity")
status=$(<"$bat/status")
total=$((total + capacity))
count=$((count + 1))
done
[ "$count" -gt 0 ] || exit 0
percentage=$((total / count))
}
last_state=""
while true; do
get_info
if [[ "$status" == "Discharging" && "$percentage" -le "$CRITICAL" ]]; then
notify critical "Battery Critically Low" "$percentage% suspending."
$ACTION
elif [[ "$status" == "Discharging" && "$percentage" -le "$LOW" ]]; then
if [[ "$last_state" != "low" ]]; then
notify normal "Battery Low" "$percentage% remaining."
last_state="low"
fi
elif [[ "$status" != "Discharging" && "$percentage" -ge "$FULL" ]]; then
if [[ "$last_state" != "full" ]]; then
notify normal "Battery Full" "$percentage% unplug charger."
last_state="full"
fi
else else
last_state="" notify-send -u critical -t 5000 "Performance mode [OFF]"
hyprctl reload
exit 0
fi fi
'';
sleep "$INTERVAL" };
done # Old script that was used for the battery. Might not work.
''; packages.custom-olddeprecatedbatterynotify = pkgs.writeShellApplication {
};}; name = "custom-olddeprecatedbatterynotify";
flake.homeModules.cbatticon = { ... }: {
runtimeInputs = with pkgs; [
libnotify # provides notify-send
systemd # provides systemctl
];
text = ''
set -euo pipefail
LOW="''${BATTERY_LOW_THRESHOLD:-20}"
CRITICAL="''${BATTERY_CRITICAL_THRESHOLD:-5}"
FULL="''${BATTERY_FULL_THRESHOLD:-95}"
INTERVAL="''${BATTERY_INTERVAL:-30}"
ACTION="''${BATTERY_CRITICAL_ACTION:-systemctl suspend}"
notify() {
notify-send -a "Battery" -u "$1" "$2" "$3"
}
get_info() {
total=0
count=0
for bat in /sys/class/power_supply/BAT*; do
[ -f "$bat/capacity" ] || continue
capacity=$(<"$bat/capacity")
status=$(<"$bat/status")
total=$((total + capacity))
count=$((count + 1))
done
[ "$count" -gt 0 ] || exit 0
percentage=$((total / count))
}
last_state=""
while true; do
get_info
if [[ "$status" == "Discharging" && "$percentage" -le "$CRITICAL" ]]; then
notify critical "Battery Critically Low" "$percentage% suspending."
$ACTION
elif [[ "$status" == "Discharging" && "$percentage" -le "$LOW" ]]; then
if [[ "$last_state" != "low" ]]; then
notify normal "Battery Low" "$percentage% remaining."
last_state="low"
fi
elif [[ "$status" != "Discharging" && "$percentage" -ge "$FULL" ]]; then
if [[ "$last_state" != "full" ]]; then
notify normal "Battery Full" "$percentage% unplug charger."
last_state="full"
fi
else
last_state=""
fi
sleep "$INTERVAL"
done
'';
};
};
flake.homeModules.cbatticon = _: {
# don't works. some GTK error. I let it here if someday, someone is interest in this shit. # don't works. some GTK error. I let it here if someday, someone is interest in this shit.
# ChatGPT half baked a replacement that works on my system. # ChatGPT half baked a replacement that works on my system.
# see qtbatticon # see qtbatticon
+1 -1
View File
@@ -1,4 +1,4 @@
{ ...}: { _: {
flake.nixosModules.bluetooth = {pkgs, ...}: { flake.nixosModules.bluetooth = {pkgs, ...}: {
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
+2 -2
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.bootloader-laptop = { flake.nixosModules.bootloader-laptop = {
inputs, inputs,
pkgs, pkgs,
@@ -8,7 +8,7 @@
boot.loader.grub = { boot.loader.grub = {
theme = inputs.nixos-grub-themes.packages.${pkgs.system}.nixos; # if you want to use nixos grub theme theme = inputs.nixos-grub-themes.packages.${pkgs.system}.nixos; # if you want to use nixos grub theme
}; };
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
+3 -3
View File
@@ -1,11 +1,11 @@
{ ... }: { _: {
flake.nixosModules.disk = { pkgs, ... }: { flake.nixosModules.disk = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
gnome-disk-utility gnome-disk-utility
udiskie udiskie
]; ];
}; };
flake.nixosModules.disk-laptop = { ... }: { flake.nixosModules.disk-laptop = _: {
# i found swap necessary when running nixpkgs review # i found swap necessary when running nixpkgs review
swapDevices = [ swapDevices = [
{ {
+6 -6
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.hardware-configuration-laptop = { flake.nixosModules.hardware-configuration-laptop = {
config, config,
lib, lib,
@@ -11,25 +11,25 @@
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod"]; boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod"];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/6aa664c2-8b23-4e20-b6e9-1806bf0f8df2"; device = "/dev/disk/by-uuid/6aa664c2-8b23-4e20-b6e9-1806bf0f8df2";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-uuid/A59A-7AFA"; device = "/dev/disk/by-uuid/A59A-7AFA";
fsType = "vfat"; fsType = "vfat";
options = ["fmask=0077" "dmask=0077"]; options = ["fmask=0077" "dmask=0077"];
}; };
swapDevices = []; swapDevices = [];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}; };
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.hardwareUtils-laptop = {pkgs, ...}: { flake.nixosModules.hardwareUtils-laptop = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# used for the framework 16 laptop # used for the framework 16 laptop
+5 -5
View File
@@ -1,15 +1,15 @@
{ ... }: { _: {
flake.nixosModules.udev = { ... }: { flake.nixosModules.udev = _: {
# udev with only the necessary rules. See udev.nix to get all the rules # udev with only the necessary rules. See udev.nix to get all the rules
services.udev.extraRules = '' services.udev.extraRules = ''
# adapted from here https://wiki.nixos.org/wiki/Keychron_M6 # adapted from here https://wiki.nixos.org/wiki/Keychron_M6
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="32ac", MODE="0660", GROUP="users", TAG+="uaccess" KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="32ac", MODE="0660", GROUP="users", TAG+="uaccess"
# taken from here # taken from here
SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0013", TAG+="uaccess" SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0013", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0018", TAG+="uaccess" SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0018", TAG+="uaccess"
# acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12 # acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12
# the random keypress stuck comes from conflict between powertop and udev # the random keypress stuck comes from conflict between powertop and udev
# fix from: https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68 # fix from: https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68
+22 -20
View File
@@ -1,16 +1,19 @@
{ inputs, self, ...}: { {
inputs,
self,
...
}: {
flake.nixosConfigurations.laptop = inputs.nixpkgs.lib.nixosSystem { flake.nixosConfigurations.laptop = inputs.nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; #system = "x86_64-linux";
specialArgs = { specialArgs = {
inherit (self) pkgs-unstable; inherit (self) pkgs-unstable;
}; };
modules = with self.nixosModules; [ modules = with self.nixosModules; [
# important do not remove # important do not remove
home-manager-laptop home-manager-laptop
laptop laptop
{ nixpkgs.pkgs = self.pkgs; } {nixpkgs.pkgs = self.pkgs;}
# keep this alphabetically organised # keep this alphabetically organised
anki anki
audioAndMedia audioAndMedia
autoCleanup-laptop autoCleanup-laptop
@@ -44,7 +47,7 @@
user user
]; ];
}; };
flake.homeModules.laptop = { ... }: { flake.homeModules.laptop = {...}: {
imports = with self.homeModules; [ imports = with self.homeModules; [
inputs.caelestia-shell.homeManagerModules.default inputs.caelestia-shell.homeManagerModules.default
anki anki
@@ -67,13 +70,13 @@
ssh ssh
thunderbird thunderbird
tomasr tomasr
vivify vivify
zoxide zoxide
zsh zsh
zsh-laptop zsh-laptop
]; ];
}; };
flake.nixosModules.laptop = { ... }: { flake.nixosModules.laptop = _: {
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave
@@ -81,25 +84,25 @@
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "25.11"; # Did you read the comment? system.stateVersion = "25.11"; # Did you read the comment?
nix.settings.experimental-features = [ nix.settings.experimental-features = [
"nix-command" "nix-command"
"flakes" "flakes"
]; ];
}; };
flake.nixosModules.home-manager-laptop = { pkgs, ... }: { flake.nixosModules.home-manager-laptop = {pkgs, ...}: {
imports = [ imports = [
inputs.home-manager.nixosModules.default # import official home-manager NixOS module inputs.home-manager.nixosModules.default # import official home-manager NixOS module
]; ];
# Warning. Git is used in case I break everything up. It already saved me once # Warning. Git is used in case I break everything up. It already saved me once
environment.systemPackages = [ pkgs.git ]; environment.systemPackages = [pkgs.git];
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { extraSpecialArgs = {
pkgs-unstable = self.pkgs-unstable; inherit (self) pkgs-unstable;
inherit self; inherit self;
}; };
}; };
@@ -108,11 +111,10 @@
}; };
home-manager.users.tomasr = self.homeModules.laptop; home-manager.users.tomasr = self.homeModules.laptop;
}; };
flake.homeModules.tomasr = { ... }: { flake.homeModules.tomasr = _: {
home.username = "tomasr"; home.username = "tomasr";
home.homeDirectory = "/home/tomasr"; home.homeDirectory = "/home/tomasr";
home.sessionVariables = { home.sessionVariables = {
EDITOR = "neovim"; EDITOR = "neovim";
TERMINAL = "kitty"; TERMINAL = "kitty";
@@ -127,7 +129,7 @@
# You should not change this value, even if you update Home Manager. If you do # You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager # want to update the value, then make sure to first check the Home Manager
# release notes. # release notes.
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
}; };
+4 -4
View File
@@ -1,17 +1,17 @@
{ ... }: { _: {
flake.nixosModules.IO = {pkgs, ...}: { flake.nixosModules.IO = {pkgs, ...}: {
# Configure keymap in X11 # Configure keymap in X11
services.xserver.xkb = { services.xserver.xkb = {
layout = "ch"; layout = "ch";
variant = "fr"; variant = "fr";
}; };
# Configure console keymap # Configure console keymap
console.keyMap = "fr_CH"; console.keyMap = "fr_CH";
# Enable touchpad support (enabled default in most desktopManager). # Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true; # services.xserver.libinput.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
wl-clipboard wl-clipboard
cliphist cliphist
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.homeModules.cursor = {pkgs, ...}: { flake.homeModules.cursor = {pkgs, ...}: {
home.pointerCursor = { home.pointerCursor = {
hyprcursor.enable = true; hyprcursor.enable = true;
+3 -3
View File
@@ -1,6 +1,6 @@
{ ... }: { _: {
flake.homeModules.desktopEntries = { ... }: { flake.homeModules.desktopEntries = _: {
# for when the system lacks of a .desktop file # for when the system lacks of a .desktop file
home.file.".local/share/applications/org.quickshell.desktop" = { home.file.".local/share/applications/org.quickshell.desktop" = {
enable = true; enable = true;
text = '' text = ''
+2 -2
View File
@@ -1,5 +1,5 @@
{ ... }: { _: {
flake.nixosModules.fonts = { pkgs, ... }: { flake.nixosModules.fonts = {pkgs, ...}: {
# fonts # fonts
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
nerd-fonts._0xproto nerd-fonts._0xproto
+3 -3
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.printer = {pkgs, ...}: { flake.nixosModules.printer = {pkgs, ...}: {
#https://wiki.nixos.org/wiki/Printing #https://wiki.nixos.org/wiki/Printing
services.avahi = { services.avahi = {
@@ -6,7 +6,7 @@
nssmdns4 = true; nssmdns4 = true;
openFirewall = true; openFirewall = true;
}; };
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing = { services.printing = {
enable = true; enable = true;
@@ -34,7 +34,7 @@
model = "drv:///hp/hpcups.drv/hp-officejet_pro_7740_series.ppd"; model = "drv:///hp/hpcups.drv/hp-officejet_pro_7740_series.ppd";
} }
]; ];
ensureDefaultPrinter = "HP_OfficeJet_Pro_7740"; ensureDefaultPrinter = "HP_OfficeJet_Pro_7740";
}; };
}; };
+10 -10
View File
@@ -1,21 +1,21 @@
{ ... }: { _: {
flake.nixosModules.user = { flake.nixosModules.user = {
pkgs, pkgs,
pkgs-unstable, pkgs-unstable,
... ...
}: { }: {
services.dbus.enable = true; services.dbus.enable = true;
security.polkit.enable = true; security.polkit.enable = true;
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Zurich"; time.timeZone = "Europe/Zurich";
# Select internationalisation properties. # Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
# zsh dont want to work if it is not initialzed here. # zsh dont want to work if it is not initialzed here.
programs.zsh.enable = true; programs.zsh.enable = true;
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users.tomasr = { users.users.tomasr = {
isNormalUser = true; isNormalUser = true;
@@ -23,9 +23,9 @@
extraGroups = ["networkmanager" "wheel" "fuse"]; #wheel allow to use sudo / fuse -> rclone extraGroups = ["networkmanager" "wheel" "fuse"]; #wheel allow to use sudo / fuse -> rclone
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
services.upower.enable = true; services.upower.enable = true;
# removes need for password for nixos-rebuild # removes need for password for nixos-rebuild
security.sudo.extraRules = [ security.sudo.extraRules = [
{ {
+12 -12
View File
@@ -1,14 +1,14 @@
{ ... }: { _: {
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-bottom = pkgs.writeShellApplication { packages.custom-bottom = pkgs.writeShellApplication {
name = "custom-bottom"; name = "custom-bottom";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
kitty kitty
bottom bottom
]; ];
text = '' text = ''
kitty --class "custom-bottom" -o font_size=10 --name "custom-bottom" -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T kitty --class "custom-bottom" -o font_size=10 --name "custom-bottom" -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T
''; '';
};
}; };
};
} }
+71 -72
View File
@@ -1,75 +1,74 @@
{ ... }: { _: {
perSystem = {pkgs, ...}: {
perSystem = { pkgs, ... }: { packages.custom-colorpicker = pkgs.writeShellApplication {
packages.custom-colorpicker = pkgs.writeShellApplication { # useless. Just use hyprpicker
# useless. Just use hyprpicker name = "custom-colorpicker";
name = "custom-colorpicker"; runtimeInputs = with pkgs; [
runtimeInputs = with pkgs; [ hyprpicker
hyprpicker libnotify
libnotify toybox
toybox wl-clipboard
wl-clipboard ];
]; text = ''
text = '' check() {
check() { command -v "$1" 1>/dev/null
command -v "$1" 1>/dev/null
}
notify() {
check notify-send && {
notify-send -a "Color Picker" "$@"
return
} }
echo "$@"
} notify() {
check notify-send && {
loc="$HOME/.cache/colorpicker" notify-send -a "Color Picker" "$@"
[ -d "$loc" ] || mkdir -p "$loc" return
[ -f "$loc/colors" ] || touch "$loc/colors" }
echo "$@"
limit=10 }
[[ $# -eq 1 && $1 = "-l" ]] && { loc="$HOME/.cache/colorpicker"
cat "$loc/colors" [ -d "$loc" ] || mkdir -p "$loc"
exit [ -f "$loc/colors" ] || touch "$loc/colors"
}
limit=10
[[ $# -eq 1 && $1 = "-j" ]] && {
text="$(head -n 1 "$loc/colors")" [[ $# -eq 1 && $1 = "-l" ]] && {
cat "$loc/colors"
mapfile -t allcolors < <(tail -n +2 "$loc/colors") exit
# allcolors=($(tail -n +2 "$loc/colors")) }
tooltip="<b> COLORS</b>\n\n"
[[ $# -eq 1 && $1 = "-j" ]] && {
tooltip+="-> <b>$text</b> <span color='$text'>󰸌</span> \n" text="$(head -n 1 "$loc/colors")"
for i in "''${allcolors[@]}"; do
tooltip+=" <b>$i</b> <span color='$i'>󰸌</span> \n" mapfile -t allcolors < <(tail -n +2 "$loc/colors")
done # allcolors=($(tail -n +2 "$loc/colors"))
tooltip="<b> COLORS</b>\n\n"
cat <<EOF
{ "text":"<span color='$text'>󰸌</span>", "tooltip":"$tooltip"} tooltip+="-> <b>$text</b> <span color='$text'>󰸌</span> \n"
EOF for i in "''${allcolors[@]}"; do
tooltip+=" <b>$i</b> <span color='$i'>󰸌</span> \n"
exit done
}
cat <<EOF
check hyprpicker || { { "text":"<span color='$text'>󰸌</span>", "tooltip":"$tooltip"}
notify "hyprpicker is not installed" EOF
exit
} exit
killall -q hyprpicker }
color=$(hyprpicker)
check hyprpicker || {
check wl-copy && { notify "hyprpicker is not installed"
echo "$color" | sed -z 's/\n//g' | wl-copy exit
} }
killall -q hyprpicker
prevColors=$(head -n $((limit - 1)) "$loc/colors") color=$(hyprpicker)
echo "$color" >"$loc/colors"
echo "$prevColors" >>"$loc/colors" check wl-copy && {
sed -i '/^$/d' "$loc/colors" echo "$color" | sed -z 's/\n//g' | wl-copy
pkill -RTMIN+1 waybar }
'';
prevColors=$(head -n $((limit - 1)) "$loc/colors")
echo "$color" >"$loc/colors"
echo "$prevColors" >>"$loc/colors"
sed -i '/^$/d' "$loc/colors"
pkill -RTMIN+1 waybar
'';
};
}; };
};
} }
+83 -82
View File
@@ -1,83 +1,84 @@
{ ... }: { _: {
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-cowsay = pkgs.writeShellApplication { packages.custom-cowsay = pkgs.writeShellApplication {
name = "custom-cowsay"; name = "custom-cowsay";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
cowsay cowsay
]; ];
text = '' text = ''
cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www") cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www")
declare -a sentences=( declare -a sentences=(
"Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something. -Richard Stallman" "Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something. -Richard Stallman"
"Free software' is a matter of liberty, not price. To understand the concept, you should think of 'free' as in 'free speech,' not as in 'free beer'. -Richard Stallman" "Free software' is a matter of liberty, not price. To understand the concept, you should think of 'free' as in 'free speech,' not as in 'free beer'. -Richard Stallman"
"Programming is not a science. Programming is a craft. -Richard Stallman" "Programming is not a science. Programming is a craft. -Richard Stallman"
"I did write some code in Java once, but that was the island in Indonesia. -Richard Stallman" "I did write some code in Java once, but that was the island in Indonesia. -Richard Stallman"
"Facebook is not your friend, it is a surveillance engine. -Richard Stallman" "Facebook is not your friend, it is a surveillance engine. -Richard Stallman"
"People said I should accept the world. Bullshit! I don't accept the world. -Richard Stallman" "People said I should accept the world. Bullshit! I don't accept the world. -Richard Stallman"
"You can use any editor you want, but remember that vi vi vi is the text editor of the beast. -Richard Stallman" "You can use any editor you want, but remember that vi vi vi is the text editor of the beast. -Richard Stallman"
"The idea of copyright did not exist in ancient times, when authors frequently copied other authors at length in works of non-fiction. This practice was useful, and is the only way many authors' works have survived even in part. -Richard Stallman" "The idea of copyright did not exist in ancient times, when authors frequently copied other authors at length in works of non-fiction. This practice was useful, and is the only way many authors' works have survived even in part. -Richard Stallman"
"Idiots can be defeated but they never admit it. -Richard Stallman" "Idiots can be defeated but they never admit it. -Richard Stallman"
"Open source is a development methodology; free software is a social movement. -Richard Stallman" "Open source is a development methodology; free software is a social movement. -Richard Stallman"
"People sometimes ask me if it is a sin in the Church of Emacs to use vi. Using a free version of vi is not a sin; it is a penance. So happy hacking. -Richard Stallman" "People sometimes ask me if it is a sin in the Church of Emacs to use vi. Using a free version of vi is not a sin; it is a penance. So happy hacking. -Richard Stallman"
"A computer is like air conditioning - it becomes useless when you open Windows -Linus Torvald" "A computer is like air conditioning - it becomes useless when you open Windows -Linus Torvald"
"Intelligence is the ability to avoid doing work, yet getting the work done. -Linus Torvald" "Intelligence is the ability to avoid doing work, yet getting the work done. -Linus Torvald"
"Software is like sex: It's better when it's free. -Linus Torvald" "Software is like sex: It's better when it's free. -Linus Torvald"
"All operating systems sucks, but Linux just sucks less -Linus Torvald" "All operating systems sucks, but Linux just sucks less -Linus Torvald"
"I like offending people, because I think people who get offended should be offended. -Linus Torval" "I like offending people, because I think people who get offended should be offended. -Linus Torval"
"Talk is cheap. Show me the code. -Linus Torval" "Talk is cheap. Show me the code. -Linus Torval"
"Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. -Linus Torvald" "Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. -Linus Torvald"
"Bad programmers worry about the code. Good programmers worry about data structures and their relationships. -Linus Torvald" "Bad programmers worry about the code. Good programmers worry about data structures and their relationships. -Linus Torvald"
"If Microsoft ever does applications for Linux it means I've won. -Linus Torvald" "If Microsoft ever does applications for Linux it means I've won. -Linus Torvald"
"Avoiding complexity reduces bugs. -Linus Torvald" "Avoiding complexity reduces bugs. -Linus Torvald"
"Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it. -Linus Torvald" "Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it. -Linus Torvald"
"Nobody actually creates perfect code the first time around, except me. But there's only one of me. -Linus Torvald" "Nobody actually creates perfect code the first time around, except me. But there's only one of me. -Linus Torvald"
"Microsoft isn't evil, they just make really crappy operating systems. -Linus Torvald" "Microsoft isn't evil, they just make really crappy operating systems. -Linus Torvald"
"When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, for free.' -Linus Torval" "When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, for free.' -Linus Torval"
"C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. -Linus Torvald" "C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. -Linus Torvald"
"If you think your users are idiots, only idiots will use it. -Linus Torvald" "If you think your users are idiots, only idiots will use it. -Linus Torvald"
"My name is Linus, and I am your God. -Linus Torvald" "My name is Linus, and I am your God. -Linus Torvald"
"An infinite number of monkeys typing into GNU emacs would never make a good program. -Linus Torvald" "An infinite number of monkeys typing into GNU emacs would never make a good program. -Linus Torvald"
"Object-oriented programming is an exceptionally bad idea which could only have originated in California. -Edgser Dijkstra" "Object-oriented programming is an exceptionally bad idea which could only have originated in California. -Edgser Dijkstra"
"If debugging is the process of removing software bugs, then programming must be the process of putting them in. -Edgser Dijkstra" "If debugging is the process of removing software bugs, then programming must be the process of putting them in. -Edgser Dijkstra"
"The art of programming is the art of organizing complexity. -Edgser Dijkstra" "The art of programming is the art of organizing complexity. -Edgser Dijkstra"
"Program testing can be used to show the presence of bugs, but never to show their absence! -Edgser Dijkstra" "Program testing can be used to show the presence of bugs, but never to show their absence! -Edgser Dijkstra"
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. -Edgser Dijkstra" "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. -Edgser Dijkstra"
"The effort of using machines to mimic the human mind has always struck me as rather silly. I would rather use them to mimic something better. -Edgser Dijkstra" "The effort of using machines to mimic the human mind has always struck me as rather silly. I would rather use them to mimic something better. -Edgser Dijkstra"
"Computer science is no more about computers than astronomy is about telescopes. -Edgser Dijkstra" "Computer science is no more about computers than astronomy is about telescopes. -Edgser Dijkstra"
"Programming in Basic causes brain damage. -Edgser Dijkstra" "Programming in Basic causes brain damage. -Edgser Dijkstra"
"The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. -Edgser Dijkstra" "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. -Edgser Dijkstra"
"If in physics there's something you don't understand, you can always hide behind the uncharted depths of nature. You can always blame God. You didn't make it so complex yourself. But if your program doesn't work, there is no one to hide behind. You cannot hide behind an obstinate nature. If it doesn't work, you've messed up. -Edgser Dijkstra" "If in physics there's something you don't understand, you can always hide behind the uncharted depths of nature. You can always blame God. You didn't make it so complex yourself. But if your program doesn't work, there is no one to hide behind. You cannot hide behind an obstinate nature. If it doesn't work, you've messed up. -Edgser Dijkstra"
"Teaching COBOL ought to be regarded as a criminal act. -Edgser Dijkstra" "Teaching COBOL ought to be regarded as a criminal act. -Edgser Dijkstra"
"If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. -Edgser Dijkstra" "If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. -Edgser Dijkstra"
"If we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent.' -Edgser Dijkstra" "If we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent.' -Edgser Dijkstra"
"In almost every computation a great variety of arrangements for the succession of the processes is possible, and various considerations must influence the selections amongst them for the purposes of a calculating engine. One essential object is to choose that arrangement which shall tend to reduce to a minimum the time necessary for completing the calculation. -Ada Lovelace" "In almost every computation a great variety of arrangements for the succession of the processes is possible, and various considerations must influence the selections amongst them for the purposes of a calculating engine. One essential object is to choose that arrangement which shall tend to reduce to a minimum the time necessary for completing the calculation. -Ada Lovelace"
"Im making an operating system myself, so I know what its like to be God. -Terry Davis" "Im making an operating system myself, so I know what its like to be God. -Terry Davis"
"Im schizophrenic and so am I. -Terry Davis" "Im schizophrenic and so am I. -Terry Davis"
"If I was a dog, I would bark. -Terry Davis" "If I was a dog, I would bark. -Terry Davis"
"Who has a better kernel? Debian? No. -Terry Davis" "Who has a better kernel? Debian? No. -Terry Davis"
"Computers are fast, programmers keep it slow. -A random Reddit user" "Computers are fast, programmers keep it slow. -A random Reddit user"
"Before software can be reusable it first has to be usable. -Ralph Johnson" "Before software can be reusable it first has to be usable. -Ralph Johnson"
"The best thing about a Boolean is that even if you are wrong, you're only off by a bit. -Anonymous" "The best thing about a Boolean is that even if you are wrong, you're only off by a bit. -Anonymous"
"It's not a bug, it's a feature. -Programmers" "It's not a bug, it's a feature. -Programmers"
"NVIDIA, fuck you -Linus Torvald" "NVIDIA, fuck you -Linus Torvald"
) )
while true while true
do do
echo echo
echo echo
echo echo
echo echo
echo echo
echo echo
SIndex=$(( RANDOM % ''${#sentences[@]} )) SIndex=$(( RANDOM % ''${#sentences[@]} ))
index=$(( RANDOM % ''${#cows[@]} )) index=$(( RANDOM % ''${#cows[@]} ))
#cow="/usr/share/cowsay/cows/''${cows[index]}.cow" #cow="/usr/share/cowsay/cows/''${cows[index]}.cow"
cowsay -f "''${cows[index]}" "''${sentences[SIndex]}" cowsay -f "''${cows[index]}" "''${sentences[SIndex]}"
sleep 10 sleep 10
clear clear
done done
''; '';
# reduce terminal size for actually # reduce terminal size for actually
};
}; };
};} }
+32 -32
View File
@@ -1,34 +1,34 @@
{ ... }: { _: {
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
# fzf librewolf profile selector # fzf librewolf profile selector
packages.custom-librewolfprofiles = pkgs.writeShellApplication { packages.custom-librewolfprofiles = pkgs.writeShellApplication {
name = "custom-librewolfprofiles"; name = "custom-librewolfprofiles";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
zsh zsh
fzf fzf
]; ];
text = '' text = ''
# List of profiles # List of profiles
profiles=("work" "other" "private window") profiles=("work" "other" "private window")
# Use fzf to select # Use fzf to select
selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:") selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:")
# If user cancels, exit # If user cancels, exit
[[ -z "$selected" ]] && exit 0 [[ -z "$selected" ]] && exit 0
# Launch LibreWolf detached, keeping environment # Launch LibreWolf detached, keeping environment
if [[ "$selected" == "private window" ]]; then if [[ "$selected" == "private window" ]]; then
setsid librewolf --private-window --no-remote >/dev/null 2>&1 & setsid librewolf --private-window --no-remote >/dev/null 2>&1 &
pkill -f "kitty.*Select LibreWolf profile" pkill -f "kitty.*Select LibreWolf profile"
else else
setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 & setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 &
pkill -f "kitty.*Select LibreWolf profile" pkill -f "kitty.*Select LibreWolf profile"
fi fi
# Exit the kitty terminal after selection # Exit the kitty terminal after selection
exit exit
''; '';
}; };
}; };
} }
+31 -30
View File
@@ -1,30 +1,31 @@
{ ... }: _: {
{ perSystem = {pkgs, ...}: {
perSystem = { pkgs, ... }: { # counts how many syllabes in a string.
# counts how many syllabes in a string. # not perfect. Does not handle silents e in french
# not perfect. Does not handle silents e in french # but that's what I use for writing poetry
# but that's what I use for writing poetry packages.custom-syllabes =
packages.custom-syllabes = pkgs.writers.writePython3Bin "custom-syllabes" { pkgs.writers.writePython3Bin "custom-syllabes" {
libraries = with pkgs; [ libraries = with pkgs; [
python3Packages.pyphen python3Packages.pyphen
]; ];
} '' } ''
import sys import sys
import pyphen import pyphen
dic = pyphen.Pyphen(lang="fr") dic = pyphen.Pyphen(lang="fr")
text = sys.stdin.read().strip() text = sys.stdin.read().strip()
chunks = [] chunks = []
total = 0 total = 0
for w in text.split(): for w in text.split():
hyphenated = dic.inserted(w) hyphenated = dic.inserted(w)
parts = hyphenated.split("-") parts = hyphenated.split("-")
chunks.append("/".join(parts)) chunks.append("/".join(parts))
total += len(parts) total += len(parts)
print(f"{total} ({'/'.join(chunks)})") print(f"{total} ({'/'.join(chunks)})")
''; '';
};} };
}
+12 -13
View File
@@ -1,15 +1,14 @@
{ ... }: _: {
{ perSystem = {pkgs, ...}: {
perSystem = { pkgs, ...}: { packages.custom-tomato = pkgs.writeShellApplication {
packages.custom-tomato = pkgs.writeShellApplication { name = "custom-tomato";
name = "custom-tomato"; runtimeInputs = with pkgs; [
runtimeInputs = with pkgs; [ kitty
kitty tomato-c
tomato-c ];
]; text = ''
text = '' kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato
kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato '';
''; };
}; };
};
} }
+15 -15
View File
@@ -1,16 +1,16 @@
{ ... }: _: {
{ perSystem = {pkgs, ...}: {
perSystem = { pkgs, ... }: { packages.custom-weather = pkgs.writeShellApplication {
packages.custom-weather = pkgs.writeShellApplication { name = "custom-weather";
name = "custom-weather"; runtimeInputs = with pkgs; [
runtimeInputs = with pkgs; [ curl
curl ];
]; text = ''
text = '' while true; do
while true; do curl "https://wttr.in/?0&d&q&F&lang=fr"
curl "https://wttr.in/?0&d&q&F&lang=fr" sleep 7200
sleep 7200 done
done '';
''; };
}; };
};} }
+41 -41
View File
@@ -1,41 +1,41 @@
{ self, ... }: { {self, ...}: {
perSystem = { pkgs, ...}: perSystem = {pkgs, ...}: let
let inherit (self) pkgs-unstable;
pkgs-unstable = self.pkgs-unstable; in {
in # perSystem doesnt like pkgs-unstable we must input it globally
{ # perSystem doesnt like pkgs-unstable we must input it globally packages.dejaManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: {
packages.dejaManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: { pname = "deja";
pname = "deja"; version = "0.2.6";
version = "0.2.6"; __structuredAttrs = true;
__structuredAttrs = true; src = pkgs.fetchFromGitHub {
src = pkgs.fetchFromGitHub { owner = "Giammarco-Ferranti";
owner = "Giammarco-Ferranti"; repo = "deja";
repo = "deja"; tag = "v${finalAttrs.version}";
tag = "v${finalAttrs.version}"; hash = "sha256-xxbClKhhSwo+jUjAZ2gS4yOS5sSI76dfPpDzA3qdV18=";
hash = "sha256-xxbClKhhSwo+jUjAZ2gS4yOS5sSI76dfPpDzA3qdV18="; };
};
vendorHash = "sha256-KmLdMK94cGOXMPJwWS6NgLB5OiNmJbszHdnLzauqJm8=";
vendorHash = "sha256-KmLdMK94cGOXMPJwWS6NgLB5OiNmJbszHdnLzauqJm8=";
ldflags = [
ldflags = [ "-s"
"-s" "-w"
"-w" "-X main.version=${finalAttrs.version}"
"-X main.version=${finalAttrs.version}" ];
];
doCheck = true;
doCheck = true;
nativeCheckInputs = [pkgs.versionCheckHook];
nativeCheckInputs = [pkgs.versionCheckHook];
passthru.updateScript = pkgs.nix-update-script {};
passthru.updateScript = pkgs.nix-update-script {};
meta = {
meta = { description = "Predictive inline shell autosuggestions for zsh";
description = "Predictive inline shell autosuggestions for zsh"; homepage = "https://github.com/Giammarco-Ferranti/deja";
homepage = "https://github.com/Giammarco-Ferranti/deja"; license = pkgs.lib.licenses.mit;
license = pkgs.lib.licenses.mit; platforms = pkgs.lib.platforms.unix;
platforms = pkgs.lib.platforms.unix; maintainers = with pkgs.lib.maintainers; [tomasrivera];
maintainers = with pkgs.lib.maintainers; [tomasrivera]; mainProgram = "deja";
mainProgram = "deja"; };
}; });
}); };
};} }
+44 -39
View File
@@ -1,39 +1,44 @@
{ ... }: { _: {
perSystem = { pkgs, pkgs-unstable, ... }: { perSystem = {
packages.sbb-tuiManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: { pkgs,
pname = "sbb-tui"; pkgs-unstable,
version = "1.14.2"; ...
__structuredAttrs = true; }: {
src = pkgs.fetchFromGitHub { packages.sbb-tuiManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: {
owner = "Necrom4"; pname = "sbb-tui";
repo = "sbb-tui"; version = "1.14.2";
tag = "v${finalAttrs.version}"; __structuredAttrs = true;
hash = pkgs.lib.fakeHash; src = pkgs.fetchFromGitHub {
}; owner = "Necrom4";
repo = "sbb-tui";
vendorHash = "sha256-K4DOu3rfSlKAa5JNKCzWWpnWZlXXxtN5Po7p1Spqe1w="; tag = "v${finalAttrs.version}";
hash = pkgs.lib.fakeHash;
ldflags = [ };
"-s"
"-w" vendorHash = "sha256-K4DOu3rfSlKAa5JNKCzWWpnWZlXXxtN5Po7p1Spqe1w=";
"-X main.version=${finalAttrs.version}"
]; ldflags = [
"-s"
allowGoReference = true; "-w"
"-X main.version=${finalAttrs.version}"
doCheck = true; ];
nativeCheckInputs = [pkgs.versionCheckHook]; allowGoReference = true;
passthru.updateScript = pkgs.nix-update-script {}; doCheck = true;
meta = { nativeCheckInputs = [pkgs.versionCheckHook];
description = "TUI client for Switzerland's public transport timetables, inspired by SBB/CFF/FFS app";
homepage = "https://github.com/Necrom4/sbb-tui"; passthru.updateScript = pkgs.nix-update-script {};
license = pkgs.lib.licenses.mit;
platforms = pkgs.lib.platforms.unix; meta = {
maintainers = with pkgs.lib.maintainers; [tomasrivera]; description = "TUI client for Switzerland's public transport timetables, inspired by SBB/CFF/FFS app";
mainProgram = "sbb-tui"; homepage = "https://github.com/Necrom4/sbb-tui";
}; license = pkgs.lib.licenses.mit;
}); platforms = pkgs.lib.platforms.unix;
}; } maintainers = with pkgs.lib.maintainers; [tomasrivera];
mainProgram = "sbb-tui";
};
});
};
}
+82 -77
View File
@@ -1,78 +1,83 @@
{ ... }: { _: {
perSystem = { pkgs, nodejs, ... }: { perSystem = {
packages.vivifyManuallyDerived = pkgs.stdenv.mkDerivation (finalAttrs: { pkgs,
pname = "vivify"; nodejs,
version = "0.14.0"; ...
}: {
src = pkgs.fetchFromGitHub { packages.vivifyManuallyDerived = pkgs.stdenv.mkDerivation (finalAttrs: {
owner = "jannis-baum"; pname = "vivify";
repo = "Vivify"; version = "0.14.0";
tag = "v${finalAttrs.version}";
hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0="; src = pkgs.fetchFromGitHub {
}; owner = "jannis-baum";
repo = "Vivify";
yarnOfflineCache = pkgs.fetchYarnDeps { tag = "v${finalAttrs.version}";
yarnLock = "${finalAttrs.src}/yarn.lock"; hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0=";
hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc="; };
};
yarnOfflineCache = pkgs.fetchYarnDeps {
installPhase = '' yarnLock = "${finalAttrs.src}/yarn.lock";
runHook preInstall hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc=";
};
yarn install
installPhase = ''
substituteInPlace node_modules/.bin/tsc \ runHook preInstall
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'
yarn install
substituteInPlace node_modules/.bin/webpack \
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}' substituteInPlace node_modules/.bin/tsc \
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'
substituteInPlace node_modules/.bin/postject \
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}' substituteInPlace node_modules/.bin/webpack \
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'
make VIV_VERSION=${finalAttrs.version} linux
substituteInPlace node_modules/.bin/postject \
mkdir -p $out/bin --replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'
install -Dm755 ./build/linux/viv $out/bin/viv
install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server make VIV_VERSION=${finalAttrs.version} linux
wrapProgram $out/bin/viv \ mkdir -p $out/bin
--prefix PATH : ${ install -Dm755 ./build/linux/viv $out/bin/viv
pkgs.lib.makeBinPath [ install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server
pkgs.nodejs
pkgs.file wrapProgram $out/bin/viv \
] --prefix PATH : ${
} pkgs.lib.makeBinPath [
''; pkgs.nodejs
pkgs.file
nativeBuildInputs = with pkgs; [ ]
yarnConfigHook }
npmHooks.npmInstallHook
zip
nodejs
file
];
# Stripping 'unneeded symbols' causes vivify-server executable to break
# (segmentation fault)
dontStrip = true;
passthru.updateScript = pkgs.nix-update-script {};
meta = {
description = "Live Markdown viewer";
longDescription = ''
Vivify brings your files to life in the browser!
Vivify is primarily made to render Markdown and Jupyter Notebooks, but will also
serve as a directory browser and let you view code files with syntax highlighting.
''; '';
homepage = "https://github.com/jannis-baum/Vivify";
changelog = "https://github.com/jannis-baum/Vivify/releases/tag/v${finalAttrs.src.tag}"; nativeBuildInputs = with pkgs; [
license = pkgs.lib.licenses.gpl3; yarnConfigHook
maintainers = with pkgs.lib.maintainers; [skohtv]; npmHooks.npmInstallHook
platforms = pkgs.lib.platforms.linux; zip
mainProgram = "viv";
}; nodejs
}); file
};} ];
# Stripping 'unneeded symbols' causes vivify-server executable to break
# (segmentation fault)
dontStrip = true;
passthru.updateScript = pkgs.nix-update-script {};
meta = {
description = "Live Markdown viewer";
longDescription = ''
Vivify brings your files to life in the browser!
Vivify is primarily made to render Markdown and Jupyter Notebooks, but will also
serve as a directory browser and let you view code files with syntax highlighting.
'';
homepage = "https://github.com/jannis-baum/Vivify";
changelog = "https://github.com/jannis-baum/Vivify/releases/tag/v${finalAttrs.src.tag}";
license = pkgs.lib.licenses.gpl3;
maintainers = with pkgs.lib.maintainers; [skohtv];
platforms = pkgs.lib.platforms.linux;
mainProgram = "viv";
};
});
};
}
+2 -2
View File
@@ -1,11 +1,11 @@
# see https://www.vimjoyer.com/nix/dendritic-home-manager # see https://www.vimjoyer.com/nix/dendritic-home-manager
{ inputs, ... }: { {inputs, ...}: {
imports = [ imports = [
# adds home-manager options to flake-parts # adds home-manager options to flake-parts
inputs.home-manager.flakeModules.home-manager inputs.home-manager.flakeModules.home-manager
]; ];
config.systems = [ config.systems = [
"x86_64-linux" "x86_64-linux"
#"aarch64-linux" #"aarch64-linux"
#"x86_64-darwin" #"x86_64-darwin"
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
#"aarch64-linux" #"aarch64-linux"
#"x86_64-darwin" #"x86_64-darwin"
+6 -5
View File
@@ -1,4 +1,4 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.audioAndMedia = {pkgs, ...}: { flake.nixosModules.audioAndMedia = {pkgs, ...}: {
# Enable sound with pipewire. # Enable sound with pipewire.
services.pulseaudio.enable = false; services.pulseaudio.enable = false;
@@ -10,7 +10,7 @@
pulse.enable = true; pulse.enable = true;
# If you want to use JACK applications, uncomment this # If you want to use JACK applications, uncomment this
#jack.enable = true; #jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default, # use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now) # no need to redefine it in your config for now)
#media-session.enable = true; #media-session.enable = true;
@@ -32,7 +32,7 @@
gpu-screen-recorder gpu-screen-recorder
inkscape inkscape
]; ];
security.wrappers.gsr-kms-server = { security.wrappers.gsr-kms-server = {
# to remove the password prompt when using gpu-screen-recorder # to remove the password prompt when using gpu-screen-recorder
owner = "root"; owner = "root";
@@ -41,7 +41,7 @@
source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server"; source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server";
}; };
}; };
perSystem = { pkgs, ...}: { perSystem = {pkgs, ...}: {
packages.custom-changeAudioOutput = pkgs.writeShellApplication { packages.custom-changeAudioOutput = pkgs.writeShellApplication {
name = "custom-changeAudioOutput"; name = "custom-changeAudioOutput";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
@@ -56,5 +56,6 @@
fi fi
pkill -f "kitty.*Select audio output" pkill -f "kitty.*Select audio output"
''; '';
};
}; };
};} }
+34 -29
View File
@@ -1,5 +1,9 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.autoCleanup-laptop = {pkgs, pkgs-unstable, ...}: { flake.nixosModules.autoCleanup-laptop = {
pkgs,
pkgs-unstable,
...
}: {
# Ensure your script is available system-wide # Ensure your script is available system-wide
environment.systemPackages = [ environment.systemPackages = [
self.packages.${pkgs.system}.custom-cleanNix-laptop self.packages.${pkgs.system}.custom-cleanNix-laptop
@@ -8,47 +12,47 @@
users.users.tomasr = { users.users.tomasr = {
linger = true; # lingering is required linger = true; # lingering is required
}; };
systemd.user.services.custom-cleanNix = { systemd.user.services.custom-cleanNix = {
description = "NixOS configuration auto cleanup"; description = "NixOS configuration auto cleanup";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "/run/current-system/sw/bin/custom-cleanNix"; ExecStart = "/run/current-system/sw/bin/custom-cleanNix";
# safety for long rebuilds # safety for long rebuilds
TimeoutStartSec = "45min"; TimeoutStartSec = "45min";
TimeoutStopSec = "10min"; TimeoutStopSec = "10min";
# avoid overlap # avoid overlap
RemainAfterExit = true; RemainAfterExit = true;
# tweaks that should make the system run normally during the rebuilds # tweaks that should make the system run normally during the rebuilds
Nice = 10; Nice = 10;
IOSchedulingClass = "best-effort"; IOSchedulingClass = "best-effort";
IOSchedulingPriority = 7; IOSchedulingPriority = 7;
}; };
}; };
# Systemd USER timer # Systemd USER timer
systemd.user.timers.custom-cleanNix = { systemd.user.timers.custom-cleanNix = {
wantedBy = ["timers.target"]; wantedBy = ["timers.target"];
timerConfig = { timerConfig = {
OnCalendar = "Sat *-*-* 20:00:00"; # runs saturday night. If for whatever reason something breaks. I have whole sunday to fix it. OnCalendar = "Sat *-*-* 20:00:00"; # runs saturday night. If for whatever reason something breaks. I have whole sunday to fix it.
Persistent = true; # if it happens during shutted down Persistent = true; # if it happens during shutted down
# avoids thundering herd on boot # avoids thundering herd on boot
RandomizedDelaySec = "2h"; RandomizedDelaySec = "2h";
}; };
}; };
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-cleanNix-laptop = pkgs.writeShellApplication { packages.custom-cleanNix-laptop = pkgs.writeShellApplication {
name = "custom-cleanNix"; name = "custom-cleanNix";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
git git
nixos-rebuild nixos-rebuild
@@ -57,21 +61,21 @@
alejandra alejandra
deadnix deadnix
]; ];
text = '' text = ''
set -e set -e
FLAKE_DIR="/home/tomasr/nixos" FLAKE_DIR="/home/tomasr/nixos"
FLAKE="$FLAKE_DIR#laptop" FLAKE="$FLAKE_DIR#laptop"
TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ") TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ")
ERROR_FILE=$(mktemp) ERROR_FILE=$(mktemp)
# snapshot current state # snapshot current state
git -C "$FLAKE_DIR" add -A git -C "$FLAKE_DIR" add -A
git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-cleanup-$TIME" git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-cleanup-$TIME"
git -C "$FLAKE_DIR" tag "pre-cleanup-$TIME" HEAD git -C "$FLAKE_DIR" tag "pre-cleanup-$TIME" HEAD
# the echos are to separate what each one is doing. Just for curiosity # the echos are to separate what each one is doing. Just for curiosity
echo "deadnix scans your Nix code and removes or reports unused (dead) variables and bindings" echo "deadnix scans your Nix code and removes or reports unused (dead) variables and bindings"
deadnix --edit "$FLAKE_DIR" # removes unused code deadnix --edit "$FLAKE_DIR" # removes unused code
@@ -82,16 +86,16 @@
echo "alejandra formats your Nix code consistently according to a strict, opinionated style." echo "alejandra formats your Nix code consistently according to a strict, opinionated style."
alejandra "$FLAKE_DIR" # formats the config alejandra "$FLAKE_DIR" # formats the config
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"
if sudo /run/current-system/sw/bin/nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then # use /run/.../bin/ uses the sudoless rule if sudo /run/current-system/sw/bin/nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then # use /run/.../bin/ uses the sudoless rule
if ! git -C "$FLAKE_DIR" diff --quiet HEAD; then if ! git -C "$FLAKE_DIR" diff --quiet HEAD; then
git -C "$FLAKE_DIR" add -A git -C "$FLAKE_DIR" add -A
git -C "$FLAKE_DIR" commit -m "Auto: cleanup-$TIME" git -C "$FLAKE_DIR" commit -m "Auto: cleanup-$TIME"
git -C "$FLAKE_DIR" push git -C "$FLAKE_DIR" push
notify-send "Nix auto cleanup" "Everything OK" notify-send "Nix auto cleanup" "Everything OK"
matrix-commander-rs --verbose -m "Nix auto cleanup. Everything OK.<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \ matrix-commander-rs --verbose -m "Nix auto cleanup. Everything OK.<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
--html \ --html \
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
@@ -99,21 +103,22 @@
notify-send "Nix auto cleanup" "No changes" notify-send "Nix auto cleanup" "No changes"
git -C "$FLAKE_DIR" push git -C "$FLAKE_DIR" push
fi fi
else else
ERROR_MSG=$(cat "$ERROR_FILE") ERROR_MSG=$(cat "$ERROR_FILE")
notify-send -u critical "Nix auto cleanup" "FAILED" notify-send -u critical "Nix auto cleanup" "FAILED"
matrix-commander-rs --verbose -m "Nix auto cleanup failed.<br>Error: <pre>$ERROR_MSG</pre><br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \ matrix-commander-rs --verbose -m "Nix auto cleanup failed.<br>Error: <pre>$ERROR_MSG</pre><br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
--html \ --html \
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
git -C "$FLAKE_DIR" reset --hard "pre-cleanup-$TIME" git -C "$FLAKE_DIR" reset --hard "pre-cleanup-$TIME"
fi fi
git -C "$FLAKE_DIR" tag -d "pre-cleanup-$TIME" # removes the tag git -C "$FLAKE_DIR" tag -d "pre-cleanup-$TIME" # removes the tag
rm -f "$ERROR_FILE" rm -f "$ERROR_FILE"
''; '';
}; };
};} };
}
+29 -28
View File
@@ -1,4 +1,4 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.autoUpdate-laptop = {pkgs, ...}: { flake.nixosModules.autoUpdate-laptop = {pkgs, ...}: {
# Ensure your script is available system-wide # Ensure your script is available system-wide
environment.systemPackages = [ environment.systemPackages = [
@@ -7,38 +7,38 @@
users.users.tomasr = { users.users.tomasr = {
linger = true; # lingering is required linger = true; # lingering is required
}; };
systemd.user.services.custom-autoupdate = { systemd.user.services.custom-autoupdate = {
description = "NixOS flake auto update"; description = "NixOS flake auto update";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "/run/current-system/sw/bin/custom-autoupdate"; ExecStart = "/run/current-system/sw/bin/custom-autoupdate";
# safety for long rebuilds # safety for long rebuilds
TimeoutStartSec = "45min"; TimeoutStartSec = "45min";
TimeoutStopSec = "10min"; TimeoutStopSec = "10min";
# avoid overlap # avoid overlap
RemainAfterExit = true; RemainAfterExit = true;
# tweaks that should make the system run normally during the rebuilds # tweaks that should make the system run normally during the rebuilds
Nice = 10; Nice = 10;
IOSchedulingClass = "best-effort"; IOSchedulingClass = "best-effort";
IOSchedulingPriority = 7; IOSchedulingPriority = 7;
}; };
}; };
# Systemd USER timer # Systemd USER timer
systemd.user.timers.custom-autoupdate = { systemd.user.timers.custom-autoupdate = {
wantedBy = ["timers.target"]; wantedBy = ["timers.target"];
timerConfig = { timerConfig = {
OnCalendar = "Fri *-*-* 20:00:00"; # runs friday night. If for whatever reason something breaks. I have whole week-end to fix it. OnCalendar = "Fri *-*-* 20:00:00"; # runs friday night. If for whatever reason something breaks. I have whole week-end to fix it.
Persistent = true; # if it happens during shutted down Persistent = true; # if it happens during shutted down
# avoids thundering herd on boot # avoids thundering herd on boot
RandomizedDelaySec = "2h"; RandomizedDelaySec = "2h";
}; };
@@ -47,40 +47,40 @@
perSystem = {pkgs, ...}: { perSystem = {pkgs, ...}: {
packages.custom-autoupdate-laptop = pkgs.writeShellApplication { packages.custom-autoupdate-laptop = pkgs.writeShellApplication {
name = "custom-autoupdate"; name = "custom-autoupdate";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
git git
nixos-rebuild nixos-rebuild
matrix-commander-rs matrix-commander-rs
libnotify libnotify
]; ];
text = '' text = ''
set -e set -e
FLAKE_DIR="/home/tomasr/nixos" FLAKE_DIR="/home/tomasr/nixos"
FLAKE="$FLAKE_DIR#laptop" FLAKE="$FLAKE_DIR#laptop"
TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ") TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ")
ERROR_FILE=$(mktemp) ERROR_FILE=$(mktemp)
# snapshot current state # snapshot current state
git -C "$FLAKE_DIR" add -A git -C "$FLAKE_DIR" add -A
git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-autoupdate-$TIME" git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-autoupdate-$TIME"
git -C "$FLAKE_DIR" tag "pre-autoupdate-$TIME" HEAD git -C "$FLAKE_DIR" tag "pre-autoupdate-$TIME" HEAD
# update lock only # update lock only
nix flake update --flake "$FLAKE_DIR" nix flake update --flake "$FLAKE_DIR"
if sudo /run/current-system/sw/bin/nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then # use /run/.../bin/ uses the sudoless rule if sudo /run/current-system/sw/bin/nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then # use /run/.../bin/ uses the sudoless rule
if ! git -C "$FLAKE_DIR" diff --quiet -- flake.lock; then if ! git -C "$FLAKE_DIR" diff --quiet -- flake.lock; then
git -C "$FLAKE_DIR" add flake.lock git -C "$FLAKE_DIR" add flake.lock
git -C "$FLAKE_DIR" commit -m "flake.lock: autoupdate-$TIME" git -C "$FLAKE_DIR" commit -m "flake.lock: autoupdate-$TIME"
git -C "$FLAKE_DIR" push git -C "$FLAKE_DIR" push
notify-send "Flake autoupdate" "Rebuild OK" notify-send "Flake autoupdate" "Rebuild OK"
matrix-commander-rs --verbose -m "Flake rebuild succesfull.<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \ matrix-commander-rs --verbose -m "Flake rebuild succesfull.<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
--html \ --html \
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
@@ -88,22 +88,23 @@
notify-send "Flake autoupdate" "No changes" notify-send "Flake autoupdate" "No changes"
git -C "$FLAKE_DIR" push git -C "$FLAKE_DIR" push
fi fi
else else
ERROR_MSG=$(cat "$ERROR_FILE") ERROR_MSG=$(cat "$ERROR_FILE")
notify-send -u critical "Flake autoupdate" "FAILED" notify-send -u critical "Flake autoupdate" "FAILED"
matrix-commander-rs --verbose -m "Flake rebuild failed.<br>Error: <pre>$ERROR_MSG</pre><br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \ matrix-commander-rs --verbose -m "Flake rebuild failed.<br>Error: <pre>$ERROR_MSG</pre><br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
--html \ --html \
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
git -C "$FLAKE_DIR" reset --hard "pre-autoupdate-$TIME" git -C "$FLAKE_DIR" reset --hard "pre-autoupdate-$TIME"
fi fi
git -C "$FLAKE_DIR" tag -d "pre-autoupdate-$TIME" # removes the tag git -C "$FLAKE_DIR" tag -d "pre-autoupdate-$TIME" # removes the tag
rm -f "$ERROR_FILE" rm -f "$ERROR_FILE"
''; '';
}; };
};} };
}
@@ -1,5 +1,5 @@
{ self, ...}: { {self, ...}: {
flake.nixosModules.notifications = { pkgs, ... }: { flake.nixosModules.notifications = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
libnotify # Library that sends desktop notifications to a notification daemon libnotify # Library that sends desktop notifications to a notification daemon
socat # Utility for bidirectional data transfer between two independent data channels (used to communicate between hyprland and swww to change wallpapers dinamically) socat # Utility for bidirectional data transfer between two independent data channels (used to communicate between hyprland and swww to change wallpapers dinamically)
@@ -13,49 +13,50 @@
self.packages.${pkgs.system}.custom-checkKdrive # check if kdrive is set up with rclone self.packages.${pkgs.system}.custom-checkKdrive # check if kdrive is set up with rclone
]; ];
}; };
perSystem = { pkgs, ...}: { perSystem = {pkgs, ...}: {
packages.custom-checkMatrix = pkgs.writeShellApplication { packages.custom-checkMatrix = pkgs.writeShellApplication {
name = "custom-checkMatrix"; name = "custom-checkMatrix";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
matrix-commander-rs matrix-commander-rs
libnotify libnotify
]; ];
text = '' text = ''
expected="@totorile1:unredacted.org" expected="@totorile1:unredacted.org"
current="$(matrix-commander-rs --whoami | tr -d '\n')" current="$(matrix-commander-rs --whoami | tr -d '\n')"
if [ "$current" != "$expected" ]; then if [ "$current" != "$expected" ]; then
notify-send "matrix-commander-rs" \ notify-send "matrix-commander-rs" \
"You are not logged in as @totorile1:unredacted.org\nLog:\n$current" "You are not logged in as @totorile1:unredacted.org\nLog:\n$current"
fi fi
''; '';
};
packages.custom-gitnotify = pkgs.writeShellApplication {
name = "custom-gitnotify";
runtimeInputs = with pkgs; [
git
libnotify
];
text = ''
# Check if git is installed
if ! command -v git >/dev/null 2>&1; then
exit 0
fi
NAME=$(git config --global user.name)
EMAIL=$(git config --global user.email)
if [[ -z "$NAME" || -z "$EMAIL" ]]; then
notify-send \
"Git not configured" \
"Set your identity\n or remove this warning by removing the custom-gitnotify line in\n ~/nixos/modules/applications/hyprland.nix"
matrix-commander-rs --verbose -m "Git not configured.<br>Set your identify or remove this warning by removing the custom-gitnotify in ~/nixos/modules/applications/hyprland.nix<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
--html \
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
fi
'';
};
}; };
packages.custom-gitnotify = pkgs.writeShellApplication { }
name = "custom-gitnotify";
runtimeInputs = with pkgs; [
git
libnotify
];
text = ''
# Check if git is installed
if ! command -v git >/dev/null 2>&1; then
exit 0
fi
NAME=$(git config --global user.name)
EMAIL=$(git config --global user.email)
if [[ -z "$NAME" || -z "$EMAIL" ]]; then
notify-send \
"Git not configured" \
"Set your identity\n or remove this warning by removing the custom-gitnotify line in\n ~/nixos/modules/applications/hyprland.nix"
matrix-commander-rs --verbose -m "Git not configured.<br>Set your identify or remove this warning by removing the custom-gitnotify in ~/nixos/modules/applications/hyprland.nix<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
--html \
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
fi
'';
};
};}
+6 -3
View File
@@ -1,6 +1,9 @@
{ ... }: _: {
{ flake.nixosModules.development = {
flake.nixosModules.development = { pkgs, pkgs-unstable, ... }: { pkgs,
pkgs-unstable,
...
}: {
programs.nix-ld.enable = true; #Run unpatched dynamic binaries on NixOS. For example lets run ./a.out from gcc programs.nix-ld.enable = true; #Run unpatched dynamic binaries on NixOS. For example lets run ./a.out from gcc
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
gcc gcc
+49 -46
View File
@@ -1,5 +1,7 @@
{ self, ... }: let cacheTime = "10"; in { {self, ...}: let
flake.nixosModules.documentation = { pkgs, ... }: { cacheTime = "10";
in {
flake.nixosModules.documentation = {pkgs, ...}: {
# unfortunatly this adds a lot of computation when nix rebuilds # unfortunatly this adds a lot of computation when nix rebuilds
documentation.man.generateCaches = true; # used for the man script documentation.man.generateCaches = true; # used for the man script
@@ -14,7 +16,7 @@
self.packages.${pkgs.system}.custom-manix self.packages.${pkgs.system}.custom-manix
]; ];
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
packages.custom-man = pkgs.writeShellApplication { packages.custom-man = pkgs.writeShellApplication {
name = "custom-man"; name = "custom-man";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
@@ -26,67 +28,68 @@
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}" CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
CACHE_FILE="$CACHE_DIR/custom-man-options.txt" CACHE_FILE="$CACHE_DIR/custom-man-options.txt"
mkdir -p "$CACHE_DIR" mkdir -p "$CACHE_DIR"
REGENERATE=0 REGENERATE=0
# check if -r flag was passed # check if -r flag was passed
if [ "''${1:-}" = "-r" ]; then if [ "''${1:-}" = "-r" ]; then
REGENERATE=1 REGENERATE=1
fi fi
# regenerate if file does not exist or is older than cacheTime days # regenerate if file does not exist or is older than cacheTime days
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
REGENERATE=1 REGENERATE=1
fi fi
if [ $REGENERATE -eq 1 ]; then if [ $REGENERATE -eq 1 ]; then
echo "(Re)building custom-manix cache..." echo "(Re)building custom-manix cache..."
mkdir -p "$(dirname "$CACHE_FILE")" mkdir -p "$(dirname "$CACHE_FILE")"
man -k . > "$CACHE_FILE" man -k . > "$CACHE_FILE"
fi fi
# read from cache and pipe into fzf # read from cache and pipe into fzf
cat "$CACHE_FILE" \ cat "$CACHE_FILE" \
| fzf --preview "man {1}" \ | fzf --preview "man {1}" \
| xargs man | xargs man
''; '';
}; };
packages.custom-manix = pkgs.writeShellApplication { packages.custom-manix = pkgs.writeShellApplication {
name = "custom-manix"; name = "custom-manix";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
manix manix
ripgrep ripgrep
fzf fzf
]; ];
text = '' text = ''
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}" CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
CACHE_FILE="$CACHE_DIR/custom-manix-options.txt" CACHE_FILE="$CACHE_DIR/custom-manix-options.txt"
mkdir -p "$CACHE_DIR" mkdir -p "$CACHE_DIR"
REGENERATE=0 REGENERATE=0
# check if -r flag was passed # check if -r flag was passed
if [ "''${1:-}" = "-r" ]; then if [ "''${1:-}" = "-r" ]; then
REGENERATE=1 REGENERATE=1
fi fi
# regenerate if file does not exist or is older than cacheTime days # regenerate if file does not exist or is older than cacheTime days
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
REGENERATE=1 REGENERATE=1
fi fi
if [ $REGENERATE -eq 1 ]; then if [ $REGENERATE -eq 1 ]; then
echo "(Re)building custom-manix cache..." echo "(Re)building custom-manix cache..."
mkdir -p "$(dirname "$CACHE_FILE")" mkdir -p "$(dirname "$CACHE_FILE")"
manix "" | rg -N '^(?:\x1b\[[0-9;]*m)*# ' | sed 's/\x1b\[[0-9;]*m//g; s/^# //' | rg -Nv '^(<|.*https?://)' > "$CACHE_FILE" manix "" | rg -N '^(?:\x1b\[[0-9;]*m)*# ' | sed 's/\x1b\[[0-9;]*m//g; s/^# //' | rg -Nv '^(<|.*https?://)' > "$CACHE_FILE"
fi fi
# read from cache and pipe into fzf # read from cache and pipe into fzf
cat "$CACHE_FILE" \ cat "$CACHE_FILE" \
| fzf --preview "manix {}" \ | fzf --preview "manix {}" \
| xargs manix | xargs manix
''; '';
};
}; };
};} }
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.latex = {pkgs, ...}: { flake.nixosModules.latex = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
texlab texlab
+5 -5
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.networking = {pkgs, ...}: { flake.nixosModules.networking = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
wget wget
@@ -7,17 +7,17 @@
]; ];
#networking.Name = "nixos"; # Define your hostname. #networking.Name = "nixos"; # Define your hostname.
#networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. #networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary
#networking.proxy.default = "http://user:password@proxy:port/"; #networking.proxy.default = "http://user:password@proxy:port/";
#networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; #networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking # Enable networking
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
# services.openssh.enable = true; # services.openssh.enable = true;
# Open ports in the firewall. # Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];
+269 -269
View File
@@ -1,28 +1,27 @@
{ inputs, ... }: {inputs, ...}: {
{ flake.nixosModules.nixUtils-laptop = _: {
flake.nixosModules.nixUtils-laptop = { ... }: {
# nixpkgs-review crashed my laptop multiple times. We must reduce how much ressources it can take. # nixpkgs-review crashed my laptop multiple times. We must reduce how much ressources it can take.
# for reference, my laptop is a 12 core ryzen 7 # for reference, my laptop is a 12 core ryzen 7
nix.settings.max-jobs = 6; nix.settings.max-jobs = 6;
nix.settings.cores = 6; nix.settings.cores = 6;
}; };
flake.nixosModules.nixUtils = { pkgs-unstable, ... }: { flake.nixosModules.nixUtils = {pkgs-unstable, ...}: {
# Garbage collector of generations # Garbage collector of generations
nix.gc = { nix.gc = {
automatic = true; automatic = true;
dates = "weekly"; dates = "weekly";
options = "--delete-older-than 7d"; # every week delete generations older than a month options = "--delete-older-than 7d"; # every week delete generations older than a month
}; };
#manix is unhappy without this #manix is unhappy without this
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${inputs.nixpkgs.outPath}" "nixpkgs=${inputs.nixpkgs.outPath}"
"home-manager=${inputs.home-manager.outPath}" "home-manager=${inputs.home-manager.outPath}"
]; ];
#adds nixos experimental features: #adds nixos experimental features:
nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.experimental-features = ["nix-command" "flakes"];
environment.systemPackages = with pkgs-unstable; [ environment.systemPackages = with pkgs-unstable; [
nixpkgs-review nixpkgs-review
nixfmt-tree nixfmt-tree
@@ -35,267 +34,268 @@
statix statix
]; ];
}; };
perSystem = { pkgs, ... }: { perSystem = {pkgs, ...}: {
# https://gist.github.com/MaxwellDupre/3077cd229490cf93ecab08ef2a79c852 # https://gist.github.com/MaxwellDupre/3077cd229490cf93ecab08ef2a79c852
# better garbage collector # better garbage collector
packages.custom-trimmer = pkgs.writeShellApplication { packages.custom-trimmer = pkgs.writeShellApplication {
name = "custom-trimmer"; name = "custom-trimmer";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
nix nix
]; ];
text = '' text = ''
set -euo pipefail set -euo pipefail
## Defaults ## Defaults
keepGensDef=30; keepDaysDef=7 keepGensDef=30; keepDaysDef=7
keepGens=$keepGensDef; keepDays=$keepDaysDef keepGens=$keepGensDef; keepDays=$keepDaysDef
## Usage ## Usage
usage () { usage () {
printf "Usage:\n\t ./trim-generations.sh <keep-generations> <keep-days> <profile> \n\n printf "Usage:\n\t ./trim-generations.sh <keep-generations> <keep-days> <profile> \n\n
(defaults are: Keep-Gens=%d Keep-Days=%d Profile=user)\n\n" "$keepGensDef" "$keepDaysDef" (defaults are: Keep-Gens=%d Keep-Days=%d Profile=user)\n\n" "$keepGensDef" "$keepDaysDef"
printf "If you enter any parameters, you must enter all three, or none to use defaults.\n" printf "If you enter any parameters, you must enter all three, or none to use defaults.\n"
printf "Example:\n\t trim-generations.sh 15 10 home-manager\n" printf "Example:\n\t trim-generations.sh 15 10 home-manager\n"
printf " this will work on the home-manager profile and keep all generations from the\n" printf " this will work on the home-manager profile and keep all generations from the\n"
printf "last 10 days, and keep at least 15 generations no matter how old.\n" printf "last 10 days, and keep at least 15 generations no matter how old.\n"
printf "\nProfiles available are:\tuser, home-manager, channels, system (root)\n" printf "\nProfiles available are:\tuser, home-manager, channels, system (root)\n"
printf "\n-h or --help prints this help text." printf "\n-h or --help prints this help text."
} }
if [ $# -eq 1 ]; then # if help requested if [ $# -eq 1 ]; then # if help requested
if [ "$1" = "-h" ]; then if [ "$1" = "-h" ]; then
usage usage
exit 1; exit 1;
fi fi
if [ "$1" = "--help" ]; then if [ "$1" = "--help" ]; then
usage usage
exit 2; exit 2;
fi fi
printf "Dont recognise your option exiting..\n\n" printf "Dont recognise your option exiting..\n\n"
usage usage
exit 3; exit 3;
elif [ $# -eq 0 ]; then # print the defaults elif [ $# -eq 0 ]; then # print the defaults
printf "The current defaults are:\n Keep-Gens=%d Keep-Days=%d \n\n" "$keepGensDef" "$keepDaysDef" printf "The current defaults are:\n Keep-Gens=%d Keep-Days=%d \n\n" "$keepGensDef" "$keepDaysDef"
read -r -p "Keep these defaults? (y/n):" answer read -r -p "Keep these defaults? (y/n):" answer
case "$answer" in case "$answer" in
[yY1] ) [yY1] )
printf "Using defaults..\n" printf "Using defaults..\n"
;; ;;
[nN0] ) printf "ok, doing nothing, exiting..\n" [nN0] ) printf "ok, doing nothing, exiting..\n"
exit 6; exit 6;
;; ;;
* ) printf "%b" "Doing nothing, exiting.." * ) printf "%b" "Doing nothing, exiting.."
exit 7; exit 7;
;; ;;
esac esac
fi fi
## Handle parameters (and change if root) ## Handle parameters (and change if root)
if [[ $EUID -ne 0 ]]; then # if not root if [[ $EUID -ne 0 ]]; then # if not root
profile=$(readlink /home/"$USER"/.nix-profile) profile=$(readlink /home/"$USER"/.nix-profile)
else else
if [ -d /nix/var/nix/profiles/system ]; then # maybe this or the other if [ -d /nix/var/nix/profiles/system ]; then # maybe this or the other
profile="/nix/var/nix/profiles/system" profile="/nix/var/nix/profiles/system"
elif [ -d /nix/var/nix/profiles/default ]; then elif [ -d /nix/var/nix/profiles/default ]; then
profile="/nix/var/nix/profiles/default" profile="/nix/var/nix/profiles/default"
else else
echo "Cant find profile for root. Exiting" echo "Cant find profile for root. Exiting"
exit 8 exit 8
fi fi
fi fi
if (( $# < 1 )); then if (( $# < 1 )); then
printf "Keeping default: %d generations OR %d days, whichever is more\n" "$keepGensDef" "$keepDaysDef" printf "Keeping default: %d generations OR %d days, whichever is more\n" "$keepGensDef" "$keepDaysDef"
elif [[ $# -le 2 ]]; then elif [[ $# -le 2 ]]; then
printf "\nError: Not enough arguments.\n\n" >&2 printf "\nError: Not enough arguments.\n\n" >&2
usage usage
exit 1 exit 1
elif (( $# > 4)); then elif (( $# > 4)); then
printf "\nError: Too many arguments.\n\n" >&2 printf "\nError: Too many arguments.\n\n" >&2
usage usage
exit 2 exit 2
else else
if [ "$1" -lt 1 ]; then if [ "$1" -lt 1 ]; then
printf "using Gen numbers less than 1 not recommended. Setting to min=1\n" printf "using Gen numbers less than 1 not recommended. Setting to min=1\n"
read -r -p "is that ok? (y/n): " answer read -r -p "is that ok? (y/n): " answer
printf "%s" "$answer" printf "%s" "$answer"
case "$answer" in case "$answer" in
[yY1] ) [yY1] )
printf "ok, continuing..\n" printf "ok, continuing..\n"
;; ;;
[nN0] ) [nN0] )
printf "ok, doing nothing, exiting..\n" printf "ok, doing nothing, exiting..\n"
exit 6; exit 6;
;; ;;
* ) * )
printf "%b" "Doing nothing, exiting.." printf "%b" "Doing nothing, exiting.."
exit 7; exit 7;
;; ;;
esac esac
fi fi
if [ "$2" -lt 0 ]; then if [ "$2" -lt 0 ]; then
printf "using negative days number not recommended. Setting to min=0\n" printf "using negative days number not recommended. Setting to min=0\n"
read -r -p "is that ok? (y/n): " answer read -r -p "is that ok? (y/n): " answer
case "$answer" in case "$answer" in
[yY1] ) [yY1] )
printf "ok, continuing..\n" printf "ok, continuing..\n"
;; ;;
[nN0] ) [nN0] )
printf "ok, doing nothing, exiting..\n" printf "ok, doing nothing, exiting..\n"
exit 6; exit 6;
;; ;;
* ) * )
printf "%b" "Doing nothing, exiting.." printf "%b" "Doing nothing, exiting.."
exit 7; exit 7;
;; ;;
esac esac
fi fi
keepGens=$1; keepDays=$2; keepGens=$1; keepDays=$2;
(( keepGens < 1 )) && keepGens=1 (( keepGens < 1 )) && keepGens=1
(( keepDays < 0 )) && keepDays=0 (( keepDays < 0 )) && keepDays=0
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
if [[ $3 == "user" ]] || [[ $3 == "default" ]]; then if [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
profile=$(readlink /home/"$USER"/.nix-profile) profile=$(readlink /home/"$USER"/.nix-profile)
elif [[ $3 == "home-manager" ]]; then elif [[ $3 == "home-manager" ]]; then
# home-manager defaults to $XDG_STATE_HOME; otherwise, use # home-manager defaults to $XDG_STATE_HOME; otherwise, use
# `home-manager generations` and `nix-store --query --roots # `home-manager generations` and `nix-store --query --roots
# /nix/store/...` to figure out what reference is keeping the old # /nix/store/...` to figure out what reference is keeping the old
# generations alive. # generations alive.
profile="''${XDG_STATE_HOME:-$HOME/.local/state}/nix/profiles/home-manager" profile="''${XDG_STATE_HOME:-$HOME/.local/state}/nix/profiles/home-manager"
elif [[ $3 == "channels" ]]; then elif [[ $3 == "channels" ]]; then
profile="/nix/var/nix/profiles/per-user/$USER/channels" profile="/nix/var/nix/profiles/per-user/$USER/channels"
else else
printf "\nError: Do not understand your third argument. Should be one of: (user / home-manager/ channels)\n\n" printf "\nError: Do not understand your third argument. Should be one of: (user / home-manager/ channels)\n\n"
usage usage
exit 3 exit 3
fi fi
else else
if [[ $3 == "system" ]]; then if [[ $3 == "system" ]]; then
profile="/nix/var/nix/profiles/system" profile="/nix/var/nix/profiles/system"
elif [[ $3 == "user" ]] || [[ $3 == "default" ]]; then elif [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
profile="/nix/var/nix/profiles/default" profile="/nix/var/nix/profiles/default"
else else
printf "\nError: Do not understand your third argument. Should be one of: (user / system)\n\n" printf "\nError: Do not understand your third argument. Should be one of: (user / system)\n\n"
usage usage
exit 3 exit 3
fi fi
fi fi
printf "OK! \t Keep Gens = %s \t Keep Days = %s \n\n" "$keepGens" "$keepDays" printf "OK! \t Keep Gens = %s \t Keep Days = %s \n\n" "$keepGens" "$keepDays"
fi fi
printf "Operating on profile: %s \t \n\n" "$profile" printf "Operating on profile: %s \t \n\n" "$profile"
## Runs at the end, to decide whether to delete profiles that match chosen parameters. ## Runs at the end, to decide whether to delete profiles that match chosen parameters.
choose () { choose () {
local default="$1" local default="$1"
local prompt="$2" local prompt="$2"
local answer local answer
read -r -p "$prompt" answer read -r -p "$prompt" answer
[ -z "$answer" ] && answer="$default" [ -z "$answer" ] && answer="$default"
case "$answer" in case "$answer" in
[yY1] ) #printf "answered yes!\n" [yY1] ) #printf "answered yes!\n"
nix-env --delete-generations -p "$profile" "''${!gens[@]}" nix-env --delete-generations -p "$profile" "''${!gens[@]}"
exit 0 exit 0
;; ;;
[nN0] ) printf "Ok doing nothing exiting..\n" [nN0] ) printf "Ok doing nothing exiting..\n"
exit 6; exit 6;
;; ;;
* ) printf "%b" "Unexpected answer '$answer'!" >&2 * ) printf "%b" "Unexpected answer '$answer'!" >&2
exit 7; exit 7;
;; ;;
esac esac
} # end of function choose } # end of function choose
# printf "profile = %s \n\n" "$profile" # printf "profile = %s \n\n" "$profile"
## Query nix-env for generations list ## Query nix-env for generations list
#IFS=$'\n' nixGens=( $(nix-env --list-generations -p "$profile" | sed 's:^\s*::; s:\s*$::' | tr '\t' ' ' | tr -s ' ') ) #IFS=$'\n' nixGens=( $(nix-env --list-generations -p "$profile" | sed 's:^\s*::; s:\s*$::' | tr '\t' ' ' | tr -s ' ') )
# gave errors replaced by: # gave errors replaced by:
mapfile -t nixGens < <( mapfile -t nixGens < <(
nix-env --list-generations -p "$profile" | nix-env --list-generations -p "$profile" |
sed 's:^\s*::; s:\s*$::' | sed 's:^\s*::; s:\s*$::' |
tr '\t' ' ' | tr '\t' ' ' |
tr -s ' ' tr -s ' '
) )
timeNow=$(date +%s) timeNow=$(date +%s)
## Get info on oldest generation ## Get info on oldest generation
IFS=' ' read -r -a oldestGenArr <<< "''${nixGens[0]}" IFS=' ' read -r -a oldestGenArr <<< "''${nixGens[0]}"
oldestGen=''${oldestGenArr[0]} oldestGen=''${oldestGenArr[0]}
oldestDate=''${oldestGenArr[1]} oldestDate=''${oldestGenArr[1]}
printf "%-30s %s\n" "oldest generation:" "$oldestGen" printf "%-30s %s\n" "oldest generation:" "$oldestGen"
#oldestDate=''${nixGens[0]:3:19} #oldestDate=''${nixGens[0]:3:19}
printf "%-30s %s\n" "oldest generation created:" "$oldestDate" printf "%-30s %s\n" "oldest generation created:" "$oldestDate"
oldestTime=$(date -d "$oldestDate" +%s) oldestTime=$(date -d "$oldestDate" +%s)
oldestElapsedSecs=$((timeNow-oldestTime)) oldestElapsedSecs=$((timeNow-oldestTime))
oldestElapsedMins=$((oldestElapsedSecs/60)) oldestElapsedMins=$((oldestElapsedSecs/60))
oldestElapsedHours=$((oldestElapsedMins/60)) oldestElapsedHours=$((oldestElapsedMins/60))
oldestElapsedDays=$((oldestElapsedHours/24)) oldestElapsedDays=$((oldestElapsedHours/24))
printf "%-30s %s\n" "minutes before now:" "$oldestElapsedMins" printf "%-30s %s\n" "minutes before now:" "$oldestElapsedMins"
printf "%-30s %s\n" "hours before now:" "$oldestElapsedHours" printf "%-30s %s\n" "hours before now:" "$oldestElapsedHours"
printf "%-30s %s\n\n" "days before now:" "$oldestElapsedDays" printf "%-30s %s\n\n" "days before now:" "$oldestElapsedDays"
## Get info on current generation ## Get info on current generation
for i in "''${nixGens[@]}"; do for i in "''${nixGens[@]}"; do
IFS=' ' read -r -a iGenArr <<< "$i" IFS=' ' read -r -a iGenArr <<< "$i"
genNumber=''${iGenArr[0]} genNumber=''${iGenArr[0]}
genDate=''${iGenArr[1]} genDate=''${iGenArr[1]}
if [[ "$i" =~ current ]]; then if [[ "$i" =~ current ]]; then
currentGen=$genNumber currentGen=$genNumber
printf "%-30s %s\n" "current generation:" "$currentGen" printf "%-30s %s\n" "current generation:" "$currentGen"
currentDate=$genDate currentDate=$genDate
printf "%-30s %s\n" "current generation created:" "$currentDate" printf "%-30s %s\n" "current generation created:" "$currentDate"
currentTime=$(date -d "$currentDate" +%s) currentTime=$(date -d "$currentDate" +%s)
currentElapsedSecs=$((timeNow-currentTime)) currentElapsedSecs=$((timeNow-currentTime))
currentElapsedMins=$((currentElapsedSecs/60)) currentElapsedMins=$((currentElapsedSecs/60))
currentElapsedHours=$((currentElapsedMins/60)) currentElapsedHours=$((currentElapsedMins/60))
currentElapsedDays=$((currentElapsedHours/24)) currentElapsedDays=$((currentElapsedHours/24))
printf "%-30s %s\n" "minutes before now:" "$currentElapsedMins" printf "%-30s %s\n" "minutes before now:" "$currentElapsedMins"
printf "%-30s %s\n" "hours before now:" "$currentElapsedHours" printf "%-30s %s\n" "hours before now:" "$currentElapsedHours"
printf "%-30s %s\n\n" "days before now:" "$currentElapsedDays" printf "%-30s %s\n\n" "days before now:" "$currentElapsedDays"
fi fi
done done
## Compare oldest and current generations ## Compare oldest and current generations
timeBetweenOldestAndCurrent=$((currentTime-oldestTime)) timeBetweenOldestAndCurrent=$((currentTime-oldestTime))
elapsedDays=$((timeBetweenOldestAndCurrent/60/60/24)) elapsedDays=$((timeBetweenOldestAndCurrent/60/60/24))
generationsDiff=$((currentGen-oldestGen)) generationsDiff=$((currentGen-oldestGen))
## Figure out what we should do, based on generations and options ## Figure out what we should do, based on generations and options
if [[ elapsedDays -le keepDays ]]; then if [[ elapsedDays -le keepDays ]]; then
printf "All generations are no more than %s days older than current generation. \nOldest gen days difference from current gen: %s \n\n\tNothing to do!\n" "$keepDays" "$elapsedDays" printf "All generations are no more than %s days older than current generation. \nOldest gen days difference from current gen: %s \n\n\tNothing to do!\n" "$keepDays" "$elapsedDays"
exit 4; exit 4;
elif [[ generationsDiff -lt keepGens ]]; then elif [[ generationsDiff -lt keepGens ]]; then
printf "Oldest generation (%d) is only %d generations behind current (%d). \n\n\t Nothing to do!\n" "$oldestGen" "$generationsDiff" "$currentGen" printf "Oldest generation (%d) is only %d generations behind current (%d). \n\n\t Nothing to do!\n" "$oldestGen" "$generationsDiff" "$currentGen"
exit 5; exit 5;
else else
printf "\tSomething to do...\n" printf "\tSomething to do...\n"
declare -a gens declare -a gens
for i in "''${nixGens[@]}"; do for i in "''${nixGens[@]}"; do
IFS=' ' read -r -a iGenArr <<< "$i" IFS=' ' read -r -a iGenArr <<< "$i"
genNumber=''${iGenArr[0]} genNumber=''${iGenArr[0]}
genDiff=$((currentGen-genNumber)) genDiff=$((currentGen-genNumber))
genDate=''${iGenArr[1]} genDate=''${iGenArr[1]}
genTime=$(date -d "$genDate" +%s) genTime=$(date -d "$genDate" +%s)
elapsedSecs=$((timeNow-genTime)) elapsedSecs=$((timeNow-genTime))
genDaysOld=$((elapsedSecs/60/60/24)) genDaysOld=$((elapsedSecs/60/60/24))
if [[ genDaysOld -gt keepDays ]] && [[ genDiff -ge keepGens ]]; then if [[ genDaysOld -gt keepDays ]] && [[ genDiff -ge keepGens ]]; then
gens["$genNumber"]="$genDate, $genDaysOld day(s) old" gens["$genNumber"]="$genDate, $genDaysOld day(s) old"
fi fi
done done
printf "\nFound the following generation(s) to delete:\n" printf "\nFound the following generation(s) to delete:\n"
for K in "''${!gens[@]}"; do for K in "''${!gens[@]}"; do
printf "generation %d \t ''${gens[$K]}\n" "$K" printf "generation %d \t ''${gens[$K]}\n" "$K"
done done
printf "\n" printf "\n"
choose "y" "Do you want to delete these? [Y/n]: " choose "y" "Do you want to delete these? [Y/n]: "
fi fi
''; '';
};
}; };
};} }
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.office = {pkgs, ...}: { flake.nixosModules.office = {pkgs, ...}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
libreoffice libreoffice
+1 -1
View File
@@ -1,4 +1,4 @@
{ ... }: { _: {
flake.nixosModules.ollama = {pkgs-unstable, ...}: { flake.nixosModules.ollama = {pkgs-unstable, ...}: {
services.ollama = { services.ollama = {
enable = true; enable = true;
+28 -27
View File
@@ -1,28 +1,29 @@
{ self, ... }: { {self, ...}: {
flake.nixosModules.otherUtils = # try to keep packages here at a minium. Preferably use a dedicated file flake.nixosModules.otherUtils =
{ # try to keep packages here at a minium. Preferably use a dedicated file
pkgs, {
pkgs-unstable, pkgs,
... pkgs-unstable,
}: { ...
environment.systemPackages = with pkgs; [ }: {
gnome-calculator environment.systemPackages = with pkgs; [
snapshot gnome-calculator
gnome-characters snapshot
#tree # shows dir in tree # we use eza now gnome-characters
brightnessctl # control brightness #tree # shows dir in tree # we use eza now
powertop brightnessctl # control brightness
fzf powertop
bottom # Cross-platform graphical process/system monitor with a customizable interface fzf
tomato-c # pomodoro timer bottom # Cross-platform graphical process/system monitor with a customizable interface
#hyprshot tomato-c # pomodoro timer
mailcap #hyprshot
fuzzel mailcap
usbutils # used for lsusb fuzzel
self.packages.${pkgs.system}.custom-tomato usbutils # used for lsusb
self.packages.${pkgs.system}.custom-syllabes self.packages.${pkgs.system}.custom-tomato
pkgs-unstable.bitwarden-desktop self.packages.${pkgs.system}.custom-syllabes
fluffychat # matrix client pkgs-unstable.bitwarden-desktop
]; fluffychat # matrix client
}; ];
};
} }