diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b97a005 --- /dev/null +++ b/flake.lock @@ -0,0 +1,169 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1770165109, + "narHash": "sha256-9VnK6Oqai65puVJ4WYtCTvlJeXxMzAp/69HhQuTdl/I=", + "owner": "ryantm", + "repo": "agenix", + "rev": "b027ee29d959fda4b60b57566d64c98a202e0feb", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1744478979, + "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "43975d782b418ebf4969e9ccba82466728c2851b", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1745494811, + "narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775683737, + "narHash": "sha256-oBYyowo6yfgb95Z78s3uTnAd9KkpJpwzjJbfnpLaM2Y=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "7ba4ee4228ed36123c7cb75d50524b43514ef992", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "neovim-dotfiles": { + "flake": false, + "locked": { + "lastModified": 1775223189, + "narHash": "sha256-7xYfbrPimM1CEj/pASSFKJ8xPN6nMeCT0CN7efnAZIg=", + "ref": "main", + "rev": "9127a6161e465b7ca529d97109b60f2f05b8f561", + "revCount": 43, + "type": "git", + "url": "https://dario48.site/git/Dario48/neovim-dotfiles.git" + }, + "original": { + "ref": "main", + "type": "git", + "url": "https://dario48.site/git/Dario48/neovim-dotfiles.git" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1775423009, + "narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "home-manager": "home-manager_2", + "neovim-dotfiles": "neovim-dotfiles", + "nixpkgs": "nixpkgs", + "zen-browser": "zen-browser" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "zen-browser": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775277437, + "narHash": "sha256-zCi04nIBNwTMt8n35w9cBgNUqnyhbjivsGlx6/Qhqug=", + "owner": "youwen5", + "repo": "zen-browser-flake", + "rev": "de6d9094822a8f87fc380d1638f34d6cc6fa68ca", + "type": "github" + }, + "original": { + "owner": "youwen5", + "repo": "zen-browser-flake", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d0c9380 --- /dev/null +++ b/flake.nix @@ -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; + }; + } + ); + }; + } + # }}} + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..42af3c5 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,33 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/a88cdfe9-1aa3-45bf-b5ba-a073e9db30c3"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/EB8A-599D"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/582e463c-40f8-4fee-9a93-cb035fc0b93f"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}