3 Commits

Author SHA1 Message Date
Hadi d71c9d8169 Nix fmt
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
2026-05-04 20:40:09 +02:00
Hadi e805c868a7 Add usbguard service
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
2026-05-04 19:51:01 +02:00
Hadi 0fd0a73e92 Move monitor to host's home.nix file
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
2026-05-04 19:50:35 +02:00
64 changed files with 721 additions and 353 deletions
+13 -3
View File
@@ -75,11 +75,20 @@
}; };
}; };
outputs = inputs @ {nixpkgs, nixpkgs-stable, ...}: let outputs = inputs @ {
nixpkgs,
nixpkgs-stable,
...
}: let
system = "x86_64-linux"; system = "x86_64-linux";
args = {
inherit inputs nixpkgs system;
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
args = {
inherit
inputs
nixpkgs
system
pkgs
;
pkgs-stable = nixpkgs-stable.legacyPackages.${system}; pkgs-stable = nixpkgs-stable.legacyPackages.${system};
}; };
merge = nixpkgs.lib.foldl nixpkgs.lib.recursiveUpdate {}; merge = nixpkgs.lib.foldl nixpkgs.lib.recursiveUpdate {};
@@ -89,6 +98,7 @@
(import ./home/programs/group/flake.nix args) (import ./home/programs/group/flake.nix args)
(import ./home/programs/nixy/flake.nix args) (import ./home/programs/nixy/flake.nix args)
{ {
formatter.${system} = pkgs.alejandra;
nixosConfigurations = { nixosConfigurations = {
h-laptop = import ./hosts/laptop/flake.nix args; h-laptop = import ./hosts/laptop/flake.nix args;
h-work = import ./hosts/work/flake.nix args; h-work = import ./hosts/work/flake.nix args;
+12 -3
View File
@@ -63,8 +63,14 @@
exec = "brave --incognito"; exec = "brave --incognito";
icon = "brave-browser"; icon = "brave-browser";
terminal = false; terminal = false;
categories = ["Network" "WebBrowser"]; categories = [
mimeType = ["text/html" "text/xml"]; "Network"
"WebBrowser"
];
mimeType = [
"text/html"
"text/xml"
];
}; };
brave-tor = { brave-tor = {
name = "Brave (Private window w/Tor)"; name = "Brave (Private window w/Tor)";
@@ -72,7 +78,10 @@
exec = "brave --tor"; exec = "brave --tor";
icon = "brave-browser"; icon = "brave-browser";
terminal = false; terminal = false;
categories = ["Network" "WebBrowser"]; categories = [
"Network"
"WebBrowser"
];
}; };
}; };
} }
+2 -4
View File
@@ -44,10 +44,8 @@ in {
st = "status"; st = "status";
br = "branch"; br = "branch";
df = "!git hist | peco | awk '{print $2}' | xargs -I {} git diff {}^ {}"; df = "!git hist | peco | awk '{print $2}' | xargs -I {} git diff {}^ {}";
hist = '' hist = ''log --pretty=format:"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)" --graph --date=relative --decorate --all'';
log --pretty=format:"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)" --graph --date=relative --decorate --all''; llog = ''log --graph --name-status --pretty=format:"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset" --date=relative'';
llog = ''
log --graph --name-status --pretty=format:"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset" --date=relative'';
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; hx `f`"; edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; hx `f`";
}; };
}; };
+4 -1
View File
@@ -21,7 +21,10 @@ in {
}; };
gui = { gui = {
theme = { theme = {
activeBorderColor = [accent "bold"]; activeBorderColor = [
accent
"bold"
];
inactiveBorderColor = [muted]; inactiveBorderColor = [muted];
}; };
showListFooter = false; showListFooter = false;
+2 -2
View File
@@ -10,12 +10,12 @@
go go
bun bun
nodejs nodejs
air
duckdb
claude-code claude-code
inputs.bun2nix.packages.${stdenv.hostPlatform.system}.default inputs.bun2nix.packages.${stdenv.hostPlatform.system}.default
]) ])
++ (with pkgs-stable; [ ++ (with pkgs-stable; [
air
duckdb
docker docker
python3 python3
jq jq
+3 -1
View File
@@ -8,5 +8,7 @@
configDirectory = "$HOME/.config/nixos"; configDirectory = "$HOME/.config/nixos";
}; };
homeManagerModules.nixy = {imports = [./default.nix];}; homeManagerModules.nixy = {
imports = [./default.nix];
};
} }
+5 -1
View File
@@ -1,4 +1,8 @@
{inputs, pkgs, ...}: { {
inputs,
pkgs,
...
}: {
imports = [inputs.nvf.homeManagerModules.default]; imports = [inputs.nvf.homeManagerModules.default];
# Packages needed by snacks image preview # Packages needed by snacks image preview
home.packages = with pkgs; [ home.packages = with pkgs; [
+25 -5
View File
@@ -62,19 +62,31 @@
} }
{ {
key = "<MiddleMouse>"; key = "<MiddleMouse>";
mode = ["n" "i" "v"]; mode = [
"n"
"i"
"v"
];
action = "<nop>"; action = "<nop>";
silent = true; silent = true;
} }
{ {
key = "<2-MiddleMouse>"; key = "<2-MiddleMouse>";
mode = ["n" "i" "v"]; mode = [
"n"
"i"
"v"
];
action = "<nop>"; action = "<nop>";
silent = true; silent = true;
} }
{ {
key = "<3-MiddleMouse>"; key = "<3-MiddleMouse>";
mode = ["n" "i" "v"]; mode = [
"n"
"i"
"v"
];
action = "<nop>"; action = "<nop>";
silent = true; silent = true;
} }
@@ -218,7 +230,11 @@
# Save # Save
{ {
key = "<C-s>"; key = "<C-s>";
mode = ["n" "i" "v"]; mode = [
"n"
"i"
"v"
];
silent = true; silent = true;
action = "<cmd>w<cr>"; action = "<cmd>w<cr>";
desc = "Save file"; desc = "Save file";
@@ -227,7 +243,11 @@
# Deactivate "esc" # Deactivate "esc"
{ {
key = "<Esc>"; key = "<Esc>";
mode = ["n" "i" "v"]; mode = [
"n"
"i"
"v"
];
silent = true; silent = true;
action = "<Nop>"; action = "<Nop>";
desc = "Disable Escape"; desc = "Disable Escape";
+1 -2
View File
@@ -66,8 +66,7 @@
key = "<leader>fc"; key = "<leader>fc";
mode = "n"; mode = "n";
silent = true; silent = true;
action = '' action = ''<cmd>lua Snacks.picker.files({ cwd = vim.fn.stdpath("config") })<cr>'';
<cmd>lua Snacks.picker.files({ cwd = vim.fn.stdpath("config") })<cr>'';
desc = "Find Config File"; desc = "Find Config File";
} }
{ {
@@ -14,13 +14,9 @@
c = config.lib.stylix.colors; c = config.lib.stylix.colors;
stripProtocol = url: stripProtocol = url: lib.removePrefix "https://" (lib.removePrefix "http://" url);
lib.removePrefix "https://" (lib.removePrefix "http://" url);
stripDomain = url: stripDomain = url: builtins.head (lib.splitString "/" (stripProtocol url));
builtins.head (
lib.splitString "/" (stripProtocol url)
);
mkCard = item: let mkCard = item: let
domain = stripDomain item.url; domain = stripDomain item.url;
@@ -69,13 +65,15 @@
items = result.pending; items = result.pending;
}; };
in in
lib.concatMapStrings (chunk: lib.concatMapStrings (
chunk:
if chunk.isCards if chunk.isCards
then '' then ''
<div class="cards"> <div class="cards">
${lib.concatMapStrings mkCard chunk.items} ${lib.concatMapStrings mkCard chunk.items}
</div>'' </div>''
else mkFolder chunk.folder) else mkFolder chunk.folder
)
chunks; chunks;
mkFolder = folder: let mkFolder = folder: let
@@ -145,9 +143,7 @@
) )
items; items;
publicBookmarks = publicBookmarks = pkgs.writeText "qutebrowser-public-bookmarks" (collectBookmarks "" bookmarkList);
pkgs.writeText "qutebrowser-public-bookmarks"
(collectBookmarks "" bookmarkList);
in { in {
config = { config = {
xdg.dataFile."qutebrowser/bookmarks.html".text = '' xdg.dataFile."qutebrowser/bookmarks.html".text = ''
+4 -1
View File
@@ -27,7 +27,10 @@
genericName = "Web Browser"; genericName = "Web Browser";
exec = "qutebrowser --temp-basedir %U"; exec = "qutebrowser --temp-basedir %U";
icon = "qutebrowser"; icon = "qutebrowser";
categories = ["Network" "WebBrowser"]; categories = [
"Network"
"WebBrowser"
];
}; };
programs.qutebrowser = { programs.qutebrowser = {
+11 -2
View File
@@ -7,7 +7,11 @@
}; };
new_instance_open_target = "window"; new_instance_open_target = "window";
"tabs.last_close" = "close"; "tabs.last_close" = "close";
"statusbar.widgets" = ["keypress" "url" "progress"]; "statusbar.widgets" = [
"keypress"
"url"
"progress"
];
# Adblock # Adblock
"content.blocking.enabled" = true; "content.blocking.enabled" = true;
@@ -26,7 +30,12 @@
"downloads.location.prompt" = false; "downloads.location.prompt" = false;
# Editor (Ctrl+e in text fields) # Editor (Ctrl+e in text fields)
"editor.command" = ["ghostty" "-e" "nvim" "{}"]; "editor.command" = [
"ghostty"
"-e"
"nvim"
"{}"
];
# Tabs # Tabs
# "tabs.show" = "switching"; # "tabs.show" = "switching";
+4 -2
View File
@@ -29,8 +29,10 @@
"qutebrowser/greasemonkey/return-youtube-dislike.user.js".source = inputs.qs-return-youtube-dislike; "qutebrowser/greasemonkey/return-youtube-dislike.user.js".source = inputs.qs-return-youtube-dislike;
"qutebrowser/greasemonkey/sponsorblock-lite.user.js".source = inputs.qs-sponsorblock-lite; "qutebrowser/greasemonkey/sponsorblock-lite.user.js".source = inputs.qs-sponsorblock-lite;
"qutebrowser/greasemonkey/dont-track-me-google.user.js".source = inputs.qs-dont-track-me-google; "qutebrowser/greasemonkey/dont-track-me-google.user.js".source = inputs.qs-dont-track-me-google;
"qutebrowser/greasemonkey/i-dont-care-about-cookies.user.js".source = inputs.qs-i-dont-care-about-cookies; "qutebrowser/greasemonkey/i-dont-care-about-cookies.user.js".source =
"qutebrowser/greasemonkey/tracking-token-stripper.user.js".source = inputs.qs-tracking-token-stripper; inputs.qs-i-dont-care-about-cookies;
"qutebrowser/greasemonkey/tracking-token-stripper.user.js".source =
inputs.qs-tracking-token-stripper;
"qutebrowser/greasemonkey/bypass-paywalls-clean.user.js".source = inputs.qs-bypass-paywalls-clean; "qutebrowser/greasemonkey/bypass-paywalls-clean.user.js".source = inputs.qs-bypass-paywalls-clean;
"qutebrowser/greasemonkey/anti-adblock-fuckoff.user.js".source = inputs.qs-anti-adblock-fuckoff; "qutebrowser/greasemonkey/anti-adblock-fuckoff.user.js".source = inputs.qs-anti-adblock-fuckoff;
}; };
+7 -1
View File
@@ -1,4 +1,10 @@
# Import all shell configurations # Import all shell configurations
{ {
imports = [./fzf.nix ./zsh.nix ./starship.nix ./zoxide.nix ./eza.nix]; imports = [
./fzf.nix
./zsh.nix
./starship.nix
./zoxide.nix
./eza.nix
];
} }
+3 -1
View File
@@ -20,7 +20,9 @@ in {
"$git_status" "$git_status"
"$character" "$character"
]; ];
directory = {style = accent;}; directory = {
style = accent;
};
character = { character = {
success_symbol = "[](${accent})"; success_symbol = "[](${accent})";
+15 -5
View File
@@ -7,7 +7,12 @@
}: let }: let
fetch = config.theme.fetch; # neofetch, nerdfetch, pfetch fetch = config.theme.fetch; # neofetch, nerdfetch, pfetch
in { in {
home.packages = with pkgs; [bat ripgrep tldr witr]; home.packages = with pkgs; [
bat
ripgrep
tldr
witr
];
# Add go binaries to the PATH # Add go binaries to the PATH
home.sessionPath = ["$HOME/go/bin"]; home.sessionPath = ["$HOME/go/bin"];
@@ -22,7 +27,14 @@ in {
autosuggestion.enable = true; autosuggestion.enable = true;
syntaxHighlighting = { syntaxHighlighting = {
enable = true; enable = true;
highlighters = ["main" "brackets" "pattern" "regexp" "root" "line"]; highlighters = [
"main"
"brackets"
"pattern"
"regexp"
"root"
"line"
];
}; };
historySubstringSearch.enable = true; historySubstringSearch.enable = true;
@@ -33,9 +45,7 @@ in {
}; };
profileExtra = lib.optionalString (config.home.sessionPath != []) '' profileExtra = lib.optionalString (config.home.sessionPath != []) ''
export PATH="$PATH''${PATH:+:}${ export PATH="$PATH''${PATH:+:}${lib.concatStringsSep ":" config.home.sessionPath}"
lib.concatStringsSep ":" config.home.sessionPath
}"
''; '';
shellAliases = { shellAliases = {
+64 -15
View File
@@ -1,10 +1,22 @@
{ {
programs.caelestia.settings = { programs.caelestia.settings = {
session.commands = { session.commands = {
shutdown = ["systemctl" "poweroff"]; shutdown = [
logout = ["loginctl" "lock-session"]; "systemctl"
hibernate = ["systemctl" "hibernate"]; "poweroff"
reboot = ["systemctl" "reboot"]; ];
logout = [
"loginctl"
"lock-session"
];
hibernate = [
"systemctl"
"hibernate"
];
reboot = [
"systemctl"
"reboot"
];
}; };
launcher = { launcher = {
actionPrefix = "/"; actionPrefix = "/";
@@ -13,7 +25,10 @@
name = "Calculator"; name = "Calculator";
icon = "calculate"; icon = "calculate";
description = "Do simple math equations (powered by Qalc)"; description = "Do simple math equations (powered by Qalc)";
command = ["autocomplete" "calc"]; command = [
"autocomplete"
"calc"
];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
@@ -21,7 +36,10 @@
name = "Shutdown"; name = "Shutdown";
icon = "power_settings_new"; icon = "power_settings_new";
description = "Shutdown the system"; description = "Shutdown the system";
command = ["systemctl" "poweroff"]; command = [
"systemctl"
"poweroff"
];
enabled = true; enabled = true;
dangerous = true; dangerous = true;
} }
@@ -29,7 +47,10 @@
name = "Reboot"; name = "Reboot";
icon = "cached"; icon = "cached";
description = "Reboot the system"; description = "Reboot the system";
command = ["systemctl" "reboot"]; command = [
"systemctl"
"reboot"
];
enabled = true; enabled = true;
dangerous = true; dangerous = true;
} }
@@ -37,7 +58,11 @@
name = "Logout"; name = "Logout";
icon = "exit_to_app"; icon = "exit_to_app";
description = "Log out of the current session"; description = "Log out of the current session";
command = ["loginctl" "terminate-user" ""]; command = [
"loginctl"
"terminate-user"
""
];
enabled = true; enabled = true;
dangerous = true; dangerous = true;
} }
@@ -45,7 +70,10 @@
name = "Lock"; name = "Lock";
icon = "lock"; icon = "lock";
description = "Lock the current session"; description = "Lock the current session";
command = ["loginctl" "lock-session"]; command = [
"loginctl"
"lock-session"
];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
@@ -53,7 +81,10 @@
name = "Sleep"; name = "Sleep";
icon = "bedtime"; icon = "bedtime";
description = "Suspend then hibernate"; description = "Suspend then hibernate";
command = ["systemctl" "suspend-then-hibernate"]; command = [
"systemctl"
"suspend-then-hibernate"
];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
@@ -61,7 +92,12 @@
name = "Restart caelestia"; name = "Restart caelestia";
icon = "cached"; icon = "cached";
description = "Restart caelestia"; description = "Restart caelestia";
command = ["hyprctl" "dispatch" "exec" "caelestia-shell kill | sleep 1 | caelestia-shell"]; command = [
"hyprctl"
"dispatch"
"exec"
"caelestia-shell kill | sleep 1 | caelestia-shell"
];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
@@ -69,7 +105,11 @@
name = "Emoji Picker"; name = "Emoji Picker";
icon = "mood"; icon = "mood";
description = "Toggle the emoji picker"; description = "Toggle the emoji picker";
command = ["caelestia" "emoji" "-p"]; command = [
"caelestia"
"emoji"
"-p"
];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
@@ -77,7 +117,10 @@
name = "Clipboard History"; name = "Clipboard History";
icon = "content_paste"; icon = "content_paste";
description = "Toggle the clipboard history"; description = "Toggle the clipboard history";
command = ["caelestia" "clipboard"]; command = [
"caelestia"
"clipboard"
];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
@@ -85,7 +128,10 @@
name = "Delete from Clipboard History"; name = "Delete from Clipboard History";
icon = "content_paste_off"; icon = "content_paste_off";
description = "Delete a line from the clipboard history"; description = "Delete a line from the clipboard history";
command = ["caelestia" "clipboard"]; command = [
"caelestia"
"clipboard"
];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
@@ -101,7 +147,10 @@
name = "Hyprpicker"; name = "Hyprpicker";
icon = "colorize"; icon = "colorize";
description = "Pick an hex color"; description = "Pick an hex color";
command = ["hyprpicker" "-a"]; command = [
"hyprpicker"
"-a"
];
enabled = true; enabled = true;
dangerous = false; dangerous = false;
} }
+3 -1
View File
@@ -122,7 +122,9 @@
colorsHash = builtins.hashString "sha256" (builtins.toJSON colors); colorsHash = builtins.hashString "sha256" (builtins.toJSON colors);
customCli = inputs.caelestia-cli.packages.${pkgs.stdenv.hostPlatform.system}.default.overrideAttrs (oldAttrs: { customCli =
inputs.caelestia-cli.packages.${pkgs.stdenv.hostPlatform.system}.default.overrideAttrs
(oldAttrs: {
name = "${oldAttrs.name or "caelestia-cli"}-themed-${colorsHash}"; name = "${oldAttrs.name or "caelestia-cli"}-themed-${colorsHash}";
postUnpack = '' postUnpack = ''
mkdir -p $sourceRoot/src/caelestia/data/schemes/custom/main mkdir -p $sourceRoot/src/caelestia/data/schemes/custom/main
+19 -11
View File
@@ -7,9 +7,8 @@
colors = config.lib.stylix.colors; colors = config.lib.stylix.colors;
mkMenu = menu: let mkMenu = menu: let
configFile = configFile = pkgs.writeText "config.yaml" (
pkgs.writeText "config.yaml" lib.generators.toYAML {} {
(lib.generators.toYAML {} {
anchor = "bottom-right"; anchor = "bottom-right";
border = "#${colors.base0D}80"; border = "#${colors.base0D}80";
background = "#${colors.base01}EE"; background = "#${colors.base01}EE";
@@ -19,7 +18,8 @@
rows_per_column = 5; rows_per_column = 5;
inherit menu; inherit menu;
}); }
);
in in
pkgs.writeShellScriptBin "menu" '' pkgs.writeShellScriptBin "menu" ''
exec ${lib.getExe pkgs.wlr-which-key} ${configFile} exec ${lib.getExe pkgs.wlr-which-key} ${configFile}
@@ -32,7 +32,8 @@ in {
bind = bind =
[ [
# Applications # Applications
("$shiftMod, A, exec, " (
"$shiftMod, A, exec, "
+ lib.getExe (mkMenu [ + lib.getExe (mkMenu [
{ {
key = "a"; key = "a";
@@ -84,14 +85,16 @@ in {
desc = "Qutebrowser (Temp session)"; desc = "Qutebrowser (Temp session)";
cmd = "${pkgs.qutebrowser}/bin/qutebrowser --temp-basedir"; cmd = "${pkgs.qutebrowser}/bin/qutebrowser --temp-basedir";
} }
])) ])
)
# Web links # Web links
"$mod,B, exec, uwsm app -- ${pkgs.qutebrowser}/bin/qutebrowser" # Browser (Qutebrowser) "$mod,B, exec, uwsm app -- ${pkgs.qutebrowser}/bin/qutebrowser" # Browser (Qutebrowser)
# Power # Power
"$mod, X, global, caelestia:session" # Powermenu "$mod, X, global, caelestia:session" # Powermenu
("$shiftMod, X, exec, " (
"$shiftMod, X, exec, "
+ lib.getExe (mkMenu [ + lib.getExe (mkMenu [
{ {
key = "l"; key = "l";
@@ -123,7 +126,8 @@ in {
desc = "Restart caelestia"; desc = "Restart caelestia";
cmd = "hyprctl dispatch exec 'caelestia-shell kill | sleep 1 | caelestia-shell'"; cmd = "hyprctl dispatch exec 'caelestia-shell kill | sleep 1 | caelestia-shell'";
} }
])) ])
)
# Quick launch # Quick launch
"$mod,RETURN, exec, uwsm app -- ${pkgs.ghostty}/bin/ghostty" # Ghostty (terminal) "$mod,RETURN, exec, uwsm app -- ${pkgs.ghostty}/bin/ghostty" # Ghostty (terminal)
@@ -154,13 +158,17 @@ in {
", Print, global, caelestia:screenshotFreeze" # Capture region (freeze) ", Print, global, caelestia:screenshotFreeze" # Capture region (freeze)
"$shiftMod+Alt, S, global, caelestia:screenshot" # Capture region "$shiftMod+Alt, S, global, caelestia:screenshot" # Capture region
] ]
++ (builtins.concatLists (builtins.genList (i: let ++ (builtins.concatLists (
builtins.genList (
i: let
ws = i + 1; ws = i + 1;
in [ in [
"$mod,code:1${toString i}, workspace, ${toString ws}" "$mod,code:1${toString i}, workspace, ${toString ws}"
"$mod SHIFT,code:1${toString i}, movetoworkspace, ${toString ws}" "$mod SHIFT,code:1${toString i}, movetoworkspace, ${toString ws}"
]) ]
9)); )
9
));
bindm = [ bindm = [
"$mod,mouse:272, movewindow" # Move Window (mouse) "$mod,mouse:272, movewindow" # Move Window (mouse)
-3
View File
@@ -62,9 +62,6 @@ in {
]; ];
monitor = [ monitor = [
"eDP-2,highres,0x0,1" # My internal laptop screen
"desc:AOC U34G2G1 0x00000E06,3440x1440@99.98,auto,1" # My external monitor
"desc:Philips Consumer Electronics Company PHL 221B8L ZV02144013987,highres,0x0,1"
",prefered,auto,1" # default ",prefered,auto,1" # default
]; ];
+3 -1
View File
@@ -39,4 +39,6 @@
''; '';
command = "bash ${keyboard-backlight}/bin/keyboard-backlight &"; command = "bash ${keyboard-backlight}/bin/keyboard-backlight &";
in {wayland.windowManager.hyprland.settings.exec-once = [command];} in {
wayland.windowManager.hyprland.settings.exec-once = [command];
}
+1 -2
View File
@@ -8,8 +8,7 @@
splash = false; splash = false;
}; };
}; };
systemd.user.services.hyprpaper.Unit.After = systemd.user.services.hyprpaper.Unit.After = lib.mkForce "graphical-session.target";
lib.mkForce "graphical-session.target";
wayland.windowManager.hyprland.settings.exec-once = [ wayland.windowManager.hyprland.settings.exec-once = [
"systemctl --user enable --now hyprpaper.service" "systemctl --user enable --now hyprpaper.service"
+7 -4
View File
@@ -117,14 +117,17 @@ with lib; let
desktopName = "Neovim (Ghostty)"; desktopName = "Neovim (Ghostty)";
exec = ''ghostty --title="Neovim Editor" -e nvim %F''; exec = ''ghostty --title="Neovim Editor" -e nvim %F'';
terminal = false; terminal = false;
categories = ["Development" "TextEditor"]; categories = [
"Development"
"TextEditor"
];
mimeTypes = mimeMap.code ++ mimeMap.text; mimeTypes = mimeMap.code ++ mimeMap.text;
}; };
associations = with lists; associations = with lists;
listToAttrs (flatten (mapAttrsToList listToAttrs (
(key: map (type: attrsets.nameValuePair type defaultApps."${key}")) flatten (mapAttrsToList (key: map (type: attrsets.nameValuePair type defaultApps."${key}")) mimeMap)
mimeMap)); );
in { in {
home.packages = [nvim-ghostty]; home.packages = [nvim-ghostty];
+24
View File
@@ -12,6 +12,7 @@
../../nixos/users.nix ../../nixos/users.nix
../../nixos/utils.nix ../../nixos/utils.nix
../../nixos/hyprland.nix ../../nixos/hyprland.nix
../../nixos/usbguard.nix
../../nixos/omen.nix # CHANGEME: For my laptop only, remove this (OMEN 16) ../../nixos/omen.nix # CHANGEME: For my laptop only, remove this (OMEN 16)
@@ -20,6 +21,29 @@
./variables.nix ./variables.nix
]; ];
# USBGuard:
# Allow all USB devices until a proper policy is configured.
# Run `sudo usbguard generate-policy` with your devices plugged in,
# then set rules = "<output>" and switch implicitPolicyTarget to "block".
# services.usbguard.implicitPolicyTarget = lib.mkForce "allow";
services.usbguard.rules = ''
allow id 1532:02a1 serial "" name "Razer Ornata V3" hash "wfuIjBhhGuge8gflyA526SKqKoy8rHJZQZ+2o6usMiE=" parent-hash "MSXcPAlZqkpTyZQylOhSIB8eMfST2AzVHV9EbrBGTWc=" with-interface { 03:01:01 03:00:01 03:00:02 } with-connect-type "unknown"
allow id 1d6b:0002 serial "0000:05:00.3" name "xHCI Host Controller" hash "4a4NgfdUaJO43rkCzmWRSeHHR/uUh5+SNsXnhosm9qs=" parent-hash "ldMchY4Tt4GPUYo30eNGvai+Fs/EdnVY3vMyxJUq4Nk=" with-interface 09:00:00 with-connect-type ""
allow id 1d6b:0003 serial "0000:05:00.3" name "xHCI Host Controller" hash "d+DNGWARDtv9nEK2ZvnNOCtFernuMu5/e/oZ7kCppqQ=" parent-hash "ldMchY4Tt4GPUYo30eNGvai+Fs/EdnVY3vMyxJUq4Nk=" with-interface 09:00:00 with-connect-type ""
allow id 0bda:c85c serial "00e04c000001" name "Bluetooth Radio" hash "Q/wlToV8WQgEYHBW/UIhnSwCCusCGqAR2D5gspSCImQ=" parent-hash "4a4NgfdUaJO43rkCzmWRSeHHR/uUh5+SNsXnhosm9qs=" with-interface { e0:01:01 e0:01:01 e0:01:01 e0:01:01 e0:01:01 e0:01:01 e0:01:01 e0:01:01 } with-connect-type "hardwired"
allow id 30c9:009f serial "01.00.00" name "HP True Vision FHD Camera" hash "eYW5fqReJd29tfHXkEktKC63dGfDpmlRMo5uMGUWwME=" parent-hash "icotY3rI59mWiKsGxc59BGZZeBjfbuH0b4NUByj3cbQ=" with-interface { 0e:01:01 0e:02:01 0e:02:01 0e:02:01 0e:02:01 0e:02:01 0e:02:01 0e:02:01 0e:02:01 0e:02:01 0e:02:01 0e:02:01 0e:02:01 fe:01:01 } with-connect-type "hardwired"
allow id 03f0:036b serial "" name "HP USB-C Dock G5" hash "iPFGrgGz0sWgKQjWD/F8eNOhkeR728dTG8JJtkUSvuM=" parent-hash "Hp8B0Enf+ACRT2tyy0EqXj7eNsFDAnTRZadzuh/Iqd4=" with-interface { 09:00:01 09:00:02 } with-connect-type "hotplug"
allow id 03f0:066b serial "" name "HP USB-C Dock G5" hash "JHDjLFApQNqijjmuKdJSWH5+1oLL7S6LQ9QHTAk5fTk=" parent-hash "rJ3LKdvkCK3SUrCU3lV8qVbmPjA+r9Fe5106x2HlgK4=" with-interface 09:00:00 with-connect-type "hotplug"
allow id 03f0:056b serial "201604140001" name "USB Audio" hash "OxQ8HQenW3/4HSGEBOSYFS15rXDTOaNDnjMbICweHgw=" parent-hash "iPFGrgGz0sWgKQjWD/F8eNOhkeR728dTG8JJtkUSvuM=" with-interface { 01:01:00 01:02:00 01:02:00 01:02:00 01:02:00 03:00:00 } with-connect-type "unknown"
allow id 03f0:086b serial "" name "USB2734" hash "MSXcPAlZqkpTyZQylOhSIB8eMfST2AzVHV9EbrBGTWc=" parent-hash "iPFGrgGz0sWgKQjWD/F8eNOhkeR728dTG8JJtkUSvuM=" with-interface { 09:00:01 09:00:02 } with-connect-type "unknown"
allow id 03f0:046b serial "11AD1D0A89EA2D08310E0B00" name "HP USB-C Dock G5" hash "DEGeuj1u4lwqrzp0UksFX7mSEY9JnGLxg7yxGbglAKE=" parent-hash "iPFGrgGz0sWgKQjWD/F8eNOhkeR728dTG8JJtkUSvuM=" with-interface { 11:00:00 ff:03:00 03:00:00 } with-connect-type "unknown"
allow id 03f0:076b serial "" name "USB5734" hash "BshoqybYo0IKgoDORYPRtbhhlmQrYAxPQb2EAm1JsWA=" parent-hash "JHDjLFApQNqijjmuKdJSWH5+1oLL7S6LQ9QHTAk5fTk=" with-interface 09:00:00 with-connect-type "unknown"
allow id 0bda:8153 serial "000001000000" name "USB 10/100/1000 LAN" hash "utEnXKJ57kRUbPcGUaNWhEyoOEbLOYAFxvlsyC0PZkk=" parent-hash "JHDjLFApQNqijjmuKdJSWH5+1oLL7S6LQ9QHTAk5fTk=" with-interface { ff:ff:00 02:06:00 0a:00:00 0a:00:00 } with-connect-type "unknown"
allow id 046d:0ab7 serial "2046BAB04T68" name "Blue Microphones" hash "cC6AQ2e1Q/BeFeostpbf1mH2WpoUmt6bhau4NlA3niU=" parent-hash "MSXcPAlZqkpTyZQylOhSIB8eMfST2AzVHV9EbrBGTWc=" with-interface { 01:01:00 01:02:00 01:02:00 01:02:00 01:02:00 01:02:00 01:02:00 03:00:00 } with-connect-type "unknown"
allow id 13fd:5900 serial "50026B76861EE752 " name "External" hash "Xebp3uQRrhCKBHdGRVKXH0I5Vdawi4mSpuu0ttKgDyE=" parent-hash "BshoqybYo0IKgoDORYPRtbhhlmQrYAxPQb2EAm1JsWA=" with-interface { 08:06:50 08:06:62 } with-connect-type "unknown"
'';
home-manager.users."${config.var.username}" = import ./home.nix; home-manager.users."${config.var.username}" = import ./home.nix;
# Don't touch this # Don't touch this
+5 -1
View File
@@ -1,4 +1,8 @@
{inputs, nixpkgs, ...}: {
inputs,
nixpkgs,
...
}:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
modules = [ modules = [
{ {
+11 -2
View File
@@ -11,7 +11,13 @@
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "uas" "usbhid" "sd_mod"]; boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"uas"
"usbhid"
"sd_mod"
];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
@@ -24,7 +30,10 @@
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-uuid/5251-9B85"; device = "/dev/disk/by-uuid/5251-9B85";
fsType = "vfat"; fsType = "vfat";
options = ["fmask=0077" "dmask=0077"]; options = [
"fmask=0077"
"dmask=0077"
];
}; };
swapDevices = []; swapDevices = [];
+11 -3
View File
@@ -36,7 +36,9 @@
home = { home = {
inherit (config.var) username; inherit (config.var) username;
homeDirectory = "/home/" + config.var.username; homeDirectory = "/home/" + config.var.username;
file.".face" = {source = ./profile_picture.png;}; file.".face" = {
source = ./profile_picture.png;
};
sessionVariables = { sessionVariables = {
AQ_DRM_DEVICES = "/dev/dri/card2:/dev/dri/card1"; # CHANGEME: Related to the GPU AQ_DRM_DEVICES = "/dev/dri/card2:/dev/dri/card1"; # CHANGEME: Related to the GPU
@@ -46,10 +48,16 @@
stateVersion = "24.05"; stateVersion = "24.05";
}; };
programs.home-manager.enable = true; wayland.windowManager.hyprland.settings.monitor = [
"eDP-2,highres,0x0,1" # My internal laptop screen
"desc:AOC U34G2G1 0x00000E06,3440x1440@99.98,auto,1" # My external monitor
];
programs.nixy = { programs = {
home-manager.enable = true;
nixy = {
enable = true; enable = true;
configDirectory = config.var.configDirectory; configDirectory = config.var.configDirectory;
}; };
};
} }
+19 -6
View File
@@ -14,11 +14,21 @@ in {
age.keyFile = "${home}/.config/sops/age/keys.txt"; age.keyFile = "${home}/.config/sops/age/keys.txt";
defaultSopsFile = ./secrets.yaml; defaultSopsFile = ./secrets.yaml;
secrets = { secrets = {
ssh-config = {path = "${home}/.ssh/config";}; ssh-config = {
github-key = {path = "${home}/.ssh/github";}; path = "${home}/.ssh/config";
jack-key = {path = "${home}/.ssh/jack";}; };
signing-key = {path = "${home}/.ssh/key";}; github-key = {
signing-pub-key = {path = "${home}/.ssh/key.pub";}; path = "${home}/.ssh/github";
};
jack-key = {
path = "${home}/.ssh/jack";
};
signing-key = {
path = "${home}/.ssh/key";
};
signing-pub-key = {
path = "${home}/.ssh/key.pub";
};
}; };
}; };
@@ -42,7 +52,10 @@ in {
''; '';
systemd.user.services.mbsync.Unit.After = ["sops-nix.service"]; systemd.user.services.mbsync.Unit.After = ["sops-nix.service"];
home.packages = with pkgs; [sops age]; home.packages = with pkgs; [
sops
age
];
wayland.windowManager.hyprland.settings.exec-once = ["systemctl --user start sops-nix"]; wayland.windowManager.hyprland.settings.exec-once = ["systemctl --user start sops-nix"];
} }
+1 -4
View File
@@ -11,10 +11,7 @@
config.var = { config.var = {
hostname = "h-laptop"; hostname = "h-laptop";
username = "hadi"; username = "hadi";
configDirectory = configDirectory = "/home/" + config.var.username + "/.config/nixos"; # The path of the nixos configuration directory
"/home/"
+ config.var.username
+ "/.config/nixos"; # The path of the nixos configuration directory
keyboardLayout = "fr"; keyboardLayout = "fr";
+5 -1
View File
@@ -1,4 +1,8 @@
{inputs, nixpkgs, ...}: {
inputs,
nixpkgs,
...
}:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
modules = [ modules = [
{_module.args = {inherit inputs;};} {_module.args = {inherit inputs;};}
+17 -5
View File
@@ -9,7 +9,14 @@
... ...
}: { }: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = ["dm-snapshot"]; boot.initrd.kernelModules = ["dm-snapshot"];
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
@@ -20,12 +27,18 @@
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-uuid/DD15-1125"; device = "/dev/disk/by-uuid/DD15-1125";
fsType = "vfat"; fsType = "vfat";
options = ["fmask=0077" "dmask=0077"]; options = [
"fmask=0077"
"dmask=0077"
];
}; };
fileSystems."/mnt/data" = { fileSystems."/mnt/data" = {
device = "/dev/disk/by-uuid/0b055155-0134-448c-b1ca-e81030ff064e"; device = "/dev/disk/by-uuid/0b055155-0134-448c-b1ca-e81030ff064e";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=/" "compress=zstd"]; # adapte selon si t'as des subvolumes options = [
"subvol=/"
"compress=zstd"
]; # adapte selon si t'as des subvolumes
}; };
swapDevices = []; swapDevices = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
@@ -35,6 +48,5 @@
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
+4 -1
View File
@@ -26,5 +26,8 @@
}; };
}; };
environment.systemPackages = with pkgs; [sops age]; environment.systemPackages = with pkgs; [
sops
age
];
} }
+1 -4
View File
@@ -11,10 +11,7 @@
config.var = { config.var = {
hostname = "jack"; hostname = "jack";
username = "hadi"; username = "hadi";
configDirectory = configDirectory = "/home/" + config.var.username + "/.config/nixos"; # The path of the nixos configuration directory
"/home/"
+ config.var.username
+ "/.config/nixos"; # The path of the nixos configuration directory
keyboardLayout = "fr"; keyboardLayout = "fr";
+5 -1
View File
@@ -1,4 +1,8 @@
{inputs, nixpkgs, ...}: {
inputs,
nixpkgs,
...
}:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
modules = [ modules = [
{ {
+12 -2
View File
@@ -12,7 +12,14 @@
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod"]; boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"usbhid"
"sd_mod"
];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
@@ -25,7 +32,10 @@
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-uuid/043E-1755"; device = "/dev/disk/by-uuid/043E-1755";
fsType = "vfat"; fsType = "vfat";
options = ["fmask=0077" "dmask=0077"]; options = [
"fmask=0077"
"dmask=0077"
];
}; };
swapDevices = []; swapDevices = [];
+7 -2
View File
@@ -39,10 +39,15 @@
stateVersion = "24.05"; stateVersion = "24.05";
}; };
programs.home-manager.enable = true; wayland.windowManager.hyprland.settings.monitor = [
"desc:Philips Consumer Electronics Company PHL 221B8L ZV02144013987,highres,0x0,1"
];
programs.nixy = { programs = {
home-manager.enable = true;
nixy = {
enable = true; enable = true;
configDirectory = config.var.configDirectory; configDirectory = config.var.configDirectory;
}; };
};
} }
+16 -5
View File
@@ -14,10 +14,18 @@ in {
age.keyFile = "${home}/.config/sops/age/keys.txt"; age.keyFile = "${home}/.config/sops/age/keys.txt";
defaultSopsFile = ./secrets.yaml; defaultSopsFile = ./secrets.yaml;
secrets = { secrets = {
ssh-config = {path = "${home}/.ssh/config";}; ssh-config = {
netrc = {path = "${home}/.netrc";}; path = "${home}/.ssh/config";
github-key = {path = "${home}/.ssh/github";}; };
gitlab-key = {path = "${home}/.ssh/gitlab";}; netrc = {
path = "${home}/.netrc";
};
github-key = {
path = "${home}/.ssh/github";
};
gitlab-key = {
path = "${home}/.ssh/gitlab";
};
}; };
}; };
@@ -41,7 +49,10 @@ in {
''; '';
systemd.user.services.mbsync.Unit.After = ["sops-nix.service"]; systemd.user.services.mbsync.Unit.After = ["sops-nix.service"];
home.packages = with pkgs; [sops age]; home.packages = with pkgs; [
sops
age
];
wayland.windowManager.hyprland.settings.exec-once = ["systemctl --user start sops-nix"]; wayland.windowManager.hyprland.settings.exec-once = ["systemctl --user start sops-nix"];
} }
+1 -4
View File
@@ -11,10 +11,7 @@
config.var = { config.var = {
hostname = "h-work"; hostname = "h-work";
username = "hadrien"; username = "hadrien";
configDirectory = configDirectory = "/home/" + config.var.username + "/.config/nixos"; # The path of the nixos configuration directory
"/home/"
+ config.var.username
+ "/.config/nixos"; # The path of the nixos configuration directory
keyboardLayout = "fr"; keyboardLayout = "fr";
+3 -1
View File
@@ -13,7 +13,9 @@
enable = true; enable = true;
extraConfig = { extraConfig = {
"10-disable-camera" = { "10-disable-camera" = {
"wireplumber.profiles" = {main."monitor.libcamera" = "disabled";}; "wireplumber.profiles" = {
main."monitor.libcamera" = "disabled";
};
}; };
}; };
}; };
+5 -1
View File
@@ -1,5 +1,9 @@
# Home-manager configuration for NixOS # Home-manager configuration for NixOS
{inputs, pkgs, ...}: { {
inputs,
pkgs,
...
}: {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
+4 -1
View File
@@ -35,7 +35,10 @@ in {
settings = { settings = {
download-buffer-size = 262144000; # 250 MB (250 * 1024 * 1024) download-buffer-size = 262144000; # 250 MB (250 * 1024 * 1024)
auto-optimise-store = true; auto-optimise-store = true;
experimental-features = ["nix-command" "flakes"]; experimental-features = [
"nix-command"
"flakes"
];
substituters = [ substituters = [
# high priority since it's almost always used # high priority since it's almost always used
"https://cache.nixos.org?priority=10" "https://cache.nixos.org?priority=10"
+1 -2
View File
@@ -55,8 +55,7 @@ in {
# Optimized configuration for switchable graphics laptops # Optimized configuration for switchable graphics laptops
offload = { offload = {
enable = true; # Mode optimized for power saving enable = true; # Mode optimized for power saving
enableOffloadCmd = enableOffloadCmd = true; # Allows running applications with dedicated GPU
true; # Allows running applications with dedicated GPU
}; };
# sync.enable disabled as offload is generally better for laptops # sync.enable disabled as offload is generally better for laptops
sync.enable = false; sync.enable = false;
+4 -4
View File
@@ -5,9 +5,8 @@
pkgs, pkgs,
... ...
}: let }: let
hp-omen-linux-module = hp-omen-linux-module = pkgs.callPackage (
pkgs.callPackage {
({
kernel ? config.boot.kernelPackages.kernel, kernel ? config.boot.kernelPackages.kernel,
stdenv, stdenv,
fetchFromGitHub, fetchFromGitHub,
@@ -33,7 +32,8 @@
install hp-wmi.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/platform/x86/hp/ install hp-wmi.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/platform/x86/hp/
runHook postInstall runHook postInstall
''; '';
})) {kernel = config.boot.kernelPackages.kernel;}; })
) {kernel = config.boot.kernelPackages.kernel;};
in { in {
boot.extraModulePackages = [hp-omen-linux-module]; boot.extraModulePackages = [hp-omen-linux-module];
boot.kernelModules = ["hp-wmi"]; boot.kernelModules = ["hp-wmi"];
+4 -3
View File
@@ -11,8 +11,7 @@
}; };
}; };
tmp.cleanOnBoot = true; tmp.cleanOnBoot = true;
kernelPackages = kernelPackages = pkgs.linuxPackages_latest; # _zen, _hardened, _rt, _rt_latest, etc.
pkgs.linuxPackages_latest; # _zen, _hardened, _rt, _rt_latest, etc.
# Silent boot # Silent boot
kernelParams = [ kernelParams = [
@@ -38,5 +37,7 @@
}; };
# To avoid systemd services hanging on shutdown # To avoid systemd services hanging on shutdown
systemd.settings.Manager = { DefaultTimeoutStopSec = "10s"; }; systemd.settings.Manager = {
DefaultTimeoutStopSec = "10s";
};
} }
+10
View File
@@ -0,0 +1,10 @@
{config, ...}: {
services.usbguard = {
enable = true;
implicitPolicyTarget = "block";
IPCAllowedUsers = [
"root"
config.var.username
];
};
}
+4 -1
View File
@@ -13,7 +13,10 @@ in {
users.${username} = { users.${username} = {
isNormalUser = true; isNormalUser = true;
description = "${username} account"; description = "${username} account";
extraGroups = ["networkmanager" "wheel"]; extraGroups = [
"networkmanager"
"wheel"
];
}; };
}; };
} }
+16 -4
View File
@@ -21,11 +21,17 @@ in {
enable = autoUpgrade; enable = autoUpgrade;
dates = "04:00"; dates = "04:00";
flake = "${configDir}"; flake = "${configDir}";
flags = ["--update-input" "nixpkgs" "--commit-lock-file"]; flags = [
"--update-input"
"nixpkgs"
"--commit-lock-file"
];
allowReboot = false; allowReboot = false;
}; };
time = {timeZone = timeZone;}; time = {
timeZone = timeZone;
};
i18n.defaultLocale = defaultLocale; i18n.defaultLocale = defaultLocale;
i18n.extraLocaleSettings = { i18n.extraLocaleSettings = {
LC_ADDRESS = extraLocale; LC_ADDRESS = extraLocale;
@@ -65,7 +71,10 @@ in {
dbus = { dbus = {
enable = true; enable = true;
implementation = "broker"; implementation = "broker";
packages = with pkgs; [gcr gnome-settings-daemon]; packages = with pkgs; [
gcr
gnome-settings-daemon
];
}; };
gvfs.enable = true; gvfs.enable = true;
upower.enable = true; upower.enable = true;
@@ -115,7 +124,10 @@ in {
xdgOpenUsePortal = true; xdgOpenUsePortal = true;
config = { config = {
common.default = ["gtk"]; common.default = ["gtk"];
hyprland.default = ["gtk" "hyprland"]; hyprland.default = [
"gtk"
"hyprland"
];
}; };
extraPortals = [pkgs.xdg-desktop-portal-gtk]; extraPortals = [pkgs.xdg-desktop-portal-gtk];
+4 -1
View File
@@ -49,7 +49,10 @@ in {
}; };
}; };
users.users.jellyfin.extraGroups = ["video" "render"]; users.users.jellyfin.extraGroups = [
"video"
"render"
];
services.cloudflared.tunnels."${config.var.tunnelId}".ingress = { services.cloudflared.tunnels."${config.var.tunnelId}".ingress = {
"media.${config.var.domain}" = "http://localhost:8096"; "media.${config.var.domain}" = "http://localhost:8096";
+13 -5
View File
@@ -1,8 +1,11 @@
{ config, inputs, lib, ... }:
let
inherit (import ./mk-container.nix { inherit lib config; }) mkContainer;
in
{ {
config,
inputs,
lib,
...
}: let
inherit (import ./mk-container.nix {inherit lib config;}) mkContainer;
in {
imports = [ imports = [
(mkContainer { (mkContainer {
name = "wallpapers"; name = "wallpapers";
@@ -13,7 +16,12 @@ in
enable = true; enable = true;
virtualHosts."wallpapers" = { virtualHosts."wallpapers" = {
root = "${inputs.awesome-wallpapers.packages.${pkgs.system}.default}/share/awesome-wallpapers"; root = "${inputs.awesome-wallpapers.packages.${pkgs.system}.default}/share/awesome-wallpapers";
listen = [{ addr = "0.0.0.0"; port = 8080; }]; listen = [
{
addr = "0.0.0.0";
port = 8080;
}
];
locations."/" = { locations."/" = {
tryFiles = "$uri $uri/ /index.html"; tryFiles = "$uri $uri/ /index.html";
}; };
+4 -1
View File
@@ -51,7 +51,10 @@ in {
}; };
}; };
}; };
networking.firewall.allowedTCPPorts = [8080 8081]; networking.firewall.allowedTCPPorts = [
8080
8081
];
system.stateVersion = "24.05"; system.stateVersion = "24.05";
}; };
}) })
+12 -5
View File
@@ -1,8 +1,10 @@
{ config, lib, ... }:
let
inherit (import ./mk-container.nix { inherit lib config; }) mkContainer;
in
{ {
config,
lib,
...
}: let
inherit (import ./mk-container.nix {inherit lib config;}) mkContainer;
in {
imports = [ imports = [
(mkContainer { (mkContainer {
name = "cyberchef"; name = "cyberchef";
@@ -13,7 +15,12 @@ in
enable = true; enable = true;
virtualHosts."cyberchef" = { virtualHosts."cyberchef" = {
root = "${pkgs.cyberchef}/share/cyberchef"; root = "${pkgs.cyberchef}/share/cyberchef";
listen = [{ addr = "0.0.0.0"; port = 8080; }]; listen = [
{
addr = "0.0.0.0";
port = 8080;
}
];
}; };
}; };
networking.firewall.allowedTCPPorts = [8080]; networking.firewall.allowedTCPPorts = [8080];
+7 -4
View File
@@ -1,9 +1,12 @@
{ config, inputs, lib, ... }: {
let config,
inputs,
lib,
...
}: let
inherit (import ./mk-container.nix {inherit lib config;}) mkContainer; inherit (import ./mk-container.nix {inherit lib config;}) mkContainer;
domain = config.var.domain; domain = config.var.domain;
in in {
{
imports = [ imports = [
(mkContainer { (mkContainer {
name = "def-creds"; name = "def-creds";
+11 -6
View File
@@ -1,5 +1,9 @@
{ config, pkgs, lib, ... }: {
let config,
pkgs,
lib,
...
}: let
inherit (import ./mk-container.nix {inherit lib config;}) mkContainer; inherit (import ./mk-container.nix {inherit lib config;}) mkContainer;
domain = config.var.domain; domain = config.var.domain;
catppuccin-gitea = pkgs.fetchzip { catppuccin-gitea = pkgs.fetchzip {
@@ -7,8 +11,7 @@ let
sha256 = "sha256-rZHLORwLUfIFcB6K9yhrzr+UwdPNQVSadsw6rg8Q7gs="; sha256 = "sha256-rZHLORwLUfIFcB6K9yhrzr+UwdPNQVSadsw6rg8Q7gs=";
stripRoot = false; stripRoot = false;
}; };
in in {
{
imports = [ imports = [
(mkContainer { (mkContainer {
name = "gitea"; name = "gitea";
@@ -26,10 +29,12 @@ in
services.postgresql = { services.postgresql = {
enable = true; enable = true;
ensureDatabases = ["gitea"]; ensureDatabases = ["gitea"];
ensureUsers = [{ ensureUsers = [
{
name = "gitea"; name = "gitea";
ensureDBOwnership = true; ensureDBOwnership = true;
}]; }
];
}; };
services.gitea = { services.gitea = {
+75 -21
View File
@@ -1,41 +1,87 @@
{ config, lib, ... }: {
let config,
lib,
...
}: let
inherit (import ../mk-container.nix {inherit lib config;}) mkContainer; inherit (import ../mk-container.nix {inherit lib config;}) mkContainer;
domain = config.var.domain; domain = config.var.domain;
hostIp = "10.233.12.1"; hostIp = "10.233.12.1";
# Convert 6-char hex color to "H S L" string for glance (integers, no % sign) # Convert 6-char hex color to "H S L" string for glance (integers, no % sign)
hexToGlanceHsl = hex: hexToGlanceHsl = hex: let
let
h = lib.toLower hex; h = lib.toLower hex;
d = c: d = c:
if c == "a" then 10 else if c == "b" then 11 else if c == "c" then 12 if c == "a"
else if c == "d" then 13 else if c == "e" then 14 else if c == "f" then 15 then 10
else if c == "b"
then 11
else if c == "c"
then 12
else if c == "d"
then 13
else if c == "e"
then 14
else if c == "f"
then 15
else lib.toInt c; else lib.toInt c;
byte = pos: d (builtins.substring pos 1 h) * 16 + d (builtins.substring (pos + 1) 1 h); byte = pos: d (builtins.substring pos 1 h) * 16 + d (builtins.substring (pos + 1) 1 h);
ri = byte 0; gi = byte 2; bi = byte 4; ri = byte 0;
gi = byte 2;
bi = byte 4;
r = ri * 1.0 / 255.0; r = ri * 1.0 / 255.0;
g = gi * 1.0 / 255.0; g = gi * 1.0 / 255.0;
b = bi * 1.0 / 255.0; b = bi * 1.0 / 255.0;
mx = if r >= g && r >= b then "r" else if g >= b then "g" else "b"; mx =
mn = if r <= g && r <= b then "r" else if g <= b then "g" else "b"; if r >= g && r >= b
cmax = if mx == "r" then r else if mx == "g" then g else b; then "r"
cmin = if mn == "r" then r else if mn == "g" then g else b; else if g >= b
then "g"
else "b";
mn =
if r <= g && r <= b
then "r"
else if g <= b
then "g"
else "b";
cmax =
if mx == "r"
then r
else if mx == "g"
then g
else b;
cmin =
if mn == "r"
then r
else if mn == "g"
then g
else b;
delta = cmax - cmin; delta = cmax - cmin;
l = (cmax + cmin) / 2.0; l = (cmax + cmin) / 2.0;
s = if delta < 0.0001 then 0.0 s =
else if l <= 0.5 then delta / (cmax + cmin) if delta < 0.0001
then 0.0
else if l <= 0.5
then delta / (cmax + cmin)
else delta / (2.0 - cmax - cmin); else delta / (2.0 - cmax - cmin);
hue = hue =
if delta < 0.0001 then 0.0 if delta < 0.0001
else if mx == "r" then let raw = 60.0 * (g - b) / delta; in if raw < 0.0 then raw + 360.0 else raw then 0.0
else if mx == "g" then 60.0 * ((b - r) / delta + 2.0) else if mx == "r"
then let
raw = 60.0 * (g - b) / delta;
in
if raw < 0.0
then raw + 360.0
else raw
else if mx == "g"
then 60.0 * ((b - r) / delta + 2.0)
else 60.0 * ((r - g) / delta + 4.0); else 60.0 * ((r - g) / delta + 4.0);
in "${toString (builtins.floor (hue + 0.5))} ${toString (builtins.floor (s * 100.0 + 0.5))} ${toString (builtins.floor (l * 100.0 + 0.5))}"; in "${toString (builtins.floor (hue + 0.5))} ${toString (builtins.floor (s * 100.0 + 0.5))} ${
toString (builtins.floor (l * 100.0 + 0.5))
}";
c = config.stylix.base16Scheme; c = config.stylix.base16Scheme;
in in {
{
# 0444 so the glance user inside the container can read the bind-mounted file # 0444 so the glance user inside the container can read the bind-mounted file
sops.secrets.adguard-pwd.mode = "0444"; sops.secrets.adguard-pwd.mode = "0444";
@@ -52,7 +98,10 @@ in
nixosConfig = {lib, ...}: { nixosConfig = {lib, ...}: {
_module.args.domain = domain; _module.args.domain = domain;
_module.args.adguardUrl = "http://${hostIp}:3000"; _module.args.adguardUrl = "http://${hostIp}:3000";
imports = [ ./home.nix ./server.nix ]; imports = [
./home.nix
./server.nix
];
services.glance = { services.glance = {
enable = true; enable = true;
@@ -77,7 +126,12 @@ in
proxy_cache_path /var/cache/nginx/glance levels=1:2 keys_zone=glance:1m inactive=30m max_size=100m; proxy_cache_path /var/cache/nginx/glance levels=1:2 keys_zone=glance:1m inactive=30m max_size=100m;
''; '';
virtualHosts."glance" = { virtualHosts."glance" = {
listen = [{ addr = "0.0.0.0"; port = 8080; }]; listen = [
{
addr = "0.0.0.0";
port = 8080;
}
];
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:5678"; proxyPass = "http://127.0.0.1:5678";
extraConfig = '' extraConfig = ''
+17 -10
View File
@@ -1,15 +1,16 @@
{ config, lib, ... }:
let
inherit (import ./mk-container.nix { inherit lib config; }) mkContainer;
in
{ {
config,
lib,
...
}: let
inherit (import ./mk-container.nix {inherit lib config;}) mkContainer;
in {
imports = [ imports = [
(mkContainer { (mkContainer {
name = "mazanoke"; name = "mazanoke";
hostIp = "10.233.7.1"; hostIp = "10.233.7.1";
containerIp = "10.233.7.2"; containerIp = "10.233.7.2";
nixosConfig = { pkgs, ... }: nixosConfig = {pkgs, ...}: let
let
version = "1.1.5"; version = "1.1.5";
mazanoke-pkg = pkgs.stdenv.mkDerivation { mazanoke-pkg = pkgs.stdenv.mkDerivation {
inherit version; inherit version;
@@ -25,14 +26,20 @@ in
cp -r ./index.html ./favicon.ico ./manifest.json ./service-worker.js ./assets $out/share/mazanoke/ cp -r ./index.html ./favicon.ico ./manifest.json ./service-worker.js ./assets $out/share/mazanoke/
''; '';
}; };
in in {
{
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts."mazanoke" = { virtualHosts."mazanoke" = {
root = "${mazanoke-pkg}/share/mazanoke"; root = "${mazanoke-pkg}/share/mazanoke";
listen = [{ addr = "0.0.0.0"; port = 8080; }]; listen = [
locations."/" = { index = "index.html"; }; {
addr = "0.0.0.0";
port = 8080;
}
];
locations."/" = {
index = "index.html";
};
}; };
}; };
networking.firewall.allowedTCPPorts = [8080]; networking.firewall.allowedTCPPorts = [8080];
+6 -4
View File
@@ -1,8 +1,10 @@
{ config, lib, ... }:
let
inherit (import ./mk-container.nix { inherit lib config; }) mkContainer;
in
{ {
config,
lib,
...
}: let
inherit (import ./mk-container.nix {inherit lib config;}) mkContainer;
in {
imports = [ imports = [
(mkContainer { (mkContainer {
name = "mealie"; name = "mealie";
+17 -13
View File
@@ -1,5 +1,7 @@
{ lib, config }: {
lib,
config,
}:
# Returns a NixOS module (attrset), to be used in `imports`. # Returns a NixOS module (attrset), to be used in `imports`.
# #
# Options: # Options:
@@ -7,16 +9,13 @@
# externalInterface - WAN interface for NAT, required when internet = true # externalInterface - WAN interface for NAT, required when internet = true
# bindMounts - host paths to mount into the container (see containers.<name>.bindMounts) # bindMounts - host paths to mount into the container (see containers.<name>.bindMounts)
# config - NixOS module for the container # config - NixOS module for the container
let let
nginxHardening = { config, ... }: lib.mkIf config.services.nginx.enable { nginxHardening = {config, ...}:
lib.mkIf config.services.nginx.enable {
services.nginx.serverTokens = false; services.nginx.serverTokens = false;
}; };
in in {
mkContainer = {
{
mkContainer =
{
name, name,
hostIp, hostIp,
containerIp, containerIp,
@@ -25,8 +24,7 @@ in
bindMounts ? {}, bindMounts ? {},
nixosConfig, nixosConfig,
}: }:
assert lib.assertMsg assert lib.assertMsg (lib.stringLength "ve-${name}" <= 15)
(lib.stringLength "ve-${name}" <= 15)
"mkContainer: interface name 've-${name}' is ${toString (lib.stringLength "ve-${name}")} chars, max is 15"; "mkContainer: interface name 've-${name}' is ${toString (lib.stringLength "ve-${name}")} chars, max is 15";
{ {
containers.${name} = { containers.${name} = {
@@ -36,8 +34,14 @@ in
localAddress = containerIp; localAddress = containerIp;
inherit bindMounts; inherit bindMounts;
config = {...}: { config = {...}: {
imports = [ nixosConfig nginxHardening ]; imports = [
networking.nameservers = lib.mkIf internet [ "1.1.1.1" "1.0.0.1" ]; nixosConfig
nginxHardening
];
networking.nameservers = lib.mkIf internet [
"1.1.1.1"
"1.0.0.1"
];
}; };
}; };
} }
+8 -2
View File
@@ -17,8 +17,14 @@ in {
AllowTcpForwarding = false; AllowTcpForwarding = false;
ClientAliveInterval = 300; ClientAliveInterval = 300;
ClientAliveCountMax = 2; ClientAliveCountMax = 2;
KexAlgorithms = ["curve25519-sha256" "curve25519-sha256@libssh.org"]; KexAlgorithms = [
Ciphers = ["chacha20-poly1305@openssh.com" "aes256-gcm@openssh.com"]; "curve25519-sha256"
"curve25519-sha256@libssh.org"
];
Ciphers = [
"chacha20-poly1305@openssh.com"
"aes256-gcm@openssh.com"
];
}; };
}; };
+6 -4
View File
@@ -1,8 +1,10 @@
{ config, lib, ... }:
let
inherit (import ./mk-container.nix { inherit lib config; }) mkContainer;
in
{ {
config,
lib,
...
}: let
inherit (import ./mk-container.nix {inherit lib config;}) mkContainer;
in {
imports = [ imports = [
(mkContainer { (mkContainer {
name = "stirling-pdf"; name = "stirling-pdf";
+6 -4
View File
@@ -1,8 +1,10 @@
{ config, lib, ... }:
let
inherit (import ./mk-container.nix { inherit lib config; }) mkContainer;
in
{ {
config,
lib,
...
}: let
inherit (import ./mk-container.nix {inherit lib config;}) mkContainer;
in {
sops.secrets.umami-secret.mode = "0400"; sops.secrets.umami-secret.mode = "0400";
imports = [ imports = [
+1 -2
View File
@@ -16,8 +16,7 @@
border-size = 2; border-size = 2;
animation-speed = "medium"; # "fast" | "medium" | "slow" animation-speed = "medium"; # "fast" | "medium" | "slow"
fetch = "none"; # "nerdfetch" | "neofetch" | "pfetch" | "none" fetch = "none"; # "nerdfetch" | "neofetch" | "pfetch" | "none"
textColorOnWallpaper = textColorOnWallpaper = config.lib.stylix.colors.base00; # Color of the text displayed on the wallpaper (Lockscreen, display manager, ...)
config.lib.stylix.colors.base00; # Color of the text displayed on the wallpaper (Lockscreen, display manager, ...)
}; };
description = "Theme configuration options"; description = "Theme configuration options";
}; };
+1 -2
View File
@@ -16,8 +16,7 @@
border-size = 4; border-size = 4;
animation-speed = "fast"; # "fast" | "medium" | "slow" animation-speed = "fast"; # "fast" | "medium" | "slow"
fetch = "none"; # "nerdfetch" | "neofetch" | "pfetch" | "none" fetch = "none"; # "nerdfetch" | "neofetch" | "pfetch" | "none"
textColorOnWallpaper = textColorOnWallpaper = config.lib.stylix.colors.base00; # Color of the text displayed on the wallpaper (Lockscreen, display manager, ...)
config.lib.stylix.colors.base00; # Color of the text displayed on the wallpaper (Lockscreen, display manager, ...)
}; };
description = "Theme configuration options"; description = "Theme configuration options";
}; };
+1 -2
View File
@@ -16,8 +16,7 @@
border-size = 4; border-size = 4;
animation-speed = "medium"; # "fast" | "medium" | "slow" animation-speed = "medium"; # "fast" | "medium" | "slow"
fetch = "none"; # "nerdfetch" | "neofetch" | "pfetch" | "none" fetch = "none"; # "nerdfetch" | "neofetch" | "pfetch" | "none"
textColorOnWallpaper = textColorOnWallpaper = config.lib.stylix.colors.base00; # Color of the text displayed on the wallpaper (Lockscreen, display manager, ...)
config.lib.stylix.colors.base00; # Color of the text displayed on the wallpaper (Lockscreen, display manager, ...)
}; };
description = "Theme configuration options"; description = "Theme configuration options";
}; };