From a87c4a786cee706f2d0a00c5c24c62fc009bc775 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sat, 27 Aug 2022 15:02:09 +0300 Subject: [PATCH] rename nix to home, add system --- .gitignore | 13 +- {nix => home}/home.nix | 3 +- {nix => home}/progs/default.nix | 0 {nix => home}/progs/exa.nix | 0 {nix => home}/progs/git.nix | 0 {nix => home}/progs/himalaya.nix | 0 {nix => home}/progs/hledger.nix | 0 {nix => home}/progs/nvim/coc_settings.nix | 0 {nix => home}/progs/nvim/config.vim | 0 {nix => home}/progs/nvim/custom_plugins.nix | 0 {nix => home}/progs/nvim/default.nix | 0 {nix => home}/progs/nvim/lua/basic.lua | 0 {nix => home}/progs/nvim/lua/coc.lua | 0 {nix => home}/progs/nvim/lua/plugins.lua | 0 {nix => home}/progs/nvim/nvim_nightly.nix | 0 {nix => home}/progs/pass.nix | 0 {nix => home}/progs/vifm/default.nix | 0 {nix => home}/progs/vifm/vifmrc | 0 {nix => home}/progs/zoxide.nix | 0 {nix => home}/shell/default.nix | 0 {nix => home}/shell/prompt/default.nix | 0 .../shell/prompt/starship/config.nix | 0 .../shell/prompt/starship/default.nix | 0 {nix => home}/shell/zsh.nix | 0 {nix => home}/wm/bar/default.nix | 0 {nix => home}/wm/bar/polybar/config.nix | 0 {nix => home}/wm/bar/polybar/default.nix | 0 {nix => home}/wm/default.nix | 0 {nix => home}/wm/xmonad/config.hs | 0 {nix => home}/wm/xmonad/default.nix | 0 scripts/get_volume.sh | 2 +- ...secrets.example.nix => secrets.example.nix | 0 system/configuration.nix | 138 ++++++++++ system/hardware-configuration.nix | 251 ++++++++++++++++++ 34 files changed, 396 insertions(+), 11 deletions(-) rename {nix => home}/home.nix (98%) rename {nix => home}/progs/default.nix (100%) rename {nix => home}/progs/exa.nix (100%) rename {nix => home}/progs/git.nix (100%) rename {nix => home}/progs/himalaya.nix (100%) rename {nix => home}/progs/hledger.nix (100%) rename {nix => home}/progs/nvim/coc_settings.nix (100%) rename {nix => home}/progs/nvim/config.vim (100%) rename {nix => home}/progs/nvim/custom_plugins.nix (100%) rename {nix => home}/progs/nvim/default.nix (100%) rename {nix => home}/progs/nvim/lua/basic.lua (100%) rename {nix => home}/progs/nvim/lua/coc.lua (100%) rename {nix => home}/progs/nvim/lua/plugins.lua (100%) rename {nix => home}/progs/nvim/nvim_nightly.nix (100%) rename {nix => home}/progs/pass.nix (100%) rename {nix => home}/progs/vifm/default.nix (100%) rename {nix => home}/progs/vifm/vifmrc (100%) rename {nix => home}/progs/zoxide.nix (100%) rename {nix => home}/shell/default.nix (100%) rename {nix => home}/shell/prompt/default.nix (100%) rename {nix => home}/shell/prompt/starship/config.nix (100%) rename {nix => home}/shell/prompt/starship/default.nix (100%) rename {nix => home}/shell/zsh.nix (100%) rename {nix => home}/wm/bar/default.nix (100%) rename {nix => home}/wm/bar/polybar/config.nix (100%) rename {nix => home}/wm/bar/polybar/default.nix (100%) rename {nix => home}/wm/default.nix (100%) rename {nix => home}/wm/xmonad/config.hs (100%) rename {nix => home}/wm/xmonad/default.nix (100%) rename nix/secrets.example.nix => secrets.example.nix (100%) create mode 100644 system/configuration.nix create mode 100644 system/hardware-configuration.nix diff --git a/.gitignore b/.gitignore index 35f5100..dabbdbc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,16 @@ /* !/.gitignore +!/*.example.nix !/notes -!/nix -/nix/* -!/nix/wm -!/nix/shell -!/nix/progs -!/nix/home.nix -!/nix/*.example.nix - !/programs - !/scripts +!/system +!/home + !/wallpapers /wallpapers/* !/wallpapers/*.png diff --git a/nix/home.nix b/home/home.nix similarity index 98% rename from nix/home.nix rename to home/home.nix index 8f34713..6471f3c 100644 --- a/nix/home.nix +++ b/home/home.nix @@ -6,7 +6,7 @@ in { imports = (import ./wm) ++ (import ./shell) ++ (import ./progs); - targets.genericLinux.enable = true; + # targets.genericLinux.enable = true; # Home Manager needs a bit of information about you and the # paths it should manage. @@ -25,6 +25,7 @@ in asciinema # record the terminal neofetch # command-line system information + alacritty # tools xh # friendly and fast tool for sending HTTP requests diff --git a/nix/progs/default.nix b/home/progs/default.nix similarity index 100% rename from nix/progs/default.nix rename to home/progs/default.nix diff --git a/nix/progs/exa.nix b/home/progs/exa.nix similarity index 100% rename from nix/progs/exa.nix rename to home/progs/exa.nix diff --git a/nix/progs/git.nix b/home/progs/git.nix similarity index 100% rename from nix/progs/git.nix rename to home/progs/git.nix diff --git a/nix/progs/himalaya.nix b/home/progs/himalaya.nix similarity index 100% rename from nix/progs/himalaya.nix rename to home/progs/himalaya.nix diff --git a/nix/progs/hledger.nix b/home/progs/hledger.nix similarity index 100% rename from nix/progs/hledger.nix rename to home/progs/hledger.nix diff --git a/nix/progs/nvim/coc_settings.nix b/home/progs/nvim/coc_settings.nix similarity index 100% rename from nix/progs/nvim/coc_settings.nix rename to home/progs/nvim/coc_settings.nix diff --git a/nix/progs/nvim/config.vim b/home/progs/nvim/config.vim similarity index 100% rename from nix/progs/nvim/config.vim rename to home/progs/nvim/config.vim diff --git a/nix/progs/nvim/custom_plugins.nix b/home/progs/nvim/custom_plugins.nix similarity index 100% rename from nix/progs/nvim/custom_plugins.nix rename to home/progs/nvim/custom_plugins.nix diff --git a/nix/progs/nvim/default.nix b/home/progs/nvim/default.nix similarity index 100% rename from nix/progs/nvim/default.nix rename to home/progs/nvim/default.nix diff --git a/nix/progs/nvim/lua/basic.lua b/home/progs/nvim/lua/basic.lua similarity index 100% rename from nix/progs/nvim/lua/basic.lua rename to home/progs/nvim/lua/basic.lua diff --git a/nix/progs/nvim/lua/coc.lua b/home/progs/nvim/lua/coc.lua similarity index 100% rename from nix/progs/nvim/lua/coc.lua rename to home/progs/nvim/lua/coc.lua diff --git a/nix/progs/nvim/lua/plugins.lua b/home/progs/nvim/lua/plugins.lua similarity index 100% rename from nix/progs/nvim/lua/plugins.lua rename to home/progs/nvim/lua/plugins.lua diff --git a/nix/progs/nvim/nvim_nightly.nix b/home/progs/nvim/nvim_nightly.nix similarity index 100% rename from nix/progs/nvim/nvim_nightly.nix rename to home/progs/nvim/nvim_nightly.nix diff --git a/nix/progs/pass.nix b/home/progs/pass.nix similarity index 100% rename from nix/progs/pass.nix rename to home/progs/pass.nix diff --git a/nix/progs/vifm/default.nix b/home/progs/vifm/default.nix similarity index 100% rename from nix/progs/vifm/default.nix rename to home/progs/vifm/default.nix diff --git a/nix/progs/vifm/vifmrc b/home/progs/vifm/vifmrc similarity index 100% rename from nix/progs/vifm/vifmrc rename to home/progs/vifm/vifmrc diff --git a/nix/progs/zoxide.nix b/home/progs/zoxide.nix similarity index 100% rename from nix/progs/zoxide.nix rename to home/progs/zoxide.nix diff --git a/nix/shell/default.nix b/home/shell/default.nix similarity index 100% rename from nix/shell/default.nix rename to home/shell/default.nix diff --git a/nix/shell/prompt/default.nix b/home/shell/prompt/default.nix similarity index 100% rename from nix/shell/prompt/default.nix rename to home/shell/prompt/default.nix diff --git a/nix/shell/prompt/starship/config.nix b/home/shell/prompt/starship/config.nix similarity index 100% rename from nix/shell/prompt/starship/config.nix rename to home/shell/prompt/starship/config.nix diff --git a/nix/shell/prompt/starship/default.nix b/home/shell/prompt/starship/default.nix similarity index 100% rename from nix/shell/prompt/starship/default.nix rename to home/shell/prompt/starship/default.nix diff --git a/nix/shell/zsh.nix b/home/shell/zsh.nix similarity index 100% rename from nix/shell/zsh.nix rename to home/shell/zsh.nix diff --git a/nix/wm/bar/default.nix b/home/wm/bar/default.nix similarity index 100% rename from nix/wm/bar/default.nix rename to home/wm/bar/default.nix diff --git a/nix/wm/bar/polybar/config.nix b/home/wm/bar/polybar/config.nix similarity index 100% rename from nix/wm/bar/polybar/config.nix rename to home/wm/bar/polybar/config.nix diff --git a/nix/wm/bar/polybar/default.nix b/home/wm/bar/polybar/default.nix similarity index 100% rename from nix/wm/bar/polybar/default.nix rename to home/wm/bar/polybar/default.nix diff --git a/nix/wm/default.nix b/home/wm/default.nix similarity index 100% rename from nix/wm/default.nix rename to home/wm/default.nix diff --git a/nix/wm/xmonad/config.hs b/home/wm/xmonad/config.hs similarity index 100% rename from nix/wm/xmonad/config.hs rename to home/wm/xmonad/config.hs diff --git a/nix/wm/xmonad/default.nix b/home/wm/xmonad/default.nix similarity index 100% rename from nix/wm/xmonad/default.nix rename to home/wm/xmonad/default.nix diff --git a/scripts/get_volume.sh b/scripts/get_volume.sh index 4393738..2600f05 100755 --- a/scripts/get_volume.sh +++ b/scripts/get_volume.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh enabled=$(amixer -D pulse sget Master | egrep -o "\[on\]" | wc -l) if [[ $enabled == "0" ]]; then echo "off" diff --git a/nix/secrets.example.nix b/secrets.example.nix similarity index 100% rename from nix/secrets.example.nix rename to secrets.example.nix diff --git a/system/configuration.nix b/system/configuration.nix new file mode 100644 index 0000000..52f5508 --- /dev/null +++ b/system/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, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + boot = { + # Use the GRUB 2 boot loader. + loader.grub = { + enable = true; + version = 2; + device = "/dev/sda"; + }; + + kernelPackages = pkgs.linuxPackages_latest; + }; + + networking = { + hostName = "nixos"; # Define your hostname. + networkmanager.enable = true; + + # The global useDHCP flag is deprecated, therefore explicitly set to false here. + # Per-interface useDHCP will be mandatory in the future, so this generated config + # replicates the default behaviour. + useDHCP = false; + }; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + # Set your time zone. + time.timeZone = "Europe/Moscow"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkbOptions in tty. + # }; + + # Enable the X11 windowing system. + services = { + dbus = { + enable = true; + packages = [ pkgs.dconf ]; + }; + + xserver = { + enable = true; + + xkbModel = "pc105"; + layout = "us,us"; + xkbVariant = "dvorak,"; + xkbOptions = "grp:win_space_toggle"; + + displayManager = { + defaultSession = "none+xmonad"; + }; + windowManager.xmonad.enable = true; + }; + }; + + # Configure keymap in X11 + # services.xserver.xkbOptions = { + # "eurosign:e"; + # "caps:escape" # map caps to escape. + # }; + + # Enable CUPS to print documents. + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + programs.zsh.enable = true; + + users.users.root.initialHashedPassword = ""; + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.janabhumi = { + isNormalUser = true; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + shell = pkgs.zsh; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + alacritty + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + ]; + + # 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.11"; # Did you read the comment? + +} + diff --git a/system/hardware-configuration.nix b/system/hardware-configuration.nix new file mode 100644 index 0000000..b78082e --- /dev/null +++ b/system/hardware-configuration.nix @@ -0,0 +1,251 @@ +# 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" "usb_storage" "usbhid" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/969c5f68-631d-4429-b81b-0d81e050449b"; + fsType = "ext4"; + }; + + #fileSystems."/snap/bare/5" = + # { device = "/var/lib/snapd/snaps/bare_5.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/code/105" = + # { device = "/var/lib/snapd/snaps/code_105.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/core22/188" = + # { device = "/var/lib/snapd/snaps/core22_188.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gnome-3-28-1804/145" = + # { device = "/var/lib/snapd/snaps/gnome-3-28-1804_145.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/snap-store/547" = + # { device = "/var/lib/snapd/snaps/snap-store_547.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gnome-3-28-1804/161" = + # { device = "/var/lib/snapd/snaps/gnome-3-28-1804_161.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gnome-3-38-2004/112" = + # { device = "/var/lib/snapd/snaps/gnome-3-38-2004_112.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/kde-frameworks-5-core18/32" = + # { device = "/var/lib/snapd/snaps/kde-frameworks-5-core18_32.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/snapd/16292" = + # { device = "/var/lib/snapd/snaps/snapd_16292.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/core18/2538" = + # { device = "/var/lib/snapd/snaps/core18_2538.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gtk2-common-themes/13" = + # { device = "/var/lib/snapd/snaps/gtk2-common-themes_13.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/snapd/16010" = + # { device = "/var/lib/snapd/snaps/snapd_16010.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gnome-3-34-1804/77" = + # { device = "/var/lib/snapd/snaps/gnome-3-34-1804_77.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/telegram-desktop/4116" = + # { device = "/var/lib/snapd/snaps/telegram-desktop_4116.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/zoom-client/175" = + # { device = "/var/lib/snapd/snaps/zoom-client_175.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/telegram-desktop/4095" = + # { device = "/var/lib/snapd/snaps/telegram-desktop_4095.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gtk-common-themes/1535" = + # { device = "/var/lib/snapd/snaps/gtk-common-themes_1535.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gimp/383" = + # { device = "/var/lib/snapd/snaps/gimp_383.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/snap-store/558" = + # { device = "/var/lib/snapd/snaps/snap-store_558.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/zoom-client/170" = + # { device = "/var/lib/snapd/snaps/zoom-client_170.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/core20/1611" = + # { device = "/var/lib/snapd/snaps/core20_1611.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/core/13308" = + # { device = "/var/lib/snapd/snaps/core_13308.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/e17fb0c0-9482-436d-83e8-3760772fe9b8"; + fsType = "ext4"; + }; + + #fileSystems."/snap/core20/1593" = + # { device = "/var/lib/snapd/snaps/core20_1593.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/core18/2409" = + # { device = "/var/lib/snapd/snaps/core18_2409.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/core/13425" = + # { device = "/var/lib/snapd/snaps/core_13425.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gtk-common-themes/1534" = + # { device = "/var/lib/snapd/snaps/gtk-common-themes_1534.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gnome-3-34-1804/72" = + # { device = "/var/lib/snapd/snaps/gnome-3-34-1804_72.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gimp/393" = + # { device = "/var/lib/snapd/snaps/gimp_393.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/gnome-3-38-2004/106" = + # { device = "/var/lib/snapd/snaps/gnome-3-38-2004_106.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/snap/code/104" = + # { device = "/var/lib/snapd/snaps/code_104.snap"; + # fsType = "squashfs"; + # options = [ "loop" ]; + # }; + + #fileSystems."/var/lib/docker/overlay2/cfd9350881d936ad20855c6168748edeb798891035adf93444a58a3c72a78e7d/merged" = + # { device = "overlay"; + # fsType = "overlay"; + # }; + + #fileSystems."/var/lib/docker/overlay2/57f90306c107dfd8d783015c8e5bd9ee9725148cb40f6dde57ada35063389c94/merged" = + # { device = "overlay"; + # fsType = "overlay"; + # }; + + #fileSystems."/var/lib/docker/containers/262292efecbabcd08c076a2e3b2b722df2f62ce597277fd03465ced8ce3e2173/mounts/shm" = + # { device = "shm"; + # fsType = "tmpfs"; + # }; + + #fileSystems."/var/lib/docker/containers/ecdd23824971de5eeb20946639727a4741c88f77def0d673549b929ae13ae8fd/mounts/shm" = + # { device = "shm"; + # fsType = "tmpfs"; + # }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/1be15503-cd51-4c57-bb91-04f45a964202"; } + ]; + + # 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.br-25eea85a2a63.useDHCP = lib.mkDefault true; + # networking.interfaces.br-589021a10f40.useDHCP = lib.mkDefault true; + # networking.interfaces.br-7624ebce9469.useDHCP = lib.mkDefault true; + # networking.interfaces.br-a5ddf40cdb21.useDHCP = lib.mkDefault true; + # networking.interfaces.br-f542643d9add.useDHCP = lib.mkDefault true; + # networking.interfaces.docker0.useDHCP = lib.mkDefault true; + # networking.interfaces.docker_gwbridge.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.vetha0f735a.useDHCP = lib.mkDefault true; + # networking.interfaces.vethe5fb438.useDHCP = lib.mkDefault true; + # networking.interfaces.vethf610b0a.useDHCP = lib.mkDefault true; + # networking.interfaces.wlxd03745e1e87b.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}