diff --git a/config.nix b/config.nix index 90c79bf..47f6b9f 100644 --- a/config.nix +++ b/config.nix @@ -1,15 +1,11 @@ { config, lib, pkgs, ... }: let - scripts = import ./dot/scripts.nix pkgs; - constants = import ./constants.nix; - wallpaper = pkgs.copyPathToStore ./art/haskell-grey.png; - theme = { - gtk = { name = "Numix-SX-Dark"; package = pkgs.numix-sx-gtk-theme; }; - icon = { name = "Papirus-Adapta-Nokto"; package = pkgs.papirus-icon-theme; }; - }; + scripts = import ./dot/scripts.nix { inherit pkgs; }; + helpers = import ./helpers.nix; in { imports = [ "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos" + ./options.nix ./configs/shells.nix ./configs/editors.nix ./configs/graphics.nix @@ -64,8 +60,7 @@ in { services.redshift = { enable = true; - latitude = "52"; - longitude = "13"; + provider = "geoclue2"; temperature = { night = 25000; day = 1000; }; }; @@ -76,7 +71,6 @@ in { terminal = "screen-256color"; }; - # networking.hostName = "scardanelli"; networking.hosts = { "192.168.178.27" = [ "printer.local" ]; }; @@ -85,20 +79,21 @@ in { networking.wireless.networks = { Aether = { pskRaw = "e1b18af54036c5c9a747fe681c6a694636d60a5f8450f7dec0d76bc93e2ec85a"; }; "Asoziales Netzwerk" = { pskRaw = "8e234041ec5f0cd1b6a14e9adeee9840ed51b2f18856a52137485523e46b0cb6"; }; + "c-base-public" = {}; }; home-manager.users.kfm = { gtk = { enable = true; font = with import ./theme.nix; { package = pkgs.roboto; name = uiFont.name; }; - iconTheme = theme.icon; - theme = theme.gtk; + iconTheme = config.constants.theme.icon; + theme = config.constants.theme.gtk; }; programs.git = { enable = true; - userName = constants.user.name; - userEmail = constants.user.email; + userName = config.constants.user.name; + userEmail = config.constants.user.email; aliases = { br = "branch"; co = "checkout"; @@ -110,24 +105,37 @@ in { last = "log -1 HEAD"; pull-all = "!${scripts.git-pull-all}"; }; - ignores = constants.ignoredFiles; + ignores = config.constants.ignore; }; programs.rofi = with import ./theme.nix; { enable = true; separator = "solid"; scrollbar = false; + terminal = config.defaultApplications.terminal; borderWidth = 0; lines = 5; font = "${uiFont.name} ${toString (uiFont.size + 1)}"; - colors = { + colors = rec { window = { background = black; border = black; separator = gray.dark; }; rows = { normal = { - background = black; + background = window.background; + backgroundAlt = window.background; foreground = gray.light; - backgroundAlt = black; - highlight = { background = black; foreground = white; }; + highlight = { foreground = white; inherit (window) background; }; + }; + active = { + background = window.background; + backgroundAlt = window.background; + foreground = blue.dark; + highlight = { foreground = blue.light; inherit (window) background; }; + }; + urgent = { + background = window.background; + backgroundAlt = window.background; + foreground = red.dark; + highlight = { foreground = red.light; inherit (window) background; }; }; }; }; @@ -137,7 +145,7 @@ in { services.dunst = with import ./theme.nix; { enable = true; - iconTheme = theme.icon; + iconTheme = config.constants.theme.icon; settings = { global = { transparency = 10; @@ -180,9 +188,9 @@ in { }; home.file = { - ".background-image".source = wallpaper; - ".ghci".text = import ./dot/ghci.nix pkgs; - ".stack/config.yaml".text = import ./dot/stack.nix constants.user; + ".background-image".source = config.constants.wallpaper; + ".ghci".text = import ./dot/ghci.nix { inherit pkgs; }; + ".stack/config.yaml".text = import ./dot/stack.nix { user = config.constants.user; }; ".config/zathura/zathurarc".text = "set selection-clipboard clipboard"; ".config/mpv/input.conf".text = import ./dot/mpv.nix; ".config/xfce4/terminal/terminalrc".text = import ./dot/terminal.nix; diff --git a/configs/editors.nix b/configs/editors.nix index 775a17f..05f80eb 100644 --- a/configs/editors.nix +++ b/configs/editors.nix @@ -1,5 +1,6 @@ -{ pkgs, ... }: -let vim_conf = with import ../constants.nix; '' +{ pkgs, config, ... }: +with import ../helpers.nix; +let vim_conf = '' " if tabular vmap a= :Tabularize /= vmap a; :Tabularize /:: @@ -14,7 +15,7 @@ let vim_conf = with import ../constants.nix; '' set number set path=$PWD/** set completeopt=menu,longest - set wildmode=longest,full,list wildignore+=${commaSep ignoredFiles} + set wildmode=list:longest wildignore+=${commaSep config.constants.ignore} set shortmess+=aI set nowritebackup noswapfile set mouse=a diff --git a/configs/graphics.nix b/configs/graphics.nix index a322b94..90c9768 100644 --- a/configs/graphics.nix +++ b/configs/graphics.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, config, ... }: let spotify_info = pkgs.writeBash "spotify.info" '' STATUS=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$) @@ -26,7 +26,7 @@ let ''; battery_info = pkgs.writeBash "battery.info" '' BAT_DIR="/sys/class/power_supply/$BLOCK_INSTANCE/" - [ -d BAT_DIR ] && cd BAT_DIR || exit 1 + [ -d $BAT_DIR ] && cd $BAT_DIR || exit 1 status=$(cat status) charge_f=$((100 * $(cat charge_now) / $(cat charge_full))) @@ -122,15 +122,6 @@ let [separator] - [brightness] - command=printf "%.1f%%" $(${pkgs.xorg.xbacklight}/bin/xbacklight) - label= - min_width= 100% - signal=2 - interval=once - - [separator] - [cpu_usage] command=cut -d' ' -f 1-3 < /proc/loadavg label= @@ -182,11 +173,12 @@ let new_window pixel 1 new_float pixel 1 - bindsym $mod+Return exec ${pkgs.xfce.terminal}/bin/xfce4-terminal - bindsym $mod+y exec ${pkgs.chromium}/bin/chrome-browser - bindsym $mod+t exec ${pkgs.xfce.thunar}/bin/thunar + bindsym $mod+Return exec ${config.defaultApplications.terminal} + bindsym $mod+y exec ${config.defaultApplications.browser} + bindsym $mod+t exec ${config.defaultApplications.fileManager} bindsym $mod+Shift+w exec ${pkgs.xautolock}/bin/xautolock -locknow bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -display-run — -show run + bindsym $mod+a exec ${pkgs.rofi}/bin/rofi -display-window — -show window bindsym $mod+Shift+q kill bindsym $mod+Left focus left @@ -243,8 +235,6 @@ let bindsym XF86AudioLowerVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5 && pkill -RTMIN+3 i3blocks bindsym XF86AudioRaiseVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5 && pkill -RTMIN+3 i3blocks bindsym XF86AudioMute exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t && pkill -RTMIN+3 i3blocks - bindsym XF86MonBrightnessUp exec --no-startup-id ${pkgs.light}/bin/light +A 10 && pkill -RTMIN+2 i3blocks - bindsym XF86MonBrightnessDown exec --no-startup-id ${pkgs.light}/bin/light -A 10 && pkill -RTMIN+2 i3blocks mode "  " { bindsym Left resize shrink width 10 px or 10 ppt @@ -284,17 +274,17 @@ let } ''; in { - services.xserver = with import ../constants.nix; with import ../theme.nix; { + services.xserver = with import ../helpers.nix; with import ../theme.nix; { enable = true; layout = commaSep [ "de" "gr" "ru" ]; xkbVariant = commaSep [ "T3" "polytonic" "phonetic_winkeys" ]; xkbOptions = commaSep [ "terminate:ctrl_alt_bksp" "grp:alt_space_toggle" ]; libinput.enable = true; - xautolock = let i3lock = "${pkgs.i3lock}/bin/i3lock -e -c ${lib.strings.removePrefix "#" black}"; in { + xautolock = { enable = true; time = 15; - locker = i3lock; - nowlocker = i3lock; + locker = config.defaultApplications.locker; + nowlocker = config.defaultApplications.locker; enableNotifier = true; notifier = ''${pkgs.libnotify}/bin/notify-send -u normal -a xautolock "Locking soon" "The screen will lock in 10 seconds."''; }; @@ -317,10 +307,11 @@ in { services.compton = { enable = true; - fade = true; shadow = true; menuOpacity = "0.9"; - shadowOpacity = "0.5"; - fadeDelta = 2; + shadowOpacity = "0.3"; }; + + services.illum.enable = true; + services.unclutter.enable = true; } diff --git a/configs/packages.nix b/configs/packages.nix index a773d9a..e17e309 100644 --- a/configs/packages.nix +++ b/configs/packages.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: with pkgs; { fonts.fonts = [ @@ -13,8 +13,10 @@ with pkgs; environment.systemPackages = [ chromium + config.constants.theme.gtk.package + config.constants.theme.icon.package ffmpeg - firefox firefoxPackages.tor-browser + firefox git gnumake htop @@ -27,6 +29,8 @@ with pkgs; pmount ripgrep tree rlwrap + tor-browser-bundle-bin + unzip w3m wget whois @@ -34,21 +38,28 @@ with pkgs; xfce.ristretto xfce.terminal xfce.thunar + xfce.tumbler + xorg.xbacklight + xorg.xcursorthemes + xorg.xkill youtubeDL zathura - zip unzip + zip ]; programs.command-not-found.enable = true; programs.java.enable = true; - programs.light.enable = true; users.users.kfm.packages = [ + (texlive.combine { inherit (pkgs.texlive) scheme-full latexmk; }) audacity biber + cabal-install + cabal2nix calibre clojure ctags + dropbox-cli franz fsharp gcc @@ -59,8 +70,9 @@ with pkgs; haskellPackages.hasktags haskellPackages.hindent haskellPackages.hoogle - haskellPackages.idris - haskellPackages.pandoc haskellPackages.pandoc-citeproc + haskellPackages.pandoc + haskellPackages.pandoc-citeproc + idris inkscape jo lua @@ -79,7 +91,6 @@ with pkgs; spotify stack swiProlog - texlive.combined.scheme-tetex tinycc ]; diff --git a/configs/shells.nix b/configs/shells.nix index 3ac4819..bb28a89 100644 --- a/configs/shells.nix +++ b/configs/shells.nix @@ -1,5 +1,5 @@ { pkgs, ... }: -let scripts = import ../dot/scripts.nix pkgs; +let scripts = import ../dot/scripts.nix { inherit pkgs; }; in { environment.shellAliases = let rlwrap = cmd: "${pkgs.rlwrap}/bin/rlwrap ${cmd}"; @@ -12,7 +12,6 @@ in { ip = "${pkgs.iproute}/bin/ip -c"; ocaml = rlwrap "${pkgs.ocaml}/bin/ocaml"; tmux = "${pkgs.tmux}/bin/tmux -2"; - gdrive = ''sh -c "cd ~/google-drive && ${pkgs.grive2}/bin/grive" >/dev/null 2>&1 &''; } // scripts; environment.extraInit = '' @@ -56,7 +55,7 @@ in { }; programs.bash = { - promptInit = ''PS1="$(tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(tput sgr0) ''; + promptInit = ''PS1="$(tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(tput sgr0) "''; enableCompletion = true; }; diff --git a/constants.nix b/constants.nix deleted file mode 100644 index cacfa7d..0000000 --- a/constants.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - commaSep = strs: builtins.concatStringsSep "," strs; - - ignoredFiles = [ "*~" ".stack-work/" "__pycache__/" ".mypy_cache/" "*.o" "*.hi" "*.aux" "*.class" "*.dyn_hi" "*.dyn_o" ]; - - user = { - github = "kmein"; - name = "Kierán Meinhardt"; - email = "kieran.meinhardt@gmail.com"; - }; -} diff --git a/dot/ghci.nix b/dot/ghci.nix index 486215e..b6a56a6 100644 --- a/dot/ghci.nix +++ b/dot/ghci.nix @@ -1,4 +1,4 @@ -pkgs: +{ pkgs }: '' :set editor vim :def hoogle \x -> return $ ":!${pkgs.haskellPackages.hoogle}/bin/hoogle --color \"" ++ x ++ "\" " diff --git a/dot/scripts.nix b/dot/scripts.nix index 2671c33..452014f 100644 --- a/dot/scripts.nix +++ b/dot/scripts.nix @@ -1,4 +1,4 @@ -pkgs: +{ pkgs }: let bingWallpaper = pkgs.writeBash "bing-wallpaper.sh" '' PICTURE_DIR="$HOME/pictures/external/bing/" diff --git a/dot/stack.nix b/dot/stack.nix index c4fc889..9e3bc18 100644 --- a/dot/stack.nix +++ b/dot/stack.nix @@ -1,4 +1,4 @@ -user: +{ user }: '' templates: params: diff --git a/helpers.nix b/helpers.nix new file mode 100644 index 0000000..be82438 --- /dev/null +++ b/helpers.nix @@ -0,0 +1,3 @@ +{ + commaSep = builtins.concatStringsSep ","; +} diff --git a/options.nix b/options.nix new file mode 100644 index 0000000..73eb5a3 --- /dev/null +++ b/options.nix @@ -0,0 +1,46 @@ +{ lib, pkgs, ... }: +with lib; +with import ./theme.nix; +let + stringOption = def: mkOption { type = types.string; default = def; }; + themeOption = def: mkOption { + type = types.submodule { + options = { + name = mkOption { type = types.string; default = def.name; }; + package = mkOption { type = types.package; default = def.package; }; + }; + }; + default = def; + }; +in { + options.defaultApplications = mapAttrs (const stringOption) { + terminal = "${pkgs.xfce.terminal}/bin/xfce4-terminal"; + browser = "${pkgs.chromium}/bin/chromium"; + fileManager = "${pkgs.xfce.thunar}/bin/thunar"; + locker = "${pkgs.i3lock}/bin/i3lock -e -c ${strings.removePrefix "#" black}"; + }; + + options.constants = { + user = mapAttrs (const stringOption) { + github = "kmein"; + name = "Kierán Meinhardt"; + email = "kieran.meinhardt@gmail.com"; + }; + + ignore = mkOption { + type = types.listOf types.string; + default = [ "*~" ".stack-work/" "__pycache__/" ".mypy_cache/" "*.o" "*.hi" "*.aux" "*.class" "*.dyn_hi" "*.dyn_o" "dist/" ]; + }; + + theme = mapAttrs (const themeOption) { + gtk = { name = "Paper"; package = pkgs.paper-gtk-theme; }; + icon = { name = "Paper"; package = pkgs.paper-icon-theme; }; + }; + + wallpaper = mkOption { + type = types.path; + default = pkgs.copyPathToStore ./art/haskell-grey.png; + }; + }; + +}