From 2369f43398f5734011fe341ec828b1b1efa05d8d Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Thu, 30 Jul 2020 22:17:28 -0600 Subject: [PATCH] format: apply nixpkgs-fmt --- cachix.nix | 8 +- cachix/nrdxp.nix | 2 - configuration.nix | 27 ++-- flake.nix | 39 +++--- hosts/default.nix | 68 +++++----- lib/utils.nix | 19 +-- modules/security/mitigations.nix | 3 +- modules/services/games/gamemode.nix | 4 +- .../services/hardware/wii-u-gc-adapter.nix | 4 +- modules/services/torrent/qbittorrent.nix | 3 +- .../services/x11/window-managers/steam.nix | 4 +- overlays/pcsx2.nix | 3 +- overlays/retroarch.nix | 3 +- overlays/slock.nix | 3 +- .../sddm/themes/chili/default.nix | 3 +- .../window-managers/steamcompmgr/default.nix | 16 ++- pkgs/data/fonts/dejavu-nerdfont/default.nix | 3 +- .../development/libraries/libinih/default.nix | 3 +- pkgs/os-specific/linux/gamemode/default.nix | 14 ++- pkgs/shells/zsh/pure/default.nix | 3 +- pkgs/shells/zsh/purs/default.nix | 3 +- profiles/core.nix | 6 +- profiles/develop/python/default.nix | 65 +++++----- profiles/develop/tmux/default.nix | 13 +- profiles/develop/zsh/default.nix | 117 ++++++++++-------- profiles/graphical/default.nix | 25 ++-- profiles/graphical/misc/volnoti.nix | 3 +- profiles/graphical/qutebrowser/default.nix | 17 +-- profiles/graphical/sway/default.nix | 6 +- profiles/graphical/xmonad/_xmonad.nix | 3 +- profiles/graphical/xmonad/xmonad.hs.nix | 5 +- profiles/im/default.nix | 1 - profiles/laptop/default.nix | 26 ++-- profiles/misc/adblocking.nix | 6 +- profiles/misc/torrent.nix | 3 +- profiles/postgres/default.nix | 1 - profiles/ssh/default.nix | 1 - profiles/virt/default.nix | 25 ++-- shell.nix | 3 +- 39 files changed, 319 insertions(+), 242 deletions(-) diff --git a/cachix.nix b/cachix.nix index cce90a3..32a3e8d 100644 --- a/cachix.nix +++ b/cachix.nix @@ -1,14 +1,12 @@ - # 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 { +in +{ inherit imports; - nix.binaryCaches = ["https://cache.nixos.org/"]; + nix.binaryCaches = [ "https://cache.nixos.org/" ]; } - \ No newline at end of file diff --git a/cachix/nrdxp.nix b/cachix/nrdxp.nix index c6a09b6..bb3b4a5 100644 --- a/cachix/nrdxp.nix +++ b/cachix/nrdxp.nix @@ -1,4 +1,3 @@ - { nix = { binaryCaches = [ @@ -9,4 +8,3 @@ ]; }; } - \ No newline at end of file diff --git a/configuration.nix b/configuration.nix index 59f7770..2e189a2 100644 --- a/configuration.nix +++ b/configuration.nix @@ -7,16 +7,18 @@ let hostname = lib.fileContents /etc/hostname; host = "/etc/nixos/hosts/${hostname}.nix"; - config = if (builtins.pathExists host) then - [ host ] - else - [ /etc/nixos/hosts/NixOS.nix ]; -in { + config = + if (builtins.pathExists host) then + [ host ] + else + [ /etc/nixos/hosts/NixOS.nix ]; +in +{ imports = (import ./modules/list.nix) ++ [ "${ builtins.fetchTarball - "https://github.com/rycee/home-manager/archive/master.tar.gz" - }/nixos" + "https://github.com/rycee/home-manager/archive/master.tar.gz" + }/nixos" /etc/nixos/profiles/core.nix ] ++ config; @@ -27,8 +29,11 @@ in { "nixpkgs-overlays=/etc/nixos/overlays" ]; - nixpkgs.overlays = let - overlays = map (name: import (./overlays + "/${name}")) - (attrNames (readDir ./overlays)); - in overlays; + nixpkgs.overlays = + let + overlays = map + (name: import (./overlays + "/${name}")) + (attrNames (readDir ./overlays)); + in + overlays; } diff --git a/flake.nix b/flake.nix index 60cd03c..2f6d10d 100644 --- a/flake.nix +++ b/flake.nix @@ -26,7 +26,8 @@ pkgs = pkgImport nixpkgs; unstablePkgs = pkgImport unstable; - in { + in + { nixosConfigurations = import ./hosts (inputs // { inherit system pkgs unstablePkgs utils; }); @@ -34,27 +35,31 @@ overlay = import ./pkgs; - overlays = let - overlayDir = ./overlays; - fullPath = name: overlayDir + "/${name}"; - overlayPaths = map fullPath (attrNames (readDir overlayDir)); - in pathsToImportedAttrs overlayPaths; + overlays = + let + overlayDir = ./overlays; + fullPath = name: overlayDir + "/${name}"; + overlayPaths = map fullPath (attrNames (readDir overlayDir)); + in + pathsToImportedAttrs overlayPaths; packages."${system}" = self.overlay pkgs pkgs; - nixosModules = let - # binary cache - cachix = import ./cachix.nix; - cachixAttrs = { inherit cachix; }; + nixosModules = + let + # binary cache + cachix = import ./cachix.nix; + cachixAttrs = { inherit cachix; }; - # modules - moduleList = import ./modules/list.nix; - modulesAttrs = pathsToImportedAttrs moduleList; + # modules + moduleList = import ./modules/list.nix; + modulesAttrs = pathsToImportedAttrs moduleList; - # profiles - profilesList = import ./profiles/list.nix; - profilesAttrs = { profiles = pathsToImportedAttrs profilesList; }; + # profiles + profilesList = import ./profiles/list.nix; + profilesAttrs = { profiles = pathsToImportedAttrs profilesList; }; - in cachixAttrs // modulesAttrs // profilesAttrs; + in + cachixAttrs // modulesAttrs // profilesAttrs; }; } diff --git a/hosts/default.nix b/hosts/default.nix index f51e1c3..5d391f9 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -8,46 +8,49 @@ let lib.nixosSystem { inherit system; - modules = let - inherit (home.nixosModules) home-manager; + modules = + let + inherit (home.nixosModules) home-manager; - core = self.nixosModules.profiles.core; + core = self.nixosModules.profiles.core; - global = { - networking.hostName = hostName; - nix.nixPath = [ - "nixpkgs=${nixpkgs}" - "nixos-config=/etc/nixos/configuration.nix" - "nixpkgs-overlays=/etc/nixos/overlays" - ]; + global = { + networking.hostName = hostName; + nix.nixPath = [ + "nixpkgs=${nixpkgs}" + "nixos-config=/etc/nixos/configuration.nix" + "nixpkgs-overlays=/etc/nixos/overlays" + ]; - nixpkgs = { inherit pkgs; }; + nixpkgs = { inherit pkgs; }; - nix.registry = { - nixpkgs.flake = nixpkgs; - nixflk.flake = self; - master.flake = unstable; + nix.registry = { + nixpkgs.flake = nixpkgs; + nixflk.flake = self; + master.flake = unstable; + }; }; - }; - unstables = { - systemd.package = unstablePkgs.systemd; - nixpkgs.overlays = [ - (final: prev: - with unstablePkgs; { - inherit starship element-desktop discord signal-desktop mpv - dhall; - }) - ]; - }; + unstables = { + systemd.package = unstablePkgs.systemd; + nixpkgs.overlays = [ + (final: prev: + with unstablePkgs; { + inherit starship element-desktop discord signal-desktop mpv + dhall; + } + ) + ]; + }; - local = import "${toString ./.}/${hostName}.nix"; + local = import "${toString ./.}/${hostName}.nix"; - # Everything in `./modules/list.nix`. - flakeModules = - attrValues (removeAttrs self.nixosModules [ "profiles" ]); + # Everything in `./modules/list.nix`. + flakeModules = + attrValues (removeAttrs self.nixosModules [ "profiles" ]); - in flakeModules ++ [ core global local home-manager unstables ]; + in + flakeModules ++ [ core global local home-manager unstables ]; }; @@ -55,4 +58,5 @@ let dir = ./.; _import = config; }; -in hosts +in +hosts diff --git a/lib/utils.nix b/lib/utils.nix index bd55d9a..f1aae4b 100644 --- a/lib/utils.nix +++ b/lib/utils.nix @@ -13,18 +13,21 @@ let # Generate an attribute set by mapping a function over a list of values. genAttrs' = values: f: listToAttrs (map f values); -in { +in +{ inherit mapFilterAttrs genAttrs'; recImport = { dir, _import ? base: import "${dir}/${base}.nix" }: - mapFilterAttrs (_: v: v != null) (n: v: - if n != "default.nix" && hasSuffix ".nix" n && v == "regular" + mapFilterAttrs + (_: v: v != null) + (n: v: + if n != "default.nix" && hasSuffix ".nix" n && v == "regular" + then + let name = removeSuffix ".nix" n; in nameValuePair (name) (_import name) - then - let name = removeSuffix ".nix" n; in nameValuePair (name) (_import name) - - else - nameValuePair ("") (null)) (readDir dir); + else + nameValuePair ("") (null)) + (readDir dir); # Convert a list to file paths to attribute set # that has the filenames stripped of nix extension as keys diff --git a/modules/security/mitigations.nix b/modules/security/mitigations.nix index 33e8b13..7f96431 100644 --- a/modules/security/mitigations.nix +++ b/modules/security/mitigations.nix @@ -8,7 +8,8 @@ let cmdline = '' ibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off ''; -in { +in +{ options = { security.mitigations.disable = mkOption { type = types.bool; diff --git a/modules/services/games/gamemode.nix b/modules/services/games/gamemode.nix index 7a47348..cc0149d 100644 --- a/modules/services/games/gamemode.nix +++ b/modules/services/games/gamemode.nix @@ -1,9 +1,9 @@ { config, lib, pkgs, ... }: with lib; - let cfg = config.services.gamemode; -in { +in +{ options.services.gamemode = { enable = mkOption { type = types.bool; diff --git a/modules/services/hardware/wii-u-gc-adapter.nix b/modules/services/hardware/wii-u-gc-adapter.nix index 39b4d64..3bfa1b7 100644 --- a/modules/services/hardware/wii-u-gc-adapter.nix +++ b/modules/services/hardware/wii-u-gc-adapter.nix @@ -1,9 +1,9 @@ { config, lib, pkgs, ... }: with lib; - let cfg = config.services.wii-u-gc-adapter; -in { +in +{ options = { services.wii-u-gc-adapter = { enable = mkOption { diff --git a/modules/services/torrent/qbittorrent.nix b/modules/services/torrent/qbittorrent.nix index 81cc1a5..ede365b 100644 --- a/modules/services/torrent/qbittorrent.nix +++ b/modules/services/torrent/qbittorrent.nix @@ -4,7 +4,8 @@ let cfg = config.services.qbittorrent; configDir = "${cfg.dataDir}/.config"; openFilesLimit = 4096; -in { +in +{ options.services.qbittorrent = { enable = mkOption { type = types.bool; diff --git a/modules/services/x11/window-managers/steam.nix b/modules/services/x11/window-managers/steam.nix index 948a680..46b3cb5 100644 --- a/modules/services/x11/window-managers/steam.nix +++ b/modules/services/x11/window-managers/steam.nix @@ -1,9 +1,9 @@ { pkgs, lib, config, ... }: with lib; - let cfg = config.services.xserver.windowManager.steam; -in { +in +{ options = { services.xserver.windowManager.steam = { enable = mkEnableOption "steam"; diff --git a/overlays/pcsx2.nix b/overlays/pcsx2.nix index a8bace8..6c954ea 100644 --- a/overlays/pcsx2.nix +++ b/overlays/pcsx2.nix @@ -1,5 +1,6 @@ let version = "1.6.0"; -in final: prev: { +in +final: prev: { pcsx2 = prev.pcsx2.overrideAttrs (o: { inherit version; src = prev.fetchFromGitHub { diff --git a/overlays/retroarch.nix b/overlays/retroarch.nix index b69b4ed..3214ff7 100644 --- a/overlays/retroarch.nix +++ b/overlays/retroarch.nix @@ -1,5 +1,6 @@ let version = "1.8.9"; -in final: prev: { +in +final: prev: { retroarchBare = prev.retroarchBare.overrideAttrs (o: { inherit version; diff --git a/overlays/slock.nix b/overlays/slock.nix index d053b64..4a61a4f 100644 --- a/overlays/slock.nix +++ b/overlays/slock.nix @@ -1,4 +1,3 @@ final: prev: { - slock = prev.slock.overrideAttrs - (o: { patches = [ ../pkgs/misc/screensavers/slock/window_name.patch ]; }); + slock = prev.slock.overrideAttrs (o: { patches = [ ../pkgs/misc/screensavers/slock/window_name.patch ]; }); } diff --git a/pkgs/applications/display-managers/sddm/themes/chili/default.nix b/pkgs/applications/display-managers/sddm/themes/chili/default.nix index 7b35990..c14bccd 100644 --- a/pkgs/applications/display-managers/sddm/themes/chili/default.nix +++ b/pkgs/applications/display-managers/sddm/themes/chili/default.nix @@ -1,6 +1,7 @@ { stdenv, fetchFromGitHub, ... }: let version = "0.1.5"; -in stdenv.mkDerivation { +in +stdenv.mkDerivation { pname = "sddm-chili"; inherit version; diff --git a/pkgs/applications/window-managers/steamcompmgr/default.nix b/pkgs/applications/window-managers/steamcompmgr/default.nix index 67b1462..c212a62 100644 --- a/pkgs/applications/window-managers/steamcompmgr/default.nix +++ b/pkgs/applications/window-managers/steamcompmgr/default.nix @@ -1,5 +1,17 @@ -{ stdenv, fetchFromGitHub, libudev, SDL, SDL_image, libXdamage, libXcomposite -, libXrender, libXext, libXxf86vm, pkgconfig, autoreconfHook, gnumake }: +{ stdenv +, fetchFromGitHub +, libudev +, SDL +, SDL_image +, libXdamage +, libXcomposite +, libXrender +, libXext +, libXxf86vm +, pkgconfig +, autoreconfHook +, gnumake +}: stdenv.mkDerivation { name = "steamcompmgr"; diff --git a/pkgs/data/fonts/dejavu-nerdfont/default.nix b/pkgs/data/fonts/dejavu-nerdfont/default.nix index 9e36e00..b7bfc1d 100644 --- a/pkgs/data/fonts/dejavu-nerdfont/default.nix +++ b/pkgs/data/fonts/dejavu-nerdfont/default.nix @@ -1,5 +1,6 @@ let version = "2.0.0"; -in { stdenv, fetchzip }: +in +{ stdenv, fetchzip }: stdenv.mkDerivation { pname = "dejavu-nerdfont"; diff --git a/pkgs/development/libraries/libinih/default.nix b/pkgs/development/libraries/libinih/default.nix index 5e4789a..c3e8976 100644 --- a/pkgs/development/libraries/libinih/default.nix +++ b/pkgs/development/libraries/libinih/default.nix @@ -1,6 +1,7 @@ { stdenv, meson, ninja, fetchFromGitHub, ... }: let version = "r50"; -in stdenv.mkDerivation { +in +stdenv.mkDerivation { pname = "libinih"; inherit version; diff --git a/pkgs/os-specific/linux/gamemode/default.nix b/pkgs/os-specific/linux/gamemode/default.nix index 547af85..d23be76 100644 --- a/pkgs/os-specific/linux/gamemode/default.nix +++ b/pkgs/os-specific/linux/gamemode/default.nix @@ -1,6 +1,16 @@ let version = "1.5.1"; -in { stdenv, meson, ninja, polkit, pkgconfig, systemd, dbus, libinih -, fetchFromGitHub, ... }: +in +{ stdenv +, meson +, ninja +, polkit +, pkgconfig +, systemd +, dbus +, libinih +, fetchFromGitHub +, ... +}: stdenv.mkDerivation { pname = "gamemode"; diff --git a/pkgs/shells/zsh/pure/default.nix b/pkgs/shells/zsh/pure/default.nix index f713975..92fe16a 100644 --- a/pkgs/shells/zsh/pure/default.nix +++ b/pkgs/shells/zsh/pure/default.nix @@ -1,6 +1,7 @@ { stdenv, fetchFromGitHub }: let version = "0e87bd8"; -in stdenv.mkDerivation { +in +stdenv.mkDerivation { pname = "pure"; inherit version; diff --git a/pkgs/shells/zsh/purs/default.nix b/pkgs/shells/zsh/purs/default.nix index 5029d16..2cd6d53 100644 --- a/pkgs/shells/zsh/purs/default.nix +++ b/pkgs/shells/zsh/purs/default.nix @@ -5,7 +5,8 @@ let inherit (builtins) readFile toFile; init = toFile "init.sh" "${readFile ./init.sh}"; -in buildRustPackage { +in +buildRustPackage { pname = "purs"; version = "0.1.0"; diff --git a/profiles/core.nix b/profiles/core.nix index 70fbaa5..ccad897 100644 --- a/profiles/core.nix +++ b/profiles/core.nix @@ -1,7 +1,8 @@ { config, lib, pkgs, ... }: let inherit (lib) fileContents; -in { +in +{ nix.package = pkgs.nixFlakes; nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; @@ -38,7 +39,8 @@ in { shellAliases = let ifSudo = lib.mkIf config.security.sudo.enable; - in { + in + { # quick cd ".." = "cd .."; "..." = "cd ../.."; diff --git a/profiles/develop/python/default.nix b/profiles/develop/python/default.nix index dd7f38e..58c12c3 100644 --- a/profiles/develop/python/default.nix +++ b/profiles/develop/python/default.nix @@ -1,42 +1,47 @@ { pkgs, ... }: let inherit (pkgs) python3Packages; -in { - environment.systemPackages = let - packages = pythonPackages: - with pythonPackages; [ - numpy - pandas - ptpython - requests - scipy - ]; +in +{ + environment.systemPackages = + let + packages = pythonPackages: + with pythonPackages; [ + numpy + pandas + ptpython + requests + scipy + ]; - python = pkgs.python3.withPackages packages; + python = pkgs.python3.withPackages packages; - in [ python ]; + in + [ python ]; environment.sessionVariables = { - PYTHONSTARTUP = let - startup = pkgs.writers.writePython3 "ptpython.py" { - libraries = with python3Packages; [ ptpython ]; - } '' - from __future__ import unicode_literals + PYTHONSTARTUP = + let + startup = pkgs.writers.writePython3 "ptpython.py" + { + libraries = with python3Packages; [ ptpython ]; + } '' + from __future__ import unicode_literals - from pygments.token import Token + from pygments.token import Token - from ptpython.layout import CompletionVisualisation + from ptpython.layout import CompletionVisualisation - import sys + import sys - ${builtins.readFile ./ptconfig.py} + ${builtins.readFile ./ptconfig.py} - try: - from ptpython.repl import embed - except ImportError: - print("ptpython is not available: falling back to standard prompt") - else: - sys.exit(embed(globals(), locals(), configure=configure)) - ''; - in "${startup}"; + try: + from ptpython.repl import embed + except ImportError: + print("ptpython is not available: falling back to standard prompt") + else: + sys.exit(embed(globals(), locals(), configure=configure)) + ''; + in + "${startup}"; }; } - diff --git a/profiles/develop/tmux/default.nix b/profiles/develop/tmux/default.nix index 1007a25..0d9ef45 100644 --- a/profiles/develop/tmux/default.nix +++ b/profiles/develop/tmux/default.nix @@ -5,10 +5,12 @@ let inherit (lib) removePrefix; pluginConf = plugins: - concatStringsSep "\n\n" (map (plugin: - let name = removePrefix "tmuxplugin-" plugin.pname; - in "run-shell ${plugin}/share/tmux-plugins/${name}/${name}.tmux") - plugins); + concatStringsSep "\n\n" (map + (plugin: + let name = removePrefix "tmuxplugin-" plugin.pname; + in "run-shell ${plugin}/share/tmux-plugins/${name}/${name}.tmux") + plugins + ); plugins = with pkgs.tmuxPlugins; [ copycat @@ -17,7 +19,8 @@ let yank vim-tmux-navigator ]; -in { +in +{ environment.shellAliases = { tx = "tmux new-session -A -s $USER"; }; programs.tmux = { diff --git a/profiles/develop/zsh/default.nix b/profiles/develop/zsh/default.nix index bc101d7..e18388d 100644 --- a/profiles/develop/zsh/default.nix +++ b/profiles/develop/zsh/default.nix @@ -4,22 +4,27 @@ let inherit (lib) fileContents; -in { +in +{ users.defaultUserShell = pkgs.zsh; environment = { - sessionVariables = let fd = "${pkgs.fd}/bin/fd -H"; - in { - BAT_PAGER = "less"; - SKIM_ALT_C_COMMAND = let - alt_c_cmd = pkgs.writeScriptBin "cdr-skim.zsh" '' - #!${pkgs.zsh}/bin/zsh - ${fileContents ./cdr-skim.zsh} - ''; - in "${alt_c_cmd}/bin/cdr-skim.zsh"; - SKIM_DEFAULT_COMMAND = fd; - SKIM_CTRL_T_COMMAND = fd; - }; + sessionVariables = + let fd = "${pkgs.fd}/bin/fd -H"; + in + { + BAT_PAGER = "less"; + SKIM_ALT_C_COMMAND = + let + alt_c_cmd = pkgs.writeScriptBin "cdr-skim.zsh" '' + #!${pkgs.zsh}/bin/zsh + ${fileContents ./cdr-skim.zsh} + ''; + in + "${alt_c_cmd}/bin/cdr-skim.zsh"; + SKIM_DEFAULT_COMMAND = fd; + SKIM_CTRL_T_COMMAND = fd; + }; shellAliases = { cat = "${pkgs.bat}/bin/bat"; @@ -84,58 +89,62 @@ in { eval "$(${pkgs.starship}/bin/starship init zsh)" ''; - interactiveShellInit = let - zshrc = fileContents ./zshrc; + interactiveShellInit = + let + zshrc = fileContents ./zshrc; - sources = with pkgs; [ - ./cdr.zsh - "${skim}/share/skim/completion.zsh" - "${oh-my-zsh}/share/oh-my-zsh/plugins/sudo/sudo.plugin.zsh" - "${oh-my-zsh}/share/oh-my-zsh/plugins/extract/extract.plugin.zsh" - "${zsh-you-should-use}/share/zsh/plugins/you-should-use/you-should-use.plugin.zsh" - "${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" - "${zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh" - ]; + sources = with pkgs; [ + ./cdr.zsh + "${skim}/share/skim/completion.zsh" + "${oh-my-zsh}/share/oh-my-zsh/plugins/sudo/sudo.plugin.zsh" + "${oh-my-zsh}/share/oh-my-zsh/plugins/extract/extract.plugin.zsh" + "${zsh-you-should-use}/share/zsh/plugins/you-should-use/you-should-use.plugin.zsh" + "${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" + "${zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh" + ]; - source = map (source: "source ${source}") sources; + source = map (source: "source ${source}") sources; - functions = pkgs.stdenv.mkDerivation { - name = "zsh-functions"; - src = ./functions; + functions = pkgs.stdenv.mkDerivation { + name = "zsh-functions"; + src = ./functions; - ripgrep = "${pkgs.ripgrep}"; - man = "${pkgs.man}"; - exa = "${pkgs.exa}"; + ripgrep = "${pkgs.ripgrep}"; + man = "${pkgs.man}"; + exa = "${pkgs.exa}"; - installPhase = let basename = "\${file##*/}"; - in '' - mkdir $out + installPhase = + let basename = "\${file##*/}"; + in + '' + mkdir $out - for file in $src/*; do - substituteAll $file $out/${basename} - chmod 755 $out/${basename} - done - ''; - }; + for file in $src/*; do + substituteAll $file $out/${basename} + chmod 755 $out/${basename} + done + ''; + }; - plugins = concatStringsSep "\n" ([ - "${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin" - ] ++ source); + plugins = concatStringsSep "\n" ([ + "${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin" + ] ++ source); - in '' - ${plugins} + in + '' + ${plugins} - fpath+=( ${functions} ) - autoload -Uz ${functions}/*(:t) + fpath+=( ${functions} ) + autoload -Uz ${functions}/*(:t) - ${zshrc} + ${zshrc} - eval "$(${pkgs.direnv}/bin/direnv hook zsh)" - eval $(${pkgs.gitAndTools.hub}/bin/hub alias -s) - source ${pkgs.skim}/share/skim/key-bindings.zsh + eval "$(${pkgs.direnv}/bin/direnv hook zsh)" + eval $(${pkgs.gitAndTools.hub}/bin/hub alias -s) + source ${pkgs.skim}/share/skim/key-bindings.zsh - # needs to remain at bottom so as not to be overwritten - bindkey jj vi-cmd-mode - ''; + # needs to remain at bottom so as not to be overwritten + bindkey jj vi-cmd-mode + ''; }; } diff --git a/profiles/graphical/default.nix b/profiles/graphical/default.nix index 67486cd..49d936a 100644 --- a/profiles/graphical/default.nix +++ b/profiles/graphical/default.nix @@ -1,6 +1,7 @@ { pkgs, ... }: let inherit (builtins) readFile; -in { +in +{ imports = [ ./sway ../develop ./xmonad ../networkmanager ../im ]; hardware.opengl.enable = true; @@ -35,16 +36,18 @@ in { # Theme settings QT_QPA_PLATFORMTHEME = "gtk2"; - GTK2_RC_FILES = let - gtk = '' - gtk-icon-theme-name="Papirus" - gtk-cursor-theme-name="Adwaita" - ''; - in [ - ("${pkgs.writeText "iconrc" "${gtk}"}") - "${pkgs.adapta-gtk-theme}/share/themes/Adapta/gtk-2.0/gtkrc" - "${pkgs.gnome3.gnome-themes-extra}/share/themes/Adwaita/gtk-2.0/gtkrc" - ]; + GTK2_RC_FILES = + let + gtk = '' + gtk-icon-theme-name="Papirus" + gtk-cursor-theme-name="Adwaita" + ''; + in + [ + ("${pkgs.writeText "iconrc" "${gtk}"}") + "${pkgs.adapta-gtk-theme}/share/themes/Adapta/gtk-2.0/gtkrc" + "${pkgs.gnome3.gnome-themes-extra}/share/themes/Adwaita/gtk-2.0/gtkrc" + ]; }; systemPackages = with pkgs; [ diff --git a/profiles/graphical/misc/volnoti.nix b/profiles/graphical/misc/volnoti.nix index e07fed4..e3d45bd 100644 --- a/profiles/graphical/misc/volnoti.nix +++ b/profiles/graphical/misc/volnoti.nix @@ -1,6 +1,7 @@ { pkgs, ... }: let inherit (pkgs) alsaUtils bash gnugrep volnoti; -in pkgs.writeScript "volnoti.sh" '' +in +pkgs.writeScript "volnoti.sh" '' #!${bash}/bin/bash declare -i current=$(${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -m1 -Po "[0-9]+(?=%)") diff --git a/profiles/graphical/qutebrowser/default.nix b/profiles/graphical/qutebrowser/default.nix index f6709bb..c6ec9d4 100644 --- a/profiles/graphical/qutebrowser/default.nix +++ b/profiles/graphical/qutebrowser/default.nix @@ -1,16 +1,19 @@ { pkgs, ... }: let inherit (builtins) readFile; -in { +in +{ sound.enable = true; environment = { - etc."xdg/qutebrowser/config.py".text = let mpv = "${pkgs.mpv}/bin/mpv"; - in '' - ${readFile ./config.py} + etc."xdg/qutebrowser/config.py".text = + let mpv = "${pkgs.mpv}/bin/mpv"; + in + '' + ${readFile ./config.py} - config.bind(',m', 'hint links spawn -d ${mpv} {hint-url}') - config.bind(',v', 'spawn -d ${mpv} {url}') - ''; + config.bind(',m', 'hint links spawn -d ${mpv} {hint-url}') + config.bind(',v', 'spawn -d ${mpv} {url}') + ''; sessionVariables.BROWSER = "qute"; diff --git a/profiles/graphical/sway/default.nix b/profiles/graphical/sway/default.nix index a8ee13e..d421355 100644 --- a/profiles/graphical/sway/default.nix +++ b/profiles/graphical/sway/default.nix @@ -3,7 +3,8 @@ let inherit (builtins) readFile; inherit (config.hardware) pulseaudio; -in { +in +{ imports = [ ../qutebrowser ]; sound.enable = true; @@ -38,7 +39,8 @@ in { environment.etc = { "sway/config".text = let volnoti = import ../misc/volnoti.nix { inherit pkgs; }; - in '' + in + '' set $volume ${volnoti} set $mixer "${pkgs.alsaUtils}/bin/amixer -q set Master" diff --git a/profiles/graphical/xmonad/_xmonad.nix b/profiles/graphical/xmonad/_xmonad.nix index 5e28115..792c439 100644 --- a/profiles/graphical/xmonad/_xmonad.nix +++ b/profiles/graphical/xmonad/_xmonad.nix @@ -1,6 +1,7 @@ { autostart, screenshots, pkgs, stoggle, volnoti }: let inherit (pkgs) alsaUtils; -in '' +in +'' -- Function for fullscreen toggle fullToggle :: X () fullToggle = do diff --git a/profiles/graphical/xmonad/xmonad.hs.nix b/profiles/graphical/xmonad/xmonad.hs.nix index 1583129..d145adc 100644 --- a/profiles/graphical/xmonad/xmonad.hs.nix +++ b/profiles/graphical/xmonad/xmonad.hs.nix @@ -13,9 +13,10 @@ let writeScript "xmonad-touchtoggle" (readFile ./scripts/touchtoggle); volnoti = import ../misc/volnoti.nix { inherit pkgs; }; -in '' +in +'' ${readFile ./_xmonad.hs} ${import ./_xmonad.nix { inherit screenshots touchtoggle autostart stoggle pkgs volnoti; - }} + }} '' diff --git a/profiles/im/default.nix b/profiles/im/default.nix index 373e9fb..b4d150d 100644 --- a/profiles/im/default.nix +++ b/profiles/im/default.nix @@ -5,4 +5,3 @@ signal-desktop ]; } - diff --git a/profiles/laptop/default.nix b/profiles/laptop/default.nix index bc6d0e9..7472144 100644 --- a/profiles/laptop/default.nix +++ b/profiles/laptop/default.nix @@ -45,16 +45,18 @@ ''; services.logind.lidSwitch = "suspend"; - nixpkgs.overlays = let - light_ov = self: super: { - light = super.light.overrideAttrs (o: { - src = self.fetchFromGitHub { - owner = "haikarainen"; - repo = "light"; - rev = "ae7a6ebb45a712e5293c7961eed8cceaa4ebf0b6"; - sha256 = "00z9bxrkjpfmfhz9fbf6mjbfqvixx6857mvgmiv01fvvs0lr371n"; - }; - }); - }; - in [ light_ov ]; + nixpkgs.overlays = + let + light_ov = self: super: { + light = super.light.overrideAttrs (o: { + src = self.fetchFromGitHub { + owner = "haikarainen"; + repo = "light"; + rev = "ae7a6ebb45a712e5293c7961eed8cceaa4ebf0b6"; + sha256 = "00z9bxrkjpfmfhz9fbf6mjbfqvixx6857mvgmiv01fvvs0lr371n"; + }; + }); + }; + in + [ light_ov ]; } diff --git a/profiles/misc/adblocking.nix b/profiles/misc/adblocking.nix index 8433106..011baa2 100644 --- a/profiles/misc/adblocking.nix +++ b/profiles/misc/adblocking.nix @@ -33,10 +33,12 @@ let blacklist = concatStringsSep '' - 0.0.0.0 '' [ + 0.0.0.0 '' + [ "# auto-generated: must be first" # starts here ]; -in { networking.extraHosts = readFile "${hosts}/etc/hosts"; } +in +{ networking.extraHosts = readFile "${hosts}/etc/hosts"; } diff --git a/profiles/misc/torrent.nix b/profiles/misc/torrent.nix index 2319ed3..6bebe2d 100644 --- a/profiles/misc/torrent.nix +++ b/profiles/misc/torrent.nix @@ -2,7 +2,8 @@ let inherit (config.services.qbittorrent) port; inherit (lib) mkAfter; -in { +in +{ services.qbittorrent = { enable = true; group = "media"; diff --git a/profiles/postgres/default.nix b/profiles/postgres/default.nix index 8f9c7fe..118e1f7 100644 --- a/profiles/postgres/default.nix +++ b/profiles/postgres/default.nix @@ -5,4 +5,3 @@ package = pkgs.postgresql_12; }; } - diff --git a/profiles/ssh/default.nix b/profiles/ssh/default.nix index da8645c..2b3f707 100644 --- a/profiles/ssh/default.nix +++ b/profiles/ssh/default.nix @@ -6,4 +6,3 @@ forwardX11 = true; }; } - diff --git a/profiles/virt/default.nix b/profiles/virt/default.nix index f8c7f1c..c0511b4 100644 --- a/profiles/virt/default.nix +++ b/profiles/virt/default.nix @@ -7,17 +7,18 @@ # you'll need to add your user to 'libvirtd' group to use virt-manager environment.systemPackages = with pkgs; [ virt-manager ]; - nixpkgs.overlays = let - overlay = final: prev: { + nixpkgs.overlays = + let + overlay = final: prev: { - # Patch libvirt to use ebtables-legacy - libvirt = if prev.libvirt.version <= "5.4.0" && prev.ebtables.version - > "2.0.10-4" then - prev.libvirt.overrideAttrs - (o: { EBTABLES_PATH = "${final.ebtables}/bin/ebtables-legacy"; }) - else - prev.libvirt; - }; - in [ overlay ]; + # Patch libvirt to use ebtables-legacy + libvirt = + if prev.libvirt.version <= "5.4.0" && prev.ebtables.version + > "2.0.10-4" then + prev.libvirt.overrideAttrs (o: { EBTABLES_PATH = "${final.ebtables}/bin/ebtables-legacy"; }) + else + prev.libvirt; + }; + in + [ overlay ]; } - diff --git a/shell.nix b/shell.nix index 86be994..023489a 100644 --- a/shell.nix +++ b/shell.nix @@ -5,7 +5,8 @@ let buildIso = pkgs.writeShellScriptBin "build-iso" '' nix build ${configs}.niximg.config.system.build.isoImage $@ ''; -in pkgs.mkShell { +in +pkgs.mkShell { name = "nixflk"; nativeBuildInputs = with pkgs; [ git git-crypt nixFlakes buildIso ];