From 1cb87da3e470c19997e1d78de920f689e4676fd8 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sun, 28 Aug 2022 04:54:03 +0300 Subject: [PATCH] update system config --- home/home.nix | 9 +- home/shell/zsh.nix | 2 + secrets.example.nix | 6 +- system/configuration.nix | 27 +++- system/hardware-configuration.nix | 214 +----------------------------- 5 files changed, 37 insertions(+), 221 deletions(-) diff --git a/home/home.nix b/home/home.nix index 9a6d4e6..79c17d4 100644 --- a/home/home.nix +++ b/home/home.nix @@ -10,8 +10,8 @@ in # Home Manager needs a bit of information about you and the # paths it should manage. - home.username = secrets.home.name; - home.homeDirectory = secrets.home.dir; + home.username = secrets.user.name; + home.homeDirectory = secrets.user.dir; home.keyboard = { model = "pc105"; @@ -23,6 +23,7 @@ in home.packages = with pkgs; [ # TODO: move packages to separate modules kotatogram-desktop + docker-compose asciinema # record the terminal neofetch # command-line system information @@ -41,6 +42,10 @@ in # browser librewolf # a fork of firefox, focused on privacy, security and freedom + + # for work + google-cloud-sdk + kubectl ]; # window manager diff --git a/home/shell/zsh.nix b/home/shell/zsh.nix index 9dd599d..883ba60 100644 --- a/home/shell/zsh.nix +++ b/home/shell/zsh.nix @@ -59,6 +59,8 @@ in any-nix-shell zsh --info-right | source /dev/stdin eval "$(cat $HOME/repos/tas/shell/zsh)" + + eval $(kubectl completion zsh) ''; }; }; diff --git a/secrets.example.nix b/secrets.example.nix index fb4b202..cc73963 100644 --- a/secrets.example.nix +++ b/secrets.example.nix @@ -1,5 +1,9 @@ { - home = { + networking.extraHosts = '' + 127.0.0.2 other-localhost + ''; + + user = { name = "Bob"; dir = "/home/bob"; }; diff --git a/system/configuration.nix b/system/configuration.nix index b6a33d3..9987d5e 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -4,6 +4,9 @@ { config, pkgs, ... }: +let + secrets = import ../secrets.nix; +in { imports = [ # Include the results of the hardware scan. @@ -26,6 +29,8 @@ networking = { hostName = "home"; # Define your hostname. + inherit (secrets.networking) extraHosts; + networkmanager.enable = true; # The global useDHCP flag is deprecated, therefore explicitly set to false here. @@ -78,6 +83,7 @@ displayManager = { defaultSession = "none+xmonad"; }; + windowManager.xmonad.enable = true; }; }; @@ -94,14 +100,15 @@ programs.zsh.enable = true; - users.users.root.initialHashedPassword = ""; # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.janabhumi = { + users.users.me = with secrets.user; { isNormalUser = true; + inherit name; + home = dir; extraGroups = [ "wheel" # Enable ‘sudo’ for the user. "networkmanager" - "audio" + "docker" ]; shell = pkgs.zsh; }; @@ -109,8 +116,7 @@ # 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. + vim wget ]; @@ -122,6 +128,16 @@ enableSSHSupport = true; }; + virtualisation = { + docker = { + enable = true; + autoPrune = { + enable = true; + dates = "weekly"; + }; + }; + }; + nix = { # Automate garbage collection gc = { @@ -142,7 +158,6 @@ trusted-users = [ "root" "janabhumi" ]; }; - }; # Open ports in the firewall. diff --git a/system/hardware-configuration.nix b/system/hardware-configuration.nix index b78082e..9fd317e 100644 --- a/system/hardware-configuration.nix +++ b/system/hardware-configuration.nix @@ -8,7 +8,7 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; @@ -18,211 +18,11 @@ 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"; } ]; @@ -232,18 +32,8 @@ # 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; + # networking.interfaces.wlp11s0f3u2.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";