add flake

This commit is contained in:
Dario48 2026-04-13 15:59:41 +02:00
commit 2d7c7fb47e

582
flake.nix Normal file
View file

@ -0,0 +1,582 @@
# vim: foldmethod=marker
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
zen-browser = {
url = "github:youwen5/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-dotfiles = {
url = "git+https://dario48.site/git/Dario48/neovim-dotfiles.git?ref=main";
flake = false;
};
plasma-manager = {
url = "github:nix-community/plasma-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
};
outputs =
{
self,
nixpkgs,
home-manager,
agenix,
...
}@inputs:
{
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
agenix.nixosModules.default
# configure.nix {{{
(
{
config,
pkgs,
inputs,
lib,
...
}:
let
# Zen conf {{{
extension = shortId: guid: {
name = guid;
value = {
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "normal_installed";
};
};
prefs = {
# Check these out at about:config
"zen.theme.content-element-separation" = 0;
# ...
};
extensions = [
# To add additional extensions, find it on addons.mozilla.org, find
# the short ID in the url (like https://addons.mozilla.org/en-US/firefox/addon/!SHORT_ID!/)
# Then go to https://addons.mozilla.org/api/v5/addons/addon/!SHORT_ID!/ to get the guid
(extension "ublock-origin" "uBlock0@raymondhill.net")
(extension "bitwarden-password-manager" "{446900e4-71c2-419f-a6a7-df9c091e268b}")
# ...
];
zen = (
pkgs.wrapFirefox
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.zen-browser-unwrapped
{
extraPrefs = lib.concatLines (
lib.mapAttrsToList (
name: value: "lockPref(${lib.strings.toJSON name}, ${lib.strings.toJSON value});"
) prefs
);
extraPolicies = {
DisableTelemetry = true;
ExtensionSettings = builtins.listToAttrs extensions;
SearchEngines = {
Default = "Kagi";
Add = [
{
Name = "Kagi";
URLTemplate = "https://kagi.com/search?q={searchTerms}";
IconURL = "https://kagi.com/favicon.ico";
Alias = "@k";
}
{
Name = "MDN";
URLTemplate = "https://developer.mozilla.org/en-US/search?q={searchTerms}";
IconURL = "https://developer.mozilla.org/static/img/opengraph-logo.72382e605ce3.png";
Alias = "mdn";
}
{
Name = "nixpkgs packages";
URLTemplate = "https://search.nixos.org/packages?query={searchTerms}";
IconURL = "https://wiki.nixos.org/favicon.ico";
Alias = "@np";
}
{
Name = "NixOS options";
URLTemplate = "https://search.nixos.org/options?query={searchTerms}";
IconURL = "https://wiki.nixos.org/favicon.ico";
Alias = "@no";
}
{
Name = "NixOS Wiki";
URLTemplate = "https://wiki.nixos.org/w/index.php?search={searchTerms}";
IconURL = "https://wiki.nixos.org/favicon.ico";
Alias = "@nw";
}
{
Name = "noogle";
URLTemplate = "https://noogle.dev/q?term={searchTerms}";
IconURL = "https://noogle.dev/favicon.ico";
Alias = "@ng";
}
];
};
};
}
);
# }}}
in
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
environment.sessionVariables = {
KWIN_DRM_NO_AMS = 1;
KWIN_FORCE_SW_CURSOR = "1"; # decouple cursor from DRM pipeline
__GL_VRR_ALLOWED = "0";
#KWIN_DRM_DISABLE_TRIPLE_BUFFERING = "1";
};
hardware = {
bluetooth.enable = true;
graphics.enable = true;
nvidia = {
# see the note below
open = false; # see the note above
modesetting.enable = true;
powerManagement.enable = true;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
nvidiaBusId = "PCI:1@0:0:0";
amdgpuBusId = "PCI:5@0:0:0";
};
};
};
services.xserver.videoDrivers = [
"nvidia"
"amdgpu"
];
boot.kernelParams = [ "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Use latest kernel.
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.hosts = {
};
# 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;
# Set your time zone.
time.timeZone = "Europe/Rome";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "it_IT.UTF-8";
LC_IDENTIFICATION = "it_IT.UTF-8";
LC_MEASUREMENT = "it_IT.UTF-8";
LC_MONETARY = "it_IT.UTF-8";
LC_NAME = "it_IT.UTF-8";
LC_NUMERIC = "it_IT.UTF-8";
LC_PAPER = "it_IT.UTF-8";
LC_TELEPHONE = "it_IT.UTF-8";
LC_TIME = "it_IT.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.plasma-login-manager = {
enable = true;
};
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "eu";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
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;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.dario48 = {
isNormalUser = true;
description = "Dario48";
extraGroups = [
"networkmanager"
"wheel"
];
packages = with pkgs; [
kdePackages.kate
vesktop
geteduroam
ghidra-bin
pwntools
pkgs.agenix-cli
gimp
unzip
wireguard-tools
# patch elf files to work
binutils
stdenv
nix-index
patchelf
# thunderbird
];
};
programs.nix-ld = {
enable = true;
libraries = with pkgs; [
gcc
];
};
fonts.packages =
with pkgs;
[ ]
++ (with nerd-fonts; [
iosevka-term
]);
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
git
sweet-nova
zen
tree-sitter
gcc
man-pages
man-pages-posix
python3
ripgrep
blesh
sshfs
cargo
rustc
];
programs.bash.blesh.enable = true;
documentation.dev.enable = true;
programs.neovim = {
enable = true;
vimAlias = true;
viAlias = true;
defaultEditor = true;
configure.customLuaRC = ''
vim.opt.modeline = true
vim.opt.runtimepath:prepend("${inputs.neovim-dotfiles}")
vim.opt.runtimepath:append("${inputs.neovim-dotfiles}/after")
package.path = "${inputs.neovim-dotfiles}/?.lua;" ..
"${inputs.neovim-dotfiles}/?/init.lua;" ..
package.path
dofile("${inputs.neovim-dotfiles}/init.lua")
'';
# configure = {
# customLuaRC = ''
# -- Add your config directory to package.path
# package.path = package.path .. ";${inputs.neovim-dotfiles}/?.lua;${nvim-config}/?/init.lua"
# -- Source the main init.lua
# dofile("${inputs.neovim-dotfiles}/init.lua")
# '';
# };
};
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# age.secrets.wg-key-vps = {
# file = "${inputs.self.outPath}/secrets/wg-key-vps.age";
# # for permission, see man systemd.netdev
# mode = "640";
# owner = "systemd-network";
# group = "systemd-network";
# };
# networking.useNetworkd = true;
# systemd.network = {
# enable = true;
# networks."50-wg0" = {
# matchConfig.Name = "wg0";
# address = [
# "10.81.37.18/32"
# ];
# };
# netdevs."50-wg0" = {
# netdevConfig = {
# Kind = "wireguard";
# Name = "wg0";
# };
# wireguardConfig = {
# ListenPort = 51820;
# # ensure file is readable by `systemd-network` user
# PrivateKeyFile = builtins.toFile "privatekey" "cJFKvzb/y0Humt7HEReC4SCaeXp2vxhxrYc7TAW+3l8=";
# # To automatically create routes for everything in AllowedIPs,
# # add RouteTable=main
# RouteTable = "main";
# # FirewallMark marks all packets send and received by wg0
# # with the number 42, which can be used to define policy rules on these packets.
# FirewallMark = 42;
# };
# wireguardPeers = [
# {
# PublicKey = "t57ESdPPbtAtva3L3UfF/IVbJiIbk2SC7Vxd7FIQalI=";
# AllowedIPs = [
# "10.254.0.0/24"
# "10.60.0.0/14"
# "10.64.0.0/14"
# "10.68.0.0/14"
# "10.80.0.0/16"
# "10.81.0.0/16"
# "10.10.0.0/16"
# "10.11.0.0/16"
# ];
# Endpoint = "vpn.ad.cyberchallenge.it:51820";
# # RouteTable = 1000;
# }
# ];
# };
# };
# networking.firewall.allowedUDPPorts = [ 51820 ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# 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
# this value at the release version of the first install of this system.
# 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?
}
)
# }}}
# home.nix {{{
home-manager.nixosModules.default
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [
inputs.plasma-manager.homeModules.plasma-manager
];
users.dario48 = (
{
config,
pkgs,
...
}:
{
services = {
mpris-proxy.enable = true;
arrpc.enable = true;
};
programs = {
# plasma {{{
plasma = {
enable = true;
workspace = {
lookAndFeel = "org.kde.breezedark.desktop";
colorScheme = "SweetAmbarBlue";
cursor = {
theme = "breeze_cursors";
size = 24;
};
iconTheme = "Breeze";
souneTheme = "ocean";
theme = "Sweet-Ambar-Blue";
wallpaper = "
";
};
};
# }}}
#ssh {{{
ssh = {
enable = true;
enableDefaultConfig = false;
matchBlocks = {
"*" = {
forwardAgent = false;
addKeysToAgent = "no";
compression = false;
serverAliveInterval = 0;
serverAliveCountMax = 3;
hashKnownHosts = false;
userKnownHostsFile = "~/.ssh/known_hosts";
controlMaster = "no";
controlPath = "~/.ssh/master-%r@%n:%p";
controlPersist = "no";
};
"dario48.site" = {
hostname = "93.94.24.17";
};
"git.dario48.site" = {
hostname = "dario48.site";
identityFile = "~/.ssh/id_ed25519";
port = 22;
};
home_server = {
hostname = "dario48.site";
identityFile = "~/.ssh/home_server";
user = "dario48";
port = 22;
};
};
};
# }}}
# hyfetch {{{
fastfetch.enable = true;
hyfetch = {
enable = true;
settings = {
preset = "agender";
mode = "rgb";
auto_detect_light_dark = true;
light_dark = "dark";
lightness = 0.5;
color_align = {
mode = "horizontal";
};
backend = "fastfetch";
args = null;
distro = null;
pride_month_disable = false;
custom_ascii_path = null;
};
};
# }}}
# kitty {{{
kitty = {
enable = true;
themeFile = "Carbonfox";
shellIntegration.enableBashIntegration = true;
font.name = "IosevkaTerm Nerd Font Mono";
font.size = 11;
settings = {
bold_font = "auto";
italic_font = "auto";
bold_italic_font = "auto";
confirm_os_window_close = 0;
dynamic_background_opacity = true;
window_padding_width = 0;
background_opacity = "0.5";
background_blur = 5;
};
};
# }}}
};
home = {
stateVersion = "24.11";
shell.enableShellIntegration = true;
};
}
);
};
}
# }}}
];
};
};
}