mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-11 18:18:37 +02:00
Auto: cleanup-2026-05-24T10-18-36Z
This commit is contained in:
@@ -23,28 +23,28 @@
|
||||
};
|
||||
import-tree.url = "github:vic/import-tree"; # imports ./modules recursively
|
||||
};
|
||||
outputs = inputs @ { flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; }
|
||||
outputs = inputs @ {flake-parts, ...}:
|
||||
flake-parts.lib.mkFlake {inherit inputs;}
|
||||
({
|
||||
flake = let
|
||||
system = "x86_64-linux";
|
||||
unfreePkgs = [
|
||||
"hplip"
|
||||
"vivify.vim"
|
||||
"cheatsheet.nvim"
|
||||
];
|
||||
mkUnfreePredicate = pkg:
|
||||
builtins.elem (inputs.nixpkgs.lib.getName pkg) unfreePkgs;
|
||||
mkPkgs = nixpkgsInput:
|
||||
import nixpkgsInput {
|
||||
inherit system;
|
||||
config.allowUnfreePredicate = mkUnfreePredicate;
|
||||
flake = let
|
||||
system = "x86_64-linux";
|
||||
unfreePkgs = [
|
||||
"hplip"
|
||||
"vivify.vim"
|
||||
"cheatsheet.nvim"
|
||||
];
|
||||
mkUnfreePredicate = pkg:
|
||||
builtins.elem (inputs.nixpkgs.lib.getName pkg) unfreePkgs;
|
||||
mkPkgs = nixpkgsInput:
|
||||
import nixpkgsInput {
|
||||
inherit system;
|
||||
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;
|
||||
in {
|
||||
inherit pkgs pkgs-unstable;
|
||||
};
|
||||
}
|
||||
// (inputs.import-tree ./modules));
|
||||
}
|
||||
}
|
||||
// (inputs.import-tree ./modules));
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
{ ... }: {
|
||||
flake.nixosModules.anki = { pkgs, ... }: {
|
||||
_: {
|
||||
flake.nixosModules.anki = {pkgs, ...}: {
|
||||
environment.systemPackages = [
|
||||
(pkgs.anki.withAddons [
|
||||
(pkgs.ankiAddons.recolor.withConfig {
|
||||
config = {
|
||||
# we must specify all the colors or it crashes as this overwrite the whole colors set
|
||||
colors = {
|
||||
# ===== Foregrounds =====
|
||||
FG = ["Foreground" "#ebdbb2" "#ebdbb2" ""];
|
||||
FG_SUBTLE = ["Subtle FG" "#d5c4a1" "#d5c4a1" ""];
|
||||
FG_FAINT = ["Faint FG" "#a89984" "#a89984" ""];
|
||||
FG_DISABLED = ["Disabled FG" "#928374" "#928374" ""];
|
||||
|
||||
# ===== Main Background Layers =====
|
||||
BG = ["Background" "#1d2021" "#1d2021" ""];
|
||||
MAIN_BG = ["Main Background" "#1d2021" "#1d2021" ""];
|
||||
VIEW_BG = ["View Background" "#282828" "#282828" ""];
|
||||
EDITOR_BG = ["Editor Background" "#282828" "#282828" ""];
|
||||
CANVAS = ["Canvas" "#282828" "#282828" ""];
|
||||
CANVAS_ELEVATED = ["Elevated Canvas" "#32302f" "#32302f" ""];
|
||||
|
||||
# ===== Tables & Lists =====
|
||||
TABLE_BG = ["Table Background" "#282828" "#282828" ""];
|
||||
TABLE_ALT_BG = ["Table Alt Background" "#32302f" "#32302f" ""];
|
||||
HEADER_BG = ["Header Background" "#3c3836" "#3c3836" ""];
|
||||
SELECTED_BG = ["Selected Background" "#504945" "#504945" ""];
|
||||
|
||||
# ===== Borders =====
|
||||
BORDER = ["Border" "#504945" "#504945" ""];
|
||||
FAINT_BORDER = ["Faint Border" "#3c3836" "#3c3836" ""];
|
||||
|
||||
# ===== Buttons =====
|
||||
BUTTON_GRADIENT_START = ["Button Start" "#3c3836" "#3c3836" ""];
|
||||
BUTTON_GRADIENT_END = ["Button End" "#3c3836" "#3c3836" ""];
|
||||
BUTTON_HOVER = ["Button Hover" "#665c54" "#665c54" ""];
|
||||
|
||||
# ===== Accent & Links =====
|
||||
ACCENT = ["Accent" "#458588" "#458588" ""];
|
||||
LINK = ["Link" "#83a598" "#83a598" ""];
|
||||
LINK_HOVER = ["Link Hover" "#8ec07c" "#8ec07c" ""];
|
||||
|
||||
# ===== Status =====
|
||||
WARNING = ["Warning" "#fe8019" "#fe8019" ""];
|
||||
ERROR = ["Error" "#fb4934" "#fb4934" ""];
|
||||
SUCCESS = ["Success" "#8ec07c" "#8ec07c" ""];
|
||||
};
|
||||
(pkgs.anki.withAddons [
|
||||
(pkgs.ankiAddons.recolor.withConfig {
|
||||
config = {
|
||||
# we must specify all the colors or it crashes as this overwrite the whole colors set
|
||||
colors = {
|
||||
# ===== Foregrounds =====
|
||||
FG = ["Foreground" "#ebdbb2" "#ebdbb2" ""];
|
||||
FG_SUBTLE = ["Subtle FG" "#d5c4a1" "#d5c4a1" ""];
|
||||
FG_FAINT = ["Faint FG" "#a89984" "#a89984" ""];
|
||||
FG_DISABLED = ["Disabled FG" "#928374" "#928374" ""];
|
||||
|
||||
# ===== Main Background Layers =====
|
||||
BG = ["Background" "#1d2021" "#1d2021" ""];
|
||||
MAIN_BG = ["Main Background" "#1d2021" "#1d2021" ""];
|
||||
VIEW_BG = ["View Background" "#282828" "#282828" ""];
|
||||
EDITOR_BG = ["Editor Background" "#282828" "#282828" ""];
|
||||
CANVAS = ["Canvas" "#282828" "#282828" ""];
|
||||
CANVAS_ELEVATED = ["Elevated Canvas" "#32302f" "#32302f" ""];
|
||||
|
||||
# ===== Tables & Lists =====
|
||||
TABLE_BG = ["Table Background" "#282828" "#282828" ""];
|
||||
TABLE_ALT_BG = ["Table Alt Background" "#32302f" "#32302f" ""];
|
||||
HEADER_BG = ["Header Background" "#3c3836" "#3c3836" ""];
|
||||
SELECTED_BG = ["Selected Background" "#504945" "#504945" ""];
|
||||
|
||||
# ===== Borders =====
|
||||
BORDER = ["Border" "#504945" "#504945" ""];
|
||||
FAINT_BORDER = ["Faint Border" "#3c3836" "#3c3836" ""];
|
||||
|
||||
# ===== Buttons =====
|
||||
BUTTON_GRADIENT_START = ["Button Start" "#3c3836" "#3c3836" ""];
|
||||
BUTTON_GRADIENT_END = ["Button End" "#3c3836" "#3c3836" ""];
|
||||
BUTTON_HOVER = ["Button Hover" "#665c54" "#665c54" ""];
|
||||
|
||||
# ===== Accent & Links =====
|
||||
ACCENT = ["Accent" "#458588" "#458588" ""];
|
||||
LINK = ["Link" "#83a598" "#83a598" ""];
|
||||
LINK_HOVER = ["Link Hover" "#8ec07c" "#8ec07c" ""];
|
||||
|
||||
# ===== Status =====
|
||||
WARNING = ["Warning" "#fe8019" "#fe8019" ""];
|
||||
ERROR = ["Error" "#fb4934" "#fb4934" ""];
|
||||
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 = {
|
||||
# we enable system wide with nixpkgs because it offers some addon configuration. We just use this for some config
|
||||
#enable = true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
# unused at the moment see ../hardware/battery.nix
|
||||
flake.homeModules.batsignal = { ... }: {
|
||||
flake.homeModules.batsignal = _: {
|
||||
services.batsignal.enable = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
{ self, ...}: {
|
||||
flake.nixosModules.browsers = { pkgs, pkgs-unstable, ...}: {
|
||||
{self, ...}: {
|
||||
flake.nixosModules.browsers = {
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
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.
|
||||
pkgs-unstable.tor-browser
|
||||
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
|
||||
home.sessionVariables = {
|
||||
MOZ_ENABLE_WAYLAND = 1;
|
||||
@@ -45,7 +49,7 @@
|
||||
"browser.toolbars.bookmarks.visibility" = "newtab"; # hide bookmarks toolbar; always, never, newtab
|
||||
"browser.aboutConfig.showWarning" = false; # disable warning about about:config
|
||||
"media.videocontrols.picture-in-picture.video-toggle.enabled" = false; # disable picture in picture button
|
||||
|
||||
|
||||
# Privacy
|
||||
"privacy.resistFingerprinting" = true;
|
||||
# "privacy.clearOnShutdown.cache" = false;
|
||||
@@ -69,12 +73,12 @@
|
||||
"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
|
||||
"browser.protections_panel.infoMessage.seen" = true; # disable tracking protection info
|
||||
|
||||
|
||||
# Theme
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
"svg.context-properties.content.enabled" = true;
|
||||
"layout.css.color-mix.enabled" = true;
|
||||
|
||||
|
||||
# Disable telemetry
|
||||
"toolkit.telemetry.enabled" = false;
|
||||
"toolkit.telemetry.unified" = false;
|
||||
@@ -90,7 +94,7 @@
|
||||
"browser.newtabpage.activity-stream.telemetry" = false;
|
||||
"toolkit.telemetry.shutdownPingSender.enabled" = false;
|
||||
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
|
||||
|
||||
|
||||
"browser.tabs.loadInBackground" = true; # open new tab in background
|
||||
"browser.tabs.loadBookmarksInTabs" = true; # open bookmarks in new tab
|
||||
"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.warnOnCloseOtherTabs" = false; # don't warn when closing multiple tabs
|
||||
"browser.tabs.closeWindowWithLastTab" = false; # don't close window when last tab is closed
|
||||
|
||||
|
||||
# other
|
||||
"media.autoplay.default" = 0; # enable autoplay on open
|
||||
"devtools.toolbox.host" = "right"; # move devtools to right
|
||||
@@ -108,7 +112,7 @@
|
||||
"media.rdd-vpx.enabled" = true; # enable hardware acceleration
|
||||
"devtools.cache.disabled" = true; # disable caching in devtools
|
||||
"media.ffmpeg.vaapi.enabled" = true; # enable hardware acceleration
|
||||
|
||||
|
||||
# Fonts
|
||||
"font.size.fixed.x-western" = 15;
|
||||
"font.minimum-size.x-western" = 13;
|
||||
@@ -130,12 +134,12 @@
|
||||
installation_mode = "normal_installed";
|
||||
install_url = "https://addons.mozilla.org/firefox/downloads/latest/enhancer-for-youtube/latest.xpi";
|
||||
};
|
||||
|
||||
|
||||
"sponsorBlocker@ajay.app" = {
|
||||
install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi";
|
||||
installation_mode = "force_installed";
|
||||
};
|
||||
|
||||
|
||||
"adnauseam@rednoise.org" = {
|
||||
install_url = "https://addons.mozilla.org/firefox/downloads/latest/adnauseam/latest.xpi";
|
||||
installation_mode = "force_installed";
|
||||
@@ -215,23 +219,23 @@
|
||||
# };
|
||||
# "trackmenot@mrl.nyu.edu".settings = {
|
||||
# enabled = true;
|
||||
|
||||
|
||||
# # Query behavior
|
||||
# runAtStartup = true;
|
||||
# useTab = false; # don't open visible tab
|
||||
# showQueries = false; # don't display fake queries
|
||||
|
||||
|
||||
# # Frequency (seconds between bursts)
|
||||
# timeout = 600; # 10 minutes
|
||||
# burstEnabled = true;
|
||||
# burstTimeout = 20; # burst interval
|
||||
# burstCount = 5;
|
||||
|
||||
|
||||
# # Query source
|
||||
# useRssFeeds = true; # use dynamic trending feeds
|
||||
# useUserQueries = false; # don't mix your real queries
|
||||
# useBlackList = true;
|
||||
|
||||
|
||||
# # Search engines to generate noise for
|
||||
# searchEngines = {
|
||||
# google = true;
|
||||
@@ -240,12 +244,12 @@
|
||||
# baidu = false;
|
||||
# duckduckgo = false;
|
||||
# };
|
||||
|
||||
|
||||
# # Logging
|
||||
# enableLogging = false;
|
||||
# };
|
||||
# "sponsorBlocker@ajay.app".settings = {
|
||||
|
||||
|
||||
# # Core behavior
|
||||
# isEnabled = true;
|
||||
# autoSkip = false;
|
||||
@@ -282,15 +286,15 @@
|
||||
# actionType = 0;
|
||||
# };
|
||||
# };
|
||||
|
||||
|
||||
# # Privacy
|
||||
# disableTelemetry = true;
|
||||
# showDonationLink = false;
|
||||
|
||||
|
||||
# # UX
|
||||
# showUpsells = false;
|
||||
# hideSkipButtonPlayerControls = false;
|
||||
|
||||
|
||||
# # Advanced
|
||||
# useLocalCache = true;
|
||||
# trackViewCount = false;
|
||||
@@ -496,23 +500,23 @@
|
||||
# };
|
||||
# "trackmenot@mrl.nyu.edu".settings = {
|
||||
# enabled = true;
|
||||
|
||||
|
||||
# # Query behavior
|
||||
# runAtStartup = true;
|
||||
# useTab = false; # don't open visible tab
|
||||
# showQueries = false; # don't display fake queries
|
||||
|
||||
|
||||
# # Frequency (seconds between bursts)
|
||||
# timeout = 600; # 10 minutes
|
||||
# burstEnabled = true;
|
||||
# burstTimeout = 20; # burst interval
|
||||
# burstCount = 5;
|
||||
|
||||
|
||||
# # Query source
|
||||
# useRssFeeds = true; # use dynamic trending feeds
|
||||
# useUserQueries = false; # don't mix your real queries
|
||||
# useBlackList = true;
|
||||
|
||||
|
||||
# # Search engines to generate noise for
|
||||
# searchEngines = {
|
||||
# google = true;
|
||||
@@ -521,12 +525,12 @@
|
||||
# baidu = false;
|
||||
# duckduckgo = false;
|
||||
# };
|
||||
|
||||
|
||||
# # Logging
|
||||
# enableLogging = false;
|
||||
# };
|
||||
# "sponsorBlocker@ajay.app".settings = {
|
||||
|
||||
|
||||
# # Core behavior
|
||||
# isEnabled = true;
|
||||
# autoSkip = false;
|
||||
@@ -563,15 +567,15 @@
|
||||
# actionType = 0;
|
||||
# };
|
||||
# };
|
||||
|
||||
|
||||
# # Privacy
|
||||
# disableTelemetry = true;
|
||||
# showDonationLink = false;
|
||||
|
||||
|
||||
# # UX
|
||||
# showUpsells = false;
|
||||
# hideSkipButtonPlayerControls = false;
|
||||
|
||||
|
||||
# # Advanced
|
||||
# useLocalCache = true;
|
||||
# trackViewCount = false;
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
{ self, ... }: {
|
||||
flake.nixosModules.caelestia = { pkgs, ... }: {
|
||||
{self, ...}: {
|
||||
flake.nixosModules.caelestia = {pkgs, ...}: {
|
||||
qt.enable = true;
|
||||
# to resolve this https://wiki.nixos.org/wiki/Home_Manager#I_cannot_set_GNOME_or_Gtk_themes_via_Home_Manager
|
||||
programs.dconf.enable = true;
|
||||
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
self.packages.${pkgs.system}.qtbatticon
|
||||
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'")"
|
||||
];
|
||||
};
|
||||
flake.homeModules.caelestia = { ... }: let
|
||||
flake.homeModules.caelestia = _: let
|
||||
sisyphe = ../../assets/sisyphe.gif;
|
||||
pepe-music = ../../assets/pepe-music.gif;
|
||||
in {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.eza = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.eza = _: {
|
||||
# ls replacement
|
||||
# see ./zsh.nix for the alias (usefull to se default flags)
|
||||
programs.eza = {
|
||||
@@ -8,7 +8,7 @@
|
||||
theme = {
|
||||
# from https://github.com/eza-community/eza-themes/blob/main/themes/gruvbox-dark.yml
|
||||
colourful = true;
|
||||
|
||||
|
||||
filekinds = {
|
||||
normal = {foreground = "#ebdbb2";};
|
||||
directory = {foreground = "#83a598";};
|
||||
@@ -103,7 +103,7 @@
|
||||
header = {foreground = "#ebdbb2";};
|
||||
octal = {foreground = "#8ec07c";};
|
||||
flags = {foreground = "#d3869b";};
|
||||
|
||||
|
||||
symlink_path = {foreground = "#8ec07c";};
|
||||
control_char = {foreground = "#83a598";};
|
||||
broken_symlink = {foreground = "#fb4934";};
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.fastfetch = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.fastfetch = _: {
|
||||
# Adapted from https://github.com/dacrab/fastfetch-config/blob/main/config.jsonc
|
||||
programs.fastfetch = {
|
||||
enable = true;
|
||||
|
||||
|
||||
settings = {
|
||||
logo = {
|
||||
type = "none";
|
||||
#source = "nixos";
|
||||
};
|
||||
|
||||
|
||||
modules = [
|
||||
# ───────────── Hardware ─────────────
|
||||
|
||||
|
||||
{
|
||||
type = "custom";
|
||||
format = "╭───────────────────────── Hardware ──────────────────────────╮";
|
||||
outputColor = "blue";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "title";
|
||||
key = " PC";
|
||||
keyColor = "green";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "host";
|
||||
key = "│ ├ Laptop";
|
||||
keyColor = "green";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "display";
|
||||
key = "│ ├ Display";
|
||||
keyColor = "green";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "cpu";
|
||||
key = "│ ├ CPU";
|
||||
@@ -44,63 +44,63 @@
|
||||
format = "{1}";
|
||||
keyColor = "green";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "gpu";
|
||||
key = "│ ├ GPU";
|
||||
keyColor = "green";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "memory";
|
||||
key = "└ └ Memory";
|
||||
keyColor = "green";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "custom";
|
||||
format = "╰─────────────────────────────────────────────────────────────╯";
|
||||
outputColor = "blue";
|
||||
}
|
||||
|
||||
|
||||
# ───────────── Software ─────────────
|
||||
|
||||
|
||||
{
|
||||
type = "custom";
|
||||
format = "╭───────────────────────── Software ──────────────────────────╮";
|
||||
outputColor = "blue";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "os";
|
||||
key = " OS";
|
||||
keyColor = "cyan";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "kernel";
|
||||
key = "│ ├ Kernel";
|
||||
keyColor = "cyan";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "packages";
|
||||
key = "│ ├ Packages";
|
||||
keyColor = "cyan";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "shell";
|
||||
key = "│ ├ Shell";
|
||||
keyColor = "cyan";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "terminal";
|
||||
key = "│ ├ Terminal";
|
||||
keyColor = "cyan";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "command";
|
||||
key = "│ ├ OS Age";
|
||||
@@ -113,50 +113,50 @@
|
||||
echo $days_difference days
|
||||
'';
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "uptime";
|
||||
key = "└ └ Uptime";
|
||||
keyColor = "cyan";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "de";
|
||||
key = " DE";
|
||||
keyColor = "blue";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "wm";
|
||||
key = " WM";
|
||||
keyColor = "magenta";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "gpu";
|
||||
key = "│ ├ GPU Driver";
|
||||
format = "{3}";
|
||||
keyColor = "magenta";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "brightness";
|
||||
key = "│ ├ Brightness";
|
||||
keyColor = "magenta";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "version";
|
||||
key = "└ └ FastFetch";
|
||||
keyColor = "magenta";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
type = "custom";
|
||||
format = "╰────────────────────────────────────────────────────────────╯";
|
||||
outputColor = "blue";
|
||||
}
|
||||
|
||||
|
||||
#{
|
||||
# type = "custom";
|
||||
# format = ''
|
||||
@@ -167,7 +167,7 @@
|
||||
type = "colors";
|
||||
symbol = "diamond";
|
||||
}
|
||||
|
||||
|
||||
"break"
|
||||
];
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.games = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
supertux # fuck mario
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.git = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.git = _: {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.homeModules.gtk = {pkgs, ...}: {
|
||||
# gtk config
|
||||
gtk.theme = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ ... }: {
|
||||
# this was in my home-manager config, but looks like more
|
||||
flake.nixosModules.hypridle = { ... }: {
|
||||
_: {
|
||||
# this was in my home-manager config, but looks like more
|
||||
flake.nixosModules.hypridle = _: {
|
||||
services.hypridle = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
{ self, ... }: {
|
||||
flake.nixosModules.hyprland = { pkgs, pkgs-unstable, ... }: {
|
||||
{self, ...}: {
|
||||
flake.nixosModules.hyprland = {
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
swww #wallpaper daemon
|
||||
gruvbox-gtk-theme
|
||||
@@ -31,10 +35,10 @@
|
||||
# removes uxterm
|
||||
services.xserver.excludePackages = [pkgs.xterm];
|
||||
|
||||
# Enable the X11 windowing system.
|
||||
# Enable the X11 windowing system.
|
||||
services.xserver.enable = true;
|
||||
};
|
||||
flake.homeModules.hyprland-laptop = { ... }: {
|
||||
flake.homeModules.hyprland-laptop = _: {
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
exec-once = [
|
||||
"qtbatticon" # custom battery tray
|
||||
@@ -84,10 +88,10 @@
|
||||
"workspaces, 1, 5, wind"
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
# █▀▀ █▄░█ █░█
|
||||
# ██▄ █░▀█ ▀▄▀
|
||||
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Environment-variables/
|
||||
env = [
|
||||
"PATH, $PATH:$scrPath"
|
||||
@@ -100,22 +104,22 @@
|
||||
"MOZ_ENABLE_WAYLAND,1"
|
||||
"GDK_SCALE,1"
|
||||
];
|
||||
|
||||
|
||||
# █ █▄░█ █▀█ █░█ ▀█▀
|
||||
# █ █░▀█ █▀▀ █▄█ ░█░
|
||||
|
||||
|
||||
input = {
|
||||
kb_layout = ["ch"];
|
||||
follow_mouse = 1;
|
||||
sensitivity = 0;
|
||||
force_no_accel = 1;
|
||||
};
|
||||
|
||||
|
||||
# █▄▀ █▀▀ █▄█ █▄▄ █ █▄░█ █▀▄ █ █▄░█ █▀▀ █▀
|
||||
# █░█ ██▄ ░█░ █▄█ █ █░▀█ █▄▀ █ █░▀█ █▄█ ▄█
|
||||
# caelestia shell drawers toggle dashboard
|
||||
# caelestia shell drawers toggle utilities
|
||||
|
||||
|
||||
bind = [
|
||||
#hyprland/utility keybindings
|
||||
"$mod, W, togglefloating"
|
||||
@@ -210,7 +214,7 @@
|
||||
"Ctrl+Alt, 9, exec, anki"
|
||||
# if hyprexpo plugin enabled bind = $mainMod, Space, hyprexpo:expo, toggle
|
||||
# maybe exec sudo framework-tools-tui
|
||||
|
||||
|
||||
#plugins keybindings
|
||||
#"$mod, SPACE, overview:toggle, "
|
||||
];
|
||||
@@ -285,20 +289,20 @@
|
||||
"3, right, move, +col"
|
||||
"3, left, move, -col"
|
||||
];
|
||||
|
||||
|
||||
# █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀
|
||||
# █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█
|
||||
|
||||
|
||||
dwindle = {
|
||||
preserve_split = true;
|
||||
};
|
||||
scrolling = {
|
||||
column_width = 0.45;
|
||||
};
|
||||
|
||||
|
||||
# █▀▄▀█ █ █▀ █▀▀
|
||||
# █░▀░█ █ ▄█ █▄▄
|
||||
|
||||
|
||||
misc = {
|
||||
vrr = 0;
|
||||
force_default_wallpaper = 0;
|
||||
@@ -306,7 +310,7 @@
|
||||
xwayland = {
|
||||
force_zero_scaling = true;
|
||||
};
|
||||
|
||||
|
||||
# █▀▄▀█ █▀█ █▄░█ █ ▀█▀ █▀█ █▀█
|
||||
# █░▀░█ █▄█ █#░▀█ █ ░█░ █▄█ █▀▄
|
||||
monitor = [
|
||||
@@ -343,17 +347,17 @@
|
||||
speed = 4.0;
|
||||
# how much the speed is influenced by the current shake intensitiy
|
||||
influence = 0.0;
|
||||
|
||||
|
||||
# maximal magnification the cursor can reach
|
||||
# values below 1 disable the limit (e.g. 0)
|
||||
limit = 0.0;
|
||||
|
||||
|
||||
# time in millseconds the cursor will stay magnified after a shake has ended
|
||||
timeout = 2000;
|
||||
|
||||
|
||||
# show cursor behaviour `tilt`, `rotate`, etc. while shaking
|
||||
effects = true;
|
||||
|
||||
|
||||
# enable ipc events for shake
|
||||
ipc = false;
|
||||
};
|
||||
@@ -364,7 +368,7 @@
|
||||
workspaceActiveBorder = "rgb(ab7746)";
|
||||
disableBlur = true;
|
||||
};
|
||||
|
||||
|
||||
#####################################################
|
||||
#####################################################
|
||||
# theme
|
||||
@@ -397,7 +401,7 @@
|
||||
};
|
||||
####################################################
|
||||
##################################################
|
||||
|
||||
|
||||
# /$$ /$$ /$$
|
||||
#| $$ /$ | $$ | $$
|
||||
#| $$ /$$$| $$ /$$$$$$ /$$$$$$ | $$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$
|
||||
@@ -418,7 +422,7 @@
|
||||
#"w[tv1], gapsout:1, gapsin:1"
|
||||
#"f[1], gapsout:1, gapsin:1"
|
||||
];
|
||||
|
||||
|
||||
# █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█ █▀█ █░█ █░░ █▀▀ █▀
|
||||
# ▀▄▀▄▀ █ █░▀█ █▄▀ █▄█ ▀▄▀▄▀ █▀▄ █▄█ █▄▄ ██▄ ▄█
|
||||
windowrule = [
|
||||
|
||||
@@ -1,50 +1,51 @@
|
||||
{ ...}: { # 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
|
||||
# -----------------------------------------------------
|
||||
perSystem = { pkgs, ... }: let
|
||||
_: {
|
||||
# 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
|
||||
# -----------------------------------------------------
|
||||
perSystem = {pkgs, ...}: let
|
||||
wallpaper1 = ../../assets/wallpaper1.jpg;
|
||||
wallpaper2 = ../../assets/wallpaper2.jpg;
|
||||
wallpaper3 = ../../assets/wallpaper3.jpg;
|
||||
wallpaper4 = ../../assets/wallpaper4.jpg;
|
||||
wallpaper5 = ../../assets/wallpaper5.jpg;
|
||||
in {
|
||||
# kills the app, but when it's steam or custom-pomodoro
|
||||
packages.custom-dontkillsteam = pkgs.writeShellApplication {
|
||||
name = "custom-dontkillsteam";
|
||||
runtimeInputs = with pkgs; [
|
||||
hyprland
|
||||
jq
|
||||
];
|
||||
text = ''
|
||||
class=$(hyprctl activewindow -j | jq -r ".class")
|
||||
if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then
|
||||
hyprctl dispatch movetoworkspacesilent special
|
||||
else
|
||||
hyprctl dispatch killactive ""
|
||||
fi
|
||||
|
||||
'';
|
||||
};
|
||||
packages.custom-killall = pkgs.writeShellApplication {
|
||||
name = "custom-killall";
|
||||
runtimeInputs = [
|
||||
pkgs.hyprland # for some reason pkgs-unstable doesn't work here
|
||||
pkgs.jq
|
||||
];
|
||||
text = ''
|
||||
active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
|
||||
hyprctl clients -j |
|
||||
jq -r ".[]
|
||||
| select(.workspace.id==''${active_workspace_id})
|
||||
| select(.focusHistoryID!=0)
|
||||
| .pid" |
|
||||
xargs -r kill
|
||||
'';
|
||||
};
|
||||
packages.custom-wallpaper = pkgs.writeShellApplication {
|
||||
# kills the app, but when it's steam or custom-pomodoro
|
||||
packages.custom-dontkillsteam = pkgs.writeShellApplication {
|
||||
name = "custom-dontkillsteam";
|
||||
runtimeInputs = with pkgs; [
|
||||
hyprland
|
||||
jq
|
||||
];
|
||||
text = ''
|
||||
class=$(hyprctl activewindow -j | jq -r ".class")
|
||||
if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then
|
||||
hyprctl dispatch movetoworkspacesilent special
|
||||
else
|
||||
hyprctl dispatch killactive ""
|
||||
fi
|
||||
|
||||
'';
|
||||
};
|
||||
packages.custom-killall = pkgs.writeShellApplication {
|
||||
name = "custom-killall";
|
||||
runtimeInputs = [
|
||||
pkgs.hyprland # for some reason pkgs-unstable doesn't work here
|
||||
pkgs.jq
|
||||
];
|
||||
text = ''
|
||||
active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
|
||||
hyprctl clients -j |
|
||||
jq -r ".[]
|
||||
| select(.workspace.id==''${active_workspace_id})
|
||||
| select(.focusHistoryID!=0)
|
||||
| .pid" |
|
||||
xargs -r kill
|
||||
'';
|
||||
};
|
||||
packages.custom-wallpaper = pkgs.writeShellApplication {
|
||||
name = "custom-wallpaper";
|
||||
runtimeInputs = with pkgs; [
|
||||
socat
|
||||
@@ -77,21 +78,22 @@
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
'';
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ self, ... }: {
|
||||
flake.nixosModules.kdrive = { pkgs-unstable, ... }: {
|
||||
{self, ...}: {
|
||||
flake.nixosModules.kdrive = {pkgs-unstable, ...}: {
|
||||
environment.systemPackages = with pkgs-unstable; [
|
||||
rclone
|
||||
self.packages.${pkgs.system}.custom-checkKdrive
|
||||
@@ -11,7 +11,7 @@
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
perSystem = { pkgs, ... }: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-checkKdrive = pkgs.writeShellApplication {
|
||||
name = "custom-checkKdrive";
|
||||
runtimeInputs = with pkgs; [
|
||||
@@ -20,21 +20,21 @@
|
||||
libnotify
|
||||
];
|
||||
text = ''
|
||||
|
||||
|
||||
# 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 || \
|
||||
ping -c1 -W1 8.8.8.8 >/dev/null 2>&1
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
||||
set +e
|
||||
|
||||
|
||||
output=$(rclone lsd kdrive: 2>&1)
|
||||
status=$?
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
if [ $status -eq 0 ]; then
|
||||
echo "kdrive OK"
|
||||
else
|
||||
@@ -47,23 +47,24 @@
|
||||
'';
|
||||
};
|
||||
packages.custom-mountkdrive = pkgs.writeShellApplication {
|
||||
name = "custom-mountkdrive";
|
||||
runtimeInputs = with pkgs; [
|
||||
rclone
|
||||
libnotify
|
||||
];
|
||||
text = ''
|
||||
REMOTE_NAME="kdrive"
|
||||
MOUNT_POINT="$HOME/kdrive"
|
||||
|
||||
if rclone listremotes | rg "^''${REMOTE_NAME}:"; then
|
||||
echo "Mounting ''${REMOTE_NAME}..."
|
||||
rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes --allow-non-empty &
|
||||
else
|
||||
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."
|
||||
echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix."
|
||||
fi
|
||||
'';
|
||||
name = "custom-mountkdrive";
|
||||
runtimeInputs = with pkgs; [
|
||||
rclone
|
||||
libnotify
|
||||
];
|
||||
text = ''
|
||||
REMOTE_NAME="kdrive"
|
||||
MOUNT_POINT="$HOME/kdrive"
|
||||
|
||||
if rclone listremotes | rg "^''${REMOTE_NAME}:"; then
|
||||
echo "Mounting ''${REMOTE_NAME}..."
|
||||
rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes --allow-non-empty &
|
||||
else
|
||||
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."
|
||||
echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix."
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.kitty = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.kitty = _: {
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
#font.name = nerd-fonts._0xproto;
|
||||
@@ -11,53 +11,53 @@
|
||||
bold_font auto
|
||||
italic_font auto
|
||||
bold_italic_font auto
|
||||
|
||||
|
||||
window_padding_width 25
|
||||
|
||||
|
||||
# --- Core ---
|
||||
foreground #ece0d9
|
||||
background #18120e
|
||||
|
||||
|
||||
selection_foreground #18120e
|
||||
selection_background #ece0d9
|
||||
|
||||
|
||||
cursor #ffb878
|
||||
cursor_text_color #18120e
|
||||
|
||||
|
||||
# --- Tabs ---
|
||||
active_tab_foreground #18120e
|
||||
active_tab_background #5c412a
|
||||
inactive_tab_foreground #d6c3b5
|
||||
inactive_tab_background #241e1a
|
||||
|
||||
|
||||
# --- Black / Gray ---
|
||||
color0 #353433
|
||||
color8 #b29f91
|
||||
|
||||
|
||||
# --- Red ---
|
||||
color1 #e17300
|
||||
color9 #ff8a20
|
||||
|
||||
|
||||
# --- Green ---
|
||||
color2 #ffc071
|
||||
color10 #ffd6a8
|
||||
|
||||
|
||||
# --- Yellow ---
|
||||
color3 #ffe0c6
|
||||
color11 #fff2e8
|
||||
|
||||
|
||||
# --- Blue ---
|
||||
color4 #b9ab66
|
||||
color12 #d7be91
|
||||
|
||||
|
||||
# --- Magenta ---
|
||||
color5 #ed9562
|
||||
color13 #fcad7e
|
||||
|
||||
|
||||
# --- Cyan ---
|
||||
color6 #f4c16d
|
||||
color14 #ffd497
|
||||
|
||||
|
||||
# --- White ---
|
||||
color7 #ebd4c1
|
||||
color15 #FFFFFF
|
||||
@@ -76,43 +76,43 @@
|
||||
selection_background #FFFFFF
|
||||
cursor #C3AC76
|
||||
cursor_text_color #0F1010
|
||||
|
||||
|
||||
active_tab_foreground #1B1D1C
|
||||
active_tab_background #6B5540
|
||||
inactive_tab_foreground #6B5540
|
||||
inactive_tab_background #1B1D1C
|
||||
|
||||
|
||||
# black
|
||||
color0 #29523D
|
||||
color8 #578F73
|
||||
|
||||
|
||||
# red
|
||||
#color1 #FFF0CC
|
||||
#color9 #F0DBAA
|
||||
# we need actual red colors
|
||||
color1 #CC241D
|
||||
color9 #9D0006
|
||||
|
||||
|
||||
# green
|
||||
color2 #FFEECC
|
||||
color10 #F0D9AA
|
||||
|
||||
|
||||
# yellow
|
||||
color3 #FFE5CC
|
||||
color11 #F0CCAA
|
||||
|
||||
|
||||
# blue
|
||||
color4 #9AE6C0
|
||||
color12 #9AE6C0
|
||||
|
||||
|
||||
# magenta
|
||||
color5 #E6CC9A
|
||||
color13 #E6CC9A
|
||||
|
||||
|
||||
# cyan
|
||||
color6 #E6BF9A
|
||||
color14 #E6BF9A
|
||||
|
||||
|
||||
# white
|
||||
color7 #FFF0CC
|
||||
color15 #F0DBAA
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.nixosModules.ly = { ... }: {
|
||||
_: {
|
||||
flake.nixosModules.ly = _: {
|
||||
# a minimal ly config as the big config (ly.nix) didnt worked
|
||||
services.displayManager.ly = {
|
||||
enable = true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ inputs, ... }: {
|
||||
flake.hostModules.micro = { pkgs-unstable, ... }: {
|
||||
{inputs, ...}: {
|
||||
flake.hostModules.micro = {pkgs-unstable, ...}: {
|
||||
programs.micro = {
|
||||
enable = true;
|
||||
package = pkgs-unstable.micro-full;
|
||||
@@ -18,19 +18,19 @@
|
||||
text = ''
|
||||
local buffer = import("micro/buffer")
|
||||
local shell = import("micro/shell")
|
||||
|
||||
|
||||
function vivifyOpen(buf)
|
||||
local cursor = buf:GetActiveCursor()
|
||||
local line = cursor.Loc.Y + 1
|
||||
|
||||
|
||||
shell.ExecCommand("viv", string.format("%s:%d", buf.AbsPath, line))
|
||||
end
|
||||
|
||||
|
||||
function onBufferOpen(buf)
|
||||
if os.getenv("MICRO_VIVIFY") ~= "1" then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- only run for real files (not help/log/etc)
|
||||
if buf.Type.Kind == buffer.BTDefault then
|
||||
vivifyOpen(buf)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.mullvad = {pkgs-unstable, ...}: {
|
||||
services.mullvad-vpn = {
|
||||
enable = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.homeModules.neovim = {pkgs-unstable, ...}: {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
@@ -64,9 +64,9 @@
|
||||
pkgs-unstable.vimPlugins.garbage-day-nvim
|
||||
];
|
||||
extraLuaConfig = ''
|
||||
|
||||
|
||||
local vim = vim
|
||||
|
||||
|
||||
-- =========================
|
||||
-- LEADER & KEY DISABLE
|
||||
-- =========================
|
||||
@@ -125,40 +125,40 @@
|
||||
vim.opt.inccommand = 'split'
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
|
||||
|
||||
|
||||
-- =========================
|
||||
-- BASIC KEYMAPS
|
||||
-- =========================
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||
|
||||
|
||||
-- Disable arrow keys in normal mode
|
||||
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', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
|
||||
-- Window navigation
|
||||
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-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' })
|
||||
|
||||
|
||||
-- Cheatsheet
|
||||
vim.keymap.set("n","§", "<cmd>Cheatsheet<CR>")
|
||||
require("cheatsheet").setup({
|
||||
bundled_cheatsheets = { enabled = { "default" } },
|
||||
bundled_plugin_cheatsheets = { disabled = { "gitsigns.nvim" } }
|
||||
})
|
||||
|
||||
|
||||
-- Highlight yanked text
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight on yank',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function() vim.highlight.on_yank() end,
|
||||
})
|
||||
|
||||
|
||||
-- ========================
|
||||
-- terminal
|
||||
-- =======================
|
||||
@@ -166,10 +166,10 @@
|
||||
position = 'right', -- position of the terminal window when using the shell_handler
|
||||
-- can be: top, left, right, bottom
|
||||
-- will be overwritten when using the telescope mapping to open horizontally or vertically
|
||||
|
||||
|
||||
width = 80, -- width of window when position is left or right
|
||||
height = 10, -- height of window when position is top or bottom
|
||||
|
||||
|
||||
handlers = {
|
||||
lua = function(bufnr)
|
||||
vim.print('Running lua file in buffer ' .. bufnr)
|
||||
@@ -177,13 +177,13 @@
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
vim.keymap.set("n", "<leader><leader>", function() require("runner-nvim").run() end)
|
||||
-- =========================
|
||||
-- SCROLLBAR
|
||||
-- =========================
|
||||
require("scrollbar").setup()
|
||||
|
||||
|
||||
-- =========================
|
||||
-- UFO FOLDING
|
||||
-- =========================
|
||||
@@ -196,7 +196,7 @@
|
||||
require('ufo').setup({
|
||||
provider_selector = function() return {'treesitter', 'indent'} end
|
||||
})
|
||||
|
||||
|
||||
-- =========================
|
||||
-- treesitter
|
||||
-- ========================
|
||||
@@ -219,7 +219,7 @@
|
||||
renderer = { group_empty = true },
|
||||
filters = { dotfiles = true },
|
||||
})
|
||||
|
||||
|
||||
-- =========================
|
||||
-- CMP CONFIGURATION
|
||||
-- =========================
|
||||
@@ -235,25 +235,25 @@
|
||||
}),
|
||||
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 = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } })
|
||||
|
||||
|
||||
-- =========================
|
||||
-- LSP CONFIGURATION
|
||||
-- =========================
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
|
||||
-- Diagnostics
|
||||
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>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>e2", vim.lsp.buf.code_action, { desc = "Show correction" })
|
||||
|
||||
|
||||
vim.keymap.set("n", "<leader>e<Tab>", function()
|
||||
local clients = vim.lsp.get_clients({ name = "ltex" })
|
||||
|
||||
|
||||
if #clients > 0 then
|
||||
-- Stop LTeX
|
||||
for _, client in ipairs(clients) do
|
||||
@@ -266,7 +266,7 @@
|
||||
print("LTeX ON")
|
||||
end
|
||||
end, { desc = "Toggle LTeX" })
|
||||
|
||||
|
||||
vim.diagnostic.config({
|
||||
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
|
||||
inline = false,
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
-- LSP functionality
|
||||
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>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>g5", vim.lsp.buf.references, { desc = "Show references" })
|
||||
|
||||
|
||||
-- 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("clangd", {
|
||||
@@ -300,7 +300,7 @@
|
||||
filetypes = { "c","cpp","objc","objcpp" },
|
||||
on_attach = on_attach ,
|
||||
init_options = {
|
||||
|
||||
|
||||
clangdFileStatus = true,
|
||||
usePlaceholders = true,
|
||||
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" },
|
||||
filetypes = { "markdown", "text", "tex", "plaintex" },
|
||||
on_attach = on_attach,
|
||||
|
||||
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "fr",
|
||||
|
||||
|
||||
enabled = {
|
||||
"markdown",
|
||||
"text",
|
||||
"tex",
|
||||
"plaintex",
|
||||
},
|
||||
|
||||
|
||||
completionEnabled = true,
|
||||
diagnosticSeverity = "information",
|
||||
|
||||
|
||||
additionalRules = {
|
||||
enablePickyRules = false,
|
||||
motherTongue = "fr",
|
||||
},
|
||||
|
||||
|
||||
dictionary = {
|
||||
["fr"] = {
|
||||
"icelle",
|
||||
@@ -367,7 +367,7 @@
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
vim.lsp.enable({ "lua_ls", "clangd", "pylsp", "texlab", "nixd", "ltex"})
|
||||
-- =========================
|
||||
-- DASHBOARD
|
||||
@@ -400,41 +400,41 @@
|
||||
footer = {},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-- jumps cursor when was last cursor last time
|
||||
require("nvim-lastplace").setup({
|
||||
-- Filetypes to ignore
|
||||
ignore_filetypes = {
|
||||
"gitcommit", "gitrebase", "svn", "hgcommit", "xxd", "COMMIT_EDITMSG"
|
||||
},
|
||||
|
||||
|
||||
-- Buffer types to ignore
|
||||
ignore_buftypes = {
|
||||
"quickfix", "nofile", "help", "terminal"
|
||||
},
|
||||
|
||||
|
||||
-- Center cursor after jumping
|
||||
center_on_jump = true,
|
||||
|
||||
|
||||
-- Only jump if target line is not visible
|
||||
jump_only_if_not_visible = false,
|
||||
|
||||
|
||||
-- Minimum lines required to enable jumping
|
||||
min_lines = 10,
|
||||
|
||||
|
||||
-- Maximum line to jump to (0 = no limit)
|
||||
max_line = 0,
|
||||
|
||||
|
||||
-- Open folds after jumping
|
||||
open_folds = true,
|
||||
|
||||
|
||||
-- Enable debug messages
|
||||
debug = false,
|
||||
})
|
||||
-- ======================
|
||||
-- gruvbox
|
||||
-- ======================
|
||||
|
||||
|
||||
require("gruvbox").setup({
|
||||
terminal_colors = false, -- add neovim terminal colors
|
||||
undercurl = true,
|
||||
@@ -470,18 +470,18 @@
|
||||
-- LUALINE
|
||||
-- =========================
|
||||
require('lualine').setup { options = { theme = "gruvbox_dark" } }
|
||||
|
||||
|
||||
|
||||
|
||||
--==================0
|
||||
-- Some utils
|
||||
--==================
|
||||
vim.keymap.set('n', '<leader>r1', '<cmd>Fugit2<CR>', { desc = 'Open git helper' })
|
||||
|
||||
|
||||
vim.keymap.set("n", "t", function()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
|
||||
|
||||
local result = vim.fn.system({ "custom-syllabes" }, line)
|
||||
|
||||
|
||||
print(vim.trim(result))
|
||||
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>f3', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>f4', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
|
||||
|
||||
-- Disable relative numbers even if plugins override
|
||||
vim.api.nvim_create_autocmd("VimEnter", { callback = function() vim.opt.colorcolumn = ""; vim.opt.relativenumber = false end })
|
||||
'';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
# obsidian is unused -> see my project https://github.com/tomasriveral/NoteWrapper
|
||||
flake.homeModules.obsidian = { ... }: {
|
||||
flake.homeModules.obsidian = _: {
|
||||
programs.obsidian = {
|
||||
enable = true;
|
||||
|
||||
@@ -27,99 +27,100 @@
|
||||
};
|
||||
};
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-obsidianbackup = pkgs.writeShellApplication {
|
||||
name = "custom-obsidianbackup";
|
||||
runtimeInputs = with pkgs; [
|
||||
rclone
|
||||
libnotify
|
||||
rsync
|
||||
];
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE_DIR="$HOME/Documents/Notes"
|
||||
DEST_DIR="$HOME/kdrive/Notes"
|
||||
BACKUP_DIR="$HOME/.Notes.backup"
|
||||
|
||||
mkdir -p "$DEST_DIR"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
while true; do
|
||||
# Timestamp for this run
|
||||
TIMESTAMP=$(date +%Y-%m-%d_%H-%M)
|
||||
TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP"
|
||||
mkdir -p "$TIMESTAMPED_BACKUP"
|
||||
|
||||
echo "[$(date)] Starting Obsidian backup..."
|
||||
|
||||
# Check rclone mount
|
||||
status=$(rclone about kdrive: 2>&1 || true)
|
||||
if [[ "$status" =~ .*CRITICAL.* ]]; then
|
||||
echo "[$(date)] rclone failed:"
|
||||
echo "$status"
|
||||
notify-send -u critical "rclone failed" \
|
||||
"rclone might be broken or you need to deactivate this script in HomeManager."
|
||||
else
|
||||
# Run rsync with verbose debugging
|
||||
echo "[$(date)] Running rsync..."
|
||||
rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \
|
||||
--exclude='.obsidian/cache/**' \
|
||||
"$SOURCE_DIR/" "$DEST_DIR/"
|
||||
|
||||
echo "[$(date)] Backup completed for this run."
|
||||
fi
|
||||
|
||||
# Safely remove backups older than 30 days
|
||||
if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then
|
||||
echo "[$(date)] Cleaning old backups..."
|
||||
find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \;
|
||||
else
|
||||
echo "[$(date)] Backup directory not safe. Skipping cleanup."
|
||||
fi
|
||||
|
||||
# Wait 1 hour
|
||||
echo "[$(date)] Sleeping for 1 hour..."
|
||||
sleep 3600
|
||||
done
|
||||
'';
|
||||
packages.custom-obsidianbackup = pkgs.writeShellApplication {
|
||||
name = "custom-obsidianbackup";
|
||||
runtimeInputs = with pkgs; [
|
||||
rclone
|
||||
libnotify
|
||||
rsync
|
||||
];
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE_DIR="$HOME/Documents/Notes"
|
||||
DEST_DIR="$HOME/kdrive/Notes"
|
||||
BACKUP_DIR="$HOME/.Notes.backup"
|
||||
|
||||
mkdir -p "$DEST_DIR"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
while true; do
|
||||
# Timestamp for this run
|
||||
TIMESTAMP=$(date +%Y-%m-%d_%H-%M)
|
||||
TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP"
|
||||
mkdir -p "$TIMESTAMPED_BACKUP"
|
||||
|
||||
echo "[$(date)] Starting Obsidian backup..."
|
||||
|
||||
# Check rclone mount
|
||||
status=$(rclone about kdrive: 2>&1 || true)
|
||||
if [[ "$status" =~ .*CRITICAL.* ]]; then
|
||||
echo "[$(date)] rclone failed:"
|
||||
echo "$status"
|
||||
notify-send -u critical "rclone failed" \
|
||||
"rclone might be broken or you need to deactivate this script in HomeManager."
|
||||
else
|
||||
# Run rsync with verbose debugging
|
||||
echo "[$(date)] Running rsync..."
|
||||
rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \
|
||||
--exclude='.obsidian/cache/**' \
|
||||
"$SOURCE_DIR/" "$DEST_DIR/"
|
||||
|
||||
echo "[$(date)] Backup completed for this run."
|
||||
fi
|
||||
|
||||
# Safely remove backups older than 30 days
|
||||
if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then
|
||||
echo "[$(date)] Cleaning old backups..."
|
||||
find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \;
|
||||
else
|
||||
echo "[$(date)] Backup directory not safe. Skipping cleanup."
|
||||
fi
|
||||
|
||||
# Wait 1 hour
|
||||
echo "[$(date)] Sleeping for 1 hour..."
|
||||
sleep 3600
|
||||
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
|
||||
'';
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.oh-my-posh = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.oh-my-posh = _: {
|
||||
programs.oh-my-posh = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
+117
-117
@@ -1,123 +1,123 @@
|
||||
{ ... }:
|
||||
{
|
||||
flake.homeModules.quickshell = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.quickshell = _: {
|
||||
# pulled from https://codeberg.org/zacoons/rivendell-hyprdots
|
||||
# replaced by caelestia-shell
|
||||
qt.enable = true;
|
||||
programs.quickshell = {
|
||||
systemd.enable = true;
|
||||
enable = true;
|
||||
};
|
||||
home.file.".config/quickshell" = {
|
||||
source = ../../other/quickshell;
|
||||
recursive = true;
|
||||
};
|
||||
programs.quickshell = {
|
||||
systemd.enable = true;
|
||||
enable = true;
|
||||
};
|
||||
home.file.".config/quickshell" = {
|
||||
source = ../../other/quickshell;
|
||||
recursive = true;
|
||||
};
|
||||
};
|
||||
perSystem = {pkgs, ...}: {
|
||||
# creates and maintains cache file for the notification history
|
||||
packages.QS-notifycache = pkgs.writeShellApplication {
|
||||
name = "QS-notifycache";
|
||||
text = ''
|
||||
CACHE="$HOME/.cache/notify_history"
|
||||
# Create or erase existing cache
|
||||
mkdir -p "$(dirname "$CACHE")"
|
||||
: > "$CACHE" # truncate file
|
||||
echo "Notification history initialized at $(date)" >> "$CACHE"
|
||||
'';
|
||||
# creates and maintains cache file for the notification history
|
||||
packages.QS-notifycache = pkgs.writeShellApplication {
|
||||
name = "QS-notifycache";
|
||||
text = ''
|
||||
CACHE="$HOME/.cache/notify_history"
|
||||
# Create or erase existing cache
|
||||
mkdir -p "$(dirname "$CACHE")"
|
||||
: > "$CACHE" # truncate file
|
||||
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\"}"
|
||||
'';
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.ripgrep = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.ripgrep = _: {
|
||||
programs.ripgrep = {
|
||||
enable = true;
|
||||
arguments = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.rofi = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.rofi = _: {
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
theme = "gruvbox-dark-hard";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.sbb-tui = { pkgs-unstable, ... }: {
|
||||
home.packages = [
|
||||
pkgs-unstable.sbb-tui
|
||||
_: {
|
||||
flake.homeModules.sbb-tui = {pkgs-unstable, ...}: {
|
||||
home.packages = [
|
||||
pkgs-unstable.sbb-tui
|
||||
];
|
||||
home.file.".config/sbb-tui/config.yaml" = {
|
||||
enable = true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.ssh = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.ssh = _: {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
enableDefaultConfig = false; # will be removed in the futur. Removes evaluation warning
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
# replaced by caelestia
|
||||
flake.homeModules.swaync = { ... }: {
|
||||
flake.homeModules.swaync = _: {
|
||||
services.swaync = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
flake.homeModules.swaylock = { ... }: {
|
||||
flake.homeModules.swaylock = _: {
|
||||
programs.swaylock = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.thunderbird = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.thunderbird = _: {
|
||||
programs.thunderbird = {
|
||||
enable = true;
|
||||
profiles.tomasr = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.homeModules.vivify = {pkgs-unstable, ...}: {
|
||||
home.file.".config/vivify/config.json" = {
|
||||
enable = true;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{ ... }:
|
||||
{
|
||||
flake.homeModules.waybar = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.waybar = _: {
|
||||
# replaced by caelestia
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
@@ -372,7 +371,7 @@
|
||||
@define-color foreground #c5c5c5;
|
||||
@define-color background #191919;
|
||||
@define-color cursor #c5c5c5;
|
||||
|
||||
|
||||
@define-color color0 #191919;
|
||||
@define-color color1 #3a3632;
|
||||
@define-color color2 #582c1e;
|
||||
@@ -389,9 +388,9 @@
|
||||
@define-color color13 #855f2f;
|
||||
@define-color color14 #796d62;
|
||||
@define-color color15 #c5c5c5;
|
||||
|
||||
|
||||
@define-color active @color6;
|
||||
|
||||
|
||||
* {
|
||||
font-size: 23px;
|
||||
font-family: "0xProto Nerd Font";
|
||||
@@ -403,9 +402,9 @@
|
||||
text-shadow: none;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
window#waybar {
|
||||
transition-property: background-color;
|
||||
transition-duration: 0.5s;
|
||||
@@ -415,23 +414,23 @@
|
||||
background: alpha(@background, 0.7);
|
||||
color: lighter(@active);
|
||||
}
|
||||
|
||||
|
||||
menu,
|
||||
tooltip {
|
||||
border-radius: 8px;
|
||||
padding: 2px;
|
||||
border: 1px solid lighter(@active);
|
||||
background: alpha(@background, 0.6);
|
||||
|
||||
|
||||
color: lighter(@active);
|
||||
}
|
||||
|
||||
|
||||
menu label,
|
||||
tooltip label {
|
||||
font-size: 20px;
|
||||
color: lighter(@active);
|
||||
}
|
||||
|
||||
|
||||
#submap,
|
||||
#tray>.needs-attention {
|
||||
animation-name: blink-active;
|
||||
@@ -440,14 +439,14 @@
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
|
||||
.modules-right {
|
||||
margin: 0px 6px 6px 6px;
|
||||
border-radius: 4px;
|
||||
background: alpha(@background, 0.4);
|
||||
color: lighter(@active);
|
||||
}
|
||||
|
||||
|
||||
.modules-left {
|
||||
transition-property: background-color;
|
||||
transition-duration: 0.5s;
|
||||
@@ -456,7 +455,7 @@
|
||||
background: alpha(@background, 0.4);
|
||||
color: lighter(@active);
|
||||
}
|
||||
|
||||
|
||||
#gcpu,
|
||||
#custom-github,
|
||||
#memory,
|
||||
@@ -466,7 +465,7 @@
|
||||
#custom-weather {
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
|
||||
#custom-recorder,
|
||||
#connection,
|
||||
#cnoti,
|
||||
@@ -481,38 +480,38 @@
|
||||
margin: 2px 2px 4px 2px;
|
||||
background: alpha(darker(@active), 0.3);
|
||||
}
|
||||
|
||||
|
||||
#custom-notifications {
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
|
||||
#custom-hotspot,
|
||||
#custom-github,
|
||||
#custom-notifications {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
|
||||
#custom-hotspot {
|
||||
padding-right: 2px;
|
||||
}
|
||||
|
||||
|
||||
#custom-vpn,
|
||||
#custom-hotspot {
|
||||
background: alpha(darker(@active), 0.3);
|
||||
}
|
||||
|
||||
|
||||
#privacy-item {
|
||||
padding: 6px 0px 6px 6px;
|
||||
}
|
||||
|
||||
|
||||
#gcpu {
|
||||
padding: 8px 0px 8px 0px;
|
||||
}
|
||||
|
||||
|
||||
#custom-cpu-icon {
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
|
||||
#custom-cputemp,
|
||||
#temperature {
|
||||
font-size: 17px;
|
||||
@@ -523,30 +522,30 @@
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
#custom-github {
|
||||
padding-top: 2px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
|
||||
#custom-dmark {
|
||||
color: alpha(@foreground, 0.3);
|
||||
}
|
||||
|
||||
|
||||
#submap {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
|
||||
#hyprland.window {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
|
||||
#workspaces {
|
||||
margin: 0px 2px;
|
||||
padding: 4px 0px 0px 0px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
|
||||
#workspaces button {
|
||||
transition-property: background-color;
|
||||
transition-duration: 0.5s;
|
||||
@@ -555,49 +554,49 @@
|
||||
border-radius: 4px;
|
||||
color: alpha(@foreground, 0.3);
|
||||
}
|
||||
|
||||
|
||||
#workspaces button.urgent {
|
||||
font-weight: bold;
|
||||
color: @foreground;
|
||||
}
|
||||
|
||||
|
||||
#workspaces button.active {
|
||||
padding: 4px 2px;
|
||||
background: alpha(@active, 0.4);
|
||||
color: lighter(@active);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
||||
#network.wifi {
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
|
||||
#submap {
|
||||
min-width: 0px;
|
||||
margin: 4px 6px 4px 6px;
|
||||
}
|
||||
|
||||
|
||||
#tray {
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
|
||||
#bluetooth {
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
|
||||
#window {
|
||||
border-radius: 8px;
|
||||
padding: 4px 14px;
|
||||
margin: 4px 2px 4px 2px;
|
||||
}
|
||||
|
||||
|
||||
#battery {
|
||||
font-size: 17px;
|
||||
border-radius: 8px;
|
||||
padding: 4px 0px;
|
||||
margin: 4px 2px 4px 2px;
|
||||
}
|
||||
|
||||
|
||||
#battery.discharging.warning {
|
||||
animation-name: blink-yellow;
|
||||
animation-duration: 1s;
|
||||
@@ -605,7 +604,7 @@
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
|
||||
#battery.discharging.critical {
|
||||
animation-name: blink-red;
|
||||
animation-duration: 1s;
|
||||
@@ -613,7 +612,7 @@
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
|
||||
#battery.powerdraw {
|
||||
font-size: 17px;
|
||||
padding: 0;
|
||||
@@ -626,25 +625,25 @@
|
||||
margin-left: -20px;
|
||||
margin-right: -20px;
|
||||
}
|
||||
|
||||
|
||||
#clock {
|
||||
font-weight: bold;
|
||||
padding: 4px 2px 2px 2px;
|
||||
}
|
||||
|
||||
|
||||
#pulseaudio.mic {
|
||||
border-radius: 4px;
|
||||
color: @background;
|
||||
background: alpha(darker(@foreground), 0.6);
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
|
||||
#backlight-slider slider,
|
||||
#pulseaudio-slider slider {
|
||||
background-color: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
|
||||
#backlight-slider trough,
|
||||
#pulseaudio-slider trough {
|
||||
margin-top: 4px;
|
||||
@@ -653,13 +652,13 @@
|
||||
border-radius: 8px;
|
||||
background-color: alpha(@background, 0.6);
|
||||
}
|
||||
|
||||
|
||||
#backlight-slider highlight,
|
||||
#pulseaudio-slider highlight {
|
||||
border-radius: 8px;
|
||||
background-color: lighter(@active);
|
||||
}
|
||||
|
||||
|
||||
#bluetooth.discoverable,
|
||||
#bluetooth.discovering,
|
||||
#bluetooth.pairable {
|
||||
@@ -670,21 +669,21 @@
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
|
||||
@keyframes blink-active {
|
||||
to {
|
||||
background-color: @active;
|
||||
color: @foreground;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@keyframes blink-red {
|
||||
to {
|
||||
background-color: #c64d4f;
|
||||
color: @foreground;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@keyframes blink-yellow {
|
||||
to {
|
||||
background-color: #cf9022;
|
||||
@@ -694,23 +693,24 @@
|
||||
'';
|
||||
};
|
||||
};
|
||||
perSystem = { pkgs, ... }: {
|
||||
packages.custom-weatherwaybar = pkgs.writeShellApplication {
|
||||
name = "custom-weatherwaybar";
|
||||
runtimeInputs = with pkgs; [
|
||||
curl
|
||||
];
|
||||
text = ''
|
||||
PATTERN="C"
|
||||
PATTERN2=" "
|
||||
TEXT1="''$(curl -s "https://wttr.in/?format=%c")"
|
||||
TEXT1=''${TEXT1/$PATTERN2/}
|
||||
TEXT2="''$(curl -s "https://wttr.in/?format=%t")"
|
||||
TEXT2=''${TEXT2/$PATTERN/}
|
||||
TEXT3="''$(curl -s "https://wttr.in/?format=%f")"
|
||||
TEXT3=''${TEXT3/$PATTERN/}
|
||||
printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \
|
||||
"$TEXT1" "$TEXT2" "$TEXT3"
|
||||
'';
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-weatherwaybar = pkgs.writeShellApplication {
|
||||
name = "custom-weatherwaybar";
|
||||
runtimeInputs = with pkgs; [
|
||||
curl
|
||||
];
|
||||
text = ''
|
||||
PATTERN="C"
|
||||
PATTERN2=" "
|
||||
TEXT1="''$(curl -s "https://wttr.in/?format=%c")"
|
||||
TEXT1=''${TEXT1/$PATTERN2/}
|
||||
TEXT2="''$(curl -s "https://wttr.in/?format=%t")"
|
||||
TEXT2=''${TEXT2/$PATTERN/}
|
||||
TEXT3="''$(curl -s "https://wttr.in/?format=%f")"
|
||||
TEXT3=''${TEXT3/$PATTERN/}
|
||||
printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \
|
||||
"$TEXT1" "$TEXT2" "$TEXT3"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
# replaced by wlogout
|
||||
flake.homeModules.wlogout = { ... }: let
|
||||
flake.homeModules.wlogout = _: let
|
||||
wallpaper = ../../assets/wallpaper1.jpg;
|
||||
lock = ../../assets/lock.png;
|
||||
lock-hover = ../../assets/lock-hover.png;
|
||||
@@ -46,7 +46,7 @@
|
||||
color: #000000; /* text */
|
||||
background-color: rgba(40, 40, 40, 0.76);
|
||||
}
|
||||
|
||||
|
||||
button {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
@@ -61,17 +61,17 @@
|
||||
box-shadow 0.3s ease-in-out,
|
||||
background-color 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
|
||||
button:hover {
|
||||
background-color: rgba(250, 137, 26, 0.3);
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
|
||||
button:focus {
|
||||
background-color: #ebdbb2;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
|
||||
#lock {
|
||||
background-image: image(url("${lock}"));
|
||||
}
|
||||
@@ -81,7 +81,7 @@
|
||||
#lock:hover {
|
||||
background-image: image(url("${lock-hover}"));
|
||||
}
|
||||
|
||||
|
||||
#logout {
|
||||
background-image: image(url("${logout}"));
|
||||
}
|
||||
@@ -91,8 +91,8 @@
|
||||
#logout:hover {
|
||||
background-image: image(url("${logout-hover}"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#shutdown {
|
||||
background-image: image(url("${shutdown}"));
|
||||
}
|
||||
@@ -102,7 +102,7 @@
|
||||
#shutdown:hover {
|
||||
background-image: image(url("${shutdown-hover}"));
|
||||
}
|
||||
|
||||
|
||||
#reboot {
|
||||
background-image: image(url("${reboot}"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.zoxide = { ... }: {
|
||||
_: {
|
||||
flake.homeModules.zoxide = _: {
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ self, ... }: {
|
||||
flake.homeModules.zsh-laptop = { ... }: {
|
||||
{self, ...}: {
|
||||
flake.homeModules.zsh-laptop = _: {
|
||||
programs.zsh = {
|
||||
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";
|
||||
@@ -7,12 +7,12 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
flake.homeModules.zsh = {pkgs,...}: {
|
||||
flake.homeModules.zsh = {pkgs, ...}: {
|
||||
home.packages = [
|
||||
self.packages.${pkgs.system}.dejaManuallyDerived
|
||||
#pkgs-unstable.deja
|
||||
];
|
||||
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autosuggestion.enable = false; # zsh-autocomplete is replaced by deja
|
||||
@@ -25,7 +25,7 @@
|
||||
command cat "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
custom-eza() { # behaves differently if we just call it or if we pipe initContent
|
||||
if [[ -t 1 ]]; then
|
||||
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 = {
|
||||
enable = true;
|
||||
theme = "jonathan";
|
||||
|
||||
+151
-150
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.battery-laptop = {
|
||||
lib,
|
||||
config,
|
||||
@@ -20,7 +20,7 @@
|
||||
# type = lib.types.bool;
|
||||
# };
|
||||
# };
|
||||
|
||||
|
||||
# config = lib.mkIf cfg.battery.enable {
|
||||
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
|
||||
@@ -53,7 +53,7 @@
|
||||
};
|
||||
# };
|
||||
};
|
||||
perSystem = { pkgs, ... }: let
|
||||
perSystem = {pkgs, ...}: let
|
||||
NotifySound = ../../assets/battery_notify.mp3;
|
||||
in {
|
||||
packages.custom-batterynotify = pkgs.writeShellApplication {
|
||||
@@ -65,33 +65,33 @@
|
||||
brightnessctl
|
||||
];
|
||||
text = ''
|
||||
|
||||
|
||||
# Delay for startup
|
||||
sleep 5
|
||||
|
||||
|
||||
# Change your sound path here
|
||||
|
||||
|
||||
playsound() {
|
||||
mplayer ${NotifySound}
|
||||
}
|
||||
|
||||
|
||||
adjustBrightness() {
|
||||
local adjustment="$1"
|
||||
brightnessctl set "$adjustment"
|
||||
}
|
||||
|
||||
|
||||
sendNotification() {
|
||||
local title="$1"
|
||||
local message="$2"
|
||||
notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u low "$title" "$message"
|
||||
}
|
||||
|
||||
|
||||
# Runs full time in background
|
||||
x=0
|
||||
while true; do
|
||||
Battery_Status="$(\cat /sys/class/power_supply/BAT*/status)"
|
||||
Battery_Capacity=$(\cat /sys/class/power_supply/BAT*/capacity)
|
||||
|
||||
|
||||
case "$Battery_Status" in
|
||||
"Discharging")
|
||||
if [ $x -eq 1 ]; then
|
||||
@@ -117,7 +117,7 @@
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
sleep 1
|
||||
done
|
||||
'';
|
||||
@@ -130,27 +130,27 @@
|
||||
brightnessctl
|
||||
];
|
||||
text = ''
|
||||
|
||||
|
||||
# Delay for startup
|
||||
sleep 5
|
||||
|
||||
|
||||
|
||||
|
||||
playsound() {
|
||||
mplayer ${NotifySound}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
while true; do
|
||||
Battery_Status="$(cat /sys/class/power_supply/BAT*/status)"
|
||||
Battery_Capacity="$(cat /sys/class/power_supply/BAT*/capacity)"
|
||||
|
||||
|
||||
if [ "$Battery_Status" == "Discharging" ]; 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>"
|
||||
playsound
|
||||
sleep 180
|
||||
|
||||
|
||||
elif [ "$Battery_Capacity" -lt 10 ]; then
|
||||
notify-send -e -u critical "Battery Low!" "<b>Save your works</b> before immediate shutdown."
|
||||
playsound
|
||||
@@ -170,7 +170,7 @@
|
||||
packages.qtbatticon = pkgs.stdenv.mkDerivation {
|
||||
pname = "qtbatticon";
|
||||
version = "1.0";
|
||||
|
||||
|
||||
src = pkgs.writeTextFile {
|
||||
name = "qtbatticon.cpp";
|
||||
text = ''
|
||||
@@ -183,252 +183,253 @@
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
QString readFile(const QString &path) {
|
||||
QFile f(path);
|
||||
if (!f.open(QIODevice::ReadOnly)) return "";
|
||||
QTextStream in(&f);
|
||||
return in.readAll().trimmed();
|
||||
}
|
||||
|
||||
|
||||
int readInt(const QString &path) {
|
||||
return readFile(path).toInt();
|
||||
}
|
||||
|
||||
|
||||
double readDouble(const QString &path) {
|
||||
QFile f(path);
|
||||
if (!f.open(QIODevice::ReadOnly)) return 0;
|
||||
QTextStream in(&f);
|
||||
return in.readAll().trimmed().toDouble();
|
||||
}
|
||||
|
||||
|
||||
int toStep(int capacity) {
|
||||
return (capacity / 10) * 10;
|
||||
}
|
||||
|
||||
|
||||
QString pad3(int n) {
|
||||
return QString("%1").arg(n, 3, 10, QChar('0'));
|
||||
}
|
||||
|
||||
|
||||
double getPowerW(const QString &batPath) {
|
||||
double current_uA = readDouble(batPath + "/current_now");
|
||||
double voltage_uV = readDouble(batPath + "/voltage_now");
|
||||
|
||||
|
||||
if (current_uA > 0 && voltage_uV > 0) {
|
||||
return (current_uA * voltage_uV) / 1e12;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
QIcon batteryIcon(int capacity, bool charging) {
|
||||
int step = toStep(capacity);
|
||||
QString num = pad3(step);
|
||||
|
||||
|
||||
QString base = "/run/current-system/sw/share/icons/Papirus/24x24/panel/";
|
||||
|
||||
|
||||
QString file;
|
||||
if (charging) {
|
||||
file = base + "battery-" + num + "-charging.svg";
|
||||
} else {
|
||||
file = base + "battery-" + num + ".svg";
|
||||
}
|
||||
|
||||
|
||||
QIcon icon(file);
|
||||
|
||||
|
||||
if (icon.isNull()) {
|
||||
qDebug() << "FAILED icon:" << file;
|
||||
icon = QIcon(base + "battery-100.svg");
|
||||
}
|
||||
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
||||
void sendNotification(const QString &title, const QString &body) {
|
||||
QString cmd = "notify-send \"" + title + "\" \"" + body + "\"";
|
||||
system(cmd.toUtf8().constData());
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
|
||||
|
||||
QString batPath = "/sys/class/power_supply/BAT1";
|
||||
QSystemTrayIcon tray;
|
||||
|
||||
|
||||
auto updateIcon = [&]() {
|
||||
int capacity = readInt(batPath + "/capacity");
|
||||
QString status = readFile(batPath + "/status");
|
||||
bool charging = status.contains("Charging");
|
||||
|
||||
|
||||
tray.setIcon(batteryIcon(capacity, charging));
|
||||
};
|
||||
|
||||
|
||||
auto notify = [&]() {
|
||||
int capacity = readInt(batPath + "/capacity");
|
||||
QString status = readFile(batPath + "/status");
|
||||
|
||||
|
||||
bool charging = status.contains("Charging");
|
||||
bool discharging = status.contains("Discharging");
|
||||
|
||||
|
||||
double power = getPowerW(batPath);
|
||||
|
||||
|
||||
QString state;
|
||||
if (charging) state = "Charging";
|
||||
else if (discharging) state = "Discharging";
|
||||
else state = status;
|
||||
|
||||
|
||||
QString powerStr = (power > 0.01)
|
||||
? QString::number(power, 'f', 2) + " W"
|
||||
: "N/A";
|
||||
|
||||
|
||||
QString msg =
|
||||
QString("%1\n%2%\n%3")
|
||||
.arg(state)
|
||||
.arg(capacity)
|
||||
.arg(powerStr);
|
||||
|
||||
|
||||
sendNotification("Battery status", msg);
|
||||
};
|
||||
|
||||
|
||||
QObject::connect(&tray, &QSystemTrayIcon::activated,
|
||||
[&](QSystemTrayIcon::ActivationReason r) {
|
||||
if (r == QSystemTrayIcon::Trigger) {
|
||||
notify();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
updateIcon();
|
||||
tray.setVisible(true);
|
||||
|
||||
|
||||
QTimer timer;
|
||||
QObject::connect(&timer, &QTimer::timeout, updateIcon);
|
||||
timer.start(5000);
|
||||
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
qt6.wrapQtAppsHook
|
||||
];
|
||||
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
qt6.qtbase
|
||||
qt6.qtsvg
|
||||
papirus-icon-theme
|
||||
];
|
||||
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
|
||||
buildPhase = ''
|
||||
g++ $src -o qtbatticon \
|
||||
$(pkg-config --cflags --libs Qt6Widgets)
|
||||
'';
|
||||
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
install -m755 qtbatticon $out/bin/
|
||||
'';
|
||||
};
|
||||
# This was replaced by caelestia shell's Game Mode
|
||||
packages.custom-performance = pkgs.writeShellApplication {
|
||||
name = "custom-performance";
|
||||
runtimeInputs = with pkgs; [
|
||||
hyprland
|
||||
gawk
|
||||
libnotify
|
||||
];
|
||||
text = ''
|
||||
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
|
||||
if [ "$HYPRGAMEMODE" = 1 ] ; then
|
||||
hyprctl --batch "\
|
||||
keyword animations:enabled 0;\
|
||||
keyword animation borderangle,0; \
|
||||
keyword decoration:shadow:enabled 0;\
|
||||
keyword decoration:blur:enabled 0;\
|
||||
keyword decoration:fullscreen_opacity 1;\
|
||||
keyword general:gaps_in 0;\
|
||||
keyword general:gaps_out 0;\
|
||||
keyword general:border_size 1;\
|
||||
keyword decoration:rounding 0"
|
||||
notify-send -u critical -t 5000 "Performance mode [ON]"
|
||||
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
|
||||
|
||||
# This was replaced by caelestia shell's Game Mode
|
||||
packages.custom-performance = pkgs.writeShellApplication {
|
||||
name = "custom-performance";
|
||||
runtimeInputs = with pkgs; [
|
||||
hyprland
|
||||
gawk
|
||||
libnotify
|
||||
];
|
||||
text = ''
|
||||
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
|
||||
if [ "$HYPRGAMEMODE" = 1 ] ; then
|
||||
hyprctl --batch "\
|
||||
keyword animations:enabled 0;\
|
||||
keyword animation borderangle,0; \
|
||||
keyword decoration:shadow:enabled 0;\
|
||||
keyword decoration:blur:enabled 0;\
|
||||
keyword decoration:fullscreen_opacity 1;\
|
||||
keyword general:gaps_in 0;\
|
||||
keyword general:gaps_out 0;\
|
||||
keyword general:border_size 1;\
|
||||
keyword decoration:rounding 0"
|
||||
notify-send -u critical -t 5000 "Performance mode [ON]"
|
||||
exit
|
||||
else
|
||||
last_state=""
|
||||
notify-send -u critical -t 5000 "Performance mode [OFF]"
|
||||
hyprctl reload
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sleep "$INTERVAL"
|
||||
done
|
||||
'';
|
||||
};};
|
||||
flake.homeModules.cbatticon = { ... }: {
|
||||
'';
|
||||
};
|
||||
# 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
|
||||
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.
|
||||
# ChatGPT half baked a replacement that works on my system.
|
||||
# see qtbatticon
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ...}: {
|
||||
_: {
|
||||
flake.nixosModules.bluetooth = {pkgs, ...}: {
|
||||
hardware.bluetooth.enable = true;
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.bootloader-laptop = {
|
||||
inputs,
|
||||
pkgs,
|
||||
@@ -8,7 +8,7 @@
|
||||
boot.loader.grub = {
|
||||
theme = inputs.nixos-grub-themes.packages.${pkgs.system}.nixos; # if you want to use nixos grub theme
|
||||
};
|
||||
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{ ... }: {
|
||||
flake.nixosModules.disk = { pkgs, ... }: {
|
||||
_: {
|
||||
flake.nixosModules.disk = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
gnome-disk-utility
|
||||
udiskie
|
||||
];
|
||||
};
|
||||
flake.nixosModules.disk-laptop = { ... }: {
|
||||
flake.nixosModules.disk-laptop = _: {
|
||||
# i found swap necessary when running nixpkgs review
|
||||
swapDevices = [
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.hardware-configuration-laptop = {
|
||||
config,
|
||||
lib,
|
||||
@@ -11,25 +11,25 @@
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
|
||||
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-amd"];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/6aa664c2-8b23-4e20-b6e9-1806bf0f8df2";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/A59A-7AFA";
|
||||
fsType = "vfat";
|
||||
options = ["fmask=0077" "dmask=0077"];
|
||||
};
|
||||
|
||||
|
||||
swapDevices = [];
|
||||
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.hardwareUtils-laptop = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
# used for the framework 16 laptop
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{ ... }: {
|
||||
flake.nixosModules.udev = { ... }: {
|
||||
_: {
|
||||
flake.nixosModules.udev = _: {
|
||||
# udev with only the necessary rules. See udev.nix to get all the rules
|
||||
services.udev.extraRules = ''
|
||||
# adapted from here https://wiki.nixos.org/wiki/Keychron_M6
|
||||
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="32ac", MODE="0660", GROUP="users", TAG+="uaccess"
|
||||
|
||||
|
||||
|
||||
|
||||
# taken from here
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0013", 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
|
||||
# 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
|
||||
|
||||
+22
-20
@@ -1,16 +1,19 @@
|
||||
{ inputs, self, ...}: {
|
||||
{
|
||||
inputs,
|
||||
self,
|
||||
...
|
||||
}: {
|
||||
flake.nixosConfigurations.laptop = inputs.nixpkgs.lib.nixosSystem {
|
||||
#system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
inherit (self) pkgs-unstable;
|
||||
};
|
||||
modules = with self.nixosModules; [
|
||||
|
||||
# important do not remove
|
||||
home-manager-laptop
|
||||
laptop
|
||||
{ nixpkgs.pkgs = self.pkgs; }
|
||||
# keep this alphabetically organised
|
||||
{nixpkgs.pkgs = self.pkgs;}
|
||||
# keep this alphabetically organised
|
||||
anki
|
||||
audioAndMedia
|
||||
autoCleanup-laptop
|
||||
@@ -44,7 +47,7 @@
|
||||
user
|
||||
];
|
||||
};
|
||||
flake.homeModules.laptop = { ... }: {
|
||||
flake.homeModules.laptop = {...}: {
|
||||
imports = with self.homeModules; [
|
||||
inputs.caelestia-shell.homeManagerModules.default
|
||||
anki
|
||||
@@ -67,13 +70,13 @@
|
||||
ssh
|
||||
thunderbird
|
||||
tomasr
|
||||
vivify
|
||||
vivify
|
||||
zoxide
|
||||
zsh
|
||||
zsh-laptop
|
||||
];
|
||||
};
|
||||
flake.nixosModules.laptop = { ... }: {
|
||||
flake.nixosModules.laptop = _: {
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||
@@ -81,25 +84,25 @@
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "25.11"; # Did you read the comment?
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
};
|
||||
flake.nixosModules.home-manager-laptop = { pkgs, ... }: {
|
||||
flake.nixosModules.home-manager-laptop = {pkgs, ...}: {
|
||||
imports = [
|
||||
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
|
||||
environment.systemPackages = [ pkgs.git ];
|
||||
environment.systemPackages = [pkgs.git];
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
|
||||
extraSpecialArgs = {
|
||||
pkgs-unstable = self.pkgs-unstable;
|
||||
inherit self;
|
||||
inherit (self) pkgs-unstable;
|
||||
inherit self;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -108,11 +111,10 @@
|
||||
};
|
||||
home-manager.users.tomasr = self.homeModules.laptop;
|
||||
};
|
||||
flake.homeModules.tomasr = { ... }: {
|
||||
|
||||
flake.homeModules.tomasr = _: {
|
||||
home.username = "tomasr";
|
||||
home.homeDirectory = "/home/tomasr";
|
||||
|
||||
|
||||
home.sessionVariables = {
|
||||
EDITOR = "neovim";
|
||||
TERMINAL = "kitty";
|
||||
@@ -127,7 +129,7 @@
|
||||
# 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
|
||||
# release notes.
|
||||
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.IO = {pkgs, ...}: {
|
||||
# Configure keymap in X11
|
||||
services.xserver.xkb = {
|
||||
layout = "ch";
|
||||
variant = "fr";
|
||||
};
|
||||
|
||||
|
||||
# Configure console keymap
|
||||
console.keyMap = "fr_CH";
|
||||
|
||||
|
||||
# Enable touchpad support (enabled default in most desktopManager).
|
||||
# services.xserver.libinput.enable = true;
|
||||
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wl-clipboard
|
||||
cliphist
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.homeModules.cursor = {pkgs, ...}: {
|
||||
home.pointerCursor = {
|
||||
hyprcursor.enable = true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ ... }: {
|
||||
flake.homeModules.desktopEntries = { ... }: {
|
||||
# for when the system lacks of a .desktop file
|
||||
_: {
|
||||
flake.homeModules.desktopEntries = _: {
|
||||
# for when the system lacks of a .desktop file
|
||||
home.file.".local/share/applications/org.quickshell.desktop" = {
|
||||
enable = true;
|
||||
text = ''
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ ... }: {
|
||||
flake.nixosModules.fonts = { pkgs, ... }: {
|
||||
_: {
|
||||
flake.nixosModules.fonts = {pkgs, ...}: {
|
||||
# fonts
|
||||
fonts.packages = with pkgs; [
|
||||
nerd-fonts._0xproto
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.printer = {pkgs, ...}: {
|
||||
#https://wiki.nixos.org/wiki/Printing
|
||||
services.avahi = {
|
||||
@@ -6,7 +6,7 @@
|
||||
nssmdns4 = true;
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
|
||||
# Enable CUPS to print documents.
|
||||
services.printing = {
|
||||
enable = true;
|
||||
@@ -34,7 +34,7 @@
|
||||
model = "drv:///hp/hpcups.drv/hp-officejet_pro_7740_series.ppd";
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
ensureDefaultPrinter = "HP_OfficeJet_Pro_7740";
|
||||
};
|
||||
};
|
||||
|
||||
+10
-10
@@ -1,21 +1,21 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.user = {
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
services.dbus.enable = true;
|
||||
security.polkit.enable = true;
|
||||
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/Zurich";
|
||||
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
|
||||
# zsh dont want to work if it is not initialzed here.
|
||||
programs.zsh.enable = true;
|
||||
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.tomasr = {
|
||||
isNormalUser = true;
|
||||
@@ -23,9 +23,9 @@
|
||||
extraGroups = ["networkmanager" "wheel" "fuse"]; #wheel allow to use sudo / fuse -> rclone
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
|
||||
services.upower.enable = true;
|
||||
|
||||
|
||||
# removes need for password for nixos-rebuild
|
||||
security.sudo.extraRules = [
|
||||
{
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{ ... }: {
|
||||
perSystem = { pkgs, ... }: {
|
||||
packages.custom-bottom = pkgs.writeShellApplication {
|
||||
name = "custom-bottom";
|
||||
runtimeInputs = with pkgs; [
|
||||
kitty
|
||||
bottom
|
||||
];
|
||||
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
|
||||
'';
|
||||
_: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-bottom = pkgs.writeShellApplication {
|
||||
name = "custom-bottom";
|
||||
runtimeInputs = with pkgs; [
|
||||
kitty
|
||||
bottom
|
||||
];
|
||||
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
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,75 +1,74 @@
|
||||
{ ... }: {
|
||||
|
||||
perSystem = { pkgs, ... }: {
|
||||
packages.custom-colorpicker = pkgs.writeShellApplication {
|
||||
# useless. Just use hyprpicker
|
||||
name = "custom-colorpicker";
|
||||
runtimeInputs = with pkgs; [
|
||||
hyprpicker
|
||||
libnotify
|
||||
toybox
|
||||
wl-clipboard
|
||||
];
|
||||
text = ''
|
||||
check() {
|
||||
command -v "$1" 1>/dev/null
|
||||
}
|
||||
|
||||
notify() {
|
||||
check notify-send && {
|
||||
notify-send -a "Color Picker" "$@"
|
||||
return
|
||||
_: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-colorpicker = pkgs.writeShellApplication {
|
||||
# useless. Just use hyprpicker
|
||||
name = "custom-colorpicker";
|
||||
runtimeInputs = with pkgs; [
|
||||
hyprpicker
|
||||
libnotify
|
||||
toybox
|
||||
wl-clipboard
|
||||
];
|
||||
text = ''
|
||||
check() {
|
||||
command -v "$1" 1>/dev/null
|
||||
}
|
||||
echo "$@"
|
||||
}
|
||||
|
||||
loc="$HOME/.cache/colorpicker"
|
||||
[ -d "$loc" ] || mkdir -p "$loc"
|
||||
[ -f "$loc/colors" ] || touch "$loc/colors"
|
||||
|
||||
limit=10
|
||||
|
||||
[[ $# -eq 1 && $1 = "-l" ]] && {
|
||||
cat "$loc/colors"
|
||||
exit
|
||||
}
|
||||
|
||||
[[ $# -eq 1 && $1 = "-j" ]] && {
|
||||
text="$(head -n 1 "$loc/colors")"
|
||||
|
||||
mapfile -t allcolors < <(tail -n +2 "$loc/colors")
|
||||
# allcolors=($(tail -n +2 "$loc/colors"))
|
||||
tooltip="<b> COLORS</b>\n\n"
|
||||
|
||||
tooltip+="-> <b>$text</b> <span color='$text'></span> \n"
|
||||
for i in "''${allcolors[@]}"; do
|
||||
tooltip+=" <b>$i</b> <span color='$i'></span> \n"
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
{ "text":"<span color='$text'></span>", "tooltip":"$tooltip"}
|
||||
EOF
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
check hyprpicker || {
|
||||
notify "hyprpicker is not installed"
|
||||
exit
|
||||
}
|
||||
killall -q hyprpicker
|
||||
color=$(hyprpicker)
|
||||
|
||||
check wl-copy && {
|
||||
echo "$color" | sed -z 's/\n//g' | wl-copy
|
||||
}
|
||||
|
||||
prevColors=$(head -n $((limit - 1)) "$loc/colors")
|
||||
echo "$color" >"$loc/colors"
|
||||
echo "$prevColors" >>"$loc/colors"
|
||||
sed -i '/^$/d' "$loc/colors"
|
||||
pkill -RTMIN+1 waybar
|
||||
'';
|
||||
|
||||
notify() {
|
||||
check notify-send && {
|
||||
notify-send -a "Color Picker" "$@"
|
||||
return
|
||||
}
|
||||
echo "$@"
|
||||
}
|
||||
|
||||
loc="$HOME/.cache/colorpicker"
|
||||
[ -d "$loc" ] || mkdir -p "$loc"
|
||||
[ -f "$loc/colors" ] || touch "$loc/colors"
|
||||
|
||||
limit=10
|
||||
|
||||
[[ $# -eq 1 && $1 = "-l" ]] && {
|
||||
cat "$loc/colors"
|
||||
exit
|
||||
}
|
||||
|
||||
[[ $# -eq 1 && $1 = "-j" ]] && {
|
||||
text="$(head -n 1 "$loc/colors")"
|
||||
|
||||
mapfile -t allcolors < <(tail -n +2 "$loc/colors")
|
||||
# allcolors=($(tail -n +2 "$loc/colors"))
|
||||
tooltip="<b> COLORS</b>\n\n"
|
||||
|
||||
tooltip+="-> <b>$text</b> <span color='$text'></span> \n"
|
||||
for i in "''${allcolors[@]}"; do
|
||||
tooltip+=" <b>$i</b> <span color='$i'></span> \n"
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
{ "text":"<span color='$text'></span>", "tooltip":"$tooltip"}
|
||||
EOF
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
check hyprpicker || {
|
||||
notify "hyprpicker is not installed"
|
||||
exit
|
||||
}
|
||||
killall -q hyprpicker
|
||||
color=$(hyprpicker)
|
||||
|
||||
check wl-copy && {
|
||||
echo "$color" | sed -z 's/\n//g' | wl-copy
|
||||
}
|
||||
|
||||
prevColors=$(head -n $((limit - 1)) "$loc/colors")
|
||||
echo "$color" >"$loc/colors"
|
||||
echo "$prevColors" >>"$loc/colors"
|
||||
sed -i '/^$/d' "$loc/colors"
|
||||
pkill -RTMIN+1 waybar
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,83 +1,84 @@
|
||||
{ ... }: {
|
||||
perSystem = { pkgs, ... }: {
|
||||
packages.custom-cowsay = pkgs.writeShellApplication {
|
||||
name = "custom-cowsay";
|
||||
runtimeInputs = with pkgs; [
|
||||
cowsay
|
||||
];
|
||||
text = ''
|
||||
|
||||
cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www")
|
||||
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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"Software is like sex: It's better when it's free. -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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"I’m making an operating system myself, so I know what it’s like to be God. -Terry Davis"
|
||||
"I’m schizophrenic and so am I. -Terry Davis"
|
||||
"If I was a dog, I would bark. -Terry Davis"
|
||||
"Who has a better kernel? Debian? No. -Terry Davis"
|
||||
"Computers are fast, programmers keep it slow. -A random Reddit user"
|
||||
"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"
|
||||
"It's not a bug, it's a feature. -Programmers"
|
||||
"NVIDIA, fuck you -Linus Torvald"
|
||||
)
|
||||
while true
|
||||
do
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
SIndex=$(( RANDOM % ''${#sentences[@]} ))
|
||||
index=$(( RANDOM % ''${#cows[@]} ))
|
||||
#cow="/usr/share/cowsay/cows/''${cows[index]}.cow"
|
||||
cowsay -f "''${cows[index]}" "''${sentences[SIndex]}"
|
||||
sleep 10
|
||||
clear
|
||||
done
|
||||
'';
|
||||
# reduce terminal size for actually
|
||||
_: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-cowsay = pkgs.writeShellApplication {
|
||||
name = "custom-cowsay";
|
||||
runtimeInputs = with pkgs; [
|
||||
cowsay
|
||||
];
|
||||
text = ''
|
||||
|
||||
cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www")
|
||||
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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"Software is like sex: It's better when it's free. -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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"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"
|
||||
"I’m making an operating system myself, so I know what it’s like to be God. -Terry Davis"
|
||||
"I’m schizophrenic and so am I. -Terry Davis"
|
||||
"If I was a dog, I would bark. -Terry Davis"
|
||||
"Who has a better kernel? Debian? No. -Terry Davis"
|
||||
"Computers are fast, programmers keep it slow. -A random Reddit user"
|
||||
"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"
|
||||
"It's not a bug, it's a feature. -Programmers"
|
||||
"NVIDIA, fuck you -Linus Torvald"
|
||||
)
|
||||
while true
|
||||
do
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
SIndex=$(( RANDOM % ''${#sentences[@]} ))
|
||||
index=$(( RANDOM % ''${#cows[@]} ))
|
||||
#cow="/usr/share/cowsay/cows/''${cows[index]}.cow"
|
||||
cowsay -f "''${cows[index]}" "''${sentences[SIndex]}"
|
||||
sleep 10
|
||||
clear
|
||||
done
|
||||
'';
|
||||
# reduce terminal size for actually
|
||||
};
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
{ ... }: {
|
||||
perSystem = { pkgs, ... }: {
|
||||
# fzf librewolf profile selector
|
||||
packages.custom-librewolfprofiles = pkgs.writeShellApplication {
|
||||
name = "custom-librewolfprofiles";
|
||||
runtimeInputs = with pkgs; [
|
||||
zsh
|
||||
fzf
|
||||
];
|
||||
text = ''
|
||||
# List of profiles
|
||||
profiles=("work" "other" "private window")
|
||||
|
||||
# Use fzf to select
|
||||
selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:")
|
||||
|
||||
# If user cancels, exit
|
||||
[[ -z "$selected" ]] && exit 0
|
||||
|
||||
# Launch LibreWolf detached, keeping environment
|
||||
if [[ "$selected" == "private window" ]]; then
|
||||
setsid librewolf --private-window --no-remote >/dev/null 2>&1 &
|
||||
pkill -f "kitty.*Select LibreWolf profile"
|
||||
else
|
||||
setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 &
|
||||
pkill -f "kitty.*Select LibreWolf profile"
|
||||
fi
|
||||
|
||||
# Exit the kitty terminal after selection
|
||||
exit
|
||||
'';
|
||||
};
|
||||
_: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
# fzf librewolf profile selector
|
||||
packages.custom-librewolfprofiles = pkgs.writeShellApplication {
|
||||
name = "custom-librewolfprofiles";
|
||||
runtimeInputs = with pkgs; [
|
||||
zsh
|
||||
fzf
|
||||
];
|
||||
text = ''
|
||||
# List of profiles
|
||||
profiles=("work" "other" "private window")
|
||||
|
||||
# Use fzf to select
|
||||
selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:")
|
||||
|
||||
# If user cancels, exit
|
||||
[[ -z "$selected" ]] && exit 0
|
||||
|
||||
# Launch LibreWolf detached, keeping environment
|
||||
if [[ "$selected" == "private window" ]]; then
|
||||
setsid librewolf --private-window --no-remote >/dev/null 2>&1 &
|
||||
pkill -f "kitty.*Select LibreWolf profile"
|
||||
else
|
||||
setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 &
|
||||
pkill -f "kitty.*Select LibreWolf profile"
|
||||
fi
|
||||
|
||||
# Exit the kitty terminal after selection
|
||||
exit
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
{ ... }:
|
||||
{
|
||||
perSystem = { pkgs, ... }: {
|
||||
# counts how many syllabes in a string.
|
||||
# not perfect. Does not handle silents e in french
|
||||
# but that's what I use for writing poetry
|
||||
packages.custom-syllabes = pkgs.writers.writePython3Bin "custom-syllabes" {
|
||||
libraries = with pkgs; [
|
||||
python3Packages.pyphen
|
||||
];
|
||||
} ''
|
||||
import sys
|
||||
import pyphen
|
||||
|
||||
dic = pyphen.Pyphen(lang="fr")
|
||||
|
||||
text = sys.stdin.read().strip()
|
||||
|
||||
chunks = []
|
||||
total = 0
|
||||
|
||||
for w in text.split():
|
||||
hyphenated = dic.inserted(w)
|
||||
parts = hyphenated.split("-")
|
||||
chunks.append("/".join(parts))
|
||||
total += len(parts)
|
||||
|
||||
print(f"{total} ({'/'.join(chunks)})")
|
||||
'';
|
||||
};}
|
||||
_: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
# counts how many syllabes in a string.
|
||||
# not perfect. Does not handle silents e in french
|
||||
# but that's what I use for writing poetry
|
||||
packages.custom-syllabes =
|
||||
pkgs.writers.writePython3Bin "custom-syllabes" {
|
||||
libraries = with pkgs; [
|
||||
python3Packages.pyphen
|
||||
];
|
||||
} ''
|
||||
import sys
|
||||
import pyphen
|
||||
|
||||
dic = pyphen.Pyphen(lang="fr")
|
||||
|
||||
text = sys.stdin.read().strip()
|
||||
|
||||
chunks = []
|
||||
total = 0
|
||||
|
||||
for w in text.split():
|
||||
hyphenated = dic.inserted(w)
|
||||
parts = hyphenated.split("-")
|
||||
chunks.append("/".join(parts))
|
||||
total += len(parts)
|
||||
|
||||
print(f"{total} ({'/'.join(chunks)})")
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
{ ... }:
|
||||
{
|
||||
perSystem = { pkgs, ...}: {
|
||||
packages.custom-tomato = pkgs.writeShellApplication {
|
||||
name = "custom-tomato";
|
||||
runtimeInputs = with pkgs; [
|
||||
kitty
|
||||
tomato-c
|
||||
];
|
||||
text = ''
|
||||
kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato
|
||||
'';
|
||||
_: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-tomato = pkgs.writeShellApplication {
|
||||
name = "custom-tomato";
|
||||
runtimeInputs = with pkgs; [
|
||||
kitty
|
||||
tomato-c
|
||||
];
|
||||
text = ''
|
||||
kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{ ... }:
|
||||
{
|
||||
perSystem = { pkgs, ... }: {
|
||||
packages.custom-weather = pkgs.writeShellApplication {
|
||||
name = "custom-weather";
|
||||
runtimeInputs = with pkgs; [
|
||||
curl
|
||||
];
|
||||
text = ''
|
||||
while true; do
|
||||
curl "https://wttr.in/?0&d&q&F&lang=fr"
|
||||
sleep 7200
|
||||
done
|
||||
'';
|
||||
_: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-weather = pkgs.writeShellApplication {
|
||||
name = "custom-weather";
|
||||
runtimeInputs = with pkgs; [
|
||||
curl
|
||||
];
|
||||
text = ''
|
||||
while true; do
|
||||
curl "https://wttr.in/?0&d&q&F&lang=fr"
|
||||
sleep 7200
|
||||
done
|
||||
'';
|
||||
};
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
{ self, ... }: {
|
||||
perSystem = { pkgs, ...}:
|
||||
let
|
||||
pkgs-unstable = self.pkgs-unstable;
|
||||
in
|
||||
{ # perSystem doesnt like pkgs-unstable we must input it globally
|
||||
packages.dejaManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: {
|
||||
pname = "deja";
|
||||
version = "0.2.6";
|
||||
__structuredAttrs = true;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Giammarco-Ferranti";
|
||||
repo = "deja";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-xxbClKhhSwo+jUjAZ2gS4yOS5sSI76dfPpDzA3qdV18=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-KmLdMK94cGOXMPJwWS6NgLB5OiNmJbszHdnLzauqJm8=";
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X main.version=${finalAttrs.version}"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
nativeCheckInputs = [pkgs.versionCheckHook];
|
||||
|
||||
passthru.updateScript = pkgs.nix-update-script {};
|
||||
|
||||
meta = {
|
||||
description = "Predictive inline shell autosuggestions for zsh";
|
||||
homepage = "https://github.com/Giammarco-Ferranti/deja";
|
||||
license = pkgs.lib.licenses.mit;
|
||||
platforms = pkgs.lib.platforms.unix;
|
||||
maintainers = with pkgs.lib.maintainers; [tomasrivera];
|
||||
mainProgram = "deja";
|
||||
};
|
||||
});
|
||||
};}
|
||||
{self, ...}: {
|
||||
perSystem = {pkgs, ...}: let
|
||||
inherit (self) pkgs-unstable;
|
||||
in {
|
||||
# perSystem doesnt like pkgs-unstable we must input it globally
|
||||
packages.dejaManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: {
|
||||
pname = "deja";
|
||||
version = "0.2.6";
|
||||
__structuredAttrs = true;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Giammarco-Ferranti";
|
||||
repo = "deja";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-xxbClKhhSwo+jUjAZ2gS4yOS5sSI76dfPpDzA3qdV18=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-KmLdMK94cGOXMPJwWS6NgLB5OiNmJbszHdnLzauqJm8=";
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X main.version=${finalAttrs.version}"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
nativeCheckInputs = [pkgs.versionCheckHook];
|
||||
|
||||
passthru.updateScript = pkgs.nix-update-script {};
|
||||
|
||||
meta = {
|
||||
description = "Predictive inline shell autosuggestions for zsh";
|
||||
homepage = "https://github.com/Giammarco-Ferranti/deja";
|
||||
license = pkgs.lib.licenses.mit;
|
||||
platforms = pkgs.lib.platforms.unix;
|
||||
maintainers = with pkgs.lib.maintainers; [tomasrivera];
|
||||
mainProgram = "deja";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,39 +1,44 @@
|
||||
{ ... }: {
|
||||
perSystem = { pkgs, pkgs-unstable, ... }: {
|
||||
packages.sbb-tuiManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: {
|
||||
pname = "sbb-tui";
|
||||
version = "1.14.2";
|
||||
__structuredAttrs = true;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Necrom4";
|
||||
repo = "sbb-tui";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = pkgs.lib.fakeHash;
|
||||
};
|
||||
|
||||
vendorHash = "sha256-K4DOu3rfSlKAa5JNKCzWWpnWZlXXxtN5Po7p1Spqe1w=";
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X main.version=${finalAttrs.version}"
|
||||
];
|
||||
|
||||
allowGoReference = true;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
nativeCheckInputs = [pkgs.versionCheckHook];
|
||||
|
||||
passthru.updateScript = pkgs.nix-update-script {};
|
||||
|
||||
meta = {
|
||||
description = "TUI client for Switzerland's public transport timetables, inspired by SBB/CFF/FFS app";
|
||||
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";
|
||||
};
|
||||
});
|
||||
}; }
|
||||
_: {
|
||||
perSystem = {
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
packages.sbb-tuiManuallyDerived = pkgs-unstable.buildGoModule (finalAttrs: {
|
||||
pname = "sbb-tui";
|
||||
version = "1.14.2";
|
||||
__structuredAttrs = true;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Necrom4";
|
||||
repo = "sbb-tui";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = pkgs.lib.fakeHash;
|
||||
};
|
||||
|
||||
vendorHash = "sha256-K4DOu3rfSlKAa5JNKCzWWpnWZlXXxtN5Po7p1Spqe1w=";
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X main.version=${finalAttrs.version}"
|
||||
];
|
||||
|
||||
allowGoReference = true;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
nativeCheckInputs = [pkgs.versionCheckHook];
|
||||
|
||||
passthru.updateScript = pkgs.nix-update-script {};
|
||||
|
||||
meta = {
|
||||
description = "TUI client for Switzerland's public transport timetables, inspired by SBB/CFF/FFS app";
|
||||
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";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,78 +1,83 @@
|
||||
{ ... }: {
|
||||
perSystem = { pkgs, nodejs, ... }: {
|
||||
packages.vivifyManuallyDerived = pkgs.stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "vivify";
|
||||
version = "0.14.0";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "jannis-baum";
|
||||
repo = "Vivify";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0=";
|
||||
};
|
||||
|
||||
yarnOfflineCache = pkgs.fetchYarnDeps {
|
||||
yarnLock = "${finalAttrs.src}/yarn.lock";
|
||||
hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
yarn install
|
||||
|
||||
substituteInPlace node_modules/.bin/tsc \
|
||||
--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}'
|
||||
|
||||
substituteInPlace node_modules/.bin/postject \
|
||||
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'
|
||||
|
||||
make VIV_VERSION=${finalAttrs.version} linux
|
||||
|
||||
mkdir -p $out/bin
|
||||
install -Dm755 ./build/linux/viv $out/bin/viv
|
||||
install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server
|
||||
|
||||
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.
|
||||
_: {
|
||||
perSystem = {
|
||||
pkgs,
|
||||
nodejs,
|
||||
...
|
||||
}: {
|
||||
packages.vivifyManuallyDerived = pkgs.stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "vivify";
|
||||
version = "0.14.0";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "jannis-baum";
|
||||
repo = "Vivify";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0=";
|
||||
};
|
||||
|
||||
yarnOfflineCache = pkgs.fetchYarnDeps {
|
||||
yarnLock = "${finalAttrs.src}/yarn.lock";
|
||||
hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
yarn install
|
||||
|
||||
substituteInPlace node_modules/.bin/tsc \
|
||||
--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}'
|
||||
|
||||
substituteInPlace node_modules/.bin/postject \
|
||||
--replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'
|
||||
|
||||
make VIV_VERSION=${finalAttrs.version} linux
|
||||
|
||||
mkdir -p $out/bin
|
||||
install -Dm755 ./build/linux/viv $out/bin/viv
|
||||
install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server
|
||||
|
||||
wrapProgram $out/bin/viv \
|
||||
--prefix PATH : ${
|
||||
pkgs.lib.makeBinPath [
|
||||
pkgs.nodejs
|
||||
pkgs.file
|
||||
]
|
||||
}
|
||||
'';
|
||||
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";
|
||||
};
|
||||
});
|
||||
};}
|
||||
|
||||
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}";
|
||||
license = pkgs.lib.licenses.gpl3;
|
||||
maintainers = with pkgs.lib.maintainers; [skohtv];
|
||||
platforms = pkgs.lib.platforms.linux;
|
||||
mainProgram = "viv";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
# see https://www.vimjoyer.com/nix/dendritic-home-manager
|
||||
{ inputs, ... }: {
|
||||
{inputs, ...}: {
|
||||
imports = [
|
||||
# adds home-manager options to flake-parts
|
||||
inputs.home-manager.flakeModules.home-manager
|
||||
];
|
||||
|
||||
config.systems = [
|
||||
config.systems = [
|
||||
"x86_64-linux"
|
||||
#"aarch64-linux"
|
||||
#"x86_64-darwin"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
systems = [
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
#"aarch64-linux"
|
||||
#"x86_64-darwin"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ self, ... }: {
|
||||
{self, ...}: {
|
||||
flake.nixosModules.audioAndMedia = {pkgs, ...}: {
|
||||
# Enable sound with pipewire.
|
||||
services.pulseaudio.enable = false;
|
||||
@@ -10,7 +10,7 @@
|
||||
pulse.enable = true;
|
||||
# If you want to use JACK applications, uncomment this
|
||||
#jack.enable = true;
|
||||
|
||||
|
||||
# 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)
|
||||
#media-session.enable = true;
|
||||
@@ -32,7 +32,7 @@
|
||||
gpu-screen-recorder
|
||||
inkscape
|
||||
];
|
||||
|
||||
|
||||
security.wrappers.gsr-kms-server = {
|
||||
# to remove the password prompt when using gpu-screen-recorder
|
||||
owner = "root";
|
||||
@@ -41,7 +41,7 @@
|
||||
source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server";
|
||||
};
|
||||
};
|
||||
perSystem = { pkgs, ...}: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-changeAudioOutput = pkgs.writeShellApplication {
|
||||
name = "custom-changeAudioOutput";
|
||||
runtimeInputs = with pkgs; [
|
||||
@@ -56,5 +56,6 @@
|
||||
fi
|
||||
pkill -f "kitty.*Select audio output"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
{ self, ... }: {
|
||||
flake.nixosModules.autoCleanup-laptop = {pkgs, pkgs-unstable, ...}: {
|
||||
{self, ...}: {
|
||||
flake.nixosModules.autoCleanup-laptop = {
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
# Ensure your script is available system-wide
|
||||
environment.systemPackages = [
|
||||
self.packages.${pkgs.system}.custom-cleanNix-laptop
|
||||
@@ -8,47 +12,47 @@
|
||||
users.users.tomasr = {
|
||||
linger = true; # lingering is required
|
||||
};
|
||||
|
||||
|
||||
systemd.user.services.custom-cleanNix = {
|
||||
description = "NixOS configuration auto cleanup";
|
||||
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
|
||||
|
||||
ExecStart = "/run/current-system/sw/bin/custom-cleanNix";
|
||||
|
||||
|
||||
# safety for long rebuilds
|
||||
TimeoutStartSec = "45min";
|
||||
TimeoutStopSec = "10min";
|
||||
|
||||
|
||||
# avoid overlap
|
||||
RemainAfterExit = true;
|
||||
|
||||
|
||||
# tweaks that should make the system run normally during the rebuilds
|
||||
Nice = 10;
|
||||
IOSchedulingClass = "best-effort";
|
||||
IOSchedulingPriority = 7;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# Systemd USER timer
|
||||
systemd.user.timers.custom-cleanNix = {
|
||||
wantedBy = ["timers.target"];
|
||||
|
||||
|
||||
timerConfig = {
|
||||
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
|
||||
|
||||
|
||||
# avoids thundering herd on boot
|
||||
RandomizedDelaySec = "2h";
|
||||
};
|
||||
};
|
||||
};
|
||||
perSystem = { pkgs, ... }: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-cleanNix-laptop = pkgs.writeShellApplication {
|
||||
name = "custom-cleanNix";
|
||||
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
git
|
||||
nixos-rebuild
|
||||
@@ -57,21 +61,21 @@
|
||||
alejandra
|
||||
deadnix
|
||||
];
|
||||
|
||||
|
||||
text = ''
|
||||
set -e
|
||||
|
||||
|
||||
FLAKE_DIR="/home/tomasr/nixos"
|
||||
FLAKE="$FLAKE_DIR#laptop"
|
||||
TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ")
|
||||
|
||||
|
||||
ERROR_FILE=$(mktemp)
|
||||
|
||||
|
||||
# snapshot current state
|
||||
git -C "$FLAKE_DIR" add -A
|
||||
git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-cleanup-$TIME"
|
||||
git -C "$FLAKE_DIR" tag "pre-cleanup-$TIME" HEAD
|
||||
|
||||
|
||||
# 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"
|
||||
deadnix --edit "$FLAKE_DIR" # removes unused code
|
||||
@@ -82,16 +86,16 @@
|
||||
echo "alejandra formats your Nix code consistently according to a strict, opinionated style."
|
||||
alejandra "$FLAKE_DIR" # formats the config
|
||||
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 ! git -C "$FLAKE_DIR" diff --quiet HEAD; then
|
||||
git -C "$FLAKE_DIR" add -A
|
||||
git -C "$FLAKE_DIR" commit -m "Auto: cleanup-$TIME"
|
||||
git -C "$FLAKE_DIR" push
|
||||
|
||||
|
||||
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>" \
|
||||
--html \
|
||||
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
|
||||
@@ -99,21 +103,22 @@
|
||||
notify-send "Nix auto cleanup" "No changes"
|
||||
git -C "$FLAKE_DIR" push
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
ERROR_MSG=$(cat "$ERROR_FILE")
|
||||
|
||||
|
||||
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>" \
|
||||
--html \
|
||||
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
|
||||
|
||||
|
||||
git -C "$FLAKE_DIR" reset --hard "pre-cleanup-$TIME"
|
||||
fi
|
||||
git -C "$FLAKE_DIR" tag -d "pre-cleanup-$TIME" # removes the tag
|
||||
|
||||
|
||||
rm -f "$ERROR_FILE"
|
||||
'';
|
||||
};
|
||||
};}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ self, ... }: {
|
||||
{self, ...}: {
|
||||
flake.nixosModules.autoUpdate-laptop = {pkgs, ...}: {
|
||||
# Ensure your script is available system-wide
|
||||
environment.systemPackages = [
|
||||
@@ -7,38 +7,38 @@
|
||||
users.users.tomasr = {
|
||||
linger = true; # lingering is required
|
||||
};
|
||||
|
||||
|
||||
systemd.user.services.custom-autoupdate = {
|
||||
description = "NixOS flake auto update";
|
||||
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
|
||||
|
||||
ExecStart = "/run/current-system/sw/bin/custom-autoupdate";
|
||||
|
||||
|
||||
# safety for long rebuilds
|
||||
TimeoutStartSec = "45min";
|
||||
TimeoutStopSec = "10min";
|
||||
|
||||
|
||||
# avoid overlap
|
||||
RemainAfterExit = true;
|
||||
|
||||
|
||||
# tweaks that should make the system run normally during the rebuilds
|
||||
Nice = 10;
|
||||
IOSchedulingClass = "best-effort";
|
||||
IOSchedulingPriority = 7;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# Systemd USER timer
|
||||
systemd.user.timers.custom-autoupdate = {
|
||||
wantedBy = ["timers.target"];
|
||||
|
||||
|
||||
timerConfig = {
|
||||
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
|
||||
|
||||
|
||||
# avoids thundering herd on boot
|
||||
RandomizedDelaySec = "2h";
|
||||
};
|
||||
@@ -47,40 +47,40 @@
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-autoupdate-laptop = pkgs.writeShellApplication {
|
||||
name = "custom-autoupdate";
|
||||
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
git
|
||||
nixos-rebuild
|
||||
matrix-commander-rs
|
||||
libnotify
|
||||
];
|
||||
|
||||
|
||||
text = ''
|
||||
set -e
|
||||
|
||||
|
||||
FLAKE_DIR="/home/tomasr/nixos"
|
||||
FLAKE="$FLAKE_DIR#laptop"
|
||||
TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ")
|
||||
|
||||
|
||||
ERROR_FILE=$(mktemp)
|
||||
|
||||
|
||||
# snapshot current state
|
||||
git -C "$FLAKE_DIR" add -A
|
||||
git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-autoupdate-$TIME"
|
||||
git -C "$FLAKE_DIR" tag "pre-autoupdate-$TIME" HEAD
|
||||
|
||||
|
||||
# update lock only
|
||||
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 ! git -C "$FLAKE_DIR" diff --quiet -- flake.lock; then
|
||||
git -C "$FLAKE_DIR" add flake.lock
|
||||
git -C "$FLAKE_DIR" commit -m "flake.lock: autoupdate-$TIME"
|
||||
git -C "$FLAKE_DIR" push
|
||||
|
||||
|
||||
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>" \
|
||||
--html \
|
||||
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
|
||||
@@ -88,22 +88,23 @@
|
||||
notify-send "Flake autoupdate" "No changes"
|
||||
git -C "$FLAKE_DIR" push
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
ERROR_MSG=$(cat "$ERROR_FILE")
|
||||
|
||||
|
||||
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>" \
|
||||
--html \
|
||||
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
|
||||
|
||||
|
||||
git -C "$FLAKE_DIR" reset --hard "pre-autoupdate-$TIME"
|
||||
fi
|
||||
|
||||
|
||||
git -C "$FLAKE_DIR" tag -d "pre-autoupdate-$TIME" # removes the tag
|
||||
|
||||
|
||||
rm -f "$ERROR_FILE"
|
||||
'';
|
||||
};
|
||||
};}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ self, ...}: {
|
||||
flake.nixosModules.notifications = { pkgs, ... }: {
|
||||
{self, ...}: {
|
||||
flake.nixosModules.notifications = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
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)
|
||||
@@ -13,49 +13,50 @@
|
||||
self.packages.${pkgs.system}.custom-checkKdrive # check if kdrive is set up with rclone
|
||||
];
|
||||
};
|
||||
perSystem = { pkgs, ...}: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-checkMatrix = pkgs.writeShellApplication {
|
||||
name = "custom-checkMatrix";
|
||||
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
matrix-commander-rs
|
||||
libnotify
|
||||
];
|
||||
|
||||
|
||||
text = ''
|
||||
expected="@totorile1:unredacted.org"
|
||||
|
||||
|
||||
current="$(matrix-commander-rs --whoami | tr -d '\n')"
|
||||
|
||||
|
||||
if [ "$current" != "$expected" ]; then
|
||||
notify-send "matrix-commander-rs" \
|
||||
"You are not logged in as @totorile1:unredacted.org\nLog:\n$current"
|
||||
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
|
||||
'';
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{ ... }:
|
||||
{
|
||||
flake.nixosModules.development = { pkgs, pkgs-unstable, ... }: {
|
||||
_: {
|
||||
flake.nixosModules.development = {
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
programs.nix-ld.enable = true; #Run unpatched dynamic binaries on NixOS. For example lets run ./a.out from gcc
|
||||
environment.systemPackages = with pkgs; [
|
||||
gcc
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{ self, ... }: let cacheTime = "10"; in {
|
||||
flake.nixosModules.documentation = { pkgs, ... }: {
|
||||
{self, ...}: let
|
||||
cacheTime = "10";
|
||||
in {
|
||||
flake.nixosModules.documentation = {pkgs, ...}: {
|
||||
# unfortunatly this adds a lot of computation when nix rebuilds
|
||||
documentation.man.generateCaches = true; # used for the man script
|
||||
|
||||
@@ -14,7 +16,7 @@
|
||||
self.packages.${pkgs.system}.custom-manix
|
||||
];
|
||||
};
|
||||
perSystem = { pkgs, ... }: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-man = pkgs.writeShellApplication {
|
||||
name = "custom-man";
|
||||
runtimeInputs = with pkgs; [
|
||||
@@ -26,67 +28,68 @@
|
||||
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
CACHE_FILE="$CACHE_DIR/custom-man-options.txt"
|
||||
mkdir -p "$CACHE_DIR"
|
||||
|
||||
|
||||
REGENERATE=0
|
||||
|
||||
|
||||
# check if -r flag was passed
|
||||
if [ "''${1:-}" = "-r" ]; then
|
||||
REGENERATE=1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# regenerate if file does not exist or is older than cacheTime days
|
||||
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
|
||||
REGENERATE=1
|
||||
fi
|
||||
|
||||
|
||||
if [ $REGENERATE -eq 1 ]; then
|
||||
echo "(Re)building custom-manix cache..."
|
||||
mkdir -p "$(dirname "$CACHE_FILE")"
|
||||
man -k . > "$CACHE_FILE"
|
||||
fi
|
||||
|
||||
|
||||
# read from cache and pipe into fzf
|
||||
cat "$CACHE_FILE" \
|
||||
| fzf --preview "man {1}" \
|
||||
| xargs man
|
||||
'';
|
||||
};
|
||||
packages.custom-manix = pkgs.writeShellApplication {
|
||||
name = "custom-manix";
|
||||
runtimeInputs = with pkgs; [
|
||||
manix
|
||||
ripgrep
|
||||
fzf
|
||||
];
|
||||
text = ''
|
||||
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
CACHE_FILE="$CACHE_DIR/custom-manix-options.txt"
|
||||
mkdir -p "$CACHE_DIR"
|
||||
|
||||
REGENERATE=0
|
||||
|
||||
# check if -r flag was passed
|
||||
if [ "''${1:-}" = "-r" ]; then
|
||||
REGENERATE=1
|
||||
fi
|
||||
|
||||
|
||||
# regenerate if file does not exist or is older than cacheTime days
|
||||
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
|
||||
REGENERATE=1
|
||||
fi
|
||||
|
||||
if [ $REGENERATE -eq 1 ]; then
|
||||
echo "(Re)building custom-manix cache..."
|
||||
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"
|
||||
fi
|
||||
|
||||
# read from cache and pipe into fzf
|
||||
cat "$CACHE_FILE" \
|
||||
| fzf --preview "manix {}" \
|
||||
| xargs manix
|
||||
'';
|
||||
packages.custom-manix = pkgs.writeShellApplication {
|
||||
name = "custom-manix";
|
||||
runtimeInputs = with pkgs; [
|
||||
manix
|
||||
ripgrep
|
||||
fzf
|
||||
];
|
||||
text = ''
|
||||
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
CACHE_FILE="$CACHE_DIR/custom-manix-options.txt"
|
||||
mkdir -p "$CACHE_DIR"
|
||||
|
||||
REGENERATE=0
|
||||
|
||||
# check if -r flag was passed
|
||||
if [ "''${1:-}" = "-r" ]; then
|
||||
REGENERATE=1
|
||||
fi
|
||||
|
||||
|
||||
# regenerate if file does not exist or is older than cacheTime days
|
||||
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
|
||||
REGENERATE=1
|
||||
fi
|
||||
|
||||
if [ $REGENERATE -eq 1 ]; then
|
||||
echo "(Re)building custom-manix cache..."
|
||||
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"
|
||||
fi
|
||||
|
||||
# read from cache and pipe into fzf
|
||||
cat "$CACHE_FILE" \
|
||||
| fzf --preview "manix {}" \
|
||||
| xargs manix
|
||||
'';
|
||||
};
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.latex = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
texlab
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.networking = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
wget
|
||||
@@ -7,17 +7,17 @@
|
||||
];
|
||||
#networking.Name = "nixos"; # Define your hostname.
|
||||
#networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
|
||||
|
||||
# Configure network proxy if necessary
|
||||
#networking.proxy.default = "http://user:password@proxy:port/";
|
||||
#networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||
|
||||
|
||||
# Enable networking
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
# services.openssh.enable = true;
|
||||
|
||||
|
||||
# Open ports in the firewall.
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
|
||||
+269
-269
@@ -1,28 +1,27 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.nixosModules.nixUtils-laptop = { ... }: {
|
||||
{inputs, ...}: {
|
||||
flake.nixosModules.nixUtils-laptop = _: {
|
||||
# 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
|
||||
nix.settings.max-jobs = 6;
|
||||
nix.settings.cores = 6;
|
||||
};
|
||||
flake.nixosModules.nixUtils = { pkgs-unstable, ... }: {
|
||||
flake.nixosModules.nixUtils = {pkgs-unstable, ...}: {
|
||||
# Garbage collector of generations
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 7d"; # every week delete generations older than a month
|
||||
};
|
||||
|
||||
|
||||
#manix is unhappy without this
|
||||
nix.nixPath = [
|
||||
"nixpkgs=${inputs.nixpkgs.outPath}"
|
||||
"home-manager=${inputs.home-manager.outPath}"
|
||||
];
|
||||
|
||||
|
||||
#adds nixos experimental features:
|
||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||
|
||||
|
||||
environment.systemPackages = with pkgs-unstable; [
|
||||
nixpkgs-review
|
||||
nixfmt-tree
|
||||
@@ -35,267 +34,268 @@
|
||||
statix
|
||||
];
|
||||
};
|
||||
perSystem = { pkgs, ... }: {
|
||||
# https://gist.github.com/MaxwellDupre/3077cd229490cf93ecab08ef2a79c852
|
||||
# better garbage collector
|
||||
perSystem = {pkgs, ...}: {
|
||||
# https://gist.github.com/MaxwellDupre/3077cd229490cf93ecab08ef2a79c852
|
||||
# better garbage collector
|
||||
packages.custom-trimmer = pkgs.writeShellApplication {
|
||||
name = "custom-trimmer";
|
||||
runtimeInputs = with pkgs; [
|
||||
nix
|
||||
];
|
||||
text = ''
|
||||
set -euo pipefail
|
||||
|
||||
## Defaults
|
||||
keepGensDef=30; keepDaysDef=7
|
||||
keepGens=$keepGensDef; keepDays=$keepDaysDef
|
||||
|
||||
## Usage
|
||||
usage () {
|
||||
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"
|
||||
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 " 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 "\nProfiles available are:\tuser, home-manager, channels, system (root)\n"
|
||||
printf "\n-h or --help prints this help text."
|
||||
}
|
||||
|
||||
if [ $# -eq 1 ]; then # if help requested
|
||||
if [ "$1" = "-h" ]; then
|
||||
usage
|
||||
exit 1;
|
||||
fi
|
||||
if [ "$1" = "--help" ]; then
|
||||
usage
|
||||
exit 2;
|
||||
fi
|
||||
printf "Dont recognise your option exiting..\n\n"
|
||||
usage
|
||||
exit 3;
|
||||
|
||||
elif [ $# -eq 0 ]; then # print the defaults
|
||||
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
|
||||
|
||||
case "$answer" in
|
||||
[yY1] )
|
||||
printf "Using defaults..\n"
|
||||
;;
|
||||
[nN0] ) printf "ok, doing nothing, exiting..\n"
|
||||
exit 6;
|
||||
;;
|
||||
* ) printf "%b" "Doing nothing, exiting.."
|
||||
exit 7;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## Handle parameters (and change if root)
|
||||
if [[ $EUID -ne 0 ]]; then # if not root
|
||||
profile=$(readlink /home/"$USER"/.nix-profile)
|
||||
else
|
||||
if [ -d /nix/var/nix/profiles/system ]; then # maybe this or the other
|
||||
profile="/nix/var/nix/profiles/system"
|
||||
elif [ -d /nix/var/nix/profiles/default ]; then
|
||||
profile="/nix/var/nix/profiles/default"
|
||||
else
|
||||
echo "Cant find profile for root. Exiting"
|
||||
exit 8
|
||||
fi
|
||||
fi
|
||||
if (( $# < 1 )); then
|
||||
printf "Keeping default: %d generations OR %d days, whichever is more\n" "$keepGensDef" "$keepDaysDef"
|
||||
elif [[ $# -le 2 ]]; then
|
||||
printf "\nError: Not enough arguments.\n\n" >&2
|
||||
usage
|
||||
exit 1
|
||||
elif (( $# > 4)); then
|
||||
printf "\nError: Too many arguments.\n\n" >&2
|
||||
usage
|
||||
exit 2
|
||||
else
|
||||
if [ "$1" -lt 1 ]; then
|
||||
printf "using Gen numbers less than 1 not recommended. Setting to min=1\n"
|
||||
read -r -p "is that ok? (y/n): " answer
|
||||
printf "%s" "$answer"
|
||||
case "$answer" in
|
||||
[yY1] )
|
||||
printf "ok, continuing..\n"
|
||||
;;
|
||||
[nN0] )
|
||||
printf "ok, doing nothing, exiting..\n"
|
||||
exit 6;
|
||||
;;
|
||||
* )
|
||||
printf "%b" "Doing nothing, exiting.."
|
||||
exit 7;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ "$2" -lt 0 ]; then
|
||||
printf "using negative days number not recommended. Setting to min=0\n"
|
||||
read -r -p "is that ok? (y/n): " answer
|
||||
|
||||
case "$answer" in
|
||||
[yY1] )
|
||||
printf "ok, continuing..\n"
|
||||
;;
|
||||
[nN0] )
|
||||
printf "ok, doing nothing, exiting..\n"
|
||||
exit 6;
|
||||
;;
|
||||
* )
|
||||
printf "%b" "Doing nothing, exiting.."
|
||||
exit 7;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
keepGens=$1; keepDays=$2;
|
||||
(( keepGens < 1 )) && keepGens=1
|
||||
(( keepDays < 0 )) && keepDays=0
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
if [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
|
||||
profile=$(readlink /home/"$USER"/.nix-profile)
|
||||
elif [[ $3 == "home-manager" ]]; then
|
||||
# home-manager defaults to $XDG_STATE_HOME; otherwise, use
|
||||
# `home-manager generations` and `nix-store --query --roots
|
||||
# /nix/store/...` to figure out what reference is keeping the old
|
||||
# generations alive.
|
||||
profile="''${XDG_STATE_HOME:-$HOME/.local/state}/nix/profiles/home-manager"
|
||||
elif [[ $3 == "channels" ]]; then
|
||||
profile="/nix/var/nix/profiles/per-user/$USER/channels"
|
||||
else
|
||||
printf "\nError: Do not understand your third argument. Should be one of: (user / home-manager/ channels)\n\n"
|
||||
usage
|
||||
exit 3
|
||||
fi
|
||||
else
|
||||
if [[ $3 == "system" ]]; then
|
||||
profile="/nix/var/nix/profiles/system"
|
||||
elif [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
|
||||
profile="/nix/var/nix/profiles/default"
|
||||
else
|
||||
printf "\nError: Do not understand your third argument. Should be one of: (user / system)\n\n"
|
||||
usage
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
printf "OK! \t Keep Gens = %s \t Keep Days = %s \n\n" "$keepGens" "$keepDays"
|
||||
|
||||
|
||||
fi
|
||||
|
||||
printf "Operating on profile: %s \t \n\n" "$profile"
|
||||
|
||||
## Runs at the end, to decide whether to delete profiles that match chosen parameters.
|
||||
choose () {
|
||||
local default="$1"
|
||||
local prompt="$2"
|
||||
local answer
|
||||
|
||||
read -r -p "$prompt" answer
|
||||
[ -z "$answer" ] && answer="$default"
|
||||
|
||||
case "$answer" in
|
||||
[yY1] ) #printf "answered yes!\n"
|
||||
nix-env --delete-generations -p "$profile" "''${!gens[@]}"
|
||||
exit 0
|
||||
;;
|
||||
[nN0] ) printf "Ok doing nothing exiting..\n"
|
||||
exit 6;
|
||||
;;
|
||||
* ) printf "%b" "Unexpected answer '$answer'!" >&2
|
||||
exit 7;
|
||||
;;
|
||||
esac
|
||||
} # end of function choose
|
||||
|
||||
# printf "profile = %s \n\n" "$profile"
|
||||
## Query nix-env for generations list
|
||||
#IFS=$'\n' nixGens=( $(nix-env --list-generations -p "$profile" | sed 's:^\s*::; s:\s*$::' | tr '\t' ' ' | tr -s ' ') )
|
||||
# gave errors replaced by:
|
||||
mapfile -t nixGens < <(
|
||||
nix-env --list-generations -p "$profile" |
|
||||
sed 's:^\s*::; s:\s*$::' |
|
||||
tr '\t' ' ' |
|
||||
tr -s ' '
|
||||
)
|
||||
timeNow=$(date +%s)
|
||||
|
||||
## Get info on oldest generation
|
||||
IFS=' ' read -r -a oldestGenArr <<< "''${nixGens[0]}"
|
||||
oldestGen=''${oldestGenArr[0]}
|
||||
oldestDate=''${oldestGenArr[1]}
|
||||
printf "%-30s %s\n" "oldest generation:" "$oldestGen"
|
||||
#oldestDate=''${nixGens[0]:3:19}
|
||||
printf "%-30s %s\n" "oldest generation created:" "$oldestDate"
|
||||
oldestTime=$(date -d "$oldestDate" +%s)
|
||||
oldestElapsedSecs=$((timeNow-oldestTime))
|
||||
oldestElapsedMins=$((oldestElapsedSecs/60))
|
||||
oldestElapsedHours=$((oldestElapsedMins/60))
|
||||
oldestElapsedDays=$((oldestElapsedHours/24))
|
||||
printf "%-30s %s\n" "minutes before now:" "$oldestElapsedMins"
|
||||
printf "%-30s %s\n" "hours before now:" "$oldestElapsedHours"
|
||||
printf "%-30s %s\n\n" "days before now:" "$oldestElapsedDays"
|
||||
|
||||
## Get info on current generation
|
||||
for i in "''${nixGens[@]}"; do
|
||||
IFS=' ' read -r -a iGenArr <<< "$i"
|
||||
genNumber=''${iGenArr[0]}
|
||||
genDate=''${iGenArr[1]}
|
||||
if [[ "$i" =~ current ]]; then
|
||||
currentGen=$genNumber
|
||||
printf "%-30s %s\n" "current generation:" "$currentGen"
|
||||
currentDate=$genDate
|
||||
printf "%-30s %s\n" "current generation created:" "$currentDate"
|
||||
currentTime=$(date -d "$currentDate" +%s)
|
||||
currentElapsedSecs=$((timeNow-currentTime))
|
||||
currentElapsedMins=$((currentElapsedSecs/60))
|
||||
currentElapsedHours=$((currentElapsedMins/60))
|
||||
currentElapsedDays=$((currentElapsedHours/24))
|
||||
printf "%-30s %s\n" "minutes before now:" "$currentElapsedMins"
|
||||
printf "%-30s %s\n" "hours before now:" "$currentElapsedHours"
|
||||
printf "%-30s %s\n\n" "days before now:" "$currentElapsedDays"
|
||||
fi
|
||||
done
|
||||
|
||||
## Compare oldest and current generations
|
||||
timeBetweenOldestAndCurrent=$((currentTime-oldestTime))
|
||||
elapsedDays=$((timeBetweenOldestAndCurrent/60/60/24))
|
||||
generationsDiff=$((currentGen-oldestGen))
|
||||
|
||||
## Figure out what we should do, based on generations and options
|
||||
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"
|
||||
exit 4;
|
||||
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"
|
||||
exit 5;
|
||||
else
|
||||
printf "\tSomething to do...\n"
|
||||
declare -a gens
|
||||
for i in "''${nixGens[@]}"; do
|
||||
IFS=' ' read -r -a iGenArr <<< "$i"
|
||||
genNumber=''${iGenArr[0]}
|
||||
genDiff=$((currentGen-genNumber))
|
||||
genDate=''${iGenArr[1]}
|
||||
genTime=$(date -d "$genDate" +%s)
|
||||
elapsedSecs=$((timeNow-genTime))
|
||||
genDaysOld=$((elapsedSecs/60/60/24))
|
||||
if [[ genDaysOld -gt keepDays ]] && [[ genDiff -ge keepGens ]]; then
|
||||
gens["$genNumber"]="$genDate, $genDaysOld day(s) old"
|
||||
fi
|
||||
done
|
||||
printf "\nFound the following generation(s) to delete:\n"
|
||||
for K in "''${!gens[@]}"; do
|
||||
printf "generation %d \t ''${gens[$K]}\n" "$K"
|
||||
done
|
||||
printf "\n"
|
||||
choose "y" "Do you want to delete these? [Y/n]: "
|
||||
fi
|
||||
|
||||
'';
|
||||
name = "custom-trimmer";
|
||||
runtimeInputs = with pkgs; [
|
||||
nix
|
||||
];
|
||||
text = ''
|
||||
set -euo pipefail
|
||||
|
||||
## Defaults
|
||||
keepGensDef=30; keepDaysDef=7
|
||||
keepGens=$keepGensDef; keepDays=$keepDaysDef
|
||||
|
||||
## Usage
|
||||
usage () {
|
||||
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"
|
||||
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 " 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 "\nProfiles available are:\tuser, home-manager, channels, system (root)\n"
|
||||
printf "\n-h or --help prints this help text."
|
||||
}
|
||||
|
||||
if [ $# -eq 1 ]; then # if help requested
|
||||
if [ "$1" = "-h" ]; then
|
||||
usage
|
||||
exit 1;
|
||||
fi
|
||||
if [ "$1" = "--help" ]; then
|
||||
usage
|
||||
exit 2;
|
||||
fi
|
||||
printf "Dont recognise your option exiting..\n\n"
|
||||
usage
|
||||
exit 3;
|
||||
|
||||
elif [ $# -eq 0 ]; then # print the defaults
|
||||
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
|
||||
|
||||
case "$answer" in
|
||||
[yY1] )
|
||||
printf "Using defaults..\n"
|
||||
;;
|
||||
[nN0] ) printf "ok, doing nothing, exiting..\n"
|
||||
exit 6;
|
||||
;;
|
||||
* ) printf "%b" "Doing nothing, exiting.."
|
||||
exit 7;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## Handle parameters (and change if root)
|
||||
if [[ $EUID -ne 0 ]]; then # if not root
|
||||
profile=$(readlink /home/"$USER"/.nix-profile)
|
||||
else
|
||||
if [ -d /nix/var/nix/profiles/system ]; then # maybe this or the other
|
||||
profile="/nix/var/nix/profiles/system"
|
||||
elif [ -d /nix/var/nix/profiles/default ]; then
|
||||
profile="/nix/var/nix/profiles/default"
|
||||
else
|
||||
echo "Cant find profile for root. Exiting"
|
||||
exit 8
|
||||
fi
|
||||
fi
|
||||
if (( $# < 1 )); then
|
||||
printf "Keeping default: %d generations OR %d days, whichever is more\n" "$keepGensDef" "$keepDaysDef"
|
||||
elif [[ $# -le 2 ]]; then
|
||||
printf "\nError: Not enough arguments.\n\n" >&2
|
||||
usage
|
||||
exit 1
|
||||
elif (( $# > 4)); then
|
||||
printf "\nError: Too many arguments.\n\n" >&2
|
||||
usage
|
||||
exit 2
|
||||
else
|
||||
if [ "$1" -lt 1 ]; then
|
||||
printf "using Gen numbers less than 1 not recommended. Setting to min=1\n"
|
||||
read -r -p "is that ok? (y/n): " answer
|
||||
printf "%s" "$answer"
|
||||
case "$answer" in
|
||||
[yY1] )
|
||||
printf "ok, continuing..\n"
|
||||
;;
|
||||
[nN0] )
|
||||
printf "ok, doing nothing, exiting..\n"
|
||||
exit 6;
|
||||
;;
|
||||
* )
|
||||
printf "%b" "Doing nothing, exiting.."
|
||||
exit 7;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ "$2" -lt 0 ]; then
|
||||
printf "using negative days number not recommended. Setting to min=0\n"
|
||||
read -r -p "is that ok? (y/n): " answer
|
||||
|
||||
case "$answer" in
|
||||
[yY1] )
|
||||
printf "ok, continuing..\n"
|
||||
;;
|
||||
[nN0] )
|
||||
printf "ok, doing nothing, exiting..\n"
|
||||
exit 6;
|
||||
;;
|
||||
* )
|
||||
printf "%b" "Doing nothing, exiting.."
|
||||
exit 7;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
keepGens=$1; keepDays=$2;
|
||||
(( keepGens < 1 )) && keepGens=1
|
||||
(( keepDays < 0 )) && keepDays=0
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
if [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
|
||||
profile=$(readlink /home/"$USER"/.nix-profile)
|
||||
elif [[ $3 == "home-manager" ]]; then
|
||||
# home-manager defaults to $XDG_STATE_HOME; otherwise, use
|
||||
# `home-manager generations` and `nix-store --query --roots
|
||||
# /nix/store/...` to figure out what reference is keeping the old
|
||||
# generations alive.
|
||||
profile="''${XDG_STATE_HOME:-$HOME/.local/state}/nix/profiles/home-manager"
|
||||
elif [[ $3 == "channels" ]]; then
|
||||
profile="/nix/var/nix/profiles/per-user/$USER/channels"
|
||||
else
|
||||
printf "\nError: Do not understand your third argument. Should be one of: (user / home-manager/ channels)\n\n"
|
||||
usage
|
||||
exit 3
|
||||
fi
|
||||
else
|
||||
if [[ $3 == "system" ]]; then
|
||||
profile="/nix/var/nix/profiles/system"
|
||||
elif [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
|
||||
profile="/nix/var/nix/profiles/default"
|
||||
else
|
||||
printf "\nError: Do not understand your third argument. Should be one of: (user / system)\n\n"
|
||||
usage
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
printf "OK! \t Keep Gens = %s \t Keep Days = %s \n\n" "$keepGens" "$keepDays"
|
||||
|
||||
|
||||
fi
|
||||
|
||||
printf "Operating on profile: %s \t \n\n" "$profile"
|
||||
|
||||
## Runs at the end, to decide whether to delete profiles that match chosen parameters.
|
||||
choose () {
|
||||
local default="$1"
|
||||
local prompt="$2"
|
||||
local answer
|
||||
|
||||
read -r -p "$prompt" answer
|
||||
[ -z "$answer" ] && answer="$default"
|
||||
|
||||
case "$answer" in
|
||||
[yY1] ) #printf "answered yes!\n"
|
||||
nix-env --delete-generations -p "$profile" "''${!gens[@]}"
|
||||
exit 0
|
||||
;;
|
||||
[nN0] ) printf "Ok doing nothing exiting..\n"
|
||||
exit 6;
|
||||
;;
|
||||
* ) printf "%b" "Unexpected answer '$answer'!" >&2
|
||||
exit 7;
|
||||
;;
|
||||
esac
|
||||
} # end of function choose
|
||||
|
||||
# printf "profile = %s \n\n" "$profile"
|
||||
## Query nix-env for generations list
|
||||
#IFS=$'\n' nixGens=( $(nix-env --list-generations -p "$profile" | sed 's:^\s*::; s:\s*$::' | tr '\t' ' ' | tr -s ' ') )
|
||||
# gave errors replaced by:
|
||||
mapfile -t nixGens < <(
|
||||
nix-env --list-generations -p "$profile" |
|
||||
sed 's:^\s*::; s:\s*$::' |
|
||||
tr '\t' ' ' |
|
||||
tr -s ' '
|
||||
)
|
||||
timeNow=$(date +%s)
|
||||
|
||||
## Get info on oldest generation
|
||||
IFS=' ' read -r -a oldestGenArr <<< "''${nixGens[0]}"
|
||||
oldestGen=''${oldestGenArr[0]}
|
||||
oldestDate=''${oldestGenArr[1]}
|
||||
printf "%-30s %s\n" "oldest generation:" "$oldestGen"
|
||||
#oldestDate=''${nixGens[0]:3:19}
|
||||
printf "%-30s %s\n" "oldest generation created:" "$oldestDate"
|
||||
oldestTime=$(date -d "$oldestDate" +%s)
|
||||
oldestElapsedSecs=$((timeNow-oldestTime))
|
||||
oldestElapsedMins=$((oldestElapsedSecs/60))
|
||||
oldestElapsedHours=$((oldestElapsedMins/60))
|
||||
oldestElapsedDays=$((oldestElapsedHours/24))
|
||||
printf "%-30s %s\n" "minutes before now:" "$oldestElapsedMins"
|
||||
printf "%-30s %s\n" "hours before now:" "$oldestElapsedHours"
|
||||
printf "%-30s %s\n\n" "days before now:" "$oldestElapsedDays"
|
||||
|
||||
## Get info on current generation
|
||||
for i in "''${nixGens[@]}"; do
|
||||
IFS=' ' read -r -a iGenArr <<< "$i"
|
||||
genNumber=''${iGenArr[0]}
|
||||
genDate=''${iGenArr[1]}
|
||||
if [[ "$i" =~ current ]]; then
|
||||
currentGen=$genNumber
|
||||
printf "%-30s %s\n" "current generation:" "$currentGen"
|
||||
currentDate=$genDate
|
||||
printf "%-30s %s\n" "current generation created:" "$currentDate"
|
||||
currentTime=$(date -d "$currentDate" +%s)
|
||||
currentElapsedSecs=$((timeNow-currentTime))
|
||||
currentElapsedMins=$((currentElapsedSecs/60))
|
||||
currentElapsedHours=$((currentElapsedMins/60))
|
||||
currentElapsedDays=$((currentElapsedHours/24))
|
||||
printf "%-30s %s\n" "minutes before now:" "$currentElapsedMins"
|
||||
printf "%-30s %s\n" "hours before now:" "$currentElapsedHours"
|
||||
printf "%-30s %s\n\n" "days before now:" "$currentElapsedDays"
|
||||
fi
|
||||
done
|
||||
|
||||
## Compare oldest and current generations
|
||||
timeBetweenOldestAndCurrent=$((currentTime-oldestTime))
|
||||
elapsedDays=$((timeBetweenOldestAndCurrent/60/60/24))
|
||||
generationsDiff=$((currentGen-oldestGen))
|
||||
|
||||
## Figure out what we should do, based on generations and options
|
||||
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"
|
||||
exit 4;
|
||||
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"
|
||||
exit 5;
|
||||
else
|
||||
printf "\tSomething to do...\n"
|
||||
declare -a gens
|
||||
for i in "''${nixGens[@]}"; do
|
||||
IFS=' ' read -r -a iGenArr <<< "$i"
|
||||
genNumber=''${iGenArr[0]}
|
||||
genDiff=$((currentGen-genNumber))
|
||||
genDate=''${iGenArr[1]}
|
||||
genTime=$(date -d "$genDate" +%s)
|
||||
elapsedSecs=$((timeNow-genTime))
|
||||
genDaysOld=$((elapsedSecs/60/60/24))
|
||||
if [[ genDaysOld -gt keepDays ]] && [[ genDiff -ge keepGens ]]; then
|
||||
gens["$genNumber"]="$genDate, $genDaysOld day(s) old"
|
||||
fi
|
||||
done
|
||||
printf "\nFound the following generation(s) to delete:\n"
|
||||
for K in "''${!gens[@]}"; do
|
||||
printf "generation %d \t ''${gens[$K]}\n" "$K"
|
||||
done
|
||||
printf "\n"
|
||||
choose "y" "Do you want to delete these? [Y/n]: "
|
||||
fi
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.office = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
libreoffice
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
_: {
|
||||
flake.nixosModules.ollama = {pkgs-unstable, ...}: {
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
{ self, ... }: {
|
||||
flake.nixosModules.otherUtils = # try to keep packages here at a minium. Preferably use a dedicated file
|
||||
{
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
gnome-calculator
|
||||
snapshot
|
||||
gnome-characters
|
||||
#tree # shows dir in tree # we use eza now
|
||||
brightnessctl # control brightness
|
||||
powertop
|
||||
fzf
|
||||
bottom # Cross-platform graphical process/system monitor with a customizable interface
|
||||
tomato-c # pomodoro timer
|
||||
#hyprshot
|
||||
mailcap
|
||||
fuzzel
|
||||
usbutils # used for lsusb
|
||||
self.packages.${pkgs.system}.custom-tomato
|
||||
self.packages.${pkgs.system}.custom-syllabes
|
||||
pkgs-unstable.bitwarden-desktop
|
||||
fluffychat # matrix client
|
||||
];
|
||||
};
|
||||
{self, ...}: {
|
||||
flake.nixosModules.otherUtils =
|
||||
# try to keep packages here at a minium. Preferably use a dedicated file
|
||||
{
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
gnome-calculator
|
||||
snapshot
|
||||
gnome-characters
|
||||
#tree # shows dir in tree # we use eza now
|
||||
brightnessctl # control brightness
|
||||
powertop
|
||||
fzf
|
||||
bottom # Cross-platform graphical process/system monitor with a customizable interface
|
||||
tomato-c # pomodoro timer
|
||||
#hyprshot
|
||||
mailcap
|
||||
fuzzel
|
||||
usbutils # used for lsusb
|
||||
self.packages.${pkgs.system}.custom-tomato
|
||||
self.packages.${pkgs.system}.custom-syllabes
|
||||
pkgs-unstable.bitwarden-desktop
|
||||
fluffychat # matrix client
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user