From 94ed8dba177438a6e7021da6e8150f6d253da95c Mon Sep 17 00:00:00 2001 From: natto1784 Date: Tue, 25 May 2021 23:34:11 +0530 Subject: [PATCH] Marisa: removed initrd kernel modules that are not required --- configs/nvim.nix | 54 +++++++++++++++ {home/config => configs}/nvim/init.vim | 0 {home/config => configs}/nvim/utils.vim | 0 configuration.nix | 15 +++++ flake.nix | 29 +++++--- home/ottan.nix | 37 ----------- home/stuff/programs/nvim.nix | 88 ------------------------- marisa.nix | 2 + marisa/boot.nix | 40 +---------- marisa/cachix.nix | 14 ++++ marisa/cachix/rpi4.nix | 12 ++++ marisa/hardware.nix | 2 +- marisa/networking.nix | 6 +- marisa/pkgs.nix | 10 ++- marisa/services.nix | 5 +- marisa/stuff.nix | 12 ++-- 16 files changed, 135 insertions(+), 191 deletions(-) create mode 100644 configs/nvim.nix rename {home/config => configs}/nvim/init.vim (100%) rename {home/config => configs}/nvim/utils.vim (100%) create mode 100755 configuration.nix mode change 100755 => 100644 flake.nix delete mode 100644 home/ottan.nix delete mode 100644 home/stuff/programs/nvim.nix create mode 100644 marisa/cachix.nix create mode 100644 marisa/cachix/rpi4.nix diff --git a/configs/nvim.nix b/configs/nvim.nix new file mode 100644 index 0000000..65bb903 --- /dev/null +++ b/configs/nvim.nix @@ -0,0 +1,54 @@ +{config, pkgs, ...}: +{ + programs.neovim = { + enable = true; + configure = { + customRC = '' + "theme + let g:gruvbox_italic=1 + let g:gruvbox_contrast_dark="hard" + let g:gruvbox_contrast_light="hard" + set background=dark + colorscheme gruvbox + '' + + builtins.readFile ./nvim/init.vim + + builtins.readFile ./nvim/utils.vim + + '' + "Floaterm + let g:floaterm_keymap_toggle = '' + let g:floaterm_keymap_next = '' + let g:floaterm_keymap_prev = '' + let g:floaterm_keymap_new = '' + let g:floaterm_gitcommit='floaterm' + let g:floaterm_autoinsert=1 + let g:floaterm_width=0.8 + let g:floaterm_height=0.8 + let g:floaterm_wintitle=0 + let g:floaterm_shell="/usr/bin/env zsh" + '' + +/* '' + "Colorizer + packadd! nvim-colorizer.lua + lua require'colorizer'.setup() + '' + +*/ '' + "closetag + let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js,*.erb,*.jsx" + let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.js,*.erb' + let g:closetag_emptyTags_caseSensitive = 1 + let g:closetag_shortcut = '>' + let g:closetag_close_shortcut = '>' + '' + + '' + "nerdcommenter + map NERDCommenterToggle + map NERDCommenterSexy + ''; + + packages.myVimPackage = with pkgs.vimPlugins; { + start = [ auto-pairs vim-floaterm vim-rooter vim-polyglot gruvbox vim-closetag vim-floaterm nerdcommenter]; + }; + }; + }; + } + diff --git a/home/config/nvim/init.vim b/configs/nvim/init.vim similarity index 100% rename from home/config/nvim/init.vim rename to configs/nvim/init.vim diff --git a/home/config/nvim/utils.vim b/configs/nvim/utils.vim similarity index 100% rename from home/config/nvim/utils.vim rename to configs/nvim/utils.vim diff --git a/configuration.nix b/configuration.nix new file mode 100755 index 0000000..bd1054e --- /dev/null +++ b/configuration.nix @@ -0,0 +1,15 @@ +{lib, config, ...}: +{ + imports = + [ + # + ./marisa/pkgs.nix + ./marisa/networking.nix + ./marisa/stuff.nix + ./marisa/hardware.nix + ./marisa/boot.nix + ./marisa/services.nix + ./configs/nvim.nix + ]; + system.stateVersion = "21.05"; +} diff --git a/flake.nix b/flake.nix old mode 100755 new mode 100644 index 6ae66b8..a7d1395 --- a/flake.nix +++ b/flake.nix @@ -16,21 +16,15 @@ outputs = inputs@{self, nixpkgs, ... }: inputs.utils.lib.eachDefaultSystem (system: - let - overlays = [ - (import ./overlays/overridesandshit.nix) - (import ./overlays/packages.nix) - ]; - in { packages = import nixpkgs { inherit system; - overlays = overlays ++ [ inputs.nur.overlay ]; + overlays = self.overlays ++ [ inputs.nur.overlay ]; config.allowUnfree = true; config.allowBroken = true; }; }) // - ( + ( { hm-configs = { natto = inputs.home-manager.lib.homeManagerConfiguration { @@ -46,7 +40,8 @@ homeDirectory = "/home/natto"; username = "natto"; }; - ottan = inputs.home-manager.lib.homeManagerConfiguration { + /* + ottan = inputs.home-manager.lib.homeManagerConfiguration { system = "aarch64-linux"; configuration = { lib, ... }: { imports = [ @@ -57,7 +52,7 @@ homeDirectory = "/home/ottan"; username = "ottan"; }; - + */ }; nixosConfigurations = { @@ -82,6 +77,20 @@ } ]; }; + Marisus = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + ./marisa.nix + # inputs.home-manager.nixosModules.home-manager + { + nixpkgs.pkgs = self.packages.x86_64-linux // {crossSystem.config = "aarch64-unknown-linux-gnu";}; + } + ]; + }; }; + overlays = [ + (import ./overlays/overridesandshit.nix) + (import ./overlays/packages.nix) + ]; }); } diff --git a/home/ottan.nix b/home/ottan.nix deleted file mode 100644 index 0cddfab..0000000 --- a/home/ottan.nix +++ /dev/null @@ -1,37 +0,0 @@ -{config, pkgs, lib, ...}: -let - home = config.home.homeDirectory; -in -{ - imports = [ - ./stuff/programs/nvim.nix - ./stuff/programs/emacs.nix - ./stuff/secret.nix - ]; - /* age = { - sshKeyPaths = [ "${home}/.ssh/id_ed25519" ]; - secrets = { - zshrc = { - file = ./secrets/.zshrc.age; - path = "${home}/.zshrc"; - mode = "660"; - }; - }; - };*/ - home = { - packages = with pkgs; [ - pamixer - curl - ]; - file = { - dwm-autostart = { - source = ./config/dwm/autostart.sh; - target = "${home}/.dwm/autostart.sh"; - }; - dwm-status = { - source = ./config/dwm/bruhstatus.sh; - target = "${home}/.dwm/bruhstatus.sh"; - }; - }; - }; -} diff --git a/home/stuff/programs/nvim.nix b/home/stuff/programs/nvim.nix deleted file mode 100644 index 02b9e9d..0000000 --- a/home/stuff/programs/nvim.nix +++ /dev/null @@ -1,88 +0,0 @@ -{config, pkgs, ...}: -let - plugs = { - floaterm = { - config = '' - let g:floaterm_keymap_toggle = '' - let g:floaterm_keymap_next = '' - let g:floaterm_keymap_prev = '' - let g:floaterm_keymap_new = '' - - let g:floaterm_gitcommit='floaterm' - let g:floaterm_autoinsert=1 - let g:floaterm_width=0.8 - let g:floaterm_height=0.8 - let g:floaterm_wintitle=0 - let g:floaterm_shell="/usr/bin/env zsh" - ''; - plugin = pkgs.vimPlugins.vim-floaterm; - }; - nvim-colorizer = { - plugin = pkgs.vimPlugins.nvim-colorizer-lua; - config = '' - packadd! nvim-colorizer.lua - lua require'colorizer'.setup() - ''; - }; - auto-pairs = { - plugin = pkgs.vimPlugins.auto-pairs; - }; - vim-closetag = { - config = '' - let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js,*.erb,*.jsx" - let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.js,*.erb' - let g:closetag_emptyTags_caseSensitive = 1 - let g:closetag_shortcut = '>' - let g:closetag_close_shortcut = '>' - ''; - plugin = pkgs.vimPlugins.vim-closetag; - }; - nerdcommenter = { - config = '' - map NERDCommenterToggle - map NERDCommenterSexy - ''; - plugin = pkgs.vimPlugins.nerdcommenter; - }; - vim-rooter = { - plugin = pkgs.vimPlugins.vim-rooter; - }; - vim-polyglot = { - plugin = pkgs.vimPlugins.vim-polyglot; - }; - themes = { - gruvbox = { - plugin = pkgs.vimPlugins.gruvbox; - }; - }; - }; -in - { - programs.neovim = { - enable = true; - vimAlias = false; - viAlias = false; - withNodeJs = false; - withPython = false; - extraConfig = '' - let g:gruvbox_italic=1 - let g:gruvbox_contrast_dark="hard" - let g:gruvbox_contrast_light="hard" - set background=dark - colorscheme gruvbox - '' + - builtins.readFile ../../config/nvim/init.vim + - builtins.readFile ../../config/nvim/utils.vim; - plugins = with plugs; [ - auto-pairs - # nvim-colorizer - floaterm - vim-rooter - nerdcommenter - vim-polyglot - vim-closetag - themes.gruvbox - ]; - }; - } - diff --git a/marisa.nix b/marisa.nix index ef17bd8..917a5cf 100755 --- a/marisa.nix +++ b/marisa.nix @@ -9,6 +9,8 @@ ./marisa/hardware.nix ./marisa/boot.nix ./marisa/services.nix + ./marisa/cachix.nix + ./configs/nvim.nix ]; system.stateVersion = "21.05"; } diff --git a/marisa/boot.nix b/marisa/boot.nix index 8dd422c..59c39f2 100755 --- a/marisa/boot.nix +++ b/marisa/boot.nix @@ -1,45 +1,7 @@ {config, ...}: { boot = { - initrd.availableKernelModules = [ "xhci_pci" "usb_storage" "usbhid" "uas" -"ahci" - - "ata_piix" - - "sata_inic162x" "sata_nv" "sata_promise" "sata_qstor" - "sata_sil" "sata_sil24" "sata_sis" "sata_svw" "sata_sx4" - "sata_uli" "sata_via" "sata_vsc" - - "vc4" - - "pcie-brcmstb" - - # Rockchip - "dw-hdmi" - "dw-mipi-dsi" - "rockchipdrm" - "rockchip-rga" - "phy-rockchip-pcie" - "pcie-rockchip-host" - - # Misc. uncategorized hardware - - # Used for some platform's integrated displays - "panel-simple" - "pwm-bl" - - # Power supply drivers, some platforms need them for USB - "axp20x-ac-power" - "axp20x-battery" - "pinctrl-axp209" - "mp8859" - - # USB drivers - "xhci-pci-renesas" -]; - initrd.kernelModules = [ ]; - kernelModules = [ ]; - extraModulePackages = [ ]; + initrd.availableKernelModules = [ "xhci_pci" "usb_storage" "usbhid" "uas" "pcie-brcmstb"]; loader = { grub.enable = false; generic-extlinux-compatible.enable= true; diff --git a/marisa/cachix.nix b/marisa/cachix.nix new file mode 100644 index 0000000..cce90a3 --- /dev/null +++ b/marisa/cachix.nix @@ -0,0 +1,14 @@ + +# WARN: this file will get overwritten by $ cachix use +{ pkgs, lib, ... }: + +let + folder = ./cachix; + toImport = name: value: folder + ("/" + name); + filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; + imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); +in { + inherit imports; + nix.binaryCaches = ["https://cache.nixos.org/"]; +} + \ No newline at end of file diff --git a/marisa/cachix/rpi4.nix b/marisa/cachix/rpi4.nix new file mode 100644 index 0000000..f678710 --- /dev/null +++ b/marisa/cachix/rpi4.nix @@ -0,0 +1,12 @@ + +{ + nix = { + binaryCaches = [ + "https://rpi4.cachix.org" + ]; + binaryCachePublicKeys = [ + "rpi4.cachix.org-1:fMaYBuIlj/Sa9YTXnXMXoXnVZEoVhnFxOkxseKKlku8=" + ]; + }; +} + \ No newline at end of file diff --git a/marisa/hardware.nix b/marisa/hardware.nix index ba0ad5c..9e56b8e 100755 --- a/marisa/hardware.nix +++ b/marisa/hardware.nix @@ -18,5 +18,5 @@ swapDevices = [ ]; powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; - hardware.firmware = with pkgs; [ raspberrypiWirelessFirmware ]; + hardware.firmware = [ pkgs.raspberrypiWirelessFirmware ]; } diff --git a/marisa/networking.nix b/marisa/networking.nix index 7a1d487..30f2043 100755 --- a/marisa/networking.nix +++ b/marisa/networking.nix @@ -2,8 +2,10 @@ { networking = { hostName = "Marisa"; - wireless.enable = false; - wireless.iwd.enable = true; + wireless = { + enable = false; + iwd.enable = true; + }; interfaces = { wlan0 = { useDHCP = false; diff --git a/marisa/pkgs.nix b/marisa/pkgs.nix index 73342c2..eb1189f 100755 --- a/marisa/pkgs.nix +++ b/marisa/pkgs.nix @@ -1,19 +1,16 @@ {lib, config, pkgs, ...}: { environment.systemPackages = with pkgs; [ - p7zip git gnumake - neofetch - kbd htop vim - wget + libraspberrypi ]; programs = { zsh = { enable = true; - promptInit = "PROMPT='%F{cyan}%~ %F{blue}>%f '\nRPROMPT='%F{cyan}%n%f@%F{red}%m'"; + promptInit = "PROMPT='%B%F{cyan}%~ %F{blue}>%f%b '\nRPROMPT='%B%F{cyan}%n%f@%F{red}%m%b'"; histSize = 12000; enableCompletion = true; syntaxHighlighting.enable = true; @@ -23,6 +20,7 @@ gnupg = { agent = { enable = true; + pinentryFlavor = "curses"; }; }; }; @@ -31,6 +29,6 @@ extraOptions = '' experimental-features = nix-command ca-references flakes ''; - trustedUsers = [ "root" "ottan" ]; + trustedUsers = [ "root" ]; }; } diff --git a/marisa/services.nix b/marisa/services.nix index c43ec10..2df0470 100755 --- a/marisa/services.nix +++ b/marisa/services.nix @@ -1,6 +1,9 @@ {config, ...}: { services = { - sshd.enable = true; + openssh = { + enable = true; + permitRootLogin = "yes"; + }; }; } diff --git a/marisa/stuff.nix b/marisa/stuff.nix index 780369f..5d4e904 100755 --- a/marisa/stuff.nix +++ b/marisa/stuff.nix @@ -12,7 +12,7 @@ enable = true; extraRules = [ { - users = [ "ottan" ]; + users = [ ]; keepEnv = true; persist = true; } @@ -22,10 +22,8 @@ fonts.fonts = with pkgs; [ fira-mono ]; - users.users.ottan = { - isNormalUser = true; - shell = pkgs.zsh; - home = "/home/ottan"; - extraGroups = [ "wheel" ]; - }; + documentation.enable = false; + users.extraUsers.root = { + shell = pkgs.zsh; + }; }