From 34fbb0f94530718c5442b7456d67ca86f25b92db Mon Sep 17 00:00:00 2001 From: Paul-Henri Froidmont Date: Fri, 21 Feb 2020 01:23:10 +0100 Subject: [PATCH] Split config --- configs/cli.nix | 73 +++++ {conf => configs/files}/ncmpcpp/bindings | 0 {conf => configs/files}/ncmpcpp/config | 0 {conf => configs/files}/scripts/mpd_status.sh | 0 {conf => configs/files}/xmobarrc | 4 +- {conf => configs/files}/xmonad.hs | 0 configs/gui.nix | 30 ++ configs/system.nix | 43 +++ configs/user.nix | 17 ++ configs/xmonad.nix | 144 +++++++++ copyToEtc.sh | 2 +- .../nixos-desktop/configuration.nix | 3 +- .../nixos-desktop/hardware-configuration.nix | 0 main.nix | 285 ------------------ 14 files changed, 312 insertions(+), 289 deletions(-) create mode 100644 configs/cli.nix rename {conf => configs/files}/ncmpcpp/bindings (100%) rename {conf => configs/files}/ncmpcpp/config (100%) rename {conf => configs/files}/scripts/mpd_status.sh (100%) rename {conf => configs/files}/xmobarrc (97%) rename {conf => configs/files}/xmonad.hs (100%) create mode 100644 configs/gui.nix create mode 100644 configs/system.nix create mode 100644 configs/user.nix create mode 100644 configs/xmonad.nix rename {machines => hosts}/nixos-desktop/configuration.nix (92%) rename {machines => hosts}/nixos-desktop/hardware-configuration.nix (100%) delete mode 100644 main.nix diff --git a/configs/cli.nix b/configs/cli.nix new file mode 100644 index 0000000..30e6d70 --- /dev/null +++ b/configs/cli.nix @@ -0,0 +1,73 @@ +{ config, lib, pkgs, ... }: +{ + home.packages = with pkgs; [ + zsh-syntax-highlighting + ]; + programs.neovim = { + enable = true; + vimAlias = true; + plugins = with pkgs; [ + vimPlugins.gruvbox-community + vimPlugins.vim-airline + vimPlugins.vim-airline-themes + vimPlugins.vim-gitgutter + vimPlugins.nerdtree + vimPlugins.nerdtree-git-plugin + vimPlugins.ctrlp-vim + vimPlugins.tabular + ]; + extraConfig = '' + let g:gruvbox_italic=1 + colorscheme gruvbox + set background=dark + let g:airline_powerline_fonts = 1 + autocmd VimEnter * hi Normal ctermbg=NONE guibg=NONE + + "Toggle NERDTree with Ctrl-N + map :NERDTreeToggle + + "Show hidden files in NERDTree + let NERDTreeShowHidden=1 + + set number relativenumber + + " Run xrdb whenever Xdefaults or Xresources are updated. + autocmd BufWritePost ~/.Xresources,~/.Xdefaults !xrdb % + ''; + }; + programs.broot = { + enable = true; + enableZshIntegration = true; + }; + programs.command-not-found.enable = true; + programs.zsh = { + enable = true; + history = { + save = 10000; + size = 10000; + }; + enableAutosuggestions = true; + initExtra = '' + autoload -Uz up-line-or-beginning-search down-line-or-beginning-search + zle -N up-line-or-beginning-search + zle -N down-line-or-beginning-search + + [[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search + [[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search + ''; + oh-my-zsh = { + enable = true; + plugins = [ + "git" + ]; + theme = "robbyrussell"; + }; + plugins = [ + { + name = "zsh-syntax-highlighting"; + file = "share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"; + src = "${pkgs.zsh-syntax-highlighting}"; + } + ]; + }; +} \ No newline at end of file diff --git a/conf/ncmpcpp/bindings b/configs/files/ncmpcpp/bindings similarity index 100% rename from conf/ncmpcpp/bindings rename to configs/files/ncmpcpp/bindings diff --git a/conf/ncmpcpp/config b/configs/files/ncmpcpp/config similarity index 100% rename from conf/ncmpcpp/config rename to configs/files/ncmpcpp/config diff --git a/conf/scripts/mpd_status.sh b/configs/files/scripts/mpd_status.sh similarity index 100% rename from conf/scripts/mpd_status.sh rename to configs/files/scripts/mpd_status.sh diff --git a/conf/xmobarrc b/configs/files/xmobarrc similarity index 97% rename from conf/xmobarrc rename to configs/files/xmobarrc index 9818c89..332235a 100644 --- a/conf/xmobarrc +++ b/configs/files/xmobarrc @@ -1,6 +1,6 @@ Config { - font = "xft:monospace:size=9.5:bold:antialias=true" - additionalFonts= ["xft:monospace:size=12:normal:antialias=true"] + font = "xft:monospace:size=11.5:bold:antialias=true" + additionalFonts= ["xft:monospace:size=14:normal:antialias=true"] , bgColor = "#282828" , fgColor = "#ebdbb2" , position = TopW L 94 diff --git a/conf/xmonad.hs b/configs/files/xmonad.hs similarity index 100% rename from conf/xmonad.hs rename to configs/files/xmonad.hs diff --git a/configs/gui.nix b/configs/gui.nix new file mode 100644 index 0000000..16560a2 --- /dev/null +++ b/configs/gui.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, ... }: +{ + nixpkgs.config.allowUnfree = true; + nixpkgs.config.packageOverrides = pkgs: { + nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { + inherit pkgs; + }; + }; + home.packages = with pkgs; [ + jetbrains.idea-ultimate + keepassxc + krita + riot-desktop + steam + mpv + mumble + ]; + programs.firefox = { + enable = true; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + keepassxc-browser + ublock-origin + umatrix + cookie-autodelete + dark-night-mode + ]; + }; + + services.nextcloud-client.enable = true; +} \ No newline at end of file diff --git a/configs/system.nix b/configs/system.nix new file mode 100644 index 0000000..559b524 --- /dev/null +++ b/configs/system.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + wget + inetutils + + man + + vim + git + + htop + ncdu + pciutils + ]; + fonts = { + fonts = with pkgs; [ + meslo-lg + nerdfonts + ]; + fontconfig.defaultFonts = { + monospace = [ "MesloLGMDZ Nerd Font Mono" ]; + }; + }; + + sound.enable = true; + hardware.pulseaudio.enable = true; + hardware.opengl.driSupport32Bit = true; + hardware.pulseaudio.support32Bit = true; + + users.users.froidmpa = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + shell = pkgs.zsh; + }; + + services.xserver = { + enable = true; + layout = "fr"; + desktopManager.xterm.enable = false; + windowManager.xmonad.enable = true; + }; +} \ No newline at end of file diff --git a/configs/user.nix b/configs/user.nix new file mode 100644 index 0000000..8c6e6eb --- /dev/null +++ b/configs/user.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: +{ + imports = [ + + ]; + + home-manager.users.froidmpa = {pkgs, config, ...}: { + imports = [ + ./cli.nix + ./xmonad.nix + ./gui.nix + ]; + }; + + system.stateVersion = "19.09"; +} + diff --git a/configs/xmonad.nix b/configs/xmonad.nix new file mode 100644 index 0000000..30718ad --- /dev/null +++ b/configs/xmonad.nix @@ -0,0 +1,144 @@ +{ config, lib, pkgs, ... }: +{ + xsession = { + enable = true; + windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + config = ./files/xmonad.hs; + }; + }; + nixpkgs.config.packageOverrides = pkgs: { + ncmpcpp = pkgs.ncmpcpp.override {visualizerSupport = true;}; + }; + home.packages = with pkgs; [ + haskellPackages.xmobar + ncmpcpp + mpc_cli + pulsemixer + feh + xorg.xinit + xorg.xwininfo + xorg.xkill + scrot + ]; + home.keyboard = { + layout = "fr"; + options = ["caps:escape"]; + }; + home.file.".xmonad/xmobarrc".source = ./files/xmobarrc; + home.file.".config/ncmpcpp" = { + source = ./files/ncmpcpp; + recursive = true; + }; + home.file.".xmonad/scripts" = { + source = ./files/scripts; + recursive = true; + }; + services.gpg-agent = { enable = true; enableSshSupport = true; }; + services.gnome-keyring = { + enable = true; + components = ["pkcs11" "secrets"]; + }; + services.mpd = { + enable = true; + musicDirectory = "${config.home.homeDirectory}/Nextcloud/Media/Music"; + }; + programs.rofi = { + enable = true; + theme = "gruvbox-dark"; + terminal = "urxvt"; + }; + + programs.urxvt = { + enable = true; + fonts = ["xft:monospace:size=12:antialias=true"]; + scroll = { + bar.enable = false; + lines = 65535; + }; + extraConfig = { + "background" = "rgba:28ff/28ff/28ff/cf00"; + "foreground" = "#ebdbb2"; + "color0" = "#282828"; + "color8" = "#928374"; + "color1" = "#cc241d"; + "color9" = "#fb4934"; + "color2" = "#98971a"; + "color10" = "#b8bb26"; + "color3" = "#d79921"; + "color11" = "#fabd2f"; + "color4" = "#458588"; + "color12" = "#83a598"; + "color5" = "#b16286"; + "color13" = "#d3869b"; + "color6" = "#689d6a"; + "color14" = "#8ec07c"; + "color7" = "#a89984"; + "color15" = "#ebdbb2"; + "termName" = "rxvt-256color"; + "letterSpace" = "-1"; + "internalBorder" = "10"; + "depth" = "32"; + }; + }; + + services.compton.enable = true; + services.stalonetray = { + enable = true; + config = { + geometry = "1x1-5+0"; + background = "#000000"; + transparent = true; + grow_gravity = "E"; + icon_gravity = "E"; + icon_size = "24"; + kludges = "force_icons_size"; + }; + }; + services.unclutter.enable = true; + services.pasystray.enable = true; + services.dunst = { + enable = true; + settings = { + global = { + monitor = 0; + geometry = "350x5-30+50"; + transparency = 10; + font = "monospace 14"; + idle_threshold = 120; + allow_markup = "yes"; + format = "%s\n%b"; + show_age_threshold = 300; + word_wrap = "yes"; + sticky_history = "yes"; + sort = "yes"; + }; + frame = { + width = 3; + color = "#ebdbb2"; + }; + shortcuts = { + close = "ctrl+space"; + close_all = "ctrl+shift+space"; + history = "ctrl+grave"; + context = "ctrl+shift+period"; + }; + urgency_low = { + foreground = "#ebdbb2"; + background = "#32302f"; + timeout = 10; + }; + urgency_normal = { + foreground = "#ebdbb2"; + background = "#32302f"; + timeout = 10; + }; + urgency_critical = { + foreground = "#ebdbb2"; + background = "#32302f"; + timeout = 10; + }; + }; + }; +} \ No newline at end of file diff --git a/copyToEtc.sh b/copyToEtc.sh index 7783f03..24b898c 100755 --- a/copyToEtc.sh +++ b/copyToEtc.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -sudo cp -r conf machines main.nix /etc/nixos/ \ No newline at end of file +sudo cp -r configs hosts /etc/nixos/ \ No newline at end of file diff --git a/machines/nixos-desktop/configuration.nix b/hosts/nixos-desktop/configuration.nix similarity index 92% rename from machines/nixos-desktop/configuration.nix rename to hosts/nixos-desktop/configuration.nix index f9c83e7..5775c97 100644 --- a/machines/nixos-desktop/configuration.nix +++ b/hosts/nixos-desktop/configuration.nix @@ -2,7 +2,8 @@ { imports = [ ./hardware-configuration.nix - ../../main.nix + ../../configs/system.nix + ../../configs/user.nix ]; fileSystems."/home/froidmpa/Nextcloud" = { diff --git a/machines/nixos-desktop/hardware-configuration.nix b/hosts/nixos-desktop/hardware-configuration.nix similarity index 100% rename from machines/nixos-desktop/hardware-configuration.nix rename to hosts/nixos-desktop/hardware-configuration.nix diff --git a/main.nix b/main.nix deleted file mode 100644 index 3f212e4..0000000 --- a/main.nix +++ /dev/null @@ -1,285 +0,0 @@ -{ config, pkgs, ... }: -{ - imports = [ - - ]; - - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - wget - inetutils - - man - - vim - git - - htop - ncdu - ]; - fonts = { - fonts = with pkgs; [ - meslo-lg - nerdfonts - ]; - fontconfig.defaultFonts = { - monospace = [ "MesloLGMDZ Nerd Font Mono" ]; - }; - }; - - sound.enable = true; - hardware.pulseaudio.enable = true; - hardware.opengl.driSupport32Bit = true; - hardware.pulseaudio.support32Bit = true; - - services.xserver = { - enable = true; - layout = "fr"; - desktopManager.xterm.enable = false; - windowManager.xmonad.enable = true; - }; - - users.users.froidmpa = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - shell = pkgs.zsh; - }; - - home-manager.users.froidmpa = {pkgs, config, ...}: { - xsession = { - enable = true; - windowManager.xmonad = { - enable = true; - enableContribAndExtras = true; - config = ./conf/xmonad.hs; - }; - }; - nixpkgs.config.allowUnfree = true; - nixpkgs.config.packageOverrides = pkgs: { - ncmpcpp = pkgs.ncmpcpp.override {visualizerSupport = true;}; - nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { - inherit pkgs; - }; - }; - home.packages = with pkgs; [ - jetbrains.idea-ultimate - haskellPackages.xmobar - keepassxc - zsh-syntax-highlighting - ncmpcpp - mpc_cli - pulsemixer - krita - feh - riot-desktop - steam - xorg.xinit - xorg.xwininfo - xorg.xkill - mpv - ]; - home.keyboard = { - layout = "fr"; - options = ["caps:escape"]; - }; - home.file.".xmonad/xmobarrc".source = ./conf/xmobarrc; - home.file.".config/ncmpcpp" = { - source = ./conf/ncmpcpp; - recursive = true; - }; - home.file.".xmonad/scripts" = { - source = ./conf/scripts; - recursive = true; - }; - - programs.firefox = { - enable = true; - extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - keepassxc-browser - ublock-origin - umatrix - cookie-autodelete - dark-night-mode - ]; - }; - - programs.rofi = { - enable = true; - theme = "gruvbox-dark"; - terminal = "urxvt"; - }; - - programs.urxvt = { - enable = true; - fonts = ["xft:monospace:size=11:antialias=true"]; - scroll = { - bar.enable = false; - lines = 65535; - }; - extraConfig = { - "background" = "rgba:28ff/28ff/28ff/cf00"; - "foreground" = "#ebdbb2"; - "color0" = "#282828"; - "color8" = "#928374"; - "color1" = "#cc241d"; - "color9" = "#fb4934"; - "color2" = "#98971a"; - "color10" = "#b8bb26"; - "color3" = "#d79921"; - "color11" = "#fabd2f"; - "color4" = "#458588"; - "color12" = "#83a598"; - "color5" = "#b16286"; - "color13" = "#d3869b"; - "color6" = "#689d6a"; - "color14" = "#8ec07c"; - "color7" = "#a89984"; - "color15" = "#ebdbb2"; - "termName" = "rxvt-256color"; - "letterSpace" = "-1"; - "internalBorder" = "10"; - "depth" = "32"; - }; - }; - programs.neovim = { - enable = true; - vimAlias = true; - plugins = with pkgs; [ - vimPlugins.gruvbox-community - vimPlugins.vim-airline - vimPlugins.vim-airline-themes - vimPlugins.vim-gitgutter - vimPlugins.nerdtree - vimPlugins.nerdtree-git-plugin - vimPlugins.ctrlp-vim - vimPlugins.tabular - ]; - extraConfig = '' - let g:gruvbox_italic=1 - colorscheme gruvbox - set background=dark - let g:airline_powerline_fonts = 1 - autocmd VimEnter * hi Normal ctermbg=NONE guibg=NONE - - "Toggle NERDTree with Ctrl-N - map :NERDTreeToggle - - "Show hidden files in NERDTree - let NERDTreeShowHidden=1 - - set number relativenumber - - " Run xrdb whenever Xdefaults or Xresources are updated. - autocmd BufWritePost ~/.Xresources,~/.Xdefaults !xrdb % - ''; - }; - programs.broot = { - enable = true; - enableZshIntegration = true; - enableFishIntegration = true; - }; - programs.zsh = { - enable = true; - history = { - save = 10000; - size = 10000; - }; - enableAutosuggestions = true; - initExtra = '' - autoload -Uz up-line-or-beginning-search down-line-or-beginning-search - zle -N up-line-or-beginning-search - zle -N down-line-or-beginning-search - - [[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search - [[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search - ''; - oh-my-zsh = { - enable = true; - plugins = [ - "git" - ]; - theme = "robbyrussell"; - }; - plugins = [ - { - name = "zsh-syntax-highlighting"; - file = "share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"; - src = "${pkgs.zsh-syntax-highlighting}"; - } - ]; - }; - programs.command-not-found.enable = true; - services.compton.enable = true; - services.stalonetray = { - enable = true; - config = { - geometry = "1x1-50+0"; - background = "#000000"; - transparent = true; - grow_gravity = "E"; - icon_gravity = "NE"; - icon_size = "20"; - }; - }; - services.unclutter.enable = true; - services.pasystray.enable = true; - services.mpd = { - enable = true; - musicDirectory = "${config.home.homeDirectory}/Nextcloud/Media/Music"; - }; - services.dunst = { - enable = true; - settings = { - global = { - monitor = 0; - geometry = "350x5-30+50"; - transparency = 10; - font = "monospace 14"; - idle_threshold = 120; - allow_markup = "yes"; - format = "%s\n%b"; - show_age_threshold = 300; - word_wrap = "yes"; - sticky_history = "yes"; - sort = "yes"; - }; - frame = { - width = 3; - color = "#ebdbb2"; - }; - shortcuts = { - close = "ctrl+space"; - close_all = "ctrl+shift+space"; - history = "ctrl+grave"; - context = "ctrl+shift+period"; - }; - urgency_low = { - foreground = "#ebdbb2"; - background = "#32302f"; - timeout = 10; - }; - urgency_normal = { - foreground = "#ebdbb2"; - background = "#32302f"; - timeout = 10; - }; - urgency_critical = { - foreground = "#ebdbb2"; - background = "#32302f"; - timeout = 10; - }; - }; - }; - services.nextcloud-client.enable = true; - services.gpg-agent = { enable = true; enableSshSupport = true; }; - services.gnome-keyring = { - enable = true; - components = ["pkcs11" "secrets"]; - }; - }; - - system.stateVersion = "19.09"; -} -