# 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"; }; assets.url = "git+https://dario48.site/git/Dario48/NixOs.git?ref=assets"; secrets.url = "./secrets"; }; 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; ensureProfiles.profiles = { eduroam = { connection = { id = "eduroam"; type = "wifi"; interface-name = "wlo1"; # # replace with your interface-name as displayed by "ip a" }; wifi = { mode = "infrastructure"; ssid = "eduroam"; }; wifi-security = { key-mgmt = "wpa-eap"; }; "802-1x" = { # # not all or even some additional values may be needed here according to your institution eap = "PEAP"; # # adapt according to your universities setup identity = "dario.spinnato@studenti.unimi.it"; client-cert = "/etc/ssl/certs/eduroam/cert.pem"; private-key-password = inputs.secrets.private-key-password; ca-cert = "/etc/ssl/certs/certs.pem"; }; ipv4 = { method = "auto"; }; ipv6 = { method = "auto"; }; }; }; }; # 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 wl-clipboard cargo rustc luajit ]; programs.bash.blesh.enable = true; documentation.dev.enable = true; programs.neovim = { enable = true; vimAlias = true; viAlias = true; defaultEditor = true; configure.customLuaRC = '' 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" ]; # 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; fonts.fixedWidth = { family = "IosevkaTerm Nerd Font Mono"; pointSize = 11; }; hotkeys.commands = { "kitty" = { name = "launch kitty"; key = "Alt+Return"; command = "kitty"; }; }; input = { keyboard = { layouts = [ { layout = "eu"; } ]; options = [ "caps:esc" ]; }; mice = [ { name = "Logitech USB Optical Mouse"; vendorId = "046d"; productId = "c077"; naturalScroll = true; } ]; touchpads = [ { vendorId = "04f3"; productId = "3298"; name = "ELAN07C9:00 04F3:3298 Touchpad"; disableWhileTyping = false; naturalScroll = true; } ]; }; krunner = { position = "top"; shortcuts.launch = "Meta"; }; kscreenlocker = { appearance.wallpaper = "${inputs.assets.wallpaper}"; lockOnResume = true; passwordRequired = true; }; kwin = { borderlessMaximizedWindows = true; cornerBarrier = false; effects = { dimAdminMode.enable = true; dimInactive.enable = true; hideCursor = { enable = true; hideOnTyping = true; hideOnInactivity = 5; }; #magnifier = { # enable = true; # height = 200; # width = 355; #}; shakeCursor.enable = true; snapHelper.enable = true; zoom = { enable = true; mousePointer = "keep"; mouseTracking = "centered"; scrollGestureModKeys = "Meta+Ctrl"; }; }; nightLight = { enable = true; mode = "constant"; temperature = { day = 5400; night = 5400; }; }; }; shortcuts.kwin = { "Window Close" = "Alt+Q"; "Switch Window Down" = "Alt+J"; "Switch Window Left" = "Alt+H"; "Switch Window Right" = "Alt+L"; "Switch Window Up" = "Alt+K"; }; panels = [ { alignment = "center"; floating = false; hiding = "none"; lengthMode = "fill"; location = "top"; offset = 0; opacity = "translucent"; screen = "all"; widgets = [ "org.kde.plasma.kickoff" "org.kde.plasma.pager" "org.kde.plasma.icontasks" "org.kde.plasma.marginsseparator" { systemTray.items = { shown = [ "org.kde.plasma.notifications" "org.kde.plasma.clipboard" "org.kde.plasma.mediacontroller" "org.kde.plasma.networkmanagement" "org.kde.plasma.volume" "org.kde.plasma.battery" "org.kde.plasma.brightness" "org.kde.plasma.bluetooth" ]; hidden = [ "org.kde.plasma.manage-inputmethod" "org.kde.plasma.cameraindicator" "org.kde.plasma.keyboardlayout" "org.kde.plasma.devicenotifier" "org.kde.kscreen" "org.kde.plasma.keyboardindicator" "org.kde.plasma.printmanager" "org.kde.plasma.weather" ]; }; } "org.kde.plasma.digitalclock" "org.kde.plasma.showdesktop" "org.kde.plasma.systemmonitor.cpucore" ]; } ]; powerdevil.AC.whenLaptopLidClosed = "hibernate"; session.sessionRestore.restoreOpenApplicationsOnLogin = "onLastLogout"; windows.allowWindowsToRememberPositions = true; workspace = { colorScheme = "SweetAmbarBlue"; cursor = { theme = "breeze_cursors"; size = 24; }; iconTheme = "Breeze"; soundTheme = "ocean"; theme = "Sweet-Ambar-Blue"; wallpaper = "${inputs.assets.wallpaper}"; windowDecorations = { library = "org.kde.kwin.aurorae.v2"; theme = "__aurorae__svg__Sweet-ambar-blue"; }; }; }; # }}} #ssh {{{ ssh = { enable = true; enableDefaultConfig = false; matchBlocks = let server = { ip = "93.94.24.17"; port = 22; username = "dario48"; }; in { "*" = { 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"; }; "git.dario48.site" = { hostname = server.ip; identityFile = "~/.ssh/id_ed25519"; port = server.port; }; home_server = { hostname = server.ip; identityFile = "~/.ssh/home_server"; user = server.username; port = server.port; }; }; }; # }}} # 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 = "#000000"; background_opacity = "0.5"; background_blur = 64; }; }; # }}} }; home = { stateVersion = "24.11"; shell.enableShellIntegration = true; }; } ); }; } # }}} ]; }; }; }