From 16b8136f50b17858e347fd7414b2ca05597aaef7 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Fri, 3 Jan 2020 22:06:31 -0700 Subject: [PATCH] change formatter to nixfmt --- README.md | 4 +- configuration.nix | 23 +++-- flake.nix | 24 +++--- hosts/NixOS.nix | 7 +- hosts/default.nix | 31 +++---- hosts/niximg.nix | 8 +- lib/utils.nix | 48 +++-------- local/locale.nix | 3 +- modules/default.nix | 4 +- modules/services/torrent/qbittorrent.nix | 18 ++-- pkgs/data/fonts/dejavu-nerdfont/default.nix | 5 +- pkgs/default.nix | 7 +- pkgs/shells/zsh/purs/default.nix | 16 +--- profiles/core.nix | 40 ++------- profiles/develop/default.nix | 18 ++-- profiles/develop/kakoune/default.nix | 31 ++++--- profiles/develop/kakoune/lint/nix.kak | 2 +- profiles/develop/tmux/default.nix | 30 ++----- profiles/develop/zsh/default.nix | 93 +++++++++------------ profiles/games/default.nix | 10 +-- profiles/graphical/default.nix | 27 ++---- profiles/graphical/qutebrowser/default.nix | 30 +++---- profiles/graphical/sway/default.nix | 93 +++++++++------------ profiles/graphical/sway/volnoti.nix | 6 +- profiles/misc/adblocking.nix | 19 ++--- profiles/misc/default.nix | 9 +- profiles/misc/make-linux-fast-again.nix | 15 ++-- profiles/misc/plex.nix | 3 +- profiles/misc/stubby.nix | 4 +- profiles/misc/torrent.nix | 3 +- shell.nix | 15 +--- 31 files changed, 226 insertions(+), 420 deletions(-) diff --git a/README.md b/README.md index 4f8735a..e3b1feb 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ the `template` branch to provide a host of useful NixOS configurations available "out of the box". If you wish to contribute such an expression please follow these guidelines: -* format your code with [`nixpkgs-fmt`][nixpkgs-fmt] +* format your code with [`nixfmt`][nixfmt] * The commit message follows the same semantics as [nixpkgs][nixpkgs]. * You can use a `#` symbol to specify abiguities. For example, `develop#zsh: ` would tell me that your updating the @@ -173,7 +173,7 @@ licenses of the respective packages. [direnv]: https://direnv.net [home-manager]: https://github.com/rycee/home-manager [NixOS]: https://nixos.org -[nixpkgs-fmt]: https://github.com/nix-community/nixpkgs-fmt +[nixfmt]: https://github.com/serokell/nixfmt [nixpkgs]: https://github.com/NixOS/nixpkgs [old]: https://github.com/nrdxp/nixos [pr]: https://github.com/NixOS/nixpkgs/pull/68897 diff --git a/configuration.nix b/configuration.nix index 4eb8132..3db2c07 100644 --- a/configuration.nix +++ b/configuration.nix @@ -5,23 +5,22 @@ 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 = builtins.attrValues (import ./modules) ++ [ - "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos" + "${ + builtins.fetchTarball + "https://github.com/rycee/home-manager/archive/master.tar.gz" + }/nixos" /etc/nixos/profiles/core.nix ] ++ config; - networking.hostName = hostname; - nix.nixPath = [ - "nixpkgs=${}" - "nixos-config=/etc/nixos/configuration.nix" - ]; + nix.nixPath = + [ "nixpkgs=${}" "nixos-config=/etc/nixos/configuration.nix" ]; nixpkgs.overlays = lib.singleton (import ./pkgs); } diff --git a/flake.nix b/flake.nix index 3b1b026..0d189d5 100644 --- a/flake.nix +++ b/flake.nix @@ -6,18 +6,16 @@ inputs.nixpkgs.url = "github:nrdxp/nixpkgs/fork"; inputs.home.url = "github:nrdxp/home-manager/flakes"; - outputs = args@{ self, home, nixpkgs }: let - pkgs = import nixpkgs { - system = "x86_64-linux"; - overlays = self.overlays; - }; - in - { - nixosConfigurations = let - configs = import ./hosts args; + outputs = args@{ self, home, nixpkgs }: + let + pkgs = import nixpkgs { + system = "x86_64-linux"; + overlays = self.overlays; + }; + in { + nixosConfigurations = let configs = import ./hosts args; - in - configs; + in configs; overlay = import ./pkgs; @@ -27,8 +25,6 @@ inherit (pkgs) sddm-chili dejavu_nerdfont purs; }; - nixosModules = (import ./modules) // { - profiles = import ./profiles; - }; + nixosModules = (import ./modules) // { profiles = import ./profiles; }; }; } diff --git a/hosts/NixOS.nix b/hosts/NixOS.nix index d435b3b..5c8ef3b 100644 --- a/hosts/NixOS.nix +++ b/hosts/NixOS.nix @@ -1,6 +1 @@ -{ - imports = [ - ../profiles/develop - ../profiles/misc - ]; -} +{ imports = [ ../profiles/develop ../profiles/misc ]; } diff --git a/hosts/default.nix b/hosts/default.nix index f53ee16..8a71c9f 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -2,15 +2,9 @@ args@{ home, nixpkgs, self, ... }: let utils = import ../lib/utils.nix { lib = nixpkgs.lib; }; - inherit (utils) - recImport - ; - - inherit (builtins) - attrValues - removeAttrs - ; + inherit (utils) recImport; + inherit (builtins) attrValues removeAttrs; config = this: nixpkgs.lib.nixosSystem rec { @@ -32,20 +26,15 @@ let local = import "${toString ./.}/${this}.nix"; - flakeModules = removeAttrs self.nixosModules - [ "profiles" ]; + flakeModules = removeAttrs self.nixosModules [ "profiles" ]; - in - attrValues flakeModules ++ [ - core - global - local - home.nixosModules.home-manager - ]; + in attrValues flakeModules + ++ [ core global local home.nixosModules.home-manager ]; }; - hosts = - recImport { dir = ./.; _import = config; }; -in -hosts + hosts = recImport { + dir = ./.; + _import = config; + }; +in hosts diff --git a/hosts/niximg.nix b/hosts/niximg.nix index 2f49272..c7558e9 100644 --- a/hosts/niximg.nix +++ b/hosts/niximg.nix @@ -1,9 +1,5 @@ -{ modulesPath, ... }: -{ - imports = [ - ./NixOS.nix - "${modulesPath}/installer/cd-dvd/iso-image.nix" - ]; +{ modulesPath, ... }: { + imports = [ ./NixOS.nix "${modulesPath}/installer/cd-dvd/iso-image.nix" ]; isoImage.makeEfiBootable = true; isoImage.makeUsbBootable = true; diff --git a/lib/utils.nix b/lib/utils.nix index bfed468..53d92c4 100644 --- a/lib/utils.nix +++ b/lib/utils.nix @@ -1,49 +1,23 @@ { lib, ... }: let - inherit (builtins) - attrNames - isAttrs - readDir - ; + inherit (builtins) attrNames isAttrs readDir; + inherit (lib) filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix; - inherit (lib) - filterAttrs - hasSuffix - mapAttrs' - nameValuePair - removeSuffix - ; - -in -rec { +in rec { # mapFilterAttrs :: # (name -> value -> bool ) # (name -> value -> { name = any; value = any; }) # attrs - mapFilterAttrs = seive: f: attrs: - filterAttrs seive (mapAttrs' f attrs); + mapFilterAttrs = seive: f: attrs: filterAttrs seive (mapAttrs' f attrs); - recImport = - { dir - , _import ? base: import "${dir}/${base}.nix" - }: - mapFilterAttrs - (_: v: v != null) - ( - n: v: - if - n != "default.nix" - && hasSuffix ".nix" n - && v == "regular" + recImport = { dir, _import ? base: import "${dir}/${base}.nix" }: + 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); } diff --git a/local/locale.nix b/local/locale.nix index 6db9314..7ae145f 100644 --- a/local/locale.nix +++ b/local/locale.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{ ... }: { i18n.defaultLocale = "en_US.UTF-8"; time.timeZone = "America/Denver"; } diff --git a/modules/default.nix b/modules/default.nix index cdd258c..254143a 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,3 +1 @@ -{ - qbittorrent-nox = import ./services/torrent/qbittorrent.nix; -} +{ qbittorrent-nox = import ./services/torrent/qbittorrent.nix; } diff --git a/modules/services/torrent/qbittorrent.nix b/modules/services/torrent/qbittorrent.nix index 8f9f45c..c50f227 100644 --- a/modules/services/torrent/qbittorrent.nix +++ b/modules/services/torrent/qbittorrent.nix @@ -4,8 +4,7 @@ let cfg = config.services.qbittorrent; configDir = "${cfg.dataDir}/.config"; openFilesLimit = 4096; -in -{ +in { options.services.qbittorrent = { enable = mkOption { type = types.bool; @@ -68,11 +67,9 @@ in environment.systemPackages = [ pkgs.qbittorrent ]; nixpkgs.overlays = [ - ( - self: super: { - qbittorrent = super.qbittorrent.override { guiSupport = false; }; - } - ) + (self: super: { + qbittorrent = super.qbittorrent.override { guiSupport = false; }; + }) ]; networking.firewall = mkIf cfg.openFirewall { @@ -110,10 +107,7 @@ in }; }; - users.groups = mkIf (cfg.group == "qbittorrent") { - qbittorrent = { - gid = null; - }; - }; + users.groups = + mkIf (cfg.group == "qbittorrent") { qbittorrent = { gid = null; }; }; }; } diff --git a/pkgs/data/fonts/dejavu-nerdfont/default.nix b/pkgs/data/fonts/dejavu-nerdfont/default.nix index b6e8eb7..c8b41a5 100644 --- a/pkgs/data/fonts/dejavu-nerdfont/default.nix +++ b/pkgs/data/fonts/dejavu-nerdfont/default.nix @@ -5,7 +5,8 @@ stdenv.mkDerivation rec { version = "2.0.0"; src = fetchzip { - url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/DejaVuSansMono.zip"; + url = + "https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/DejaVuSansMono.zip"; hash = "sha256-yMvKzt5CKpK1bThT25lqSyRvZRCFvo6HHbTj+ripdCo="; stripRoot = false; }; @@ -15,7 +16,7 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "Nerdfont version of DejaVu"; - homepage = https://github.com/ryanoasis/nerd-fonts; + homepage = "https://github.com/ryanoasis/nerd-fonts"; license = licenses.mit; maintainers = [ maintainers.nrdxp ]; inherit version; diff --git a/pkgs/default.nix b/pkgs/default.nix index b163452..6b6a37d 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,5 +1,6 @@ final: prev: { - sddm-chili = prev.callPackage ./applications/display-managers/sddm/themes/chili {}; - dejavu_nerdfont = prev.callPackage ./data/fonts/dejavu-nerdfont {}; - purs = prev.callPackage ./shells/zsh/purs {}; + sddm-chili = + prev.callPackage ./applications/display-managers/sddm/themes/chili { }; + dejavu_nerdfont = prev.callPackage ./data/fonts/dejavu-nerdfont { }; + purs = prev.callPackage ./shells/zsh/purs { }; } diff --git a/pkgs/shells/zsh/purs/default.nix b/pkgs/shells/zsh/purs/default.nix index 8ee0cd3..5b254d1 100644 --- a/pkgs/shells/zsh/purs/default.nix +++ b/pkgs/shells/zsh/purs/default.nix @@ -2,15 +2,10 @@ with rustPlatform; let - inherit (builtins) - readFile - toFile - ; - + inherit (builtins) readFile toFile; init = toFile "init.sh" "${readFile ./init.sh}"; -in -buildRustPackage rec { +in buildRustPackage rec { pname = "purs"; version = "0.1.0"; @@ -21,10 +16,7 @@ buildRustPackage rec { hash = "sha256-QwkbqNROksRo+QmRrgkWuoPzPb2XBwavEtlR9oqAXDQ="; }; - buildInputs = [ - openssl - pkgconfig - ]; + buildInputs = [ openssl pkgconfig ]; cargoSha256 = "sha256-vyO2JRRA7FCNVmIeN1xybQXkdgoHbhMGT2AhUJEnp0s="; @@ -37,7 +29,7 @@ buildRustPackage rec { meta = with stdenv.lib; { description = "A Pure-inspired prompt in Rust"; - homepage = https://github.com/xcambar/purs; + homepage = "https://github.com/xcambar/purs"; maintainers = [ maintainers.nrdxp ]; license = licenses.mit; inherit version; diff --git a/profiles/core.nix b/profiles/core.nix index 6916f3f..93abca0 100644 --- a/profiles/core.nix +++ b/profiles/core.nix @@ -1,24 +1,12 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - fileContents - ; +let inherit (lib) fileContents; -in -{ +in { nix.package = pkgs.nixFlakes; - nix.systemFeatures = [ - "nixos-test" - "benchmark" - "big-parallel" - "kvm" - ]; - - imports = [ - ../local/locale.nix - ]; + nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; + imports = [ ../local/locale.nix ]; boot = { @@ -30,7 +18,6 @@ in }; - environment = { systemPackages = with pkgs; [ @@ -51,10 +38,9 @@ in utillinux ]; - shellAliases = let - ifSudo = string: lib.mkIf config.security.sudo.enable string; - in - { + shellAliases = + let ifSudo = string: lib.mkIf config.security.sudo.enable string; + in { # quick cd ".." = "cd .."; "..." = "cd ../.."; @@ -101,13 +87,8 @@ in }; - fonts = { - fonts = with pkgs; [ - powerline-fonts - dejavu_fonts - ]; - + fonts = with pkgs; [ powerline-fonts dejavu_fonts ]; fontconfig.defaultFonts = { @@ -118,7 +99,6 @@ in }; }; - nix = { autoOptimiseStore = true; @@ -139,10 +119,8 @@ in }; - nixpkgs.config.allowUnfree = true; - security = { hideProcessInformation = true; @@ -151,10 +129,8 @@ in }; - services.earlyoom.enable = true; - users = { mutableUsers = false; diff --git a/profiles/develop/default.nix b/profiles/develop/default.nix index 73d1770..180fbe3 100644 --- a/profiles/develop/default.nix +++ b/profiles/develop/default.nix @@ -1,14 +1,7 @@ -{ pkgs, ... }: -{ - imports = [ - ./zsh - ./kakoune - ./tmux - ]; +{ pkgs, ... }: { + imports = [ ./zsh ./kakoune ./tmux ]; - environment.shellAliases = { - v = "$EDITOR"; - }; + environment.shellAliases = { v = "$EDITOR"; }; environment.sessionVariables = { PAGER = "less"; @@ -32,9 +25,8 @@ fonts = { fonts = [ pkgs.dejavu_nerdfont ]; - fontconfig.defaultFonts.monospace = [ - "DejaVu Sans Mono Nerd Font Complete Mono" - ]; + fontconfig.defaultFonts.monospace = + [ "DejaVu Sans Mono Nerd Font Complete Mono" ]; }; documentation.dev.enable = true; diff --git a/profiles/develop/kakoune/default.nix b/profiles/develop/kakoune/default.nix index f3e583e..2fe820d 100644 --- a/profiles/develop/kakoune/default.nix +++ b/profiles/develop/kakoune/default.nix @@ -1,11 +1,10 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { environment.systemPackages = with pkgs; [ cquery kak-lsp kakoune-config kakoune-unwrapped - nixpkgs-fmt + nixfmt python3Packages.python-language-server rustup ]; @@ -15,7 +14,8 @@ "xdg/kak/autoload/plugins".source = ./plugins; "xdg/kak/autoload/lint".source = ./lint; "xdg/kak/autoload/lsp".source = ./lsp; - "xdg/kak/autoload/default".source = "${pkgs.kakoune-unwrapped}/share/kak/rc"; + "xdg/kak/autoload/default".source = + "${pkgs.kakoune-unwrapped}/share/kak/rc"; }; nixpkgs.overlays = let @@ -33,18 +33,15 @@ XDG_CONFIG_HOME=/etc/xdg exec ${self.kakoune}/bin/kak "$@" ''; - kakoune-unwrapped = super.kakoune-unwrapped.overrideAttrs ( - o: rec { - version = "2019.12.10"; - src = super.fetchFromGitHub { - repo = "kakoune"; - owner = "mawww"; - rev = "v${version}"; - hash = "sha256-TnRQ73bIQGavXNp+wrKtYHgGem+R6JDWt333z2izYzE="; - }; - } - ); + kakoune-unwrapped = super.kakoune-unwrapped.overrideAttrs (o: rec { + version = "2019.12.10"; + src = super.fetchFromGitHub { + repo = "kakoune"; + owner = "mawww"; + rev = "v${version}"; + hash = "sha256-TnRQ73bIQGavXNp+wrKtYHgGem+R6JDWt333z2izYzE="; + }; + }); }; - in - [ kak ]; + in [ kak ]; } diff --git a/profiles/develop/kakoune/lint/nix.kak b/profiles/develop/kakoune/lint/nix.kak index 59407b3..2deb99f 100644 --- a/profiles/develop/kakoune/lint/nix.kak +++ b/profiles/develop/kakoune/lint/nix.kak @@ -12,7 +12,7 @@ hook -group lint global WinSetOption filetype=nix %{ } && run \ ' lint-enable - set buffer formatcmd "nixpkgs-fmt" + set buffer formatcmd "nixfmt" hook buffer BufWritePre .* %{ format lint diff --git a/profiles/develop/tmux/default.nix b/profiles/develop/tmux/default.nix index 8c863dc..e74744d 100644 --- a/profiles/develop/tmux/default.nix +++ b/profiles/develop/tmux/default.nix @@ -1,25 +1,14 @@ { lib, pkgs, ... }: let - inherit (builtins) - readFile - concatStringsSep - ; - - inherit (lib) - removePrefix - ; + inherit (builtins) readFile concatStringsSep; + inherit (lib) removePrefix; pluginConf = plugins: - concatStringsSep "\n\n" - ( - map ( - plugin: let - name = removePrefix "tmuxplugin-" plugin.name; - in - "run-shell ${plugin}/share/tmux-plugins/${name}/${name}.tmux" - ) plugins - ); + concatStringsSep "\n\n" (map (plugin: + let name = removePrefix "tmuxplugin-" plugin.name; + in "run-shell ${plugin}/share/tmux-plugins/${name}/${name}.tmux") + plugins); plugins = with pkgs.tmuxPlugins; [ copycat @@ -28,11 +17,8 @@ let yank vim-tmux-navigator ]; -in -{ - environment.shellAliases = { - tx = "tmux new-session -A -s $USER"; - }; +in { + environment.shellAliases = { tx = "tmux new-session -A -s $USER"; }; programs.tmux = { enable = true; diff --git a/profiles/develop/zsh/default.nix b/profiles/develop/zsh/default.nix index 7e6c016..a82c73b 100644 --- a/profiles/develop/zsh/default.nix +++ b/profiles/develop/zsh/default.nix @@ -1,31 +1,25 @@ { lib, pkgs, ... }: let - inherit (builtins) - concatStringsSep - ; + inherit (builtins) concatStringsSep; + inherit (lib) fileContents; - 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 = - "while read line; do " - + "line=\"'\${(Q)line}'\"; [[ -d \"'$line'\" ]] && echo \"'$line'\"; " - + "done < $HOME/.cache/zsh-cdr/recent-dirs"; - 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"; @@ -62,7 +56,6 @@ in ]; }; - programs.zsh = { enable = true; @@ -104,9 +97,7 @@ in "${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"; @@ -116,43 +107,35 @@ in 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} + fpath+=( ${functions} ) + autoload -Uz ${functions}/*(:t) - in - '' - ${plugins} + ${zshrc} - fpath+=( ${functions} ) - autoload -Uz ${functions}/*(:t) + eval "$(${pkgs.direnv}/bin/direnv hook zsh)" + eval $(${pkgs.gitAndTools.hub}/bin/hub alias -s) + source ${pkgs.skim}/share/skim/key-bindings.zsh - ${zshrc} - - 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/games/default.nix b/profiles/games/default.nix index 0d89342..6855de1 100644 --- a/profiles/games/default.nix +++ b/profiles/games/default.nix @@ -1,8 +1,6 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { imports = [ ../graphical ./udev.nix ]; - environment.systemPackages = with pkgs; - [ retroarchBare steam steam-run ]; + environment.systemPackages = with pkgs; [ retroarchBare steam steam-run ]; # fps games on laptop need this services.xserver.libinput.disableWhileTyping = false; @@ -15,7 +13,5 @@ systemd.extraConfig = "DefaultLimitNOFILE=1048576"; # improve wine performance - environment.sessionVariables = { - WINEDEBUG = "-all"; - }; + environment.sessionVariables = { WINEDEBUG = "-all"; }; } diff --git a/profiles/graphical/default.nix b/profiles/graphical/default.nix index e4410eb..fd80f6e 100644 --- a/profiles/graphical/default.nix +++ b/profiles/graphical/default.nix @@ -1,14 +1,7 @@ { config, pkgs, ... }: -let - inherit (builtins) - readFile - ; -in -{ - imports = [ - ./sway - ../develop - ]; +let inherit (builtins) readFile; +in { + imports = [ ./sway ../develop ]; hardware.opengl.enable = true; hardware.opengl.driSupport = true; @@ -35,12 +28,11 @@ in gtk-icon-theme-name="Papirus-Adapta" 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" - ]; + 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; [ @@ -88,6 +80,5 @@ in libopus = prev.libopus; }; }; - in - [ overlay ]; + in [ overlay ]; } diff --git a/profiles/graphical/qutebrowser/default.nix b/profiles/graphical/qutebrowser/default.nix index ea322ff..b6d2653 100644 --- a/profiles/graphical/qutebrowser/default.nix +++ b/profiles/graphical/qutebrowser/default.nix @@ -1,29 +1,20 @@ { pkgs, ... }: -let - inherit (builtins) readFile; -in -{ +let inherit (builtins) readFile; +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"; - systemPackages = with pkgs; [ - qute - qutebrowser - mpv - youtubeDL - ]; + systemPackages = with pkgs; [ qute qutebrowser mpv youtubeDL ]; }; nixpkgs.overlays = let @@ -32,6 +23,5 @@ in exec ${prev.qutebrowser}/bin/qutebrowser -C /etc/xdg/qutebrowser/config.py "$@" ''; }; - in - [ overlay ]; + in [ overlay ]; } diff --git a/profiles/graphical/sway/default.nix b/profiles/graphical/sway/default.nix index 8569042..34ebee0 100644 --- a/profiles/graphical/sway/default.nix +++ b/profiles/graphical/sway/default.nix @@ -1,17 +1,10 @@ { lib, config, options, pkgs, ... }: let - inherit (builtins) - readFile - ; + inherit (builtins) readFile; - inherit (config.hardware) - pulseaudio - ; -in -{ - imports = [ - ../qutebrowser - ]; + inherit (config.hardware) pulseaudio; +in { + imports = [ ../qutebrowser ]; sound.enable = true; @@ -28,31 +21,30 @@ in export _JAVA_AWT_WM_NONREPARENTING=1 ''; - extraPackages = with pkgs; options.programs.sway.extraPackages.default - ++ [ - dmenu - networkmanager_dmenu - qt5.qtwayland - alacritty - volnoti - wl-clipboard - (waybar.override { pulseSupport = pulseaudio.enable; }) - ] - ; + extraPackages = with pkgs; + options.programs.sway.extraPackages.default ++ [ + dmenu + networkmanager_dmenu + qt5.qtwayland + alacritty + volnoti + wl-clipboard + (waybar.override { pulseSupport = pulseaudio.enable; }) + ]; }; environment.etc = { "sway/config".text = let - volnoti = pkgs.writeScript "volnoti.sh" (import ./volnoti.nix { inherit pkgs; }); - in - '' - set $volume ${volnoti} + volnoti = + pkgs.writeScript "volnoti.sh" (import ./volnoti.nix { inherit pkgs; }); + in '' + set $volume ${volnoti} - # set background - output * bg ${pkgs.adapta-backgrounds}/share/backgrounds/adapta/tri-fadeno.jpg fill + # set background + output * bg ${pkgs.adapta-backgrounds}/share/backgrounds/adapta/tri-fadeno.jpg fill - ${readFile ./config} - ''; + ${readFile ./config} + ''; "xdg/waybar".source = ./waybar; }; @@ -88,7 +80,7 @@ in documentation = [ "volnoti --help" ]; wantedBy = [ "sway-session.target" ]; - script = ''${pkgs.volnoti}/bin/volnoti -n''; + script = "${pkgs.volnoti}/bin/volnoti -n"; serviceConfig = { Restart = "always"; @@ -98,27 +90,22 @@ in nixpkgs.overlays = let overlay = self: super: { - redshift = super.redshift.overrideAttrs ( - o: { - src = super.fetchFromGitHub { - owner = "CameronNemo"; - repo = "redshift"; - rev = "39c162ca487a59857c2eac231318f4b28855798b"; - sha256 = "1in27draskwwi097wiam26bx2szcf58297am3gkyng1ms3rz6i58"; - }; - } - ); - wl-clipboard = super.wl-clipboard.overrideAttrs ( - o: { - src = super.fetchFromGitHub { - owner = "bugaevc"; - repo = "wl-clipboard"; - rev = "c010972e6b0d2eb3002c49a6a1b5620ff5f7c910"; - sha256 = "020l3jy9gsj6gablwdfzp1wfa8yblay3axdjc56i9q8pbhz7g12j"; - }; - } - ); + redshift = super.redshift.overrideAttrs (o: { + src = super.fetchFromGitHub { + owner = "CameronNemo"; + repo = "redshift"; + rev = "39c162ca487a59857c2eac231318f4b28855798b"; + sha256 = "1in27draskwwi097wiam26bx2szcf58297am3gkyng1ms3rz6i58"; + }; + }); + wl-clipboard = super.wl-clipboard.overrideAttrs (o: { + src = super.fetchFromGitHub { + owner = "bugaevc"; + repo = "wl-clipboard"; + rev = "c010972e6b0d2eb3002c49a6a1b5620ff5f7c910"; + sha256 = "020l3jy9gsj6gablwdfzp1wfa8yblay3axdjc56i9q8pbhz7g12j"; + }; + }); }; - in - [ overlay ]; + in [ overlay ]; } diff --git a/profiles/graphical/sway/volnoti.nix b/profiles/graphical/sway/volnoti.nix index e74b52e..c8a545b 100644 --- a/profiles/graphical/sway/volnoti.nix +++ b/profiles/graphical/sway/volnoti.nix @@ -1,8 +1,6 @@ { pkgs, ... }: -let - inherit (pkgs) alsaUtils bash gnugrep volnoti; -in -'' +let inherit (pkgs) alsaUtils bash gnugrep volnoti; +in '' #!${bash}/bin/bash declare -i current=$(${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -m1 -Po "[0-9]+(?=%)") diff --git a/profiles/misc/adblocking.nix b/profiles/misc/adblocking.nix index a8a06d0..c99a1e3 100644 --- a/profiles/misc/adblocking.nix +++ b/profiles/misc/adblocking.nix @@ -29,17 +29,14 @@ let ''; }; - whitelist = concatStringsSep "|" [ - ".*pirate(bay|proxy).*" - ]; + whitelist = concatStringsSep "|" [ ".*pirate(bay|proxy).*" ]; - blacklist = concatStringsSep "\n0.0.0.0 " [ - "# auto-generated: must be first" + blacklist = concatStringsSep '' - # starts here - ]; + 0.0.0.0 '' [ + "# auto-generated: must be first" -in -{ - networking.extraHosts = readFile "${hosts}/etc/hosts"; -} + # starts here + ]; + +in { networking.extraHosts = readFile "${hosts}/etc/hosts"; } diff --git a/profiles/misc/default.nix b/profiles/misc/default.nix index b00c411..0a1d4cb 100644 --- a/profiles/misc/default.nix +++ b/profiles/misc/default.nix @@ -1,8 +1,3 @@ -{ ... }: -{ - imports = [ - ./stubby.nix - ./adblocking.nix - ./make-linux-fast-again.nix - ]; +{ ... }: { + imports = [ ./stubby.nix ./adblocking.nix ./make-linux-fast-again.nix ]; } diff --git a/profiles/misc/make-linux-fast-again.nix b/profiles/misc/make-linux-fast-again.nix index c85adb3..58cf17f 100644 --- a/profiles/misc/make-linux-fast-again.nix +++ b/profiles/misc/make-linux-fast-again.nix @@ -2,13 +2,8 @@ { pkgs, config, ... }: let inherit (builtins) readFile fetchurl; - cmdline = readFile ( - fetchurl { - url = "https://make-linux-fast-again.com"; - sha256 = "sha256:10diw5xn5jjx79nvyjqcpdpcqihnr3y0756fsgiv1nq7w28ph9w6"; - } - ); -in -{ - boot.kernelParams = pkgs.lib.splitString " " cmdline; -} + cmdline = readFile (fetchurl { + url = "https://make-linux-fast-again.com"; + sha256 = "sha256:10diw5xn5jjx79nvyjqcpdpcqihnr3y0756fsgiv1nq7w28ph9w6"; + }); +in { boot.kernelParams = pkgs.lib.splitString " " cmdline; } diff --git a/profiles/misc/plex.nix b/profiles/misc/plex.nix index 3cfc9af..efaf532 100644 --- a/profiles/misc/plex.nix +++ b/profiles/misc/plex.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{ ... }: { services.plex = { enable = true; dataDir = "/srv/plex"; diff --git a/profiles/misc/stubby.nix b/profiles/misc/stubby.nix index 2f7c421..4f7de05 100644 --- a/profiles/misc/stubby.nix +++ b/profiles/misc/stubby.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{ ... }: { services.stubby = { enable = true; upstreamServers = '' @@ -22,7 +21,6 @@ }; }; - networking = { networkmanager.dns = "none"; resolvconf.dnsExtensionMechanism = false; diff --git a/profiles/misc/torrent.nix b/profiles/misc/torrent.nix index 6bebe2d..2319ed3 100644 --- a/profiles/misc/torrent.nix +++ b/profiles/misc/torrent.nix @@ -2,8 +2,7 @@ let inherit (config.services.qbittorrent) port; inherit (lib) mkAfter; -in -{ +in { services.qbittorrent = { enable = true; group = "media"; diff --git a/shell.nix b/shell.nix index 12f28bc..95264c1 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ -{ pkgs ? import {} }: +{ pkgs ? import { } }: let configs = "${toString ./.}#nixosConfigurations"; hostname = pkgs.lib.fileContents /etc/hostname; @@ -15,14 +15,8 @@ let nix run -vv ${configs}.$1.${build}.toplevel -c switch-to-configuration $2 fi ''; -in -pkgs.mkShell { - nativeBuildInputs = with pkgs; [ - git - git-crypt - nixFlakes - rebuild - ]; +in pkgs.mkShell { + nativeBuildInputs = with pkgs; [ git git-crypt nixFlakes rebuild ]; shellHook = '' mkdir -p secrets @@ -37,6 +31,5 @@ pkgs.mkShell { ${current} experimental-features = nix-command flakes ca-references ''; - in - "${nixConf}/opt"; + in "${nixConf}/opt"; }