diff --git a/configuration.nix b/configuration.nix index c7375a2..227c7dd 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -{ +{pkgs, ...}: { boot.loader.grub = { enable = true; device = "/dev/sda"; @@ -16,7 +14,7 @@ users.users.prever = { isNormalUser = true; - extraGroups = [ "wheel" ]; + extraGroups = ["wheel"]; packages = with pkgs; [ git tree @@ -24,27 +22,24 @@ }; environment.systemPackages = with pkgs; [ - neovim wget ]; services.openssh.enable = true; - networking.firewall.allowedTCPPorts = [ 22 80 443 ]; + networking.firewall.allowedTCPPorts = [22 80 443]; # networking.firewall.allowedUDPPorts = [ ... ]; nix = { - settings.experimental-features = [ "nix-command" "flakes" ]; + settings.experimental-features = ["nix-command" "flakes"]; optimise.automatic = true; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; - + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; }; home-manager.users.prever.home.stateVersion = "25.11"; system.stateVersion = "25.11"; } - diff --git a/flake.lock b/flake.lock index b163737..17e0d5a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,44 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768135262, + "narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -21,6 +60,34 @@ "type": "github" } }, + "ixx": { + "inputs": { + "flake-utils": [ + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "nixvim", + "nuschtosSearch", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754860581, + "narHash": "sha256-EM0IE63OHxXCOpDHXaTyHIOk2cNvMCGPqLt/IdtVxgk=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "babfe85a876162c4acc9ab6fb4483df88fa1f281", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.1.1", + "repo": "ixx", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1774388614, @@ -37,10 +104,88 @@ "type": "github" } }, + "nixvim": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "nuschtosSearch": "nuschtosSearch", + "systems": "systems_2" + }, + "locked": { + "lastModified": 1769049374, + "narHash": "sha256-h0Os2qqNyycDY1FyZgtbn28VF1ySP74/n0f+LDd8j+w=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "b8f76bf5751835647538ef8784e4e6ee8deb8f95", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "nixos-25.11", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils", + "ixx": "ixx", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768249818, + "narHash": "sha256-ANfn5OqIxq3HONPIXZ6zuI5sLzX1sS+2qcf/Pa0kQEc=", + "owner": "NuschtOS", + "repo": "search", + "rev": "b6f77b88e9009bfde28e2130e218e5123dc66796", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index bbca89e..fbc9951 100644 --- a/flake.nix +++ b/flake.nix @@ -8,19 +8,28 @@ url = "github:nix-community/home-manager/release-25.11"; inputs.nixpkgs.follows = "nixpkgs"; }; + + nixvim = { + url = "github:nix-community/nixvim/nixos-25.11"; + # If using a stable channel you can use `url = "github:nix-community/nixvim/nixos-"` + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, home-manager, ... }: let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; - in { + outputs = { + nixpkgs, + home-manager, + nixvim, + ... + }: { nixosConfigurations."prever" = nixpkgs.lib.nixosSystem { modules = [ home-manager.nixosModules.default - - ./hardware-configuration.nix + nixvim.nixosModules.nixvim + + ./hardware-configuration.nix ./configuration.nix - ./modules + ./modules ]; }; }; diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 1df3179..c36eb60 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -1,26 +1,28 @@ # 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 + "/profiles/qemu-guest.nix") - ]; + lib, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/7d06eddb-8692-4fff-8308-f860ca6aeb55"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/7d06eddb-8692-4fff-8308-f860ca6aeb55"; + fsType = "ext4"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/7aa0eb64-3587-4dce-9fc2-fcdc4a712abb"; } - ]; + swapDevices = [ + {device = "/dev/disk/by-uuid/7aa0eb64-3587-4dce-9fc2-fcdc4a712abb";} + ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; } diff --git a/modules/default.nix b/modules/default.nix index c39b2fa..09f2ba5 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,8 +1,8 @@ -{...}: -{ +{...}: { imports = [ ./fish.nix ./nginx.nix ./tmux.nix + ./nvim.nix ]; } diff --git a/modules/fish.nix b/modules/fish.nix index ed1d22c..8b8865e 100644 --- a/modules/fish.nix +++ b/modules/fish.nix @@ -30,4 +30,3 @@ }; }; } - diff --git a/modules/minecraft.nix b/modules/minecraft.nix new file mode 100644 index 0000000..ea8f50d --- /dev/null +++ b/modules/minecraft.nix @@ -0,0 +1,2 @@ +{...}: { +} diff --git a/modules/nginx.nix b/modules/nginx.nix index 1559652..67948ba 100644 --- a/modules/nginx.nix +++ b/modules/nginx.nix @@ -1,19 +1,18 @@ -{...}: -{ - services.nginx = { - enable = true; - user = "prever"; - group = "users"; +{...}: { + services.nginx = { + enable = true; + user = "prever"; + group = "users"; - virtualHosts."yelbakri.dev" = { - addSSL = true; - enableACME = true; - root = "/var/www"; - }; - }; + virtualHosts."yelbakri.dev" = { + addSSL = true; + enableACME = true; + root = "/var/www"; + }; + }; - security.acme = { - acceptTerms = true; - defaults.email = "yousefelbakri09@gmail.com"; - }; + security.acme = { + acceptTerms = true; + defaults.email = "yousefelbakri09@gmail.com"; + }; } diff --git a/modules/nvim.nix b/modules/nvim.nix new file mode 100644 index 0000000..0d6a5e2 --- /dev/null +++ b/modules/nvim.nix @@ -0,0 +1,43 @@ +{pkgs, ...}: { + programs.nixvim = { + enable = true; + globals.mapleader = " "; + + opts = { + relativenumber = true; + }; + + colorschemes.ayu.enable = true; + + autoCmd = [ + { + event = "BufWritePre"; + pattern = "*.nix"; + callback = { + __raw = "function(args) require('conform').format({ bufnr = args.buf }) end"; + }; + } + ]; + + plugins.nix.enable = true; + plugins.treesitter.enable = true; + plugins.lspconfig.enable = true; + plugins.blink-cmp.enable = true; + plugins.telescope.enable = true; + + plugins.conform-nvim = { + enable = true; + + settings = { + formatters_by_ft = { + nix = ["alejandra"]; + }; + }; + }; + lsp.servers.nil_ls.enable = true; + }; + + users.users.prever.packages = [ + pkgs.alejandra + ]; +} diff --git a/modules/tmux.nix b/modules/tmux.nix index 1db89bb..669f2f7 100644 --- a/modules/tmux.nix +++ b/modules/tmux.nix @@ -1,10 +1,13 @@ -{...}: -{ - home-manager.users.perver = { - programs.tmux = { - enable = true; - newSession = true; - shell = "fish"; - }; - }; +{pkgs, ...}: { + home-manager.users.prever = { + programs.tmux = { + enable = true; + newSession = true; + shell = "${pkgs.fish}/bin/fish"; + + plugins = with pkgs.tmuxPlugins; [ + gruvbox + ]; + }; + }; }