From 0962953fb44d7ecae4a36d4841d277bf60e4af17 Mon Sep 17 00:00:00 2001 From: Victor Isan Date: Sun, 16 Mar 2025 20:52:12 +0100 Subject: [PATCH] initial commit --- configuration.nix | 70 ++++++++++++++++ flake.lock | 49 +++++++++++ flake.nix | 27 +++++++ hardware-configuration.nix | 33 ++++++++ home.nix | 162 +++++++++++++++++++++++++++++++++++++ 5 files changed, 341 insertions(+) create mode 100644 configuration.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware-configuration.nix create mode 100644 home.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..1c7d97f --- /dev/null +++ b/configuration.nix @@ -0,0 +1,70 @@ +{ config, lib, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ]; + + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sda"; + + networking.hostName = "galleon"; + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Vienna"; + + services.xserver.enable = true; + services.xserver.windowManager.dwm.enable = true; + services.picom.enable = true; + services.xserver.windowManager.dwm.package = pkgs.dwm.overrideAttrs { + src = pkgs.fetchFromGitea { + domain = "git.isan.ro"; + owner = "victor"; + repo = "dwm"; + rev = "31762b5ecc0287f7eaec3c9c46267918c8d3bda8"; + hash = "sha256-HLn3bas6uHwjGDyiqyxvRKqVA7XBIYVoVqvFvYUBymc="; + }; + }; + + services.xserver.xkb.layout = "ro"; + services.xserver.xkb.options = "eurosign:e,caps:escape"; + + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + users.users.victor = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + environment.systemPackages = with pkgs; [ + vim + wget + git + lukesmithxyz-st + dwmblocks + + # patches + (dmenu.overrideAttrs (oldAttrs: rec { + patches = [ + (fetchurl { + url = "https://tools.suckless.org/dmenu/patches/xresources/dmenu-xresources-4.9.diff"; + sha256 = "75b884e26c959f396676110eb5e0b74bdec43b1cb9424950f08cc641e6fb63d6"; + }) + ]; + })) + ]; + fonts.packages = with pkgs; [ + nerdfonts + ]; + + # Servers + services.openssh.enable = true; + + networking.firewall.enable = false; + + system.stateVersion = "24.11"; # Leave like this. +} + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..893ee8f --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1739757849, + "narHash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "9d3d080aec2a35e05a15cedd281c2384767c2cfe", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1741862977, + "narHash": "sha256-prZ0M8vE/ghRGGZcflvxCu40ObKaB+ikn74/xQoNrGQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cdd2ef009676ac92b715ff26630164bb88fec4e0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..eec25f5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "Kellog's config (get it?)"; + + inputs = { + # NixOS official package source, using the nixos-24.11 branch here + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; + home-manager = { + url = "github:nix-community/home-manager/release-24.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager, ... }@inputs: { + nixosConfigurations.galleon = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.victor = import ./home.nix; + } + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..8f0e039 --- /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 = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/e7f24430-9b3a-4b22-a7cb-4be08e056648"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s25.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..9d4d6de --- /dev/null +++ b/home.nix @@ -0,0 +1,162 @@ +{ config, pkgs, ... }: + +{ + home.username = "victor"; + home.homeDirectory = "/home/victor"; + + # link the configuration file in current directory to the specified location in home directory + # home.file.".config/i3/wallpaper.jpg".source = ./wallpaper.jpg; + + # link all files in `./scripts` to `~/.config/i3/scripts` + # home.file.".config/i3/scripts" = { + # source = ./scripts; + # recursive = true; # link recursively + # executable = true; # make all files executable + # }; + + # encode the file content in nix configuration file directly + # home.file.".xxx".text = '' + # xxx + # ''; + + home.file.".Xresources".text = '' + !! Transparency (0-1): + *.alpha: 0.8 + + !! Set a default font and font size as below: + *.font: IntoneMonoNerdFontMono:size=16 + *.background: #1d2021 + *.foreground: #458588 + *.selbackground: #458588 + *.selforeground: #1d2021 + + /* !! gruvbox: */ + *.color0: #1d2021 + *.color1: #cc241d + *.color2: #98971a + *.color3: #d79921 + *.color4: #458588 + *.color5: #b16286 + *.color6: #689d6a + *.color7: #a89984 + *.color8: #928374 + *.color9: #fb4934 + *.color10: #b8bb26 + *.color11: #fabd2f + *.color12: #83a598 + *.color13: #d3869b + *.color14: #8ec07c + *.color15: #ebdbb2 + *.color256: #1d2021 + *.color257: #ebdbb2 + ''; + + home.packages = with pkgs; [ + neofetch + + # archives + zip + xz + unzip + + # big stuff + librewolf + + # navigation + ripgrep # recursively searches directories for a regex pattern + lf # ranger written in C + fzf # A command-line fuzzy finder + bat # better cat + + # networking tools + mtr # A network diagnostic tool + iperf3 + dnsutils # `dig` + `nslookup` + ldns # replacement of `dig`, it provide the command `drill` + aria2 # A lightweight multi-protocol & multi-source command-line download utility + socat # replacement of openbsd-netcat + nmap # A utility for network discovery and security auditing + ipcalc # it is a calculator for the IPv4/v6 addresses + + # misc + file + gnupg + + # productivity + hugo # static site generator + glow # markdown previewer in terminal (insanely cool) + + btop # replacement of htop/nmon + iotop # io monitoring + iftop # network monitoring + + # system call monitoring + strace # system call monitoring + ltrace # library call monitoring + lsof # list open files + + # system tools + pciutils # lspci + usbutils # lsusb + ]; + + # basic configuration of git, please change to your own + programs.git = { + enable = true; + userName = "Victor Ișan"; + userEmail = "victor@isan.ro"; + }; + + # starship - an customizable prompt for any shell + programs.starship = { + enable = true; + # custom settings + settings = { + add_newline = false; + aws.disabled = true; + gcloud.disabled = true; + line_break.disabled = true; + }; + }; + + # alacritty - a cross-platform, GPU-accelerated terminal emulator + programs.alacritty = { + enable = true; + # custom settings + settings = { + env.TERM = "xterm-256color"; + font = { + size = 12; + draw_bold_text_with_bright_colors = true; + }; + scrolling.multiplier = 5; + selection.save_to_clipboard = true; + }; + }; + + programs.zsh = { + enable = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + history = { + save = 10000; + ignoreSpace = true; + ignoreDups = true; + extended = true; + share = true; + path = "$HOME/.zsh_history"; + }; + shellAliases = { + ls = "ls --color=yes"; + la = "ls -a"; + ll = "ls -l"; + lla = "ls -la"; + }; + + }; + + home.stateVersion = "24.11"; # Don't change. + + # Let home Manager install and manage itself. + programs.home-manager.enable = true; +}