From 1f69ba422929ef3222d441831a4d38c7cf03d03e Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Sat, 24 Aug 2024 01:55:59 -0600 Subject: [PATCH] add alejandra formatter --- base/default.nix | 25 ++-- base/hardware-configuration-custom.nix | 32 +++-- base/platforms/posixlycorrect.nix | 2 +- flake.nix | 121 ++++++++--------- home/accounts.nix | 7 +- home/allowUnfreeWhitelist.nix | 37 +++--- home/apps/default.nix | 13 +- home/apps/library.nix | 33 ++--- home/apps/steam/default.nix | 14 +- home/apps/steam/package.nix | 7 +- home/apps/terminal/default.nix | 13 +- home/apps/terminal/kitty.conf.nix | 2 +- home/apps/virtmanager.nix | 13 +- home/cli.nix | 41 +++--- home/default.nix | 18 ++- home/gui/autorandr.nix | 13 +- home/gui/default.nix | 14 +- home/gui/fonts.nix | 13 +- home/gui/gtk.nix | 13 +- home/gui/i3.nix | 171 +++++++++++++------------ home/gui/polybar.nix | 17 ++- home/gui/startx.nix | 32 +++-- home/isolation.nix | 8 +- home/options.nix | 8 +- home/shenvs/c.nix | 3 +- home/shenvs/python.nix | 10 +- home/systemd/default.nix | 7 +- home/zshrc.nix | 41 +++--- pkgs/default.nix | 3 +- 29 files changed, 405 insertions(+), 326 deletions(-) diff --git a/base/default.nix b/base/default.nix index 5dad048..2fd0713 100644 --- a/base/default.nix +++ b/base/default.nix @@ -1,14 +1,16 @@ # Edet this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, lib, ... }: { - imports = - [ - # Include the results of the hardware scan. - ./hardware-configuration-custom.nix - ]; + config, + pkgs, + lib, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration-custom.nix + ]; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; @@ -51,7 +53,7 @@ hardware.pulseaudio.enable = true; programs.zsh.enable = true; - environment.pathsToLink = [ "/share/zsh" ]; + environment.pathsToLink = ["/share/zsh"]; users = { users.fabian = { @@ -59,7 +61,7 @@ uid = 1002; # nunca cambiar mi ID de usuario group = "fabian"; shell = pkgs.zsh; - extraGroups = [ "users" "wheel" "networkmanager" "dialout" "libvirtd" ]; + extraGroups = ["users" "wheel" "networkmanager" "dialout" "libvirtd"]; }; groups.fabian.gid = 1002; }; @@ -70,14 +72,14 @@ users.users.temp = { isNormalUser = true; - extraGroups = [ "wheel" ]; + extraGroups = ["wheel"]; }; nixpkgs.config.allowUnfree = true; virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm; virtualisation.libvirtd.qemu.ovmf.enable = true; - virtualisation.libvirtd.qemu.ovmf.packages = [ pkgs.OVMFFull.fd ]; + virtualisation.libvirtd.qemu.ovmf.packages = [pkgs.OVMFFull.fd]; virtualisation.libvirtd.enable = true; programs.dconf.enable = true; # boot.kernelModules = [ "vfio" "vfio_iommu_type1" "vfio_pci" "vfio_virqfd" ]; @@ -101,5 +103,4 @@ }; system.stateVersion = "21.11"; # No tocar esto - } diff --git a/base/hardware-configuration-custom.nix b/base/hardware-configuration-custom.nix index f117a67..a9feac6 100644 --- a/base/hardware-configuration-custom.nix +++ b/base/hardware-configuration-custom.nix @@ -1,22 +1,22 @@ -{ config, lib, pkgs, modulesPath, ... }: -let - +{ + config, + lib, + pkgs, + modulesPath, + ... +}: let subvol = subvol: { device = "/dev/disk/by-uuid/645fdba0-5c03-4285-926b-facded1ee259"; fsType = "btrfs"; - options = [ "subvol=${subvol}" "compress=zstd" "noatime" "ssd" ]; + options = ["subvol=${subvol}" "compress=zstd" "noatime" "ssd"]; }; - -in -{ - - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; +in { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; boot.initrd = { - availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + availableKernelModules = ["xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; luks.devices."toplevel" = { device = "/dev/disk/by-uuid/58277baa-90d4-4a5e-a658-1b918b89130a"; preLVM = false; @@ -29,17 +29,15 @@ in "/boot" = { device = "/dev/disk/by-uuid/B007-B007"; fsType = "vfat"; - options = [ "umask=027" ]; + options = ["umask=027"]; }; "/extern" = { device = "/dev/disk/by-uuid/7d8d3ec9-b456-4e2a-9396-551dcaf7705b"; fsType = "btrfs"; - options = [ "noatime" "compress=zstd" ]; + options = ["noatime" "compress=zstd"]; }; - }; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - } diff --git a/base/platforms/posixlycorrect.nix b/base/platforms/posixlycorrect.nix index ffcd441..0967ef4 100644 --- a/base/platforms/posixlycorrect.nix +++ b/base/platforms/posixlycorrect.nix @@ -1 +1 @@ -{ } +{} diff --git a/flake.nix b/flake.nix index 73d96ad..8cae85e 100644 --- a/flake.nix +++ b/flake.nix @@ -12,66 +12,73 @@ }; }; - outputs = { self, nixpkgs, unstable, home-manager, nur, hm-isolation, nixGL, ... }: - let - system = "x86_64-linux"; + outputs = { + self, + nixpkgs, + unstable, + home-manager, + nur, + hm-isolation, + nixGL, + ... + }: let + system = "x86_64-linux"; - pkgs = import nixpkgs { + pkgs = import nixpkgs { + inherit system; + }; + + inherit (pkgs) lib; + + base = platform: { + name = platform; + value = nixpkgs.lib.nixosSystem { inherit system; - }; - inherit (pkgs) lib; - - base = platform: { - name = platform; - value = nixpkgs.lib.nixosSystem { - inherit system; - - modules = [ (import ./base) ]; - }; - }; - - home = platform: { - name = "fabian@${platform}"; - value = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - - modules = [ - (import ./home { - inherit self nixpkgs unstable hm-isolation nixGL; - }) - - ./home/platforms/${platform}.nix - - { - config.local = { inherit platform; }; - } - ]; - }; - }; - - localPkgs = import ./pkgs; - - platforms = domain: - map - (lib.removeSuffix ".nix") - (lib.attrNames (builtins.readDir ./${domain}/platforms)); - - configs = domain: builder: - lib.listToAttrs - (map builder (platforms domain)); - in - { - nixosConfigurations = configs "base" base; - homeConfigurations = configs "home" home; - packages.${system} = localPkgs pkgs; - formatter.${system} = pkgs.nixpkgs-fmt; - - overlay = self: super: { - unstable = import unstable { - inherit (super) config system; - }; - local = localPkgs self; + modules = [(import ./base)]; }; }; + + home = platform: { + name = "fabian@${platform}"; + value = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + + modules = [ + (import ./home { + inherit self nixpkgs unstable hm-isolation nixGL; + }) + + ./home/platforms/${platform}.nix + + { + config.local = {inherit platform;}; + } + ]; + }; + }; + + localPkgs = import ./pkgs; + + platforms = domain: + map + (lib.removeSuffix ".nix") + (lib.attrNames (builtins.readDir ./${domain}/platforms)); + + configs = domain: builder: + lib.listToAttrs + (map builder (platforms domain)); + in { + nixosConfigurations = configs "base" base; + homeConfigurations = configs "home" home; + packages.${system} = localPkgs pkgs; + formatter.${system} = pkgs.alejandra; + + overlay = self: super: { + unstable = import unstable { + inherit (super) config system; + }; + local = localPkgs self; + }; + }; } diff --git a/home/accounts.nix b/home/accounts.nix index 122b0b1..97e7647 100644 --- a/home/accounts.nix +++ b/home/accounts.nix @@ -1,6 +1,9 @@ -{ lib, config, ... }: -with lib; { + lib, + config, + ... +}: +with lib; { config = mkIf (!config.home.isolation.active) { accounts.email.maildirBasePath = "${config.home.homeDirectory}/mail"; accounts.email.accounts = { diff --git a/home/allowUnfreeWhitelist.nix b/home/allowUnfreeWhitelist.nix index 95e2392..a71519f 100644 --- a/home/allowUnfreeWhitelist.nix +++ b/home/allowUnfreeWhitelist.nix @@ -1,18 +1,23 @@ -{ pkgs, config, lib, ... }: -with lib; { - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "discord" - "pycharm-professional" - "rar" - "spotify" - "spotify-unwrapped" - "steam" - "steam-original" - "steam-run" - "teams" - "vscode-extension-ms-vscode-cpptools" - "vmware-horizon-client" - "zoom" - ]; + pkgs, + config, + lib, + ... +}: +with lib; { + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "discord" + "pycharm-professional" + "rar" + "spotify" + "spotify-unwrapped" + "steam" + "steam-original" + "steam-run" + "teams" + "vscode-extension-ms-vscode-cpptools" + "vmware-horizon-client" + "zoom" + ]; } diff --git a/home/apps/default.nix b/home/apps/default.nix index 9b10b18..9155e3a 100644 --- a/home/apps/default.nix +++ b/home/apps/default.nix @@ -1,9 +1,12 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.local.apps; -in { + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.local.apps; +in { options.local.apps.enable = mkEnableOption "Applications and tools"; imports = [ ./library.nix diff --git a/home/apps/library.nix b/home/apps/library.nix index f389521..ffc3f5b 100644 --- a/home/apps/library.nix +++ b/home/apps/library.nix @@ -1,9 +1,12 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.local.apps.defaultApps; -in { + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.local.apps.defaultApps; +in { options.local.apps.defaultApps.enable = mkEnableOption "Default app library"; config = mkIf cfg.enable { home.packages = with pkgs; [ @@ -37,16 +40,16 @@ in ]; xdg.mimeApps.defaultApplications = { - "application/x-extension-htm" = [ "firefox.desktop" ]; - "application/x-extension-html" = [ "firefox.desktop" ]; - "application/x-extension-shtml" = [ "firefox.desktop" ]; - "application/x-extension-xht" = [ "firefox.desktop" ]; - "application/x-extension-xhtml" = [ "firefox.desktop" ]; - "application/xhtml+xml" = [ "firefox.desktop" ]; - "text/html" = [ "firefox.desktop" ]; - "x-scheme-handler/http" = [ "firefox.desktop" ]; - "x-scheme-handler/https" = [ "firefox.desktop" ]; - "application/pdf" = [ "qpdfview.desktop" ]; + "application/x-extension-htm" = ["firefox.desktop"]; + "application/x-extension-html" = ["firefox.desktop"]; + "application/x-extension-shtml" = ["firefox.desktop"]; + "application/x-extension-xht" = ["firefox.desktop"]; + "application/x-extension-xhtml" = ["firefox.desktop"]; + "application/xhtml+xml" = ["firefox.desktop"]; + "text/html" = ["firefox.desktop"]; + "x-scheme-handler/http" = ["firefox.desktop"]; + "x-scheme-handler/https" = ["firefox.desktop"]; + "application/pdf" = ["qpdfview.desktop"]; }; }; } diff --git a/home/apps/steam/default.nix b/home/apps/steam/default.nix index 861854e..534d4ae 100644 --- a/home/apps/steam/default.nix +++ b/home/apps/steam/default.nix @@ -1,15 +1,19 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: with lib; let cfg = config.local.apps.steam; -in -{ +in { options.local.apps.steam.enable = mkEnableOption "Steam"; config = mkIf cfg.enable { home.packages = [ - (pkgs.callPackage ./package.nix { }) + (pkgs.callPackage ./package.nix {}) pkgs.protonup pkgs.winetricks pkgs.protontricks ]; }; -} +} diff --git a/home/apps/steam/package.nix b/home/apps/steam/package.nix index 188d560..19f241f 100644 --- a/home/apps/steam/package.nix +++ b/home/apps/steam/package.nix @@ -1,4 +1,9 @@ -{ writeShellScriptBin, steam-run, steam, ... }: +{ + writeShellScriptBin, + steam-run, + steam, + ... +}: writeShellScriptBin "steam" '' exec ${steam-run}/bin/steam-run ${steam}/bin/steam -console '' diff --git a/home/apps/terminal/default.nix b/home/apps/terminal/default.nix index c336fe3..a32486d 100644 --- a/home/apps/terminal/default.nix +++ b/home/apps/terminal/default.nix @@ -1,9 +1,12 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.local.apps.terminal; -in { + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.local.apps.terminal; +in { options.local.apps.terminal.enable = mkEnableOption "Terminal emulator settings"; config.programs = mkIf cfg.enable { kitty = { diff --git a/home/apps/terminal/kitty.conf.nix b/home/apps/terminal/kitty.conf.nix index 59169d1..82904a9 100644 --- a/home/apps/terminal/kitty.conf.nix +++ b/home/apps/terminal/kitty.conf.nix @@ -15,7 +15,7 @@ cursor_shape beam cursor_beam_thickness 1.9 cursor_stop_blinking_after 0 - + # Audio enable_audio_bell no diff --git a/home/apps/virtmanager.nix b/home/apps/virtmanager.nix index 2dfe0c2..cca4dd7 100644 --- a/home/apps/virtmanager.nix +++ b/home/apps/virtmanager.nix @@ -1,9 +1,12 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.local.apps.virtmanager; -in { + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.local.apps.virtmanager; +in { options.local.apps.virtmanager.enable = mkEnableOption "Virtmanager"; config = mkIf cfg.enable { home.packages = with pkgs; [ diff --git a/home/cli.nix b/home/cli.nix index e1f148b..c2ac1f4 100644 --- a/home/cli.nix +++ b/home/cli.nix @@ -1,6 +1,10 @@ -{ config, lib, pkgs, ... }: -with lib; { + config, + lib, + pkgs, + ... +}: +with lib; { programs = { ## talvez esto debería moverse a base zsh = { @@ -31,21 +35,20 @@ with lib; pinentryPackage = pkgs.pinentry-emacs; }; - home.packages = with pkgs; - [ - calc - file - gcc - htop - killall - man-pages - man-pages-posix - neovim - rar - tree - units - unzip - usbutils - zip - ]; + home.packages = with pkgs; [ + calc + file + gcc + htop + killall + man-pages + man-pages-posix + neovim + rar + tree + units + unzip + usbutils + zip + ]; } diff --git a/home/default.nix b/home/default.nix index d2b1612..03fef94 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,7 +1,16 @@ -{ self, nixpkgs, unstable, hm-isolation, nixGL }: -{ config, pkgs, lib, ... }: -with lib; { + self, + nixpkgs, + unstable, + hm-isolation, + nixGL, +}: { + config, + pkgs, + lib, + ... +}: +with lib; { imports = [ (hm-isolation.homeManagerModule) ./accounts.nix @@ -14,7 +23,7 @@ with lib; ./systemd ]; - nixpkgs.overlays = [ self.overlay nixGL.overlay ]; + nixpkgs.overlays = [self.overlay nixGL.overlay]; services.ssh-agent.enable = true; @@ -55,4 +64,3 @@ with lib; }; }; } - diff --git a/home/gui/autorandr.nix b/home/gui/autorandr.nix index 107f5c9..c01ffe1 100644 --- a/home/gui/autorandr.nix +++ b/home/gui/autorandr.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.local.gui.autorandr; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.local.gui.autorandr; +in { options.local.gui.autorandr.enable = mkEnableOption "Autorandr"; config = mkIf cfg.enable { programs.autorandr = { diff --git a/home/gui/default.nix b/home/gui/default.nix index b7c5a2c..1b297a3 100644 --- a/home/gui/default.nix +++ b/home/gui/default.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.local.gui; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.local.gui; +in { options.local.gui = { enable = mkEnableOption "GUI settings and programs"; desktop = mkEnableOption "i3 desktop envirorment"; @@ -19,7 +22,6 @@ in ]; config = mkIf cfg.enable { - local.gui = { fonts.enable = mkDefault true; gtk.enable = mkDefault true; diff --git a/home/gui/fonts.nix b/home/gui/fonts.nix index f5f09da..7c38dbe 100644 --- a/home/gui/fonts.nix +++ b/home/gui/fonts.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.local.gui.fonts; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.local.gui.fonts; +in { options.local.gui.fonts.enable = mkEnableOption "Font management"; config = mkIf cfg.enable { fonts.fontconfig.enable = true; diff --git a/home/gui/gtk.nix b/home/gui/gtk.nix index 8f647cd..0f14af6 100644 --- a/home/gui/gtk.nix +++ b/home/gui/gtk.nix @@ -1,9 +1,12 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.local.gui.gtk; -in { + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.local.gui.gtk; +in { options.local.gui.gtk.enable = mkEnableOption "GTK related programs"; config = mkIf cfg.enable { home.packages = with pkgs; [ diff --git a/home/gui/i3.nix b/home/gui/i3.nix index e455cdb..944d4b5 100644 --- a/home/gui/i3.nix +++ b/home/gui/i3.nix @@ -1,107 +1,110 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.local.gui.i3; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.local.gui.i3; +in { options.local.gui.i3.enable = mkEnableOption "i3 window manager"; config = mkIf cfg.enable { xsession.windowManager.i3 = { enable = true; package = pkgs.i3-gaps; - config = - let - mod = "Mod4"; - in - { - modifier = mod; - # revisar luego si config.bars tiene un default danino + config = let + mod = "Mod4"; + in { + modifier = mod; + # revisar luego si config.bars tiene un default danino - fonts = { - names = [ "JetBrains Mono" ]; - style = "Regular"; - size = 8.0; + fonts = { + names = ["JetBrains Mono"]; + style = "Regular"; + size = 8.0; + }; + + gaps = { + inner = 10; + outer = -10; + }; + + window = { + hideEdgeBorders = "both"; + }; + + colors = { + focused = { + background = "#222222"; + border = "#4c7899"; + childBorder = "#222222"; + indicator = "#292d2e"; + text = "#888888"; }; + }; - gaps = { - inner = 10; - outer = -10; - }; + # mkOptionDefault hace que se ponga la config por default + # y se sobreescriba las cosas que pongo acA + # NO QUITARLO. ver man home-configuration.nix + keybindings = mkOptionDefault { + "${mod}+Return" = "exec ${pkgs.kitty}/bin/kitty ${pkgs.tmux}/bin/tmux"; + "${mod}+Tab" = "focus right"; + "${mod}+Shift+Tab" = "focus left"; + "${mod}+Shift+s" = "exec ${pkgs.maim}/bin/maim -s -u | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png -i"; + "${mod}+Shift+w" = "move workspace to output right"; + "${mod}+l" = "exec ${pkgs.betterlockscreen}/bin/betterlockscreen -l"; + }; - window = { - hideEdgeBorders = "both"; - }; + startup = [ + { + command = "${pkgs.xss-lock}/bin/xss-lock --transfer-sleep-lock -- ${pkgs.i3lock}/bin/i3lock --nofork"; + notification = false; + } + { + command = "${pkgs.networkmanagerapplet}/bin/nm-applet"; + notification = false; + } + { + command = "${pkgs.feh}/bin/feh --bg-fill ${config.home.homeDirectory}/Pictures/wallpapers/jupiter.png"; + notification = false; + always = true; + } + { + command = "${pkgs.i3-gaps}/bin/i3-msg 'workspace 1; exec ${pkgs.firefox}/bin/firefox'"; + } + { + command = "${pkgs.i3-gaps}/bin/i3-msg 'workspace 2; exec ${pkgs.tdesktop}/bin/telegram-desktop'"; + } + { + command = "${pkgs.i3-gaps}/bin/i3-msg 'workspace 2; exec ${pkgs.element-desktop}/bin/element-desktop'"; + } + { + command = "${pkgs.systemd}/bin/systemctl --user restart polybar.service"; + notification = false; + always = true; + } + { + command = "${pkgs.autorandr}/bin/autorandr -c"; + notification = false; + always = true; + } + ]; - colors = { - focused = { - background = "#222222"; - border = "#4c7899"; - childBorder = "#222222"; - indicator = "#292d2e"; - text = "#888888"; - }; - }; - - # mkOptionDefault hace que se ponga la config por default - # y se sobreescriba las cosas que pongo acA - # NO QUITARLO. ver man home-configuration.nix - keybindings = mkOptionDefault { - "${mod}+Return" = "exec ${pkgs.kitty}/bin/kitty ${pkgs.tmux}/bin/tmux"; - "${mod}+Tab" = "focus right"; - "${mod}+Shift+Tab" = "focus left"; - "${mod}+Shift+s" = "exec ${pkgs.maim}/bin/maim -s -u | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png -i"; - "${mod}+Shift+w" = "move workspace to output right"; - "${mod}+l" = "exec ${pkgs.betterlockscreen}/bin/betterlockscreen -l"; - }; - - startup = [ - { - command = "${pkgs.xss-lock}/bin/xss-lock --transfer-sleep-lock -- ${pkgs.i3lock}/bin/i3lock --nofork"; - notification = false; - } - { - command = "${pkgs.networkmanagerapplet}/bin/nm-applet"; - notification = false; - } - { - command = "${pkgs.feh}/bin/feh --bg-fill ${config.home.homeDirectory}/Pictures/wallpapers/jupiter.png"; - notification = false; - always = true; - } - { - command = "${pkgs.i3-gaps}/bin/i3-msg 'workspace 1; exec ${pkgs.firefox}/bin/firefox'"; - } - { - command = "${pkgs.i3-gaps}/bin/i3-msg 'workspace 2; exec ${pkgs.tdesktop}/bin/telegram-desktop'"; - } - { - command = "${pkgs.i3-gaps}/bin/i3-msg 'workspace 2; exec ${pkgs.element-desktop}/bin/element-desktop'"; - } - { - command = "${pkgs.systemd}/bin/systemctl --user restart polybar.service"; - notification = false; - always = true; - } - { - command = "${pkgs.autorandr}/bin/autorandr -c"; - notification = false; - always = true; - } - ]; - - workspaceOutputAssign = [ + workspaceOutputAssign = + [ { output = config.local.display."0"; workspace = "1"; } - ] ++ optional (config.local.display."1" != null) { + ] + ++ optional (config.local.display."1" != null) { output = config.local.display."1"; workspace = "10"; }; - bars = [ ]; - }; + bars = []; + }; }; }; } diff --git a/home/gui/polybar.nix b/home/gui/polybar.nix index f02cef9..042c668 100644 --- a/home/gui/polybar.nix +++ b/home/gui/polybar.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.local.gui.polybar; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.local.gui.polybar; +in { options.local.gui.polybar.enable = mkEnableOption "Polybar"; config = mkIf cfg.enable { services.polybar = mkIf (!config.home.isolation.active) { @@ -12,10 +15,10 @@ in script = '' # Terminate already running bar instances killall -q polybar - + # Wait until the processes have been shut down while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done - + # Launch Polybar, using default config location ~/.config/polybar/config polybar -r main & polybar -r secondary & ''; diff --git a/home/gui/startx.nix b/home/gui/startx.nix index 98cd8d1..61cd514 100644 --- a/home/gui/startx.nix +++ b/home/gui/startx.nix @@ -1,22 +1,26 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.local.gui.startx; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.local.gui.startx; +in { options.local.gui.startx.enable = mkEnableOption "startx"; config = mkIf cfg.enable { xsession.enable = true; - home.file.".xinitrc".source = - let - content = - if config.local.nixos then '' - exec ~/.xsession - '' else '' - exec ${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel ~/.xsession - ''; - in + home.file.".xinitrc".source = let + content = + if config.local.nixos + then '' + exec ~/.xsession + '' + else '' + exec ${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel ~/.xsession + ''; + in pkgs.writeShellScript "xinitrc" content; }; } diff --git a/home/isolation.nix b/home/isolation.nix index e98b641..6a79337 100644 --- a/home/isolation.nix +++ b/home/isolation.nix @@ -1,6 +1,10 @@ -{ pkgs, config, lib, ... }: -with lib; { + pkgs, + config, + lib, + ... +}: +with lib; { home.isolation = { enable = true; btrfsSupport = true; diff --git a/home/options.nix b/home/options.nix index 1316c9e..c816dd4 100644 --- a/home/options.nix +++ b/home/options.nix @@ -1,6 +1,9 @@ -{ config, lib, ... }: -with lib; { + config, + lib, + ... +}: +with lib; { options.local = with types; { platform = mkOption { type = str; @@ -18,7 +21,6 @@ with lib; autorandrProfile = mkOption { type = attrs; }; - }; nixos = mkOption { diff --git a/home/shenvs/c.nix b/home/shenvs/c.nix index ad081a3..0ce5ad7 100644 --- a/home/shenvs/c.nix +++ b/home/shenvs/c.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { static = true; packages = with pkgs; [ diff --git a/home/shenvs/python.nix b/home/shenvs/python.nix index c834c99..4818ea5 100644 --- a/home/shenvs/python.nix +++ b/home/shenvs/python.nix @@ -1,11 +1,11 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { static = true; packages = with pkgs; [ pipenv - (python310.withPackages (packages: with packages; [ - setuptools - ])) + (python310.withPackages (packages: + with packages; [ + setuptools + ])) ]; } diff --git a/home/systemd/default.nix b/home/systemd/default.nix index 57b9939..83d75a8 100644 --- a/home/systemd/default.nix +++ b/home/systemd/default.nix @@ -1,6 +1,9 @@ -{ lib, pkgs, ... }: -with lib; { + lib, + pkgs, + ... +}: +with lib; { systemd.user.tmpfiles.rules = [ "d %t/tmp 0700 fabian fabian 24h" ]; diff --git a/home/zshrc.nix b/home/zshrc.nix index c58bc3c..923dcc4 100644 --- a/home/zshrc.nix +++ b/home/zshrc.nix @@ -1,6 +1,11 @@ -{ maim, redshift, xclip, ... }: '' +{ + maim, + redshift, + xclip, + ... +}: '' # The following lines were added by compinstall - + zstyle ':completion:*' auto-description 'specify: %d' zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate zstyle ':completion:*' expand prefix suffix @@ -15,7 +20,7 @@ zstyle ':completion:*' preserve-prefix '//[^/]##/' zstyle ':completion:*' verbose true zstyle :compinstall filename '/home/fabian/.zshrc' - + autoload -Uz compinit compinit # End of lines added by compinstall @@ -27,49 +32,49 @@ unsetopt beep notify bindkey -v # End of lines configured by zsh-newuser-install - + # Prompt setopt prompt_subst autoload -Uz vcs_info precmd_vcs_info() { vcs_info } precmd_functions+=( precmd_vcs_info ) - + zstyle ':vcs_info:*' disable bzr cdv darcs mtn svk tla cvs svn zstyle ':vcs_info:*' enable git zstyle ':vcs_info:git+set-message:*' hooks format_msg - + function +vi-format_msg { local branch=$(git branch --show-current) - + if [[ -z "$branch" ]] ; then branch=$(git rev-parse --short HEAD) fi - + local color="" - + if [[ -z $(git status --porcelain 2>/dev/null) ]]; then color="%F{blue}" fi - + if [[ $(git status --porcelain 2>/dev/null | grep "^A \|^M " | wc -l) > 0 ]]; then color="%F{green}" fi - - if [[ $(git status --porcelain 2>/dev/null | grep "^??\|^AM\|^.D" | wc -l) > 0 ]] + + if [[ $(git status --porcelain 2>/dev/null | grep "^??\|^AM\|^.D" | wc -l) > 0 ]] then color="%F{red}" fi - + ret=1 hook_com[message]="$color($branch)%f " - + return 0 } - + PROMPT='%B[%~] ''${vcs_info_msg_0_}%b' - + # Aliases and binds alias ls='ls --color -F' alias l='ls --color -FhAltr' @@ -82,7 +87,7 @@ alias inbox="echo >> $HOME/gtd/inbox" alias nixoide="nix repl ''" alias vps="ssh -A vps" - bindkey -e + bindkey -e bindkey ";5D" backward-word bindkey ";5C" forward-word bindkey "\e[3~" delete-char @@ -119,7 +124,7 @@ bindkey '\e[A' up-line-or-beginning-search bindkey '\eOB' down-line-or-beginning-search bindkey '\e[B' down-line-or-beginning-search - + # Env export TERM=xterm-256color export EDITOR=nvim diff --git a/pkgs/default.nix b/pkgs/default.nix index f323efe..f243229 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,5 +1,4 @@ -pkgs: -{ +pkgs: { #andesight = pkgs.callPackage ./andesight {}; #netextender = pkgs.callPackage ./netextender {}; }