From 3d0f6895429484448b1111023984d7169ce828f6 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Wed, 5 Oct 2022 19:42:30 -0700 Subject: [PATCH] Initial commit --- .bashrc | 15 ++++ configuration.nix | 138 +++++++++++++++++++++++++++++++ flake.lock | 64 ++++++++++++++ flake.nix | 47 +++++++++++ git.nix | 10 +++ hardware-configuration.nix | 30 +++++++ home.nix | 48 +++++++++++ i3.nix | 34 ++++++++ picom.nix | 7 ++ polybar/aozora.nix | 25 ++++++ polybar/index.nix | 135 ++++++++++++++++++++++++++++++ polybar/polybar-now-playing.nix | 36 ++++++++ rofi/index.nix | 14 ++++ rofi/nord.rasi | 142 ++++++++++++++++++++++++++++++++ rofi/power.nix | 9 ++ rofi/power.sh | 33 ++++++++ roxynord.png | Bin 0 -> 126858 bytes terminal.nix | 13 +++ wallpaper.nix | 7 ++ 19 files changed, 807 insertions(+) create mode 100644 .bashrc create mode 100644 configuration.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 git.nix create mode 100644 hardware-configuration.nix create mode 100644 home.nix create mode 100644 i3.nix create mode 100644 picom.nix create mode 100644 polybar/aozora.nix create mode 100644 polybar/index.nix create mode 100644 polybar/polybar-now-playing.nix create mode 100644 rofi/index.nix create mode 100644 rofi/nord.rasi create mode 100644 rofi/power.nix create mode 100644 rofi/power.sh create mode 100644 roxynord.png create mode 100644 terminal.nix create mode 100644 wallpaper.nix diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..91fbadb --- /dev/null +++ b/.bashrc @@ -0,0 +1,15 @@ +alias v=`which vim` + +git=`which git` +alias g=$git +alias ga="$git add" +alias gc="$git commit -m" +alias gu="ga . && gc" # u for update +alias gs="$git status" +alias gi="$git init" +alias gp="$git push" +alias gf="$git pull" # f for fetch +alias gC="$git clone" +alias goops="$git reset --soft HEAD^" + +alias rm="trash-put" diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..11c8914 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,138 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +let + user = "elnu"; +in +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + # + ]; + + # Use the GRUB 2 boot loader. + boot.loader.grub = { + enable = true; + version = 2; + # efiSupport = true; + # efiInstallAsRemovable = true; + # efiSysMountPoint = "/boot/efi"; + # Define on which hard drive you want to install Grub. + device = "/dev/sda"; # or "nodev" for efi only + }; + + # networking.hostName = "nixos"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + time.timeZone = "America/Los_Angeles"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + # i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkbOptions in tty. + # }; + + # Enable the X11 windowing system. + services = { + xserver = { + enable = true; + displayManager = { + lightdm.enable = true; + #sddm.enable = true; + defaultSession = "none+i3"; + }; + windowManager.i3 = { + enable = true; + package = pkgs.i3-gaps; + }; + }; + }; + + # Configure keymap in X11 + # services.xserver.layout = "us"; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + nixpkgs.config.pulseaudio = 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.${user} = { + isNormalUser = true; + extraGroups = [ "wheel" "audio" "video" "optical" "storage" ]; + initialPassword = "password"; + }; + + nixpkgs.config.allowUnfree = true; + + nix = { + package = pkgs.nixVersions.stable; # flakes + extraOptions = "experimental-features = nix-command flakes"; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + rustc + cargo + ]; + + fonts.fonts = with pkgs; [ + noto-fonts + noto-fonts-cjk + (nerdfonts.override { fonts = [ "FiraCode" ]; }) # required for icons + ]; + + # 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; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # 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 = "22.05"; # Did you read the comment? + +} + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f5e7057 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1664783440, + "narHash": "sha256-KlMwR7mUf5h8MPnzV7nGFUAt6ih/euW5xgvZ5x+hwvI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "e4e639dd4dc3e431aa5b5f95325f9a66ac7e0dd9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1664780719, + "narHash": "sha256-Oxe6la5dSqRfJogjtY4sRzJjDDqvroJIVkcGEOT87MA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fd54651f5ffb4a36e8463e0c327a78442b26cbe7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + }, + "utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6cf8bc2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = github:nix-community/home-manager; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager }: + let + user = "elnu"; + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + lib = nixpkgs.lib; + in { + nixosConfigurations = { + elnu = lib.nixosSystem { + inherit system; + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.${user} = { + imports = [ + ./home.nix + ./wallpaper.nix + ./picom.nix + ./i3.nix + ./polybar/index.nix + ./rofi/index.nix + ./git.nix + ./terminal.nix + ]; + }; + } + ]; + }; + }; + }; +} diff --git a/git.nix b/git.nix new file mode 100644 index 0000000..9c376d2 --- /dev/null +++ b/git.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + programs.git = { + package = pkgs.gitAndTools.gitFull; + enable = true; + userName = "ElnuDev"; + userEmail = "elnu@elnu.com"; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..1e7f42f --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,30 @@ +# 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 = [ ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-label/nixos"; + 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.enp0s3.useDHCP = lib.mkDefault true; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + virtualisation.virtualbox.guest.enable = true; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..8ad7a40 --- /dev/null +++ b/home.nix @@ -0,0 +1,48 @@ +{ config, pkgs, ... }: + +let + user = "elnu"; +in +{ + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home = { + # Home Manager needs a bit of information about you and the + # paths it should manage. + username = "${user}"; + homeDirectory = "/home/${user}"; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + stateVersion = "22.05"; + + packages = with pkgs; [ + # Command line utilities + wget + neofetch + vim + ranger + trash-cli # aliased to rm in .bashrc + + # GUI applications + firefox + ]; + + file = { + ".bashrc" = { + source = ./.bashrc; + }; + }; + + sessionVariables = { + EDITOR = "vim"; + }; + }; +} diff --git a/i3.nix b/i3.nix new file mode 100644 index 0000000..31d60d6 --- /dev/null +++ b/i3.nix @@ -0,0 +1,34 @@ +{ pkgs, lib, ... }: + +let + mod = "Mod4"; +in { + xsession.windowManager.i3 = { + enable = true; + config = { + modifier = mod; + gaps.inner = 12; + startup = [ + { + command = "systemctl --user restart polybar"; + always = true; + notification = false; + } + ]; + keybindings = lib.mkOptionDefault { + "${mod}+Return" = "exec kitty"; + "Mod1+Q" = "exec /etc/profiles/per-user/elnu/bin/rofi-power"; + }; + keycodebindings = { + "133" = "--release exec rofi -show run -theme"; + }; + window.commands = [ + { + command = "border pixel 0"; + criteria = { class = "^.*"; }; + } + ]; + bars = []; + }; + }; +} diff --git a/picom.nix b/picom.nix new file mode 100644 index 0000000..857ced3 --- /dev/null +++ b/picom.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + services.picom = { + enable = true; + }; +} diff --git a/polybar/aozora.nix b/polybar/aozora.nix new file mode 100644 index 0000000..dee2173 --- /dev/null +++ b/polybar/aozora.nix @@ -0,0 +1,25 @@ +{ pkgs, lib, fetchFromGitHub, rustPlatform }: + +rustPlatform.buildRustPackage rec { + pname = "aozora"; + version = "5b94155b4137c885bd63bc49cd400ec58152547f"; + + buildInputs = with pkgs; [ openssl ]; + nativeBuildInputs = with pkgs; [ pkg-config ]; + + src = fetchFromGitHub { + owner = "ElnuDev"; + repo = pname; + rev = version; + sha256 = "93MP1Iw1eklC+IEQXAhzLHJ+qsDASm53qw7vUEtEstI="; + }; + + cargoSha256 = "fiDdk6c1rPS6L//KKqfp6ODxcLEzNKrpySCb9n8aGQ0="; + + meta = with lib; { + description = "A simple CLI for fetching Plume Labs air quality info."; + homepage = "https://github.com/ElnuDev/aozora"; + license = licenses.gpl3; + maintaners = [ maintainers.tailhook ]; + }; +} diff --git a/polybar/index.nix b/polybar/index.nix new file mode 100644 index 0000000..4c12011 --- /dev/null +++ b/polybar/index.nix @@ -0,0 +1,135 @@ +{ pkgs, lib, ... }: + +{ + # Dependencies + home.packages = with pkgs; [ + (pkgs.callPackage ./aozora.nix { }) + (pkgs.callPackage ./polybar-now-playing.nix { }) + ]; + services.polybar = { + enable = true; + script = "polybar &"; + package = pkgs.polybar.override { + i3GapsSupport = true; + alsaSupport = true; + }; + config = { + "colors" = { + background = "#2e3440"; + background-alt = "#3b4252"; + foreground = "#eceff4"; + primary = "#8fbcbb"; + secondary = "#ff00ff"; # not sure what this does + alert = "#ff00ff"; # not sure what this does + disabled = "#434c5e"; + }; + "bar/top" = { + font-0 = "Noto Sans Mono;2"; + font-1 = "Noto Sans CJK JP;2"; + background = "\${colors.background}"; + foreground = "\${colors.foreground}"; + width = "100%"; + + height = "24pt"; + line-size = "3pt"; + padding-right = 1; + module-margin = 1; + separator = "|"; + separator-foreground = "\${colors.disabled}"; + cursor-click = "pointer"; + cursor-scroll = "ns-resize"; + modules-left = [ + "xworkspaces" + "xwindow" + "now-playing" + ]; + modules-right = [ + "aozora" + "filesystem" + "pulseaudio" + "memory" + "cpu" + "date" + ]; + }; + "module/xworkspaces" = { + type = "internal/xworkspaces"; + + label-active-background = "\${colors.background-alt}"; + label-active-underline = "\${colors.primary}"; + label-active-padding-right = 1; + + label-occupied-padding-right = 1; + + label-urgent-background = "\${colors.alert}"; + label-urgent-padding-right = 1; + + label-empty-foreground = "\${colors.disabled}"; + label-empty-padding-right = 1; + }; + "module/xwindow" = { + type = "internal/xwindow"; + }; + "module/now-playing" = { + type = "custom/script"; + tail = true; + format = "