From 01bb0877c285383fd2857920048bd2576f4d31e9 Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Wed, 31 Jan 2024 22:02:28 +0530 Subject: restructure --- .fdignore | 9 --- .tmux.conf | 52 ------------- OwO.nix | 36 --------- config/.fdignore | 9 +++ config/.tmux.conf | 52 +++++++++++++ config/alacritty/default.nix | 11 +++ config/themes.nix | 25 ++++++ configuration.nix | 38 --------- desktop.nix | 72 ----------------- flake.lock | 48 ++++++++++++ flake.nix | 28 +++++++ hardware-configuration.nix | 38 --------- home.nix | 142 ---------------------------------- machines/z/configuration.nix | 26 +++++++ machines/z/hardware-configuration.nix | 27 +++++++ machines/z/home.nix | 20 +++++ modules/compromyse.nix | 10 +++ modules/global.nix | 12 +++ modules/nvidia.nix | 25 ++++++ modules/ssh.nix | 9 +++ 20 files changed, 302 insertions(+), 387 deletions(-) delete mode 100644 .fdignore delete mode 100644 .tmux.conf delete mode 100644 OwO.nix create mode 100644 config/.fdignore create mode 100644 config/.tmux.conf create mode 100644 config/alacritty/default.nix create mode 100644 config/themes.nix delete mode 100644 configuration.nix delete mode 100644 desktop.nix create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 hardware-configuration.nix delete mode 100644 home.nix create mode 100644 machines/z/configuration.nix create mode 100644 machines/z/hardware-configuration.nix create mode 100644 machines/z/home.nix create mode 100644 modules/compromyse.nix create mode 100644 modules/global.nix create mode 100644 modules/nvidia.nix create mode 100644 modules/ssh.nix diff --git a/.fdignore b/.fdignore deleted file mode 100644 index 44ba588..0000000 --- a/.fdignore +++ /dev/null @@ -1,9 +0,0 @@ -.git -cache -.cache -node_modules -.npm -site-packages -go/pkg -build -virtualenv diff --git a/.tmux.conf b/.tmux.conf deleted file mode 100644 index 94169b0..0000000 --- a/.tmux.conf +++ /dev/null @@ -1,52 +0,0 @@ -set -sg escape-time 0 -set -g history-limit 10000 - -set -g status-interval 5 -set -g default-terminal "screen-256color" -set -g focus-events on - -set -g base-index 1 -set -g pane-base-index 1 -set-window-option -g pane-base-index 1 -set-option -g renumber-windows on - -set-option -g detach-on-destroy off - -set -g @plugin 'christoomey/vim-tmux-navigator' -set -g @plugin 'tmux-plugins/tmux-yank' - -unbind C-b -unbind '"' -unbind % -unbind c - -set-option -g prefix C-x -bind-key C-x send-prefix - -bind -n M-h previous-window -bind -n M-l next-window - -set-window-option -g mode-keys vi -bind-key -T copy-mode-vi v send-keys -X begin-selection -bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel - -bind | split-window -h -c "#{pane_current_path}" -bind - split-window -v -c "#{pane_current_path}" - -bind-key r command-prompt -I "#W" "rename-window '%%'" -bind-key x kill-pane -bind-key c new-window -c "#{pane_current_path}" - -unbind f -bind f split-pane "bash ~/.sessionizer.sh" - -bg="#272727" - -set -g status-position "bottom" -set -g status-style bg=default,fg=default -set -g status-left " λ " -set -g status-right "" -set -g window-status-format " #I:#W " -set -g window-status-current-format "#[bg=${bg},fg=#f2f0fa] #I:#W " - -run '~/.tmux/plugins/tpm/tpm' diff --git a/OwO.nix b/OwO.nix deleted file mode 100644 index f57f2c6..0000000 --- a/OwO.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ config, pkgs, ... }: - -{ - boot.extraModprobeConfig = "options kvm_intel nested=1"; - - networking.hostName = "OwO"; - - hardware.opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - }; - - services.xserver.videoDrivers = [ "nvidia" ]; - - hardware.nvidia = { - modesetting.enable = true; - powerManagement.enable = false; - powerManagement.finegrained = false; - open = false; - nvidiaSettings = false; - package = config.boot.kernelPackages.nvidiaPackages.production; - - prime = { - intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:1:0:0"; - }; - }; - - fileSystems."/data" = { - device = "/dev/sda"; - fsType = "ext4"; - }; - - time.timeZone = "Asia/Kolkata"; -} diff --git a/config/.fdignore b/config/.fdignore new file mode 100644 index 0000000..44ba588 --- /dev/null +++ b/config/.fdignore @@ -0,0 +1,9 @@ +.git +cache +.cache +node_modules +.npm +site-packages +go/pkg +build +virtualenv diff --git a/config/.tmux.conf b/config/.tmux.conf new file mode 100644 index 0000000..94169b0 --- /dev/null +++ b/config/.tmux.conf @@ -0,0 +1,52 @@ +set -sg escape-time 0 +set -g history-limit 10000 + +set -g status-interval 5 +set -g default-terminal "screen-256color" +set -g focus-events on + +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +set-option -g detach-on-destroy off + +set -g @plugin 'christoomey/vim-tmux-navigator' +set -g @plugin 'tmux-plugins/tmux-yank' + +unbind C-b +unbind '"' +unbind % +unbind c + +set-option -g prefix C-x +bind-key C-x send-prefix + +bind -n M-h previous-window +bind -n M-l next-window + +set-window-option -g mode-keys vi +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + +bind | split-window -h -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" + +bind-key r command-prompt -I "#W" "rename-window '%%'" +bind-key x kill-pane +bind-key c new-window -c "#{pane_current_path}" + +unbind f +bind f split-pane "bash ~/.sessionizer.sh" + +bg="#272727" + +set -g status-position "bottom" +set -g status-style bg=default,fg=default +set -g status-left " λ " +set -g status-right "" +set -g window-status-format " #I:#W " +set -g window-status-current-format "#[bg=${bg},fg=#f2f0fa] #I:#W " + +run '~/.tmux/plugins/tpm/tpm' diff --git a/config/alacritty/default.nix b/config/alacritty/default.nix new file mode 100644 index 0000000..af272ef --- /dev/null +++ b/config/alacritty/default.nix @@ -0,0 +1,11 @@ +{ pkgs, config, ... }: + +{ + programs.git = { + enable = true; + userName = "Raghuram Subramani"; + userEmail = "raghus2247@gmail.com"; + }; + + programs.alacritty.enable = true; +} diff --git a/config/themes.nix b/config/themes.nix new file mode 100644 index 0000000..a0b20f5 --- /dev/null +++ b/config/themes.nix @@ -0,0 +1,25 @@ +{ home, pkgs, ... }: + +{ + home.pointerCursor = { + gtk.enable = true; + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Classic"; + size = 16; + }; + + gtk = { + enable = true; + + theme = { name = "adw-gtk3-dark"; package = pkgs.adw-gtk3; }; + iconTheme = { name = "Papirus-Dark"; package = pkgs.papirus-icon-theme; }; + + font = { name = "UbuntuMono Nerd Font"; }; + }; + + qt = { + enable = true; + platformTheme = "gtk"; + style.name = "adwaita-dark"; + }; +} diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 9c0e07d..0000000 --- a/configuration.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./hardware-configuration.nix - ./OwO.nix - ./home.nix - ./desktop.nix - ]; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - nixpkgs.config.allowUnfree = true; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - environment.systemPackages = with pkgs; [ - waybar - fuzzel - dunst - hyprpaper - swaylock - - networkmanagerapplet - - greetd.tuigreet - greetd.greetd - polkit_gnome - - libnotify - libappindicator - - cudatoolkit - ]; - - system.stateVersion = "23.11"; -} - diff --git a/desktop.nix b/desktop.nix deleted file mode 100644 index ab00242..0000000 --- a/desktop.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.hyprland = { - enable = true; - xwayland.enable = true; - }; - xdg.portal.enable = true; - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ]; - - environment.sessionVariables = { - NIXOS_OZONE_WL = "1"; - }; - - services.printing.enable = true; - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; - - networking.networkmanager.enable = true; - - hardware.bluetooth.enable = true; - hardware.bluetooth.powerOnBoot = true; - services.blueman.enable = true; - - services.xserver.libinput.enable = true; - services.greetd = { - enable = true; - settings = { - default_session = { - command = "tuigreet --time --remember --cmd Hyprland"; - user = "greeter"; - }; - }; - }; - - services.logind.extraConfig = '' - HandlePowerKey=ignore - ''; - - systemd.services.greetd.serviceConfig = { - Type = "idle"; - StandardInput = "tty"; - StandardOutput = "tty"; - StandardError = "journal"; - TTYReset = true; - TTYVHangup = true; - TTYVTDisallocate = true; - }; - - security.polkit.enable = true; - security.pam.services.swaylock.text = '' - auth include login - ''; - - programs.gnupg.agent = { - enable = true; - }; - - programs.dconf.enable = true; - - fonts.packages = with pkgs; [ - (nerdfonts.override { fonts = [ "UbuntuMono" ]; }) - ]; -} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..067fcfa --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706473109, + "narHash": "sha256-iyuAvpKTsq2u23Cr07RcV5XlfKExrG8gRpF75hf1uVc=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "d634c3abafa454551f2083b054cd95c3f287be61", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "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..1ea7430 --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + description = "Nix Configuration"; + + inputs = { + # Nixpkgs + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + # Home manager + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, ... }@inputs: { + # nixos-rebuild --flake .#machine + nixosConfigurations = { + z = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./machines/z/configuration.nix + inputs.home-manager.nixosModules.default + ]; + }; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix deleted file mode 100644 index 4618943..0000000 --- a/hardware-configuration.nix +++ /dev/null @@ -1,38 +0,0 @@ -# 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 = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/347f3061-af46-40c7-aae3-fd4546cebb24"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/03DC-FCFF"; - fsType = "vfat"; - }; - - 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.enp3s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp0s20f3.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 deleted file mode 100644 index cda4cd3..0000000 --- a/home.nix +++ /dev/null @@ -1,142 +0,0 @@ -{ config, pkgs, ... }: -let - home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/master.tar.gz"; -in -{ - imports = [ - (import "${home-manager}/nixos") - ]; - - users.users.compromyse = { - isNormalUser = true; - extraGroups = [ "wheel" "storage" "libvirtd" ]; - }; - - home-manager.useUserPackages = true; - home-manager.useGlobalPkgs = true; - - home-manager.users.compromyse = { pkgs, ... }: { - home.packages = with pkgs; [ - wget - - tmux - fzf - fd - ripgrep - - cinnamon.nemo - mate.eom - - spotify - firefox - - obs-studio - - pavucontrol - blueman - brillo - ]; - - programs.bash = { - enable = true; - initExtra= '' - export PS1="\[\e[38;5;243m\]\h \[\e[38;5;254m\]\w \[\033[0m\]> " - set -o vi - - if [[ -n "$IN_NIX_SHELL" ]]; then - export PS1="\[\e[38;5;242m\](dev) $PS1" - fi - - sessionizer() { - DIR=$(fd . /data --type d -L -H | fzf) - SESSION_NAME="$DIR_$(date +%M%S)" - - if [ -n "$DIR" ] - then - if [ "$1" == "-cd" ] - then - cd $DIR - return - fi - tmux new-session -d -c "$DIR" -s "$SESSION_NAME" - if [ -n "$TMUX" ] - then - tmux switch -t "$SESSION_NAME" - else - tmux attach -t "$SESSION_NAME" - fi - fi - } - - if [[ $- != *i* ]] - then - sessionizer - fi - - bind '"\C-f": "sessionizer\n"' - bind '"\C-a": "sessionizer -cd\n"' - ''; - }; - - programs.git = { - enable = true; - userName = "Raghuram Subramani"; - userEmail = "raghus2247@gmail.com"; - }; - - programs.neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - }; - - - programs.alacritty = { - enable = true; - }; - - home.file = { - ".tmux.conf".source = ./.tmux.conf; - ".fdignore".source = ./.fdignore; - ".config" = { - source = ./config; - recursive = true; - }; - }; - - home.pointerCursor = { - gtk.enable = true; - package = pkgs.bibata-cursors; - name = "Bibata-Modern-Classic"; - size = 16; - }; - - gtk = { - enable = true; - - theme = { name = "adw-gtk3-dark"; package = pkgs.adw-gtk3; }; - iconTheme = { name = "Papirus-Dark"; package = pkgs.papirus-icon-theme; }; - - font = { name = "UbuntuMono Nerd Font"; }; - }; - - qt = { - enable = true; - platformTheme = "gtk"; - style.name = "adwaita-dark"; - }; - - home.stateVersion = "23.11"; - }; - - environment.etc."inputrc".text = pkgs.lib.mkForce ( - builtins.readFile + '' - set completion-ignore-case on - '' - ); - - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; -} diff --git a/machines/z/configuration.nix b/machines/z/configuration.nix new file mode 100644 index 0000000..5af5c58 --- /dev/null +++ b/machines/z/configuration.nix @@ -0,0 +1,26 @@ +{ lib, inputs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ] ++ (map (path: ../../modules/${path}) [ + "global.nix" + "compromyse.nix" + ]); + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + boot.extraModprobeConfig = "options kvm_intel nested=1"; + + fileSystems."/data" = { + device = "/dev/sda"; + fsType = "ext4"; + }; + + networking.hostName = "z"; + + home-manager.users.compromyse = import ./home.nix; +} diff --git a/machines/z/hardware-configuration.nix b/machines/z/hardware-configuration.nix new file mode 100644 index 0000000..aeb8272 --- /dev/null +++ b/machines/z/hardware-configuration.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/347f3061-af46-40c7-aae3-fd4546cebb24"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/03DC-FCFF"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/z/home.nix b/machines/z/home.nix new file mode 100644 index 0000000..564d4d5 --- /dev/null +++ b/machines/z/home.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + + home = { + username = "compromyse"; + homeDirectory = "/home/compromyse"; + }; + + imports = [ + ../../config/themes.nix + ../../config/alacritty + ]; + + home.packages = with pkgs; [ + wget + ]; + + home.stateVersion = "23.11"; +} diff --git a/modules/compromyse.nix b/modules/compromyse.nix new file mode 100644 index 0000000..0d204d2 --- /dev/null +++ b/modules/compromyse.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + users.users.compromyse = { + initialPassword = "changeme"; + isNormalUser = true; + # openssh.authorizedKeys.keys = []; + extraGroups = [ "wheel" "storage" "libvirtd" ]; + }; +} diff --git a/modules/global.nix b/modules/global.nix new file mode 100644 index 0000000..61575c1 --- /dev/null +++ b/modules/global.nix @@ -0,0 +1,12 @@ +{ + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + + nixpkgs.config.allowUnfree = true; + + time.timeZone = "Asia/Kolkata"; + + system.stateVersion = "23.11"; +} diff --git a/modules/nvidia.nix b/modules/nvidia.nix new file mode 100644 index 0000000..a3f6074 --- /dev/null +++ b/modules/nvidia.nix @@ -0,0 +1,25 @@ +{ pkgs, config, ... }: + +{ + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = false; + package = config.boot.kernelPackages.nvidiaPackages.production; + + prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }; +} diff --git a/modules/ssh.nix b/modules/ssh.nix new file mode 100644 index 0000000..a389210 --- /dev/null +++ b/modules/ssh.nix @@ -0,0 +1,9 @@ +{ pkgs, config, ... }: + +{ + services.openssh = { + enable = true; + permitRootLogin = "no"; + passwordAuthentication = false; + }; +} -- cgit v1.2.3