From 64ac9834124767306cc02eccffed8cc0693a8c91 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Sun, 23 Apr 2023 20:52:50 +0200 Subject: [PATCH 01/29] Initial commit --- README.md | 10 ++ configuration.nix | 199 ++++++++++++++++++++++++++ flake.lock | 286 +++++++++++++++++++++++++++++++++++++ flake.nix | 33 +++++ hardware-configuration.nix | 43 ++++++ home.nix | 30 ++++ 6 files changed, 601 insertions(+) create mode 100644 README.md create mode 100644 configuration.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware-configuration.nix create mode 100644 home.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..652ada1 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# Nixfiles + +My personal dotfiles for working with [Nix](https://nixos.org/). +It uses Nix [Flakes](https://nixos.wiki/wiki/Flakes) under the hood. + +## Usage + +1. Clone this repo +1. Run `sudo nixos-rebuild switch --flake .#` +1. Run `home-manager switch --flake .#lena` diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..df6801f --- /dev/null +++ b/configuration.nix @@ -0,0 +1,199 @@ +{ config, pkgs, ... }: + +{ + # Import hardware specific configuration + imports = [ ./hardware-configuration.nix ]; + + # Enable bluetooth + hardware.bluetooth.enable = true; + + # Enable Flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Enable garbage collection + nix.gc.automatic = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # Enable AppArmor + security.apparmor.enable = true; + + # Enable containers + virtualisation.podman.enable = true; + + # Use secure boot with lanzaboote + boot = { + bootspec.enable = true; + loader.systemd-boot.enable = pkgs.lib.mkForce false; + lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + }; + boot.loader.efi.canTouchEfiVariables = true; + + # Enable network manager + networking.networkmanager.enable = true; + + # Set time zone + time.timeZone = "Europe/Zurich"; + + # Enable sound + sound.enable = true; + services.pipewire = { + enable = true; + pulse.enable = true; + }; + + users.users.lena = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" ]; + packages = with pkgs; [ + alacritty + autotiling-rs + awscli2 + brave + brightnessctl + cargo + chafa + chromium + clipman + diff-so-fancy + dig + fd + fx + fzf + gammastep + gh + gimp + go + golangci-lint + gopass + gopls + grim + gron + hugo + imv + inkscape + jpegoptim + jq + kanshi + kubectl + kubectx + libreoffice-fresh + lolcat + lutris + lynis + mako + moq + mpv + ncdu + nmap + nodejs + nodePackages.prettier + nodePackages.svgo + optipng + playerctl + poetry + protobuf + pwgen + python3 + quickemu + realvnc-vnc-viewer + ripgrep + rustc + shellcheck + shfmt + signal-desktop + slurp + stow + stylua + swaybg + swayidle + swaylock + taskwarrior + terraform + tflint + timewarrior + tldr + tmate + tree + vifm + waybar + wf-recorder + whois + wine + wl-clipboard + wofi + workstyle + zathura + zoxide + ]; + password = "changeme"; + }; + users.defaultUserShell = pkgs.zsh; + + fonts.fonts = with pkgs; [ + fira-mono + lato + noto-fonts-cjk + noto-fonts-emoji + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + ]; + + environment.systemPackages = with pkgs; [ + curl + gcc + git + gnumake + home-manager + sbctl + unzip + wget + zip + zsh + ]; + + # Enable Neovim and make it the default editor + programs.neovim = { + enable = true; + defaultEditor = true; + }; + + # Enable ZSH + programs.zsh.enable = true; + + # Enable system monitoring + programs.htop.enable = true; + + # Enable password manager + programs.browserpass.enable = true; + + # Enable KDE Connect + programs.kdeconnect.enable = true; + + # Enable terminal multiplexer + programs.tmux.enable = true; + + # Enable Steam for gaming + programs.steam.enable = true; + + # Enable window manager + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + programs.sway.enable = true; + xdg.portal.wlr.enable = true; + + programs.gnupg.agent = { + enable = true; + }; + + # Enable firmware updater + services.fwupd.enable = true; + + # Enable power optimization + services.auto-cpufreq.enable = true; + services.thermald.enable = true; + + system.stateVersion = "22.11"; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0b1d7cc --- /dev/null +++ b/flake.lock @@ -0,0 +1,286 @@ +{ + "nodes": { + "crane": { + "inputs": { + "flake-compat": [ + "lanzaboote", + "flake-compat" + ], + "flake-utils": [ + "lanzaboote", + "flake-utils" + ], + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ], + "rust-overlay": [ + "lanzaboote", + "rust-overlay" + ] + }, + "locked": { + "lastModified": 1683505101, + "narHash": "sha256-VBU64Jfu2V4sUR5+tuQS9erBRAe/QEYUxdVMcJGMZZs=", + "owner": "ipetkov", + "repo": "crane", + "rev": "7b5bd9e5acb2bb0cfba2d65f34d8568a894cdb6c", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1683560683, + "narHash": "sha256-XAygPMN5Xnk/W2c1aW0jyEa6lfMDZWlQgiNtmHXytPc=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "006c75898cf814ef9497252b022e91c946ba8e17", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1685019994, + "narHash": "sha256-81o6SKZPALvib21hIOMx2lIhFSs0mRy0PfPvg0zsfTk=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "d1f04b0f365a34896a37d9015637796537ec88a3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "lanzaboote": { + "inputs": { + "crane": "crane", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "pre-commit-hooks-nix": "pre-commit-hooks-nix", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1684917161, + "narHash": "sha256-8q6W6vYrV09bsBaaAfRkQrJ5h0AzDWfCkHJzi4bMXsY=", + "owner": "nix-community", + "repo": "lanzaboote", + "rev": "dc52f0352dfd44c11ffd8227803f175d53adc1e1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "lanzaboote", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1684077912, + "narHash": "sha256-HNuVjMGmSp3H1MM4ymne3r07ldIB54GgPQViUZjk5Wc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "57ace723895c43160e102cc126933d8b395391ea", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1684935479, + "narHash": "sha256-6QMMsXMr2nhmOPHdti2j3KRHt+bai2zw+LJfdCl97Mk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f91ee3065de91a3531329a674a45ddcb3467a650", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": [ + "lanzaboote", + "flake-compat" + ], + "flake-utils": [ + "lanzaboote", + "flake-utils" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1682596858, + "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "fb58866e20af98779017134319b5663b8215d912", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "lanzaboote": "lanzaboote", + "nixpkgs": "nixpkgs_2" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "lanzaboote", + "flake-utils" + ], + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1684030847, + "narHash": "sha256-z4tOxaN9Cl8C80u6wyZBpPt9A9MbL21fZ3zdB/vG+AU=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "aa1480f16bec7dda3c62b8cdb184c7e823331ba2", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0762c7e --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "System configuration of CloudLena"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + lanzaboote.url = "github:nix-community/lanzaboote"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, lanzaboote, home-manager, ... }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + + in + { + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + lanzaboote.nixosModules.lanzaboote + ./configuration.nix + ]; + }; + + homeConfigurations.lena = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ ./home.nix ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..e4fc791 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,43 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/182758bf-42de-4b61-8e68-79e76002ea96"; + + fileSystems."/boot" = + { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..bee1c28 --- /dev/null +++ b/home.nix @@ -0,0 +1,30 @@ +{ config, pkgs, ... }: + +{ + home.username = "lena"; + home.homeDirectory = "/home/lena"; + + home.packages = with pkgs; [ + alacritty + ]; + + home.stateVersion = "22.11"; + + # Let Home Manager install and manage itself + programs.home-manager.enable = true; + + # Enable ZSH + programs.zsh.enable = true; + + # Enable Git + programs.git = { + enable = true; + userName = "Lena Fuhrimann"; + userEmail = "6780471+cloudlena@users.noreply.github.com"; + }; + + # Enable GPG + services.gpg-agent.enable = true; + + services.swayidle.enable = true; +} From 4057c9cd1aeb7964ed85300bf7943b87a28db9cc Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Fri, 26 May 2023 12:36:26 +0200 Subject: [PATCH 02/29] Add LICENSE --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++ README.md | 8 +- configuration.nix | 28 +- flake.lock | 92 ++----- home.nix | 97 ++++++- 5 files changed, 797 insertions(+), 102 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md index 652ada1..2d5d8ce 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Nixfiles -My personal dotfiles for working with [Nix](https://nixos.org/). -It uses Nix [Flakes](https://nixos.wiki/wiki/Flakes) under the hood. +:snowflake: My personal [NixOS](https://nixos.org/) configuration. +It uses [Flakes](https://nixos.wiki/wiki/Flakes) under the hood. ## Usage 1. Clone this repo -1. Run `sudo nixos-rebuild switch --flake .#` -1. Run `home-manager switch --flake .#lena` +1. Run `sudo nixos-rebuild switch --flake .` +1. Run `home-manager switch --flake .` diff --git a/configuration.nix b/configuration.nix index df6801f..2b085f4 100644 --- a/configuration.nix +++ b/configuration.nix @@ -5,7 +5,10 @@ imports = [ ./hardware-configuration.nix ]; # Enable bluetooth - hardware.bluetooth.enable = true; + hardware.bluetooth = { + enable = true; + powerOnBoot = false; + }; # Enable Flakes nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -24,7 +27,6 @@ # Use secure boot with lanzaboote boot = { - bootspec.enable = true; loader.systemd-boot.enable = pkgs.lib.mkForce false; lanzaboote = { enable = true; @@ -34,7 +36,10 @@ boot.loader.efi.canTouchEfiVariables = true; # Enable network manager - networking.networkmanager.enable = true; + networking.networkmanager = { + enable = true; + wifi.macAddress = "random"; + }; # Set time zone time.timeZone = "Europe/Zurich"; @@ -70,7 +75,6 @@ go golangci-lint gopass - gopls grim gron hugo @@ -91,6 +95,7 @@ ncdu nmap nodejs + stern nodePackages.prettier nodePackages.svgo optipng @@ -99,9 +104,11 @@ protobuf pwgen python3 + python311Packages.flake8 quickemu realvnc-vnc-viewer ripgrep + rnix-lsp rustc shellcheck shfmt @@ -128,6 +135,7 @@ wofi workstyle zathura + zeroad zoxide ]; password = "changeme"; @@ -152,7 +160,6 @@ unzip wget zip - zsh ]; # Enable Neovim and make it the default editor @@ -184,9 +191,12 @@ programs.sway.enable = true; xdg.portal.wlr.enable = true; - programs.gnupg.agent = { - enable = true; - }; + # Enable GPG agent + programs.gnupg.agent.enable = true; + + # Enable Kubernetes + services.k3s.enable = true; + networking.firewall.allowedTCPPorts = [ 6643 ]; # Enable firmware updater services.fwupd.enable = true; @@ -195,5 +205,5 @@ services.auto-cpufreq.enable = true; services.thermald.enable = true; - system.stateVersion = "22.11"; + system.stateVersion = "23.05"; } diff --git a/flake.lock b/flake.lock index 0b1d7cc..059b4ca 100644 --- a/flake.lock +++ b/flake.lock @@ -1,38 +1,5 @@ { "nodes": { - "crane": { - "inputs": { - "flake-compat": [ - "lanzaboote", - "flake-compat" - ], - "flake-utils": [ - "lanzaboote", - "flake-utils" - ], - "nixpkgs": [ - "lanzaboote", - "nixpkgs" - ], - "rust-overlay": [ - "lanzaboote", - "rust-overlay" - ] - }, - "locked": { - "lastModified": 1683505101, - "narHash": "sha256-VBU64Jfu2V4sUR5+tuQS9erBRAe/QEYUxdVMcJGMZZs=", - "owner": "ipetkov", - "repo": "crane", - "rev": "7b5bd9e5acb2bb0cfba2d65f34d8568a894cdb6c", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -117,11 +84,11 @@ ] }, "locked": { - "lastModified": 1685019994, - "narHash": "sha256-81o6SKZPALvib21hIOMx2lIhFSs0mRy0PfPvg0zsfTk=", + "lastModified": 1686666715, + "narHash": "sha256-lBYoA/AI22znVdwuRd1yFwixeAT9m0oudP4TVdhJiC0=", "owner": "nix-community", "repo": "home-manager", - "rev": "d1f04b0f365a34896a37d9015637796537ec88a3", + "rev": "e4aa9fd83b5c2d43b3c9c9de979a8675fcb8e563", "type": "github" }, "original": { @@ -132,20 +99,18 @@ }, "lanzaboote": { "inputs": { - "crane": "crane", "flake-compat": "flake-compat", "flake-parts": "flake-parts", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "pre-commit-hooks-nix": "pre-commit-hooks-nix", - "rust-overlay": "rust-overlay" + "pre-commit-hooks-nix": "pre-commit-hooks-nix" }, "locked": { - "lastModified": 1684917161, - "narHash": "sha256-8q6W6vYrV09bsBaaAfRkQrJ5h0AzDWfCkHJzi4bMXsY=", + "lastModified": 1686559216, + "narHash": "sha256-8yFA8F8dqUziMgd94DUSM4ljCgudcMYyWeaqdHFUvWE=", "owner": "nix-community", "repo": "lanzaboote", - "rev": "dc52f0352dfd44c11ffd8227803f175d53adc1e1", + "rev": "59e3ebb19fdd3fd235d8275b008538a72872bad7", "type": "github" }, "original": { @@ -156,11 +121,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1684077912, - "narHash": "sha256-HNuVjMGmSp3H1MM4ymne3r07ldIB54GgPQViUZjk5Wc=", + "lastModified": 1685071405, + "narHash": "sha256-qENk2wk0Zli0zeLDKMNcs8CfhPIHhtRQgPamlFUM/xw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "57ace723895c43160e102cc126933d8b395391ea", + "rev": "794a24afefde85c3e9b533443c4c73cd871f9e3a", "type": "github" }, "original": { @@ -188,11 +153,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1684935479, - "narHash": "sha256-6QMMsXMr2nhmOPHdti2j3KRHt+bai2zw+LJfdCl97Mk=", + "lastModified": 1686501370, + "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f91ee3065de91a3531329a674a45ddcb3467a650", + "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", "type": "github" }, "original": { @@ -220,11 +185,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1682596858, - "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", + "lastModified": 1684842236, + "narHash": "sha256-rYWsIXHvNhVQ15RQlBUv67W3YnM+Pd+DuXGMvCBq2IE=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "fb58866e20af98779017134319b5663b8215d912", + "rev": "61e567d6497bc9556f391faebe5e410e6623217f", "type": "github" }, "original": { @@ -240,31 +205,6 @@ "nixpkgs": "nixpkgs_2" } }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "lanzaboote", - "flake-utils" - ], - "nixpkgs": [ - "lanzaboote", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1684030847, - "narHash": "sha256-z4tOxaN9Cl8C80u6wyZBpPt9A9MbL21fZ3zdB/vG+AU=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "aa1480f16bec7dda3c62b8cdb184c7e823331ba2", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/home.nix b/home.nix index bee1c28..4d6f558 100644 --- a/home.nix +++ b/home.nix @@ -4,27 +4,98 @@ home.username = "lena"; home.homeDirectory = "/home/lena"; + nixpkgs.config.allowUnfree = true; + home.packages = with pkgs; [ alacritty + autotiling-rs + awscli2 + brave + brightnessctl + cargo + chafa + chromium + clipman + diff-so-fancy + dig + fd + fx + fzf + gammastep + gh + gimp + go + golangci-lint + gopass + grim + gron + hugo + imv + inkscape + jpegoptim + jq + kanshi + kubectl + kubectx + libreoffice-fresh + lolcat + lutris + lynis + mako + moq + mpv + ncdu + nmap + nodejs + nodePackages.prettier + nodePackages.svgo + optipng + playerctl + poetry + protobuf + pwgen + python3 + python311Packages.flake8 + quickemu + realvnc-vnc-viewer + ripgrep + rnix-lsp + rustc + shellcheck + shfmt + signal-desktop + slurp + stern + stow + stylua + swaybg + swayidle + swaylock + taskwarrior + terraform + tflint + timewarrior + tldr + tmate + tree + vifm + waybar + wf-recorder + whois + wine + wl-clipboard + wofi + workstyle + zathura + zeroad + zoxide ]; - home.stateVersion = "22.11"; + home.stateVersion = "23.05"; # Let Home Manager install and manage itself programs.home-manager.enable = true; - # Enable ZSH - programs.zsh.enable = true; - - # Enable Git - programs.git = { - enable = true; - userName = "Lena Fuhrimann"; - userEmail = "6780471+cloudlena@users.noreply.github.com"; - }; - # Enable GPG services.gpg-agent.enable = true; - - services.swayidle.enable = true; } From 14009c165afebf5b64425378c126eb8209441cd6 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Tue, 13 Jun 2023 23:39:33 +0200 Subject: [PATCH 03/29] Switch to home manager for user packages --- configuration.nix | 112 +--------------------------------------------- flake.lock | 18 ++++---- home.nix | 11 ++++- 3 files changed, 21 insertions(+), 120 deletions(-) diff --git a/configuration.nix b/configuration.nix index 2b085f4..3a1556f 100644 --- a/configuration.nix +++ b/configuration.nix @@ -36,10 +36,7 @@ boot.loader.efi.canTouchEfiVariables = true; # Enable network manager - networking.networkmanager = { - enable = true; - wifi.macAddress = "random"; - }; + networking.networkmanager.enable = true; # Set time zone time.timeZone = "Europe/Zurich"; @@ -54,102 +51,10 @@ users.users.lena = { isNormalUser = true; extraGroups = [ "wheel" "networkmanager" ]; - packages = with pkgs; [ - alacritty - autotiling-rs - awscli2 - brave - brightnessctl - cargo - chafa - chromium - clipman - diff-so-fancy - dig - fd - fx - fzf - gammastep - gh - gimp - go - golangci-lint - gopass - grim - gron - hugo - imv - inkscape - jpegoptim - jq - kanshi - kubectl - kubectx - libreoffice-fresh - lolcat - lutris - lynis - mako - moq - mpv - ncdu - nmap - nodejs - stern - nodePackages.prettier - nodePackages.svgo - optipng - playerctl - poetry - protobuf - pwgen - python3 - python311Packages.flake8 - quickemu - realvnc-vnc-viewer - ripgrep - rnix-lsp - rustc - shellcheck - shfmt - signal-desktop - slurp - stow - stylua - swaybg - swayidle - swaylock - taskwarrior - terraform - tflint - timewarrior - tldr - tmate - tree - vifm - waybar - wf-recorder - whois - wine - wl-clipboard - wofi - workstyle - zathura - zeroad - zoxide - ]; password = "changeme"; }; users.defaultUserShell = pkgs.zsh; - fonts.fonts = with pkgs; [ - fira-mono - lato - noto-fonts-cjk - noto-fonts-emoji - (nerdfonts.override { fonts = [ "FiraCode" ]; }) - ]; - environment.systemPackages = with pkgs; [ curl gcc @@ -171,15 +76,9 @@ # Enable ZSH programs.zsh.enable = true; - # Enable system monitoring + # Enable process viewer programs.htop.enable = true; - # Enable password manager - programs.browserpass.enable = true; - - # Enable KDE Connect - programs.kdeconnect.enable = true; - # Enable terminal multiplexer programs.tmux.enable = true; @@ -191,13 +90,6 @@ programs.sway.enable = true; xdg.portal.wlr.enable = true; - # Enable GPG agent - programs.gnupg.agent.enable = true; - - # Enable Kubernetes - services.k3s.enable = true; - networking.firewall.allowedTCPPorts = [ 6643 ]; - # Enable firmware updater services.fwupd.enable = true; diff --git a/flake.lock b/flake.lock index 059b4ca..830558c 100644 --- a/flake.lock +++ b/flake.lock @@ -84,11 +84,11 @@ ] }, "locked": { - "lastModified": 1686666715, - "narHash": "sha256-lBYoA/AI22znVdwuRd1yFwixeAT9m0oudP4TVdhJiC0=", + "lastModified": 1686922395, + "narHash": "sha256-ysevinohPxdKp0RXyhDRsz1/vh1eXazg4AWp0n5X/U4=", "owner": "nix-community", "repo": "home-manager", - "rev": "e4aa9fd83b5c2d43b3c9c9de979a8675fcb8e563", + "rev": "9ba7b3990eb1f4782ea3f5fe7ac4f3c88dd7a32c", "type": "github" }, "original": { @@ -106,11 +106,11 @@ "pre-commit-hooks-nix": "pre-commit-hooks-nix" }, "locked": { - "lastModified": 1686559216, - "narHash": "sha256-8yFA8F8dqUziMgd94DUSM4ljCgudcMYyWeaqdHFUvWE=", + "lastModified": 1686692834, + "narHash": "sha256-EFjJ/r4iYVKO+XdL15g9bzOKbCExTGeqNEVHSn0H7/E=", "owner": "nix-community", "repo": "lanzaboote", - "rev": "59e3ebb19fdd3fd235d8275b008538a72872bad7", + "rev": "823ad6b70bf09b91c3a9dd9a64678ec80ba3c1ee", "type": "github" }, "original": { @@ -153,11 +153,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1686501370, - "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", + "lastModified": 1686776226, + "narHash": "sha256-o6WbKvENj98QJz9Mco6T6SZGrjPewMDAFyKg0Lp8avU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", + "rev": "0d2cf7fe5fa05d5271a15a8933414ee0a1570648", "type": "github" }, "original": { diff --git a/home.nix b/home.nix index 4d6f558..f811810 100644 --- a/home.nix +++ b/home.nix @@ -5,6 +5,7 @@ home.homeDirectory = "/home/lena"; nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowUnfreePredicate = (pkg: true); home.packages = with pkgs; [ alacritty @@ -19,11 +20,13 @@ diff-so-fancy dig fd + fira-mono fx fzf gammastep gh gimp + gnupg go golangci-lint gopass @@ -37,18 +40,21 @@ kanshi kubectl kubectx + lato libreoffice-fresh lolcat lutris - lynis mako moq mpv ncdu + (nerdfonts.override { fonts = [ "FiraCode" ]; }) nmap nodejs nodePackages.prettier nodePackages.svgo + noto-fonts-cjk + noto-fonts-emoji optipng playerctl poetry @@ -96,6 +102,9 @@ # Let Home Manager install and manage itself programs.home-manager.enable = true; + # Enable password manager + programs.browserpass.enable = true; + # Enable GPG services.gpg-agent.enable = true; } From e901faa12abdbe129478b79ce0b0486961a789ba Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Fri, 16 Jun 2023 22:40:43 +0200 Subject: [PATCH 04/29] Switch to new laptop --- configuration.nix | 40 ++++++++++++++++++++++++-------------- flake.lock | 6 +++--- hardware-configuration.nix | 13 +++++++------ home.nix | 6 +++--- 4 files changed, 38 insertions(+), 27 deletions(-) diff --git a/configuration.nix b/configuration.nix index 3a1556f..592f35c 100644 --- a/configuration.nix +++ b/configuration.nix @@ -10,21 +10,6 @@ powerOnBoot = false; }; - # Enable Flakes - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - # Enable garbage collection - nix.gc.automatic = true; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # Enable AppArmor - security.apparmor.enable = true; - - # Enable containers - virtualisation.podman.enable = true; - # Use secure boot with lanzaboote boot = { loader.systemd-boot.enable = pkgs.lib.mkForce false; @@ -35,6 +20,15 @@ }; boot.loader.efi.canTouchEfiVariables = true; + # Set up keyfile + boot.initrd.secrets = { + "/crypto_keyfile.bin" = null; + }; + + # Enable swap on luks + boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".device = "/dev/disk/by-uuid/58a9f60d-bf2d-4c94-8f08-8e29a4083728"; + boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".keyFile = "/crypto_keyfile.bin"; + # Enable network manager networking.networkmanager.enable = true; @@ -48,13 +42,29 @@ pulse.enable = true; }; + # Enable AppArmor + security.apparmor.enable = true; + + # Enable containers + virtualisation.podman.enable = true; + users.users.lena = { isNormalUser = true; + description = "Lena"; extraGroups = [ "wheel" "networkmanager" ]; password = "changeme"; }; users.defaultUserShell = pkgs.zsh; + # Enable Flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Enable garbage collection + nix.gc.automatic = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; [ curl gcc diff --git a/flake.lock b/flake.lock index 830558c..5b7a692 100644 --- a/flake.lock +++ b/flake.lock @@ -153,11 +153,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1686776226, - "narHash": "sha256-o6WbKvENj98QJz9Mco6T6SZGrjPewMDAFyKg0Lp8avU=", + "lastModified": 1686869522, + "narHash": "sha256-tbJ9B8WLCTnVP/LwESRlg0dII6Zyg2LmUU/mB9Lu98E=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0d2cf7fe5fa05d5271a15a8933414ee0a1570648", + "rev": "7c67f006ea0e7d0265f16d7df07cc076fdffd91f", "type": "github" }, "original": { diff --git a/hardware-configuration.nix b/hardware-configuration.nix index e4fc791..0b8b41d 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -9,33 +9,34 @@ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; fileSystems."/" = { - device = "/dev/disk/by-label/nixos"; + device = "/dev/disk/by-uuid/c515aa2a-c2d8-4a09-869e-948fb393cdc2"; fsType = "ext4"; }; - boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/182758bf-42de-4b61-8e68-79e76002ea96"; + boot.initrd.luks.devices."luks-3287adf5-afa8-45c8-a958-fea13766dbeb".device = "/dev/disk/by-uuid/3287adf5-afa8-45c8-a958-fea13766dbeb"; fileSystems."/boot" = { - device = "/dev/disk/by-label/boot"; + device = "/dev/disk/by-uuid/B81C-4766"; fsType = "vfat"; }; - swapDevices = [ ]; + swapDevices = + [{ device = "/dev/disk/by-uuid/598c997a-f989-4c93-bf3b-0e8eaa6908d6"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's # still possible to use this option, but it's recommended to use it in conjunction # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; diff --git a/home.nix b/home.nix index f811810..ef57003 100644 --- a/home.nix +++ b/home.nix @@ -4,9 +4,6 @@ home.username = "lena"; home.homeDirectory = "/home/lena"; - nixpkgs.config.allowUnfree = true; - nixpkgs.config.allowUnfreePredicate = (pkg: true); - home.packages = with pkgs; [ alacritty autotiling-rs @@ -99,6 +96,9 @@ home.stateVersion = "23.05"; + nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowUnfreePredicate = (pkg: true); + # Let Home Manager install and manage itself programs.home-manager.enable = true; From 3b2235673eeca9c49cc701c44b768b6498e3b95e Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Sun, 18 Jun 2023 00:48:52 +0200 Subject: [PATCH 05/29] Drop home manager --- README.md | 1 - configuration.nix | 101 +++++++++++++++++++++++++++++++++++++++++- flake.lock | 33 +++----------- flake.nix | 11 +---- home.nix | 110 ---------------------------------------------- 5 files changed, 107 insertions(+), 149 deletions(-) delete mode 100644 home.nix diff --git a/README.md b/README.md index 2d5d8ce..0a88638 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,3 @@ It uses [Flakes](https://nixos.wiki/wiki/Flakes) under the hood. 1. Clone this repo 1. Run `sudo nixos-rebuild switch --flake .` -1. Run `home-manager switch --flake .` diff --git a/configuration.nix b/configuration.nix index 592f35c..eac48ef 100644 --- a/configuration.nix +++ b/configuration.nix @@ -48,10 +48,94 @@ # Enable containers virtualisation.podman.enable = true; + # Set up user users.users.lena = { isNormalUser = true; description = "Lena"; extraGroups = [ "wheel" "networkmanager" ]; + packages = with pkgs; [ + alacritty + autotiling-rs + awscli2 + brave + brightnessctl + cargo + chafa + chromium + clipman + diff-so-fancy + dig + fd + fx + fzf + gammastep + gh + gimp + gnupg + go + golangci-lint + gopass + grim + gron + hugo + imv + inkscape + jpegoptim + jq + kanshi + kubectl + kubectx + libreoffice-fresh + lolcat + lutris + mako + moq + mpv + ncdu + nmap + nodejs + nodePackages.prettier + nodePackages.svgo + optipng + playerctl + poetry + protobuf + pwgen + python3 + python311Packages.flake8 + quickemu + realvnc-vnc-viewer + ripgrep + rnix-lsp + rustc + shellcheck + shfmt + signal-desktop + slurp + stern + stow + stylua + swaybg + swayidle + swaylock + taskwarrior + terraform + tflint + timewarrior + tldr + tmate + tree + vifm + waybar + wf-recorder + whois + wine + wl-clipboard + wofi + workstyle + zathura + zoxide + ]; password = "changeme"; }; users.defaultUserShell = pkgs.zsh; @@ -65,27 +149,42 @@ # Allow unfree packages nixpkgs.config.allowUnfree = true; + # Install system packages environment.systemPackages = with pkgs; [ curl gcc git gnumake - home-manager sbctl unzip wget zip ]; + # Install fonts + fonts.fonts = with pkgs; [ + fira-mono + lato + noto-fonts-cjk + noto-fonts-emoji + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + ]; + # Enable Neovim and make it the default editor programs.neovim = { enable = true; defaultEditor = true; }; + # Enable password manager + programs.browserpass.enable = true; + # Enable ZSH programs.zsh.enable = true; + # Enable GPG agent + programs.gnupg.agent.enable = true; + # Enable process viewer programs.htop.enable = true; diff --git a/flake.lock b/flake.lock index 5b7a692..7f95952 100644 --- a/flake.lock +++ b/flake.lock @@ -77,26 +77,6 @@ "type": "github" } }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1686922395, - "narHash": "sha256-ysevinohPxdKp0RXyhDRsz1/vh1eXazg4AWp0n5X/U4=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "9ba7b3990eb1f4782ea3f5fe7ac4f3c88dd7a32c", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, "lanzaboote": { "inputs": { "flake-compat": "flake-compat", @@ -106,11 +86,11 @@ "pre-commit-hooks-nix": "pre-commit-hooks-nix" }, "locked": { - "lastModified": 1686692834, - "narHash": "sha256-EFjJ/r4iYVKO+XdL15g9bzOKbCExTGeqNEVHSn0H7/E=", + "lastModified": 1687124707, + "narHash": "sha256-BEC2y7zwDI/Saeupr9rijLvwb0OoqTD9vntlcyciyrM=", "owner": "nix-community", "repo": "lanzaboote", - "rev": "823ad6b70bf09b91c3a9dd9a64678ec80ba3c1ee", + "rev": "c758cdad465e0c8174db57dc493f51a89f0e3372", "type": "github" }, "original": { @@ -153,11 +133,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1686869522, - "narHash": "sha256-tbJ9B8WLCTnVP/LwESRlg0dII6Zyg2LmUU/mB9Lu98E=", + "lastModified": 1686960236, + "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7c67f006ea0e7d0265f16d7df07cc076fdffd91f", + "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86", "type": "github" }, "original": { @@ -200,7 +180,6 @@ }, "root": { "inputs": { - "home-manager": "home-manager", "lanzaboote": "lanzaboote", "nixpkgs": "nixpkgs_2" } diff --git a/flake.nix b/flake.nix index 0762c7e..250eb65 100644 --- a/flake.nix +++ b/flake.nix @@ -4,13 +4,9 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; lanzaboote.url = "github:nix-community/lanzaboote"; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; - outputs = { nixpkgs, lanzaboote, home-manager, ... }: + outputs = { nixpkgs, lanzaboote, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; @@ -24,10 +20,5 @@ ./configuration.nix ]; }; - - homeConfigurations.lena = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ ./home.nix ]; - }; }; } diff --git a/home.nix b/home.nix deleted file mode 100644 index ef57003..0000000 --- a/home.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ config, pkgs, ... }: - -{ - home.username = "lena"; - home.homeDirectory = "/home/lena"; - - home.packages = with pkgs; [ - alacritty - autotiling-rs - awscli2 - brave - brightnessctl - cargo - chafa - chromium - clipman - diff-so-fancy - dig - fd - fira-mono - fx - fzf - gammastep - gh - gimp - gnupg - go - golangci-lint - gopass - grim - gron - hugo - imv - inkscape - jpegoptim - jq - kanshi - kubectl - kubectx - lato - libreoffice-fresh - lolcat - lutris - mako - moq - mpv - ncdu - (nerdfonts.override { fonts = [ "FiraCode" ]; }) - nmap - nodejs - nodePackages.prettier - nodePackages.svgo - noto-fonts-cjk - noto-fonts-emoji - optipng - playerctl - poetry - protobuf - pwgen - python3 - python311Packages.flake8 - quickemu - realvnc-vnc-viewer - ripgrep - rnix-lsp - rustc - shellcheck - shfmt - signal-desktop - slurp - stern - stow - stylua - swaybg - swayidle - swaylock - taskwarrior - terraform - tflint - timewarrior - tldr - tmate - tree - vifm - waybar - wf-recorder - whois - wine - wl-clipboard - wofi - workstyle - zathura - zeroad - zoxide - ]; - - home.stateVersion = "23.05"; - - nixpkgs.config.allowUnfree = true; - nixpkgs.config.allowUnfreePredicate = (pkg: true); - - # Let Home Manager install and manage itself - programs.home-manager.enable = true; - - # Enable password manager - programs.browserpass.enable = true; - - # Enable GPG - services.gpg-agent.enable = true; -} From 9b36d89488770315c71be3a7305c5fdf2ae0b423 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Tue, 20 Jun 2023 23:57:07 +0200 Subject: [PATCH 06/29] Bring back home manager --- README.md | 1 + alacritty/alacritty.yml | 39 ++++ configuration.nix | 173 ++++------------ flake.lock | 51 +++-- flake.nix | 16 +- gopass/config | 5 + home.nix | 175 ++++++++++++++++ hyprland/hyprland.conf | 120 +++++++++++ mako/config | 7 + nvim/init.lua | 18 ++ nvim/lua/config/autocmds.lua | 16 ++ nvim/lua/config/options.lua | 19 ++ nvim/lua/config/tools.lua | 35 ++++ nvim/lua/plugins/code_outline.lua | 11 + nvim/lua/plugins/colorscheme.lua | 13 ++ nvim/lua/plugins/completion.lua | 38 ++++ nvim/lua/plugins/convenience.lua | 19 ++ nvim/lua/plugins/debugging.lua | 49 +++++ nvim/lua/plugins/diagnostics.lua | 10 + nvim/lua/plugins/diff_directories.lua | 10 + nvim/lua/plugins/file_tree.lua | 25 +++ nvim/lua/plugins/focused_writing.lua | 17 ++ nvim/lua/plugins/fuzzy_finding.lua | 34 ++++ nvim/lua/plugins/git.lua | 61 ++++++ nvim/lua/plugins/lsp.lua | 95 +++++++++ nvim/lua/plugins/status_line.lua | 33 +++ nvim/lua/plugins/testing.lua | 66 ++++++ nvim/lua/plugins/tools.lua | 50 +++++ nvim/lua/plugins/treesitter.lua | 42 ++++ sway/config | 187 +++++++++++++++++ tmux/tmux.conf | 41 ++++ tmux/tmux.macos.conf | 2 + vifm/colors/tokyonight.vifm | 10 + vifm/vifmrc | 20 ++ wallpapers/bespinian.png | Bin 0 -> 8519 bytes waybar/config.jsonc | 69 +++++++ waybar/scripts/containers.sh | 21 ++ waybar/scripts/tasks.sh | 21 ++ waybar/scripts/updates-arch-combined.sh | 17 ++ waybar/style.css | 65 ++++++ wofi/style.css | 22 ++ workstyle/config.toml | 55 +++++ zsh/.zpreztorc | 32 +++ zsh/.zsh.d/aliases.zsh | 4 + zsh/.zsh.d/functions.zsh | 245 +++++++++++++++++++++++ zsh/.zsh.d/themes/prompt_cloudlena_setup | 49 +++++ zsh/.zshenv | 27 +++ zsh/.zshrc | 20 ++ 48 files changed, 2001 insertions(+), 154 deletions(-) create mode 100644 alacritty/alacritty.yml create mode 100644 gopass/config create mode 100644 home.nix create mode 100644 hyprland/hyprland.conf create mode 100644 mako/config create mode 100644 nvim/init.lua create mode 100644 nvim/lua/config/autocmds.lua create mode 100644 nvim/lua/config/options.lua create mode 100644 nvim/lua/config/tools.lua create mode 100644 nvim/lua/plugins/code_outline.lua create mode 100644 nvim/lua/plugins/colorscheme.lua create mode 100644 nvim/lua/plugins/completion.lua create mode 100644 nvim/lua/plugins/convenience.lua create mode 100644 nvim/lua/plugins/debugging.lua create mode 100644 nvim/lua/plugins/diagnostics.lua create mode 100644 nvim/lua/plugins/diff_directories.lua create mode 100644 nvim/lua/plugins/file_tree.lua create mode 100644 nvim/lua/plugins/focused_writing.lua create mode 100644 nvim/lua/plugins/fuzzy_finding.lua create mode 100644 nvim/lua/plugins/git.lua create mode 100644 nvim/lua/plugins/lsp.lua create mode 100644 nvim/lua/plugins/status_line.lua create mode 100644 nvim/lua/plugins/testing.lua create mode 100644 nvim/lua/plugins/tools.lua create mode 100644 nvim/lua/plugins/treesitter.lua create mode 100644 sway/config create mode 100644 tmux/tmux.conf create mode 100644 tmux/tmux.macos.conf create mode 100644 vifm/colors/tokyonight.vifm create mode 100644 vifm/vifmrc create mode 100644 wallpapers/bespinian.png create mode 100644 waybar/config.jsonc create mode 100755 waybar/scripts/containers.sh create mode 100755 waybar/scripts/tasks.sh create mode 100755 waybar/scripts/updates-arch-combined.sh create mode 100644 waybar/style.css create mode 100644 wofi/style.css create mode 100644 workstyle/config.toml create mode 100644 zsh/.zpreztorc create mode 100644 zsh/.zsh.d/aliases.zsh create mode 100644 zsh/.zsh.d/functions.zsh create mode 100644 zsh/.zsh.d/themes/prompt_cloudlena_setup create mode 100644 zsh/.zshenv create mode 100644 zsh/.zshrc diff --git a/README.md b/README.md index 0a88638..2d5d8ce 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,4 @@ It uses [Flakes](https://nixos.wiki/wiki/Flakes) under the hood. 1. Clone this repo 1. Run `sudo nixos-rebuild switch --flake .` +1. Run `home-manager switch --flake .` diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml new file mode 100644 index 0000000..23cf1ef --- /dev/null +++ b/alacritty/alacritty.yml @@ -0,0 +1,39 @@ +window: + padding: + x: 5 + y: 5 + decorations: none + startup_mode: Maximized + +font: + normal: + family: FiraCode Nerd Font + size: 12 + +# The Tokyo Night color scheme +# Copied from https://github.com/folke/tokyonight.nvim/blob/main/extras/alacritty_tokyonight_night.yml +colors: + primary: + background: "#1a1b26" + foreground: "#c0caf5" + normal: + black: "#15161E" + red: "#f7768e" + green: "#9ece6a" + yellow: "#e0af68" + blue: "#7aa2f7" + magenta: "#bb9af7" + cyan: "#7dcfff" + white: "#a9b1d6" + bright: + black: "#414868" + red: "#f7768e" + green: "#9ece6a" + yellow: "#e0af68" + blue: "#7aa2f7" + magenta: "#bb9af7" + cyan: "#7dcfff" + white: "#c0caf5" + indexed_colors: + - { index: 16, color: "#ff9e64" } + - { index: 17, color: "#db4b4b" } diff --git a/configuration.nix b/configuration.nix index eac48ef..d6dba0d 100644 --- a/configuration.nix +++ b/configuration.nix @@ -4,13 +4,13 @@ # Import hardware specific configuration imports = [ ./hardware-configuration.nix ]; - # Enable bluetooth + # Bluetooth hardware.bluetooth = { enable = true; powerOnBoot = false; }; - # Use secure boot with lanzaboote + # Secure boot boot = { loader.systemd-boot.enable = pkgs.lib.mkForce false; lanzaboote = { @@ -29,113 +29,30 @@ boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".device = "/dev/disk/by-uuid/58a9f60d-bf2d-4c94-8f08-8e29a4083728"; boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".keyFile = "/crypto_keyfile.bin"; - # Enable network manager + # Network manager networking.networkmanager.enable = true; - # Set time zone + # Time zone time.timeZone = "Europe/Zurich"; - # Enable sound + # Sound sound.enable = true; services.pipewire = { enable = true; pulse.enable = true; }; - # Enable AppArmor + # AppArmor security.apparmor.enable = true; - # Enable containers + # Containers virtualisation.podman.enable = true; - # Set up user + # Users users.users.lena = { - isNormalUser = true; description = "Lena"; + isNormalUser = true; extraGroups = [ "wheel" "networkmanager" ]; - packages = with pkgs; [ - alacritty - autotiling-rs - awscli2 - brave - brightnessctl - cargo - chafa - chromium - clipman - diff-so-fancy - dig - fd - fx - fzf - gammastep - gh - gimp - gnupg - go - golangci-lint - gopass - grim - gron - hugo - imv - inkscape - jpegoptim - jq - kanshi - kubectl - kubectx - libreoffice-fresh - lolcat - lutris - mako - moq - mpv - ncdu - nmap - nodejs - nodePackages.prettier - nodePackages.svgo - optipng - playerctl - poetry - protobuf - pwgen - python3 - python311Packages.flake8 - quickemu - realvnc-vnc-viewer - ripgrep - rnix-lsp - rustc - shellcheck - shfmt - signal-desktop - slurp - stern - stow - stylua - swaybg - swayidle - swaylock - taskwarrior - terraform - tflint - timewarrior - tldr - tmate - tree - vifm - waybar - wf-recorder - whois - wine - wl-clipboard - wofi - workstyle - zathura - zoxide - ]; password = "changeme"; }; users.defaultUserShell = pkgs.zsh; @@ -143,68 +60,64 @@ # Enable Flakes nix.settings.experimental-features = [ "nix-command" "flakes" ]; - # Enable garbage collection + # Garbage collection nix.gc.automatic = true; # Allow unfree packages nixpkgs.config.allowUnfree = true; - # Install system packages + # System packages environment.systemPackages = with pkgs; [ curl gcc - git gnumake + home-manager sbctl unzip wget zip ]; - # Install fonts - fonts.fonts = with pkgs; [ - fira-mono - lato - noto-fonts-cjk - noto-fonts-emoji - (nerdfonts.override { fonts = [ "FiraCode" ]; }) - ]; - - # Enable Neovim and make it the default editor - programs.neovim = { - enable = true; - defaultEditor = true; - }; + # Window manager + programs.sway.enable = true; + xdg.portal.wlr.enable = true; + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + environment.sessionVariables.GTK_THEME = "Adwaita:dark"; - # Enable password manager - programs.browserpass.enable = true; + programs = { + # Neovim + neovim = { + enable = true; + defaultEditor = true; + }; - # Enable ZSH - programs.zsh.enable = true; + # ZSH + zsh.enable = true; - # Enable GPG agent - programs.gnupg.agent.enable = true; + # Git + git.enable = true; - # Enable process viewer - programs.htop.enable = true; + # Process viewer + htop.enable = true; - # Enable terminal multiplexer - programs.tmux.enable = true; + # Terminal multiplexer + tmux.enable = true; - # Enable Steam for gaming - programs.steam.enable = true; + # Gaming + steam.enable = true; + }; - # Enable window manager - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - programs.sway.enable = true; - xdg.portal.wlr.enable = true; + services = { + # Firmware updater + fwupd.enable = true; - # Enable firmware updater - services.fwupd.enable = true; + # Geolocation service + geoclue2.enable = true; - # Enable power optimization - services.auto-cpufreq.enable = true; - services.thermald.enable = true; + # Power optimization + auto-cpufreq.enable = true; + thermald.enable = true; + }; system.stateVersion = "23.05"; } diff --git a/flake.lock b/flake.lock index 7f95952..47d000e 100644 --- a/flake.lock +++ b/flake.lock @@ -77,12 +77,34 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687647343, + "narHash": "sha256-1/o/i9KEFOBdlF9Cs04kBcqDFbYMt6W4SMqGa+QnnaI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0ee5ab611dc1fbb5180bd7d88d2aeb7841a4d179", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "lanzaboote": { "inputs": { "flake-compat": "flake-compat", "flake-parts": "flake-parts", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "nixpkgs" + ], "pre-commit-hooks-nix": "pre-commit-hooks-nix" }, "locked": { @@ -101,16 +123,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1685071405, - "narHash": "sha256-qENk2wk0Zli0zeLDKMNcs8CfhPIHhtRQgPamlFUM/xw=", + "lastModified": 1687502512, + "narHash": "sha256-dBL/01TayOSZYxtY4cMXuNCBk8UMLoqRZA+94xiFpJA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "794a24afefde85c3e9b533443c4c73cd871f9e3a", + "rev": "3ae20aa58a6c0d1ca95c9b11f59a2d12eebc511f", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable-small", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -131,22 +153,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1686960236, - "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": [ @@ -180,8 +186,9 @@ }, "root": { "inputs": { + "home-manager": "home-manager", "lanzaboote": "lanzaboote", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" } }, "systems": { diff --git a/flake.nix b/flake.nix index 250eb65..09546ef 100644 --- a/flake.nix +++ b/flake.nix @@ -3,10 +3,17 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - lanzaboote.url = "github:nix-community/lanzaboote"; + lanzaboote = { + url = "github:nix-community/lanzaboote"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { nixpkgs, lanzaboote, ... }: + outputs = { nixpkgs, lanzaboote, home-manager, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; @@ -20,5 +27,10 @@ ./configuration.nix ]; }; + + homeConfigurations.lena = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ ./home.nix ]; + }; }; } diff --git a/gopass/config b/gopass/config new file mode 100644 index 0000000..a3ea754 --- /dev/null +++ b/gopass/config @@ -0,0 +1,5 @@ +[core] + notifications = false + showsafecontent = true +[mounts] + path = ~/.password-store diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..3a15bbe --- /dev/null +++ b/home.nix @@ -0,0 +1,175 @@ +{ config, pkgs, ... }: + +{ + home.username = "lena"; + home.homeDirectory = "/home/lena"; + + home.packages = with pkgs; [ + alacritty + autotiling-rs + awscli2 + brave + brightnessctl + cargo + chafa + chromium + clipman + diff-so-fancy + dig + fd + fira-mono + fx + gammastep + gh + gimp + golangci-lint + gopass + grim + gron + hugo + imv + inkscape + jpegoptim + kanshi + kubectl + kubectx + lato + libreoffice-fresh + lolcat + lutris + moq + ncdu + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + nmap + nodejs + nodePackages.prettier + nodePackages.svgo + noto-fonts-cjk + noto-fonts-emoji + optipng + playerctl + poetry + protobuf + pwgen + python3 + python311Packages.flake8 + quickemu + realvnc-vnc-viewer + rnix-lsp + rustc + shellcheck + shfmt + signal-desktop + slurp + stylua + swaybg + swayidle + swaylock + terraform + tflint + timewarrior + tldr + tmate + tree + vifm + waybar + wf-recorder + whois + wine + wl-clipboard + wofi + workstyle + ]; + + home.stateVersion = "23.05"; + + nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowUnfreePredicate = pkg: true; + + programs = { + # Let Home Manager install and manage itself + home-manager.enable = true; + + # Git + git = { + enable = true; + userName = "Lena Fuhrimann"; + userEmail = "6780471+cloudlena@users.noreply.github.com"; + signing = { + key = null; + signByDefault = true; + }; + diff-so-fancy.enable = true; + }; + + # GPG + gpg.enable = true; + + # Fuzzy finder + fzf.enable = true; + + # Fast grepping + ripgrep.enable = true; + + # Quick navigation + zoxide.enable = true; + + # Password manager + browserpass.enable = true; + + # JSON parser + jq.enable = true; + + # PDF viewer + zathura.enable = true; + + # Task management + taskwarrior.enable = true; + + # Media player + mpv.enable = true; + + # Go + go.enable = true; + }; + + services = { + # GPG + gpg-agent.enable = true; + + # Notifications + mako.enable = true; + + # Adjust color temperature to reduce eye strain + gammastep = { + enable = true; + provider = "geoclue2"; + }; + + # Battery signal demon + batsignal.enable = true; + }; + + # Dotfiles + home.file = { + ".zshrc".source = ./zsh/.zshrc; + ".zshenv".source = ./zsh/.zshenv; + ".zpreztorc".source = ./zsh/.zpreztorc; + ".zsh.d".source = ./zsh/.zsh.d; + }; + xdg.configFile = { + "alacritty".source = ./alacritty; + "gopass".source = ./gopass; + "hypr".source = ./hyprland; + "mako".source = ./mako; + "nvim/init.lua".source = ./nvim/init.lua; + "nvim/lua".source = ./nvim/lua; + "sway".source = ./sway; + "tmux".source = ./tmux; + "vifm".source = ./vifm; + "waybar".source = ./waybar; + "wofi".source = ./wofi; + "workstyle".source = ./workstyle; + "wallpapers".source = ./wallpapers; + }; +} diff --git a/hyprland/hyprland.conf b/hyprland/hyprland.conf new file mode 100644 index 0000000..7126a2a --- /dev/null +++ b/hyprland/hyprland.conf @@ -0,0 +1,120 @@ +### Variables + +$mainMod = SUPER +$colorActive = rgb(bb9af7) +$wallpaper = ~/.config/wallpapers/bespinian.png +$lockCmd = swaylock --daemonize --image $wallpaper +$sleepCmd = systemctl suspend +$launcherCmd = wofi --show drun --no-actions --insensitive --prompt 'Run' + +general { + border_size = 2 + gaps_in = 0 + gaps_out = 0 + col.active_border = $colorActive + col.group_border_active = $colorActive + cursor_inactive_timeout = 8 +} + +input { + kb_options = caps:escape,compose:ralt + touchpad { + natural_scroll = yes + } +} + +gestures { + workspace_swipe = yes + workspace_swipe_min_speed_to_force = 5 +} + +misc { + disable_hyprland_logo = true + disable_splash_rendering = true +} + +### Dwindle + +dwindle { + # Put new splits on the right/bottom + force_split = 2 + no_gaps_when_only = true +} + +### Monitors + +# Scale built in monitor correctly +monitor = eDP-1, preferred, auto, 1.5 + +# Run helper programs +exec-once = workstyle &> /tmp/workstyle.log +exec-once = waybar +exec-once = mako +exec-once = gammastep +exec-once = swaybg --mode fill --image $wallpaper +exec-once = wl-paste --type text --watch clipman store +exec-once = swayidle -w timeout 900 '$lockCmd' timeout 1200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' timeout 1800 '$sleepCmd' before-sleep 'playerctl pause' before-sleep '$lockCmd' lock '$lockCmd' + +### Binds + +# Window manager +bind = $mainMod, Tab, focusurgentorlast +bind = $mainMod, Q, killactive, +bind = $mainMod, F, fullscreen + +# Shortcuts +bind = $mainMod, Space, exec, $launcherCmd +bind = $mainMod, Return, exec, alacritty +bind = $mainMod, W, exec, brave +bind = $mainMod, V, exec, clipman pick --tool wofi +bind = SUPER_CTRL, Q, exec, $lockCmd + +# Media keys +bind = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ +bind = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle +bind = , XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle +bind = , XF86MonBrightnessDown, exec, brightnessctl set 5%- +bind = , XF86MonBrightnessUp, exec, brightnessctl set +5% +bind = , XF86AudioPlay, exec, playerctl play-pause +bind = , XF86AudioNext, exec, playerctl next +bind = , XF86AudioPrev, exec, playerctl previous +bind = , XF86Search, exec, $launcherCmd + +# Screenshots +bind = , Print ,exec, grim "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png" +bind = $mainMod, Print , exec, grim -g "$(slurp)" "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png" + +# Move window focus +bind = $mainMod, H, movefocus, l +bind = $mainMod, J, movefocus, d +bind = $mainMod, K, movefocus, u +bind = $mainMod, L, movefocus, r + +# Switch workspaces +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, togglespecialworkspace + +# Move active window to workspace +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, special + +# Move/resize windows with mouse +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow diff --git a/mako/config b/mako/config new file mode 100644 index 0000000..f1577cb --- /dev/null +++ b/mako/config @@ -0,0 +1,7 @@ +font=Fira Mono 9 +background-color=#1a1b26 +text-color=#c0caf5 +width=350 +border-color=#bb9af7 +default-timeout=8000 +group-by=app-name,summary diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..ec8bd43 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,18 @@ +-- Install Lazy if not installed yet +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "--single-branch", + "https://github.com/folke/lazy.nvim.git", + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("config.options") +require("config.autocmds") + +require("lazy").setup("plugins", { defaults = { version = "*" } }) diff --git a/nvim/lua/config/autocmds.lua b/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..69d2a2d --- /dev/null +++ b/nvim/lua/config/autocmds.lua @@ -0,0 +1,16 @@ +-- Strip trailing whitespaces on save +local clean_whitespace_group = vim.api.nvim_create_augroup("CleanWhitespace", { clear = true }) +vim.api.nvim_create_autocmd("BufWritePre", { + group = clean_whitespace_group, + command = "%s/\\s\\+$//e", +}) + +-- Enable spell checking for certain file types +local enable_spell_check_group = vim.api.nvim_create_augroup("EnableSpellCheck", { clear = true }) +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + group = enable_spell_check_group, + pattern = { "*.txt", "*.md", "*.tex" }, + callback = function() + vim.opt_local.spell = true + end, +}) diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua new file mode 100644 index 0000000..369e72a --- /dev/null +++ b/nvim/lua/config/options.lua @@ -0,0 +1,19 @@ +vim.g.mapleader = " " -- Set leader key +vim.g.maplocalleader = " " -- Set local leader key +vim.o.completeopt = "menuone,noselect" -- Have a better completion experience +vim.opt.breakindent = true -- Keep indentation for line breaks +vim.opt.clipboard = "unnamedplus" -- Use system clipboard +vim.opt.ignorecase = true -- Ignore case +vim.opt.inccommand = "split" -- Preview for find-replace command +vim.opt.laststatus = 3 -- Global status line +vim.opt.number = true -- Show line numbers +vim.opt.relativenumber = true -- Relative line numbers +vim.opt.shortmess = "I" -- Disable welcome screen +vim.opt.smartcase = true -- Do not ignore case with capitals +vim.opt.spelllang = "en_us" -- Set default spell language +vim.opt.splitbelow = true -- Put new windows below current +vim.opt.splitright = true -- Put new windows right of current +vim.opt.termguicolors = true -- True color support +vim.opt.tabstop = 4 -- Set tab width to 4 spaces + +vim.keymap.set({ "n", "v" }, "", "", { silent = true }) -- Reserve space for keymaps diff --git a/nvim/lua/config/tools.lua b/nvim/lua/config/tools.lua new file mode 100644 index 0000000..8a251b1 --- /dev/null +++ b/nvim/lua/config/tools.lua @@ -0,0 +1,35 @@ +return { + lsp = { + "bashls", + "cssls", + "dockerls", + "eslint", + "golangci_lint_ls", + "gopls", + "graphql", + "jsonls", + "pyright", + "rust_analyzer", + -- "lua_ls", + "svelte", + "terraformls", + "tsserver", + "yamlls", + }, + linter = { + "flake8", + "hadolint", + }, + formatter = { + "black", + "goimports", + "prettierd", + "shfmt", + "stylua", + }, + dap = { + "delve", + "node-debug2", + "python", + }, +} diff --git a/nvim/lua/plugins/code_outline.lua b/nvim/lua/plugins/code_outline.lua new file mode 100644 index 0000000..59e65c2 --- /dev/null +++ b/nvim/lua/plugins/code_outline.lua @@ -0,0 +1,11 @@ +return { + { + "simrat39/symbols-outline.nvim", + cmd = { "SymbolsOutline" }, + keys = { + { "k", "SymbolsOutline", desc = "Toggle code outline" }, + }, + config = true, + }, + "liuchengxu/vista.vim", +} diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..42f91dc --- /dev/null +++ b/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,13 @@ +return { + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + config = function() + require("tokyonight").setup({ + style = "night", + }) + vim.api.nvim_command("colorscheme tokyonight") + end, + }, +} diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua new file mode 100644 index 0000000..e8d7e1b --- /dev/null +++ b/nvim/lua/plugins/completion.lua @@ -0,0 +1,38 @@ +return { + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-vsnip", + "hrsh7th/vim-vsnip", + "onsails/lspkind-nvim", + }, + config = function() + local cmp = require("cmp") + + local sources = { + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "path" }, + { name = "buffer" }, + } + + cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = sources, + formatting = { format = require("lspkind").cmp_format() }, + }) + end, + }, +} diff --git a/nvim/lua/plugins/convenience.lua b/nvim/lua/plugins/convenience.lua new file mode 100644 index 0000000..b85fd47 --- /dev/null +++ b/nvim/lua/plugins/convenience.lua @@ -0,0 +1,19 @@ +return { + -- Automatically set indent settings + { "tpope/vim-sleuth", event = "VeryLazy" }, + + -- Edit surrounds + { "kylechui/nvim-surround", event = "VeryLazy", config = true }, + + -- Allow to repeat plugin commands + { "tpope/vim-repeat", event = "VeryLazy" }, + + -- Autoclose pairs + { "windwp/nvim-autopairs", event = "InsertEnter", config = true }, + + -- Toggle comments + { "numToStr/Comment.nvim", keys = { "gc", { "gc", mode = "v" } }, config = true }, + + -- Highlight color definitions + { "NvChad/nvim-colorizer.lua", event = "VeryLazy", config = true }, +} diff --git a/nvim/lua/plugins/debugging.lua b/nvim/lua/plugins/debugging.lua new file mode 100644 index 0000000..940d79e --- /dev/null +++ b/nvim/lua/plugins/debugging.lua @@ -0,0 +1,49 @@ +return { + { + "mfussenegger/nvim-dap", + dependencies = { + { "theHamsta/nvim-dap-virtual-text", config = true }, + { + "rcarriga/nvim-dap-ui", + config = function() + local dapui = require("dapui") + + dapui.setup() + + vim.keymap.set("n", "du", dapui.toggle, { desc = "Toggle debugging UI" }) + vim.keymap.set("n", "dK", function() + dapui.eval(nil, { enter = true }) + end, { desc = "Debug symbol under cursor" }) + end, + }, + }, + cmd = { "DapToggleBreakpoint" }, + keys = { + { + "db", + function() + require("dap").toggle_breakpoint() + end, + desc = "Toggle breakpoint", + }, + { + "dB", + function() + require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) + end, + desc = "Set breakpoint condition", + }, + }, + config = function() + local dap = require("dap") + + vim.fn.sign_define("DapBreakpoint", { text = "󰌖", texthl = "", linehl = "", numhl = "" }) + vim.fn.sign_define("DapBreakpointCondition", { text = "󰌕", texthl = "", linehl = "", numhl = "" }) + + vim.keymap.set("n", "dd", dap.continue, { desc = "Start/continue debugging" }) + vim.keymap.set("n", "dn", dap.step_over, { desc = "Step over" }) + vim.keymap.set("n", "di", dap.step_into, { desc = "Step into" }) + vim.keymap.set("n", "do", dap.step_out, { desc = "Step out" }) + end, + }, +} diff --git a/nvim/lua/plugins/diagnostics.lua b/nvim/lua/plugins/diagnostics.lua new file mode 100644 index 0000000..dbc0483 --- /dev/null +++ b/nvim/lua/plugins/diagnostics.lua @@ -0,0 +1,10 @@ +return { + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + keys = { + { "s", "TroubleToggle workspace_diagnostics", desc = "Toggle diagnostics" }, + }, + config = true, + }, +} diff --git a/nvim/lua/plugins/diff_directories.lua b/nvim/lua/plugins/diff_directories.lua new file mode 100644 index 0000000..284da3a --- /dev/null +++ b/nvim/lua/plugins/diff_directories.lua @@ -0,0 +1,10 @@ +return { + { + "will133/vim-dirdiff", + cmd = { "DirDiff" }, + config = function() + vim.g.DirDiffExcludes = + ".DS_Store,.git,.terraform,.gradle,bin,build,coverage,dist,node_modules,target,vendor" + end, + }, +} diff --git a/nvim/lua/plugins/file_tree.lua b/nvim/lua/plugins/file_tree.lua new file mode 100644 index 0000000..1fb313e --- /dev/null +++ b/nvim/lua/plugins/file_tree.lua @@ -0,0 +1,25 @@ +return { + { + "nvim-tree/nvim-tree.lua", + dependencies = { "nvim-tree/nvim-web-devicons" }, + keys = { + { + "j", + "NvimTreeFindFileToggle", + desc = "Toggle file tree", + }, + }, + opts = { + filters = { + custom = { "^.DS_Store$", "^.git$" }, + }, + renderer = { + icons = { + show = { + git = false, + }, + }, + }, + }, + }, +} diff --git a/nvim/lua/plugins/focused_writing.lua b/nvim/lua/plugins/focused_writing.lua new file mode 100644 index 0000000..2b35587 --- /dev/null +++ b/nvim/lua/plugins/focused_writing.lua @@ -0,0 +1,17 @@ +return { + { + "folke/zen-mode.nvim", + cmd = { "ZenMode" }, + opts = { + window = { + backdrop = 1, + options = { + signcolumn = "no", + number = false, + relativenumber = false, + }, + }, + }, + }, + { "folke/twilight.nvim", config = true, lazy = true }, +} diff --git a/nvim/lua/plugins/fuzzy_finding.lua b/nvim/lua/plugins/fuzzy_finding.lua new file mode 100644 index 0000000..6c3e939 --- /dev/null +++ b/nvim/lua/plugins/fuzzy_finding.lua @@ -0,0 +1,34 @@ +return { + { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "nvim-telescope/telescope-ui-select.nvim", + }, + cmd = { "Telescope" }, + keys = { + { + "", + "Telescope find_files find_command=fd,--type=file,--type=symlink,--hidden,--no-ignore,--exclude=.DS_Store,--exclude=.git,--exclude=.terraform,--exclude=.gradle,--exclude=.svelte-kit,--exclude=bin,--exclude=build,--exclude=coverage,--exclude=dist,--exclude=node_modules,--exclude=target,--exclude=vendor,--exclude=venv,--exclude=__pycache__", + desc = "Find files", + }, + { "/", "Telescope live_grep", desc = "Live grep" }, + }, + config = function() + local telescope = require("telescope") + + telescope.setup({ + defaults = { + mappings = { + i = { + [""] = require("telescope.actions").close, + }, + }, + }, + }) + telescope.load_extension("fzf") + telescope.load_extension("ui-select") + end, + }, +} diff --git a/nvim/lua/plugins/git.lua b/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..a42a36d --- /dev/null +++ b/nvim/lua/plugins/git.lua @@ -0,0 +1,61 @@ +return { + { + "tpope/vim-fugitive", + cmd = { "Git", "Gread", "Gdiff", "Gvdiffsplit" }, + keys = { + { + "gg", + ":Git", + desc = "Git status", + }, + { + "gc", + ":Git commit", + desc = "Git commit", + }, + { + "gm", + ":Git mergetool | Gvdiffsplit!", + desc = "Git three-way merge", + }, + }, + }, + { + "lewis6991/gitsigns.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + event = "VeryLazy", + keys = { + { + "ga", + ":Gitsigns stage_hunk", + desc = "Git add hunk", + }, + { + "gu", + ":Gitsigns undo_stage_hunk", + desc = "Git unstage hunk", + }, + { + "gA", + ":Gitsigns stage_buffer", + desc = "Git add file", + }, + { + "gU", + ":Gitsigns reset_buffer", + desc = "Git reset file", + }, + { + "gd", + ":Gitsigns diffthis", + desc = "Git diff", + }, + { + "gb", + ":Gitsigns blame_line", + desc = "Git blame", + }, + }, + config = true, + }, +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..643fa04 --- /dev/null +++ b/nvim/lua/plugins/lsp.lua @@ -0,0 +1,95 @@ +local formatting_group = vim.api.nvim_create_augroup("LspFormatting", { clear = false }) + +return { + { + "neovim/nvim-lspconfig", + dependencies = { "williamboman/mason-lspconfig.nvim" }, + event = "VeryLazy", + config = function() + -- Set correct icons in sign column + local signs = { + Error = "󰅚 ", + Warn = "󰀪 ", + Hint = "󰌶 ", + Info = "󰋽 ", + } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl }) + end + + -- Set up keymaps + vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostics of current line" }) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Move to previous diagnostic" }) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Move to next diagnostic" }) + + -- Add additional capabilities supported by nvim-cmp + local capabilities = require("cmp_nvim_lsp").default_capabilities() + + -- Use an on_attach function to only map the following keys + -- after the language server attaches to the current buffer + local on_attach = function(client, bufnr) + local telescope_builtin = require("telescope.builtin") + + local function buf_opts(desc) + return { noremap = true, silent = true, buffer = bufnr, desc = desc } + end + + vim.keymap.set("n", "K", vim.lsp.buf.hover, buf_opts("Show signature of current symbol")) + vim.keymap.set("n", "gd", telescope_builtin.lsp_definitions, buf_opts("Go to definiton")) + vim.keymap.set("n", "gi", telescope_builtin.lsp_implementations, buf_opts("Go to implementation")) + vim.keymap.set("n", "gr", telescope_builtin.lsp_references, buf_opts("Go to reference")) + vim.keymap.set("n", "r", vim.lsp.buf.rename, buf_opts("Rename current symbol")) + vim.keymap.set("n", "a", vim.lsp.buf.code_action, buf_opts("Run code action")) + vim.keymap.set("n", "f", function() + vim.lsp.buf.format({ async = true }) + end, buf_opts("Format current file")) + + -- Format on save + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = formatting_group, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = formatting_group, + buffer = bufnr, + callback = function() + vim.lsp.buf.format() + end, + }) + end + end + + require("mason-lspconfig").setup_handlers({ + function(server_name) + require("lspconfig")[server_name].setup({ + on_attach = on_attach, + capabilities = capabilities, + }) + end, + }) + end, + }, + { + "jose-elias-alvarez/null-ls.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + event = "VeryLazy", + config = function() + local null_ls = require("null-ls") + null_ls.setup({ + -- Sources can be configured in config/tools.lua + -- Format on save + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = formatting_group, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = formatting_group, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ timeout_ms = 5000 }) + end, + }) + end + end, + }) + end, + }, +} diff --git a/nvim/lua/plugins/status_line.lua b/nvim/lua/plugins/status_line.lua new file mode 100644 index 0000000..ad5f0c6 --- /dev/null +++ b/nvim/lua/plugins/status_line.lua @@ -0,0 +1,33 @@ +return { + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local function get_words() + if vim.bo.filetype == "md" or vim.bo.filetype == "txt" or vim.bo.filetype == "markdown" then + if vim.fn.wordcount().visual_words == 1 then + return tostring(vim.fn.wordcount().visual_words) .. " word" + elseif not (vim.fn.wordcount().visual_words == nil) then + return tostring(vim.fn.wordcount().visual_words) .. " words" + else + return tostring(vim.fn.wordcount().words) .. " words" + end + else + return "" + end + end + + require("lualine").setup({ + sections = { + lualine_a = {}, + lualine_x = { "filetype" }, + lualine_z = { get_words }, + }, + extensions = { "nvim-tree" }, + options = { + theme = "tokyonight", + }, + }) + end, + }, +} diff --git a/nvim/lua/plugins/testing.lua b/nvim/lua/plugins/testing.lua new file mode 100644 index 0000000..5713084 --- /dev/null +++ b/nvim/lua/plugins/testing.lua @@ -0,0 +1,66 @@ +return { + { + "nvim-neotest/neotest", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "nvim-neotest/neotest-vim-test", + "vim-test/vim-test", + "nvim-neotest/neotest-go", + "haydenmeade/neotest-jest", + "nvim-neotest/neotest-python", + }, + keys = { + { + "tn", + function() + require("neotest").run.run() + end, + desc = "Run nearest test", + }, + { + "tf", + function() + require("neotest").run.run(vim.fn.expand("%")) + require("neotest").summary.open() + end, + desc = "Run all tests in file", + }, + { + "ta", + function() + require("neotest").run.run(vim.fn.getcwd()) + require("neotest").summary.open() + end, + desc = "Run all tests in suite", + }, + }, + config = function() + local neotest = require("neotest") + + neotest.setup({ + icons = { + failed = "󰅚", + passed = "󰗡", + running = "󰐍", + unknown = "󰘥", + }, + adapters = { + require("neotest-go"), + require("neotest-jest"), + require("neotest-python"), + require("neotest-vim-test")({ + ignore_filetypes = { + "go", + "python", + }, + }), + }, + }) + + vim.keymap.set("n", "tu", function() + neotest.summary.toggle() + end, { desc = "Toggle testing UI" }) + end, + }, +} diff --git a/nvim/lua/plugins/tools.lua b/nvim/lua/plugins/tools.lua new file mode 100644 index 0000000..4e2a6eb --- /dev/null +++ b/nvim/lua/plugins/tools.lua @@ -0,0 +1,50 @@ +local tools = require("config.tools") + +return { + { + "williamboman/mason.nvim", + build = ":MasonUpdate", + config = true, + }, + { + "williamboman/mason-lspconfig.nvim", + dependencies = { "williamboman/mason.nvim" }, + event = "VeryLazy", + opts = { + ensure_installed = tools.lsp, + }, + }, + { + "jay-babu/mason-null-ls.nvim", + dependencies = { "williamboman/mason.nvim" }, + event = { "BufReadPre", "BufNewFile" }, + config = function() + local mason_null_ls = require("mason-null-ls") + + local null_ls_tools = tools.linter + for _, f in pairs(tools.formatter) do + table.insert(null_ls_tools, f) + end + + mason_null_ls.setup({ + ensure_installed = null_ls_tools, + handlers = {}, + }) + end, + }, + { + "jay-babu/mason-nvim-dap.nvim", + dependencies = { "williamboman/mason.nvim" }, + event = { "BufReadPre", "BufNewFile" }, + opts = { + ensure_installed = tools.dap, + handlers = {}, + }, + }, + { + "RubixDev/mason-update-all", + dependencies = { "williamboman/mason.nvim" }, + cmd = { "MasonUpdateAll" }, + config = true, + }, +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..a3e503c --- /dev/null +++ b/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,42 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + build = function() + pcall(require("nvim-treesitter.install").update({ with_sync = true })) + end, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = "all", + highlight = { enable = true }, + }) + end, + }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + dependencies = { + "nvim-treesitter/nvim-treesitter", + }, + event = "VeryLazy", + config = function() + require("nvim-treesitter.configs").setup({ + textobjects = { + select = { + enable = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + }, + }) + end, + }, + { + "nvim-treesitter/nvim-treesitter-context", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + event = "VeryLazy", + config = true, + }, +} diff --git a/sway/config b/sway/config new file mode 100644 index 0000000..0d9e15c --- /dev/null +++ b/sway/config @@ -0,0 +1,187 @@ +### Variables + +# Set logo key as main modifier +set $mod Mod4 + +# Colors +set $foreground #c0caf5 +set $highlight #bb9af7 +set $wallpaper ~/.config/wallpapers/bespinian.png +set $lock_cmd swaylock --daemonize --image $wallpaper +set $sleep_cmd systemctl suspend +set $launcher_cmd wofi --show drun --no-actions --insensitive --prompt 'Run' | xargs swaymsg exec -- + +# Set color for focused window +client.focused $highlight $highlight $foreground + +### Outputs + +# Set wallpaper +output * bg $wallpaper fill + +### Idle + +# Lock the screen after 300 seconds of inactivity, then turn off +# all displays after another 300 seconds, and turn the screens back on when +# resumed. It will also lock the screen before the computer goes to sleep. +exec swayidle -w \ + timeout 900 '$lock_cmd' \ + timeout 1200 'swaymsg "output * dpms off"' \ + resume 'swaymsg "output * dpms on"' \ + timeout 1800 '$sleep_cmd' \ + before-sleep 'playerctl pause' \ + before-sleep '$lock_cmd' \ + lock '$lock_cmd' + +# Inhibit idle if a window is in fullscreen +for_window [shell=".*"] inhibit_idle fullscreen + +# Prevent Brave from inhibiting shortcuts +for_window [app_id="^brave-.*-.*$"] shortcuts_inhibitor disable + +### Status Bar + +bar { + swaybar_command waybar +} + +### Windows + +# Hide window title bars and borders +default_border pixel +hide_edge_borders smart + +### Inputs + +# Mouse +# Hide mouse cursor when not used +seat * hide_cursor 8000 + +# Touchpad +input type:touchpad { + tap enabled + natural_scroll enabled +} + +# Keyboard +input type:keyboard { + # Map caps lock to escape and use right alt as compose key to create umlauts + # To actually create them, type the following keys in a sequence: + # ralt + " + u --> ü + xkb_options caps:escape,compose:ralt +} + +### Key bindings + +# App launcher +bindsym $mod+space exec $launcher_cmd + +# Launch terminal +bindsym $mod+Return exec $TERMINAL + +# Launch browser +bindsym $mod+w exec $BROWSER + +# Take screenshots +bindsym Print exec grim "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png" +bindsym Print+$mod exec grim -g "$(slurp)" "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png" + +# Lock screen +bindsym $mod+ctrl+q exec loginctl lock-session + +# Media control +bindsym --locked XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ +bindsym --locked XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bindsym --locked XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle +bindsym --locked XF86AudioMicMute exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle +bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%- +bindsym --locked XF86MonBrightnessUp exec brightnessctl set +5% +bindsym --locked XF86AudioPlay exec playerctl play-pause +bindsym --locked XF86AudioNext exec playerctl next +bindsym --locked XF86AudioPrev exec playerctl previous +bindsym XF86Search exec $launcher_cmd + +# Kill focused window +bindsym $mod+q kill + +# Reload the configuration file +bindsym $mod+Shift+c reload + +# Move focus around +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# Move the focused window with the same, but add Shift +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# Switch to workspace +bindsym $mod+1 workspace number 1 +bindsym $mod+2 workspace number 2 +bindsym $mod+3 workspace number 3 +bindsym $mod+4 workspace number 4 +bindsym $mod+5 workspace number 5 +bindsym $mod+6 workspace number 6 +bindsym $mod+7 workspace number 7 +bindsym $mod+8 workspace number 8 +bindsym $mod+9 workspace number 9 +bindsym $mod+0 workspace number 10 +bindsym $mod+tab workspace back_and_forth + +# Move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number 1; workspace number 1 +bindsym $mod+Shift+2 move container to workspace number 2; workspace number 2 +bindsym $mod+Shift+3 move container to workspace number 3; workspace number 3 +bindsym $mod+Shift+4 move container to workspace number 4; workspace number 4 +bindsym $mod+Shift+5 move container to workspace number 5; workspace number 5 +bindsym $mod+Shift+6 move container to workspace number 6; workspace number 6 +bindsym $mod+Shift+7 move container to workspace number 7; workspace number 7 +bindsym $mod+Shift+8 move container to workspace number 8; workspace number 8 +bindsym $mod+Shift+9 move container to workspace number 9; workspace number 9 +bindsym $mod+Shift+0 move container to workspace number 10 + +# Splitting direction +bindsym $mod+b split toggle + +# Make current focus fullscreen +bindsym $mod+f fullscreen + +# Resizing containers +bindsym $mod+r mode 'resize' +mode 'resize' { + # Resizing keys + bindsym h resize shrink width 10px + bindsym j resize grow height 10px + bindsym k resize shrink height 10px + bindsym l resize grow width 10px + + # Return to default mode + bindsym Escape mode 'default' +} + +### Gesture bindings + +# Swipe back and forth between workspaces +bindgesture swipe:3:left workspace prev_on_output +bindgesture swipe:3:right workspace next_on_output + +### Processes + +# Automatically manage outputs +exec kanshi + +# Autotiling +exec autotiling-rs + +# Waybar Icons +exec_always --no-startup-id workstyle &> /tmp/workstyle.log + +# Clipboard manager +exec wl-paste --type text --watch clipman store +bindsym $mod+v exec clipman pick --tool wofi + +include /etc/sway/config.d/* diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..20b194f --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,41 @@ +# Set correct terminal +set-option -g default-terminal "tmux-256color" +set-option -as terminal-overrides ',alacritty:RGB' + +# Open new windows from home directory +bind c new-window -c "${HOME}" + +# Open new splits from current directory +bind '"' split-window -v -c '#{pane_current_path}' +bind % split-window -h -c '#{pane_current_path}' + +# Switch panes like vim +set-window-option -g mode-keys vi +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# Set escape time to 10 for esc to work properly in Vim +set-option -sg escape-time 10 + +# Set focus-events to enable Neovim autoread +set-option -g focus-events on + +# Color scheme +set-option -g status-style 'fg=#414868' +set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' +set-option -g mode-style 'fg=#7aa2f7,bg=#3b4261' +set-option -g message-style 'fg=#7aa2f7,bg=#3b4261' +set-option -g pane-border-style 'fg=#3b4261' +set-option -g pane-active-border-style 'fg=#3b4261' +set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' + +# Unclutter status bar +set-option -g status-right '' +set-option -g status-left '' +set-window-option -g window-status-format " #I: #W " +set-window-option -g window-status-current-format " #I: #W " + +# Allow to use user namespace out of tmux on macOS +if-shell 'test "$(uname)" = "Darwin"' 'source ~/.config/tmux/tmux.macos.conf' diff --git a/tmux/tmux.macos.conf b/tmux/tmux.macos.conf new file mode 100644 index 0000000..200eb77 --- /dev/null +++ b/tmux/tmux.macos.conf @@ -0,0 +1,2 @@ +# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard +set-option -g default-command "reattach-to-user-namespace -l $SHELL" diff --git a/vifm/colors/tokyonight.vifm b/vifm/colors/tokyonight.vifm new file mode 100644 index 0000000..cdf4011 --- /dev/null +++ b/vifm/colors/tokyonight.vifm @@ -0,0 +1,10 @@ +highlight clear + +highlight Win cterm=none ctermfg=default ctermbg=none + +highlight TopLine cterm=none ctermfg=default ctermbg=black +highlight StatusLine cterm=bold ctermfg=default ctermbg=black +highlight Border cterm=none ctermfg=default ctermbg=black + +highlight Selected cterm=bold ctermfg=magenta ctermbg=default +highlight CurrLine cterm=bold ctermfg=236 ctermbg=magenta diff --git a/vifm/vifmrc b/vifm/vifmrc new file mode 100644 index 0000000..603c472 --- /dev/null +++ b/vifm/vifmrc @@ -0,0 +1,20 @@ +" Use Neovim +set vicmd=nvim + +" Show hidden files +set dotfiles + +" File preview +view +fileviewer *.png,*.jpg,*.jpeg,*.webp,*.svg chafa %c +fileviewer *.pdf pdftotext %c - +fileviewer *.zip unzip -l %c +fileviewer *.tar,*.tar.gz tar tf %c + +" Open files +filetype *.png,*.jpg,*.jpeg,*.webp,*.svg imv %c & +filetype *.mp3,*.mp4,*.mov,*.wav mpv --quiet %c & +filetype *.pdf zathura %c & + +" Set color scheme +colorscheme tokyonight diff --git a/wallpapers/bespinian.png b/wallpapers/bespinian.png new file mode 100644 index 0000000000000000000000000000000000000000..79c39ea530dcf97e1e1905eba9c8feb37868f333 GIT binary patch literal 8519 zcmeHLX*iW_*IqkCBTtheL!L%YN`@$elu)LqP((z^m?31^l__JUkPIPHhD2ltMM&l$ zGLPG^&GR;F-*xTx`|ofE-hfuA!OAlV$*rvuIqwBm$Xy2+|wTU=RL}9y$UY9 zSD*JtJ9l4n?7m>%C2HGw?s4ZCtBy-f-HNWg>Rx@ifdeM5Nspt4pC*oYrjdg`jYoZ% zOe&emtep8$Kli<5{zuzFb>~8T_hNJ3QtQA{#}K7^WVwHAnKZF7I=wPJyE?tFHovq+ zS)s13QPTbw>mzvIy|{DIKJFRUhWxL?i`~0>R+nvSSbB9pI1AZ z@na^jWGXm&+~))NdD7^U*x^SJLx!&gwO|X_*gj;mOF9( z)u6C-=j+^w&o#4dDWf-D^oiMawe&9)Hq5>II%OF-bkno%jAe(4M{iN%+{!BTLC9c3 z&tiJTv{yR$wr{_4!bn{4WX11=J1_gG)O97--k?w8<*oBB$)jbh^SL#%svf=hb+aC+ z;!_hN5=G6c@An|(OT(Oocc1wil4&?e z$A6%)chM+}RNJ+v7dY_a_kvx_@GYPI)bi=H^6AvF>EzO>q|&MQZ&UBSPP!(K-U}Mg z4<39NI_R4*CjO)=w|2IjL^*5SX&pUunlIpblU$0G|Sywk~6QA5RzbM7glZ}KKyq>=qTj`fZ%Yx?#}Id(@B zOoV z?d~|!l`Az+MqbsVmB$?$H;(VT86Vk@nr(6-V!V06xIMdCZMt<`G%4Uf%RHsPv!pxZ z8^izaapUZjuXpH#XxX$o`ki0sFv@X$_}S*U;}zCTXjRvkE?gORE`G|u?ojd8o!zO_ z-zQwqR29#U&k59sk;g1+&W{z$@_zmh zW0LQ6%2b^VpyJq$1tYabQ%A-{t;U*i?LsQkQgtK9H`~^lIL_O%*RM4EJXO?J`Q`lv zfZsO@?4#bNO|+*w_Y2Txz4-lWG_H|>kyUKqbQQjdwFyJ&=H%I6%cCKPVoT1t0Jff3-aZEwie7pn1!qRz|S zkM4>BoVNUR;i3U&=Sk+Yb0?3n-O9Ls13<@UA;O+|uDZSS-th=w=L_wQXm`UB%%hoQ z`$LY;&ew>4{Nua8l6A!F*cA(sCc)lXtK5ZP8+B*bdQ& zokv&$t+t#;59AX9P4g%*$uExr*mqd`O6BV`%^z6^c!~0~>G;h< zJ(1UCZF56b1c))77xbr#PWOC}++}%twaD<%q$5`tz{F%bzky^9IYbHhy-E(5?mk!iz9PZs_ zceFWfj&^hm-^V4b-Ra-{1yH5g;^25Wr)<2$&4(o-lV^Ylh+*M*rB5#BP)|rX0VK8+ z95EntigfJ6Vu{>PHB58Uzmlpt|1Al+R6v zd0$UF_WNA2vJF7wXCaa(hj`*YO*?@2&PR_cdeBmU4vK5YmN$9!7;6X%0F1qHHPYki z%^LLC0L8xcg{nM)#szuD(TV7C?a-(nUSVI9pNH_1m7jk-W1D+4y=i#r^_$zV_7CSC zD#SMre|pW6c5RY%{%4}&(ew}(vHz<_6mvLccQ(kk>Cas{s%Gp?$8UEuP?-N##E zj)?kJ`8ET7;n=rf1;Ia5SyETm89S066F}#Hm^QPVhw1y0n`job?w9kfbh~Q=aP-oy zIJFyz>`-j&f5}d?X)E-+74p9n)_AOG1L#&B+sdUdLWkJ!8(0#YL_d_V_+zx=d`quJ0NLkyG7@))Xw*1b^ z9XnMR!O+S;elNXi5FM122i?_`Jp<7ucJeHh3ryVfFt&V6p56B~o60r_%{?6dSM0@y z1Q_~$UDr;Q8+v?9`GSvY?Nr$UhUzS;p3FzMe1O=+_i1=v!)7=u7SF68g>FnQy<{E2 zW?*Ah-Ly>-bY$iC@&JM8_b=<5PtvnZ2f^IzUsfeu8dq~4joULC`j0wn0J5&g^hlx_ z=e7qMfo)Ht+b^cH(fparmp7rfN2+iWSBVUTxZtenjtl8|ex5Z&zha5V2Je+^I zD>t7Wh%=>P#*UOh4L@sd!~2edTQEJ zw1%FNDnzYOLSQ;rK*_t^{bs_x$4IiLFjt}`N{zJ<>+39*ucSS^#%y$GAm2=OKWb5G z)Va>zw{LyFzH??1*si}-=w5ZOvWv^oaMyNmP^E*`gxVM)VXE6ylFcZOd3e8a_g9*O1ew*7hJ7*O30rAnk^NZv$ zpFyd@kqw|+F!gi6hhdLF#iBWvHW1n8YxcHuHc}3Abq5i^(00*`cV6s5g|I%l47VvO z!zAs^l=y8RiLQvdqHVf0)y2Wgc+V(1fV6hEIMrVwZwu}Gj}L=Uiz4wN1})3sE)E2+ z7@Z5%V%UgUXY$pmv}^(p--w(vXnBec+V*FX696O?+1WFVRM9GwaJh6WPXsl4RXW|r zoh+y;Csl@OZ9~iJIcwvpv_hIUw?T^yKFC8d!Zb_SUh_NvO^(cma_GiAn8WC&(KOhO zgnfhOJTzuUoG>f@qo9Et`Mwkf>JZne0tUHwQH8Eld1_xo%YqKcpKn`D+E%*_KnxJj z`*Pq8+YCKGci}$r?=r269H>iB2^n{8OmNJgxwdb8C%OKGw!0XbIVHUrT~=DGGiV(P zto59av$$Mw5nxZmZu0l%`L3%QL9+W?#>Dv*#R@glUMMmtdZ|n&w^FtN@yD!Q#6zcR z6=ncp=DH~Y`XNGFDU3iAT@L;(a!qKdPZ`}TpO@T5KQ~@ppz`cNfnPCtiw>1?IlD@s zHXqCD?Jb&|)qkU3>MhEzeN)1Bc4eXYg+Ap_5vur>S>2TC`>1j*EbK;^ zDEWhT3q3z+Fe7g0g$yBKRGwY&swve}OnJa&G1f6^*hcR6;>Bhh$^v zCOird+ASlHl7I&8)LlJAk7nuYZQ&A8E3`wH)MNS8LV(jnL;AJ}*i$Q__W;dP(=DCm zX(>=}l>v%ZU)4_C!k+m@O7g9dr&-AM^m^>MgMTaqORE{!reg(1{t`7TZC12>vJn$f z1>PiM!d3mHcuX(}=#8Rp}9uU^0*oZj4hKuhja$xj?&GK__>0V~wrvkjvS zOQIy*3Xk^@OJNEgZ&bCp2QI`L|GQ_{tC--daLH8~p`JxNkya3c);kQdba3j2c`zo5 z@s||Q2uUn=XbR3XAF}a@)#D}HB8C9!=LXY-F!B$2VYF4P6r!PCrI&FXx=B6-F||jd z8OF|ifQIwjGOhTxHMdL~MlJ55j0=jn)#Pu|_{ zn62$?q^FBJ$p8KY7Wyt|#%`@mX;#yo=QJIT`FUtZ%La&cIdMoKebW(upVF@{pfG2pmXk{{wv-=&WeN1TBzyoH)i0_u^79>auy5Q@~JS<0vu{cz6B8UK_^Z>3*h+OHCawW z0w{l@_%GDqQn~)E@O~3WZc&pFxrR%W<}(+>3~(fc<-z@v09Vv`8yc{{=?8IMGyyN! zMw$SlKdBiD$Q+7D!U9Ipc}iHo*CUH2;J`dWzyhuO4NbHRY~nIMp$vL`WbM%oSNYo} zf5t{EurA%Ej2)@W59F}Jl4@KMj?_EpUr0;Q`O>m1CMf!41>)3J#T!Ji;#9t@nGseJ z@F&qOyW`&{-=b7@$Xw2Rx(97NxBHRqaigb({mj+7(equ?2L-`xvdE!?yPk~)6EDV4 z)VHFi2}K{$VNA3Yf2|dVo)GU+3_1K!Zf;NOd5&WuT}+rJCW`wQIAY@Gqpw>qv3JC< zCIk};>v;}iqGL?%ZA@hJCJADq`jOZ7-(kfx!!8<8KUPB(6MSD7+{J|9oz+ihxycI# zUctFJ)oap1hF_ljj0YjMx0-+nQ%?j%X~|!%7dwhW&0d~O#DtE0)rV<>yi6hiuGl%` z8NOQAL^s)nI~;6>G?VE&QKL^#^S1Eiu;PFzQ*VQH>rHR_fhgzaU9UxrJ8Z=YQwd?Z z^0S6gAp|HIXV};u{g)OU$nV}gYmZ)DZ>#cAlR z2iWZ148<^Z8h~y}dqe#hD89_cSM+bj?tc?G^jFbCq>nuE`F7@vANmWWQXuRoU!hW4 zfpcASVC_F+>}WE46nYj9e77}r^y9Z;26JlN{@Z>M6;kd5a1IkFGan$Wct|A>pjOP` zo;QDgwP&3j6rW5e+pNTSgkckU?&LjC-LSsvIl3_&Nt_%zSCrmv)CU;im=7r`;6d+T z{(Sya;J;OYV!z=73q6uJoaD=*`GacO|E;{2(=p9=ivDj+%jH3O>`A9Nb0np;hQ{J3a?*;I(xh~r{SQTB0%`yN literal 0 HcmV?d00001 diff --git a/waybar/config.jsonc b/waybar/config.jsonc new file mode 100644 index 0000000..c3ed8df --- /dev/null +++ b/waybar/config.jsonc @@ -0,0 +1,69 @@ +{ + "modules-left": ["sway/workspaces", "sway/mode"], + "modules-center": ["custom/tasks"], + "modules-right": [ + "custom/updates", + "custom/containers", + "wireplumber", + "bluetooth", + "network", + "battery", + "clock" + ], + "battery": { + "states": { + "warning": 20, + "critical": 10 + }, + "format": "{icon}", + "format-icons": { + "default": ["󰁺", "󰁻", "󰁼", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"], + "charging": ["󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"], + "critical": ["󱃍"] + }, + "tooltip-format": "Battery at {capacity}%" + }, + "clock": { + "format": "{:%a %d %b %H:%M}", + "tooltip-format": "{:%B %Y}\n\n{calendar}" + }, + "network": { + "format-ethernet": "󰈀", + "format-wifi": "{icon}", + "format-linked": "󰈀", + "format-disconnected": "󰖪", + "format-icons": ["󰤯", "󰤟", "󰤢", "󰤥", "󰤨"], + "tooltip-format-wifi": "{essid} at {signalStrength}%" + }, + "wireplumber": { + "format": "{icon}", + "format-muted": "󰸈", + "format-icons": ["󰕿", "󰖀", "󰕾"], + "tooltip-format": "Volume at {volume}%" + }, + "bluetooth": { + "format": "", + "format-on": "󰂯", + "format-connected": "󰂱", + "tooltip-format-on": "Bluetooth {status}", + "tooltip-format-connected": "Connected to {device_alias}" + }, + "custom/tasks": { + "exec": "~/.config/waybar/scripts/tasks.sh", + "exec-if": "which task", + "interval": 60 + }, + "custom/updates": { + "format": "󰣇 {}", + "exec": "~/.config/waybar/scripts/updates-arch-combined.sh", + "interval": 7200, + "on-click": "alacritty --command paru -Syu --noconfirm", + "signal": 8 + }, + "custom/containers": { + "exec": "~/.config/waybar/scripts/containers.sh", + "exec-if": "which podman", + "interval": 60, + "return-type": "json" + } +} diff --git a/waybar/scripts/containers.sh b/waybar/scripts/containers.sh new file mode 100755 index 0000000..6feba73 --- /dev/null +++ b/waybar/scripts/containers.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +set -u + +if [ ! -x "$(command -v podman)" ]; then + exit 1 +fi + +running_container_count=$(podman ps --noheading | wc -l) + +if [ "$running_container_count" -eq 0 ]; then + echo '' + exit 0 +fi + +suffix="" +if [ "$running_container_count" -gt 1 ]; then + suffix="s" +fi + +echo "{\"text\": \"󰡨\", \"tooltip\": \"${running_container_count} container${suffix} running\"}" diff --git a/waybar/scripts/tasks.sh b/waybar/scripts/tasks.sh new file mode 100755 index 0000000..5fde618 --- /dev/null +++ b/waybar/scripts/tasks.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +set -u + +if [ ! -x "$(command -v task)" ]; then + exit 1 +fi + +active_task=$(task rc.verbose=nothing rc.report.activedesc.filter=+ACTIVE rc.report.activedesc.columns:description rc.report.activedesc.sort:urgency- rc.report.activedesc.columns:description activedesc limit:1 | head -n 1) +if [ -n "$active_task" ]; then + echo "󰐌 $active_task" + exit 0 +fi + +ready_task=$(task rc.verbose=nothing rc.report.readydesc.filter=+READY rc.report.readydesc.columns:description rc.report.readydesc.sort:urgency- rc.report.readydesc.columns:description readydesc limit:1 | head -n 1) +if [ -z "$ready_task" ]; then + echo "" + exit 0 +fi + +echo "󰳟 $ready_task" diff --git a/waybar/scripts/updates-arch-combined.sh b/waybar/scripts/updates-arch-combined.sh new file mode 100755 index 0000000..0bcdb8a --- /dev/null +++ b/waybar/scripts/updates-arch-combined.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +if ! update_count_pacman=$(checkupdates | wc -l); then + update_count_pacman=0 +fi + +if ! update_count_aur=$(paru -Qum 2>/dev/null | wc -l); then + update_count_aur=0 +fi + +update_count=$((update_count_pacman + update_count_aur)) + +if [ "$update_count" -gt 0 ]; then + echo "$update_count" +else + echo '' +fi diff --git a/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..cd67060 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,65 @@ +/* General */ +* { + border-radius: 0; + font-family: "FiraCode Nerd Font"; + font-size: 13px; + color: #c0caf5; +} + +window#waybar { + background-color: #1a1b26; +} + +tooltip { + background-color: #15161e; +} + +/* Workspaces */ +#workspaces button { + margin: 4px; + padding: 0 8px; + border-radius: 9999px; +} + +#workspaces button:hover { + border-color: transparent; + box-shadow: none; + background: #414868; +} + +#workspaces button.focused, +#workspaces button.active { + padding: 0 13px; + background: #2f334d; +} + +/* Modules */ +#clock, +#network, +#wireplumber, +#bluetooth, +#battery, +#custom-updates, +#custom-tasks, +#custom-containers, +#mode { + margin: 4px; + padding: 0 13px; + border-radius: 9999px; + background-color: #2f334d; +} + +#network { + padding: 0 15px 0 11px; +} + +#mode, +#custom-updates { + color: #bb9af7; + font-weight: bold; +} + +#battery.critical { + color: #f7768e; + font-weight: bold; +} diff --git a/wofi/style.css b/wofi/style.css new file mode 100644 index 0000000..3a0f987 --- /dev/null +++ b/wofi/style.css @@ -0,0 +1,22 @@ +#window { + font-family: "Fira Mono"; + background-color: #1a1b26; + color: #c0caf5; +} + +#input { + border-radius: 0; + border-color: transparent; + padding: 5px; + background-color: #1a1b26; + color: #c0caf5; +} + +#entry { + padding: 5px; +} + +#entry:selected { + outline: none; + background-color: #bb9af7; +} diff --git a/workstyle/config.toml b/workstyle/config.toml new file mode 100644 index 0000000..480ee11 --- /dev/null +++ b/workstyle/config.toml @@ -0,0 +1,55 @@ +# Config for workstyle +# +# Format: +# "pattern" = "icon" +# +# The pattern will be used to match against the application name, class_id or WM_CLASS. +# The icon will be used to represent that application. +# +# Note if multiple patterns are present in the same application name, +# precedence is given in order of apparition in this file. + +# Apps +"alacritty" = "" +"blender" = "󰂫" +"calendar" = "󰃭" +"gimp" = "󱇤" +"imv" = "󰥶" +"inkscape" = "󰕙" +"kde connect" = "󰄜" +"krita" = "󰃣" +"libreoffice calc" = "󱀭" +"libreoffice impress" = "󱀵" +"libreoffice writer" = "󱀾" +"libreoffice" = "󱀲" +"mail" = "󰇰" +"mpv" = "󰐋" +"pinentry" = "󰌆" +"qemu" = "󰹑" +"signal" = "󰻞" +"slack" = "󰒱" +"spotify" = "󰓇" +"steam" = "󰓓" +"thunderbird" = "󰇰" +"zathura" = "󰈦" + +# Websites +"discord" = "󰙯" +"feeds" = "" +"github" = "󰊤" +"gitlab" = "󰮠" +"linkedin" = "󰌻" +"mastodon" = "󰫑" +"pinterest" = "󰐇" +"reddit" = "󰑍" +"twitter" = "󰕄" +"youtube" = "󰗃" + +# Browsers +"brave" = "󰊯" +"chromium" = "󰊯" +"firefox" = "󰈹" + +[other] +fallback_icon = "󰘔" +deduplicate_icons = true diff --git a/zsh/.zpreztorc b/zsh/.zpreztorc new file mode 100644 index 0000000..eaaa5a7 --- /dev/null +++ b/zsh/.zpreztorc @@ -0,0 +1,32 @@ +# vim: ft=zsh + +fpath=(${HOME}/.zsh.d/themes $fpath) + +# Load Prezto modules +# The order matters. +zstyle ':prezto:load' pmodule \ + 'environment' \ + 'utility' \ + 'git' \ + 'completion' \ + 'syntax-highlighting' \ + 'history-substring-search' \ + 'prompt' \ + 'history' \ + 'autosuggestions' \ + 'editor' + +# Enable color output +zstyle ':prezto:*:*' color 'yes' + +# Enable advanced syntax highlighting for commands +zstyle ':prezto:module:syntax-highlighting' highlighters \ + 'main' \ + 'brackets' + +# Set the prompt theme to load +# Setting it to 'random' loads a random theme. +zstyle ':prezto:module:prompt' theme 'cloudlena' + +# Use vi keybindings +zstyle ':prezto:module:editor' key-bindings 'vi' diff --git a/zsh/.zsh.d/aliases.zsh b/zsh/.zsh.d/aliases.zsh new file mode 100644 index 0000000..3c6bbb5 --- /dev/null +++ b/zsh/.zsh.d/aliases.zsh @@ -0,0 +1,4 @@ +# Easier navigation +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' diff --git a/zsh/.zsh.d/functions.zsh b/zsh/.zsh.d/functions.zsh new file mode 100644 index 0000000..e936024 --- /dev/null +++ b/zsh/.zsh.d/functions.zsh @@ -0,0 +1,245 @@ +# Create a directory and enter it +mkcd() { + mkdir --parents "$@" && cd "$_" || exit +} + +# cd into directory using fuzzy search +fcd() { + local dir + dir=$(fd --type d --follow | fzf --preview 'tree -l -L 1 {}' +m) && + cd "$dir" +} + +# Edit a directory or a file using fuzzy search +fe() { + local target fzf_cmd + fzf_cmd='fd --follow --hidden --no-ignore \ + --exclude .git \ + --exclude vendor \ + --exclude node_modules \ + --exclude .terraform \ + --exclude target \ + --exclude bin \ + --exclude build \ + --exclude dist \ + --exclude coverage \ + --exclude .DS_Store' + target=$(eval $fzf_cmd | fzf +m) && + if [ -d "$target" ]; then + cd "$target" && "$EDITOR" + fi + if [ -f "$target" ]; then + "$EDITOR" "$target" + fi +} + +# Checkout Git branches or tags using fuzzy search +fco() { + local tags branches target + tags=$( + git tag | awk '{print "\x1b[31;1mtag\x1b[m\t" $1}' + ) || return + branches=$( + git branch --all | grep -v HEAD | + sed "s/.* //" | sed "s#remotes/[^/]*/##" | + sort -u | awk '{print "\x1b[34;1mbranch\x1b[m\t" $1}' + ) || return + target=$( + ( + echo "$tags" + echo "$branches" + ) | + fzf-tmux -l30 -- --no-hscroll --ansi +m -d "\t" -n 2 + ) || return + git checkout "$(echo "$target" | awk '{print $2}')" +} + +# Kill any process with fuzzy search +fkill() { + local pid + if [ "$UID" != "0" ]; then + pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}') + else + pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') + fi + + if [ "x$pid" != "x" ]; then + echo "$pid" | xargs kill "-${1:-9}" + fi +} + +# Git commit browser with fuzzy search +fshow() { + git log --graph --color=always \ + --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | + fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ + --bind "ctrl-m:execute: + (grep -o '[a-f0-9]\{7\}' | head -1 | + xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' + {} +FZF-EOF" +} + +# Open tmux and Vim in an IDE like layout +ide() { + if [ -n "$1" ]; then + cd "$1" || exit + fi + + if [ -z "${TMUX}" ]; then + tmux new-session -A -s ide + fi + + tmux split-window -vb -p 90 + tmux select-pane -t 0 + + tmux send-keys 'nvim -c NvimTreeOpen' C-m +} + +# Update project dependencies +depu() { + # Git submodules + if [ -e .gitmodules ]; then + printf "Updating Git submodules for %s...\n\n" "${PWD##*/}" + git submodule update --init --remote --rebase --recursive + fi + + # npm + if [ -e package-lock.json ]; then + printf "Updating npm dependencies for %s...\n\n" "${PWD##*/}" + npm update + npm outdated + fi + + # Go + if [ -e go.mod ]; then + printf "Updating Go dependencies for %s...\n\n" "${PWD##*/}" + go get -t -u ./... + go mod tidy + fi + + # Rust + if [ -e Cargo.toml ]; then + printf "Updating Cargo dependencies for %s...\n\n" "${PWD##*/}" + cargo update + fi + + # Python + if [ -e poetry.lock ]; then + printf "Updating Python dependencies for %s...\n\n" "${PWD##*/}" + poetry update + poetry show --outdated + fi + + # Terraform + if [ -e .terraform.lock.hcl ]; then + printf "Updating Terraform dependencies for %s...\n\n" "${PWD##*/}" + terraform init -upgrade + fi +} + +# System update +pacu() { + processes=() + + # Dotfiles repo + printf '\e[1mUpdating dotfiles repo\e[0m\n' + (cd "${HOME}/dotfiles" && git pull) + + case "$(uname)" in + + 'Linux') + # On Linux, use the respective package manager + if [ -x "$(command -v paru)" ]; then + printf '\e[1mUpdating Paru packages\e[0m\n' + paru -Syu --noconfirm + orphans=$(paru -Qtdq) || orphans='' + if [ -n "${orphans}" ]; then + printf '\e[1mRemoving orphan packages\e[0m\n' + paru -Rns $orphans --noconfirm + fi + paru -Sc --noconfirm + paru --clean --noconfirm + elif [ -x "$(command -v pacman)" ]; then + printf '\e[1mUpdating pacman packages\e[0m\n' + sudo pacman -Syu --noconfirm + orphans=$(sudo pacman -Qtdq) || orphans='' + if [ -n "${orphans}" ]; then + printf '\e[1mRemoving orphan packages\e[0m\n' + sudo pacman -Rns $orphans --noconfirm + fi + sudo pacman -Sc --noconfirm + fi + if [ -x "$(command -v pacmanfile)" ]; then + printf '\e[1mSyncing packages with pacmanfile\e[0m\n' + pacmanfile sync + fi + if [ -x "$(command -v pacdiff)" ]; then + printf '\e[1mChecking for Pacman maintenance issues\e[0m\n' + sudo DIFFPROG="${EDITOR} -d" pacdiff + fi + + # Update status bar indicator for pending updates + pkill -SIGRTMIN+8 waybar + + # Update firmwares + if [ -x "$(command -v fwupdmgr)" ]; then + printf '\e[1mUpdating firmwares\e[0m\n' + fwupdmgr refresh + fwupdmgr update + fi + ;; + + 'Darwin') + # On macOS, use mas and Homebrew + if [ -x "$(command -v mas)" ]; then + printf '\e[1mUpdating App Store apps\e[0m\n' + mas upgrade + fi + + if [ -x "$(command -v brew)" ]; then + printf '\e[1mUpdating Homebrew packages\e[0m\n' + brew update + brew upgrade + cat ~/.config/homebrew/*Brewfile | brew bundle --file=- + cat ~/.config/homebrew/*Brewfile | brew bundle cleanup --force --file=- + brew cu --all --yes --cleanup + brew cleanup --prune 7 + fi + ;; + esac + + # zprezto + if type zprezto-update 2>/dev/null | grep -q function; then + printf '\e[1mUpdating zprezto\e[0m\n' + zprezto-update & + processes+=("$!") + fi + + # npm + if [ -x "$(command -v npm)" ]; then + printf '\e[1mUpdating globally installed npm packages\e[0m\n' + npm update -g + fi + + # Yarn + if [ -x "$(command -v yarn)" ]; then + printf '\e[1mUpdating globally installed Yarn packages\e[0m\n' + (yarn global upgrade >/dev/null) & + processes+=("$!") + fi + + # Neovim + if [ -x "$(command -v nvim)" ]; then + printf '\e[1mUpdating Neovim plugins\e[0m\n' + nvim --headless -c 'Lazy! sync' -c 'qa' + nvim --headless -c 'autocmd User MasonUpdateAllComplete quitall' -c 'MasonUpdateAll' + fi + + # Wait for all processes to finish + for p in ${processes[*]}; do + wait "$p" + done + + printf '\n\e[1mSystem update finished\e[0m\n' +} diff --git a/zsh/.zsh.d/themes/prompt_cloudlena_setup b/zsh/.zsh.d/themes/prompt_cloudlena_setup new file mode 100644 index 0000000..9f16fa5 --- /dev/null +++ b/zsh/.zsh.d/themes/prompt_cloudlena_setup @@ -0,0 +1,49 @@ +# vim: ft=zsh + +function prompt_cloudlena_precmd { + if (( $+functions[git-info] )); then + git-info + fi +} + +function prompt_cloudlena_setup { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent sp subst) + + # Load required functions + autoload -Uz add-zsh-hook + + # Add hook for calling git-info before each command + add-zsh-hook precmd prompt_cloudlena_precmd + + # Tell prezto we can manage this prompt + zstyle ':prezto:module:prompt' managed 'yes' + + # Set git-info parameters + zstyle ':prezto:module:git:info' verbose 'yes' + zstyle ':prezto:module:git:info:branch' format '%b' + zstyle ':prezto:module:git:info:position' format '%p' + zstyle ':prezto:module:git:info:commit' format '%.7c' + zstyle ':prezto:module:git:info:action' format '%F{yellow}[%s]%f' + zstyle ':prezto:module:git:info:deleted' format '%F{yellow}●%f' + zstyle ':prezto:module:git:info:modified' format '%F{yellow}●%f' + zstyle ':prezto:module:git:info:untracked' format '%F{yellow}●%f' + zstyle ':prezto:module:git:info:renamed' format '%F{green}●%f' + zstyle ':prezto:module:git:info:added' format '%F{green}●%f' + zstyle ':prezto:module:git:info:ahead' format '%F{yellow} ⬆%f' + zstyle ':prezto:module:git:info:behind' format '%F{yellow} ⬇%f' + zstyle ':prezto:module:git:info:stashed' format '%F{yellow} ★%f' + zstyle ':prezto:module:git:info:keys' format \ + 'prompt' ' %F{cyan}[$(coalesce "%b" "%p" "%c")%f${(e)git_info[status]}%F{cyan}]%f%s' \ + 'status' '$(coalesce "%a" "%r")$(coalesce "%d" "%m" "%u")%A%B%S' \ + + # Define prompts + PROMPT='%F{magenta}%c%f${(e)git_info[prompt]} ' +} + +function prompt_cloudlena_help { + echo 'This prompt is as minimalist as possible and cannot be customized.' +} + +prompt_cloudlena_setup "$@" diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 100644 index 0000000..ffff56b --- /dev/null +++ b/zsh/.zshenv @@ -0,0 +1,27 @@ +# Amend PATH +path+=("${HOME}/.local/bin") +path+=("${HOME}/.node_modules/bin") +path+=("${HOME}/.cargo/bin") +path+=("${HOME}/go/bin") +export PATH + +# Prefer US English and use UTF-8 +export LC_ALL='en_US.UTF-8' +export LANG='en_US.UTF-8' + +# Set default programs +export TERMINAL='alacritty' +export BROWSER='brave' +export PAGER='less' +export EDITOR='nvim' +export VISUAL="${EDITOR}" + +# Set correct TTY for GPG +# https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html +export GPG_TTY="$(tty)" + +# Set environment variables for Firefox on Wayland +if [[ -n "${WAYLAND_DISPLAY}" ]]; then + export MOZ_ENABLE_WAYLAND=1 + export XDG_CURRENT_DESKTOP=sway +fi diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..629bbcb --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,20 @@ +# Source Prezto +if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then + source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" +fi + +# Load the shell dotfiles +# extra.zsh can be used for settings you don’t want to commit. +for file in ~/.zsh.d/*.zsh; do + source "$file" +done + +# History navigation commands +bindkey '^P' history-beginning-search-backward +bindkey '^N' history-beginning-search-forward + +# Start tmux for every terminal session +[[ -z "$TMUX" && $(tty) != /dev/tty[0-9] ]] && { tmux || exec tmux new-session && exit } + +# Initiate zoxide +eval "$(zoxide init zsh)" From 07ca2b91505eccd1d8d587d119df8c05e45d77e3 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Sun, 25 Jun 2023 16:09:45 +0200 Subject: [PATCH 07/29] Simplify ZSH setup --- .gitignore | 1 + alacritty/alacritty.yml | 39 ---- flake.lock | 12 +- flake.nix | 5 +- home.nix | 257 ++++++++++++++++++++--- mako/config | 7 - tmux/tmux.conf | 41 ---- tmux/tmux.macos.conf | 2 - waybar/config.jsonc | 8 - waybar/scripts/updates-arch-combined.sh | 17 -- wofi/style.css | 22 -- zsh/.zpreztorc | 32 --- zsh/.zsh.d/aliases.zsh | 4 - zsh/.zsh.d/themes/prompt_cloudlena_setup | 49 ----- zsh/.zshenv | 27 --- zsh/.zshrc | 20 -- zsh/{.zsh.d => }/functions.zsh | 0 17 files changed, 241 insertions(+), 302 deletions(-) create mode 100644 .gitignore delete mode 100644 alacritty/alacritty.yml delete mode 100644 mako/config delete mode 100644 tmux/tmux.conf delete mode 100644 tmux/tmux.macos.conf delete mode 100755 waybar/scripts/updates-arch-combined.sh delete mode 100644 wofi/style.css delete mode 100644 zsh/.zpreztorc delete mode 100644 zsh/.zsh.d/aliases.zsh delete mode 100644 zsh/.zsh.d/themes/prompt_cloudlena_setup delete mode 100644 zsh/.zshenv delete mode 100644 zsh/.zshrc rename zsh/{.zsh.d => }/functions.zsh (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml deleted file mode 100644 index 23cf1ef..0000000 --- a/alacritty/alacritty.yml +++ /dev/null @@ -1,39 +0,0 @@ -window: - padding: - x: 5 - y: 5 - decorations: none - startup_mode: Maximized - -font: - normal: - family: FiraCode Nerd Font - size: 12 - -# The Tokyo Night color scheme -# Copied from https://github.com/folke/tokyonight.nvim/blob/main/extras/alacritty_tokyonight_night.yml -colors: - primary: - background: "#1a1b26" - foreground: "#c0caf5" - normal: - black: "#15161E" - red: "#f7768e" - green: "#9ece6a" - yellow: "#e0af68" - blue: "#7aa2f7" - magenta: "#bb9af7" - cyan: "#7dcfff" - white: "#a9b1d6" - bright: - black: "#414868" - red: "#f7768e" - green: "#9ece6a" - yellow: "#e0af68" - blue: "#7aa2f7" - magenta: "#bb9af7" - cyan: "#7dcfff" - white: "#c0caf5" - indexed_colors: - - { index: 16, color: "#ff9e64" } - - { index: 17, color: "#db4b4b" } diff --git a/flake.lock b/flake.lock index 47d000e..42f9721 100644 --- a/flake.lock +++ b/flake.lock @@ -84,11 +84,11 @@ ] }, "locked": { - "lastModified": 1687647343, - "narHash": "sha256-1/o/i9KEFOBdlF9Cs04kBcqDFbYMt6W4SMqGa+QnnaI=", + "lastModified": 1689134369, + "narHash": "sha256-0G9dutIvhS/WUr3Awcnqw71g8EVVvvkOhVDnDDbY4Fw=", "owner": "nix-community", "repo": "home-manager", - "rev": "0ee5ab611dc1fbb5180bd7d88d2aeb7841a4d179", + "rev": "e42fb59768f0305085abde0dd27ab5e0cc15420c", "type": "github" }, "original": { @@ -123,11 +123,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1687502512, - "narHash": "sha256-dBL/01TayOSZYxtY4cMXuNCBk8UMLoqRZA+94xiFpJA=", + "lastModified": 1689192006, + "narHash": "sha256-QM0f0d8oPphOTYJebsHioR9+FzJcy1QNIzREyubB91U=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3ae20aa58a6c0d1ca95c9b11f59a2d12eebc511f", + "rev": "2de8efefb6ce7f5e4e75bdf57376a96555986841", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 09546ef..85c1a5b 100644 --- a/flake.nix +++ b/flake.nix @@ -16,10 +16,9 @@ outputs = { nixpkgs, lanzaboote, home-manager, ... }: let system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = import nixpkgs { inherit system; }; - in - { + in { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { inherit system; modules = [ diff --git a/home.nix b/home.nix index 3a15bbe..7077921 100644 --- a/home.nix +++ b/home.nix @@ -5,29 +5,30 @@ home.homeDirectory = "/home/lena"; home.packages = with pkgs; [ - alacritty + altair autotiling-rs awscli2 + black brave brightnessctl cargo chafa chromium clipman + delve diff-so-fancy dig fd fira-mono fx - gammastep gh gimp golangci-lint gopass + gopls grim gron hugo - imv inkscape jpegoptim kanshi @@ -40,10 +41,16 @@ moq ncdu (nerdfonts.override { fonts = [ "FiraCode" ]; }) + nil + nixpkgs-fmt nmap nodejs + nodePackages.bash-language-server nodePackages.prettier + nodePackages.svelte-language-server nodePackages.svgo + nodePackages.typescript-language-server + nodePackages.yaml-language-server noto-fonts-cjk noto-fonts-emoji optipng @@ -52,10 +59,10 @@ protobuf pwgen python3 - python311Packages.flake8 + python311Packages.python-lsp-server quickemu realvnc-vnc-viewer - rnix-lsp + rust-analyzer rustc shellcheck shfmt @@ -66,21 +73,31 @@ swayidle swaylock terraform + terraform-ls tflint timewarrior - tldr - tmate tree vifm + vscode-langservers-extracted waybar wf-recorder whois wine wl-clipboard - wofi workstyle ]; + home.sessionVariables = { + TERMINAL = "alacritty"; + BROWSER = "brave"; + }; + + home.shellAliases = { + e = "$EDITOR"; + ".." = "cd .."; + "..." = "cd ../.."; + }; + home.stateVersion = "23.05"; nixpkgs.config.allowUnfree = true; @@ -123,22 +140,222 @@ # PDF viewer zathura.enable = true; + # Text editor + helix = { + enable = true; + defaultEditor = true; + settings = { + theme = "tokyonight"; + editor = { + line-number = "relative"; + mouse = false; + cursor-shape.insert = "bar"; + file-picker.hidden = false; + }; + }; + languages = { + language = [ + { name = "html"; formatter = { command = "prettier"; args = [ "--parser" "html" ]; }; } + { name = "json"; formatter = { command = "prettier"; args = [ "--parser" "json" ]; }; } + { name = "css"; formatter = { command = "prettier"; args = [ "--parser" "css" ]; }; } + { name = "yaml"; formatter = { command = "prettier"; args = [ "--parser" "yaml" ]; }; } + { name = "markdown"; formatter = { command = "prettier"; args = [ "--parser" "markdown" ]; }; } + { name = "javascript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } + { name = "typescript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } + { name = "go"; config = { formatting.gofumpt = true; }; } + { name = "nix"; auto-format = true; formatter = { command = "nixpkgs-fmt"; }; } + { name = "bash"; auto-format = true; formatter = { command = "shfmt"; args = [ "-i" "4" ]; }; } + ]; + }; + }; + # Task management - taskwarrior.enable = true; + taskwarrior = { + enable = true; + config = { + taskd = { + certificate = "~/.config/task/private.certificate.pem"; + key = "~/.config/task/private.key.pem"; + ca = "~/.config/task/ca.cert.pem"; + server = "inthe.am:53589"; + credentials = "inthe_am/lena/c214a5a3-b0b2-4132-958c-ebef8d83fd25"; + trust = "strict"; + }; + }; + }; # Media player mpv.enable = true; + # Image viewer + imv.enable = true; + # Go - go.enable = true; + go = { + enable = true; + goPath = ".local/share/go"; + }; + + # Shell + zsh = { + enable = true; + enableAutosuggestions = true; + syntaxHighlighting.enable = true; + defaultKeymap = "viins"; + historySubstringSearch = { + enable = true; + searchDownKey = "^N"; + searchUpKey = "^P"; + }; + initExtra = '' + source ~/.config/zsh/* + [[ -z "$TMUX" && $(tty) != /dev/tty[0-9] ]] && { tmux || exec tmux new-session && exit } + ''; + }; + + # Shell prompt + starship = { + enable = true; + settings = { + add_newline = false; + format = "$directory$git_branch$git_status$character"; + }; + }; + + # Launcher + wofi = { + enable = true; + style = '' + #window { + font-family: "Fira Mono"; + background-color: #1a1b26; + color: #c0caf5; + } + + #input { + border-radius: 0; + border-color: transparent; + padding: 5px; + background-color: #1a1b26; + color: #c0caf5; + } + + #entry { + padding: 5px; + } + + #entry:selected { + outline: none; + background-color: #bb9af7; + } + ''; + }; + + # Terminal multiplexer + tmux = { + enable = true; + keyMode = "vi"; + escapeTime = 10; + customPaneNavigationAndResize = true; + terminal = "tmux-256color"; + extraConfig = '' + # Set correct terminal + set-option -sa terminal-features ',alacritty:RGB' + + # Open new splits from current directory + bind '"' split-window -v -c '#{pane_current_path}' + bind % split-window -h -c '#{pane_current_path}' + + # Color scheme + set-option -g status-style 'fg=#414868' + set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' + set-option -g mode-style 'fg=#7aa2f7,bg=#3b4261' + set-option -g message-style 'fg=#7aa2f7,bg=#3b4261' + set-option -g pane-border-style 'fg=#3b4261' + set-option -g pane-active-border-style 'fg=#3b4261' + set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' + + # Unclutter status bar + set-option -g status-right "" + set-option -g status-left "" + set-window-option -g window-status-format " #I: #W " + set-window-option -g window-status-current-format " #I: #W " + ''; + }; + tmate.enable = true; + + # Terminal emulator + alacritty = { + enable = true; + settings = { + window = { + padding = { + x = 5; + y = 5; + }; + decorations = "none"; + startup_mode = "Maximized"; + }; + font = { + normal.family = "FiraCode Nerd Font"; + size = 12; + }; + colors = { + primary = { + background = "#1a1b26"; + foreground = "#c0caf5"; + }; + normal = { + black = "#15161e"; + red = "#f7768e"; + green = "#9ece6a"; + yellow = "#e0af68"; + blue = "#7aa2f7"; + magenta = "#bb9af7"; + cyan = "#7dcfff"; + white = "#a9b1d6"; + }; + bright = { + black = "#414868"; + red = "#f7768e"; + green = "#9ece6a"; + yellow = "#e0af68"; + blue = "#7aa2f7"; + magenta = "#bb9af7"; + cyan = "#7dcfff"; + white = "#c0caf5"; + }; + indexed_colors = [ + { index = 16; color = "#ff9e64"; } + { index = 17; color = "#db4b4b"; } + ]; + }; + }; + }; + + # Simplified manuals + tealdeer = { + enable = true; + settings = { + updates.auto_update = true; + }; + }; }; services = { # GPG gpg-agent.enable = true; - # Notifications - mako.enable = true; + # Notification daemon + mako = { + enable = true; + font = "Fira Mono 9"; + backgroundColor = "#1a1b26"; + textColor = "#c0caf5"; + borderColor = "#bb9af7"; + defaultTimeout = 8000; + groupBy = "app-name,summary"; + }; # Adjust color temperature to reduce eye strain gammastep = { @@ -146,30 +363,20 @@ provider = "geoclue2"; }; - # Battery signal demon + # Battery signal daemon batsignal.enable = true; }; - # Dotfiles - home.file = { - ".zshrc".source = ./zsh/.zshrc; - ".zshenv".source = ./zsh/.zshenv; - ".zpreztorc".source = ./zsh/.zpreztorc; - ".zsh.d".source = ./zsh/.zsh.d; - }; xdg.configFile = { - "alacritty".source = ./alacritty; "gopass".source = ./gopass; "hypr".source = ./hyprland; - "mako".source = ./mako; "nvim/init.lua".source = ./nvim/init.lua; "nvim/lua".source = ./nvim/lua; "sway".source = ./sway; - "tmux".source = ./tmux; "vifm".source = ./vifm; + "wallpapers".source = ./wallpapers; "waybar".source = ./waybar; - "wofi".source = ./wofi; "workstyle".source = ./workstyle; - "wallpapers".source = ./wallpapers; + "zsh".source = ./zsh; }; } diff --git a/mako/config b/mako/config deleted file mode 100644 index f1577cb..0000000 --- a/mako/config +++ /dev/null @@ -1,7 +0,0 @@ -font=Fira Mono 9 -background-color=#1a1b26 -text-color=#c0caf5 -width=350 -border-color=#bb9af7 -default-timeout=8000 -group-by=app-name,summary diff --git a/tmux/tmux.conf b/tmux/tmux.conf deleted file mode 100644 index 20b194f..0000000 --- a/tmux/tmux.conf +++ /dev/null @@ -1,41 +0,0 @@ -# Set correct terminal -set-option -g default-terminal "tmux-256color" -set-option -as terminal-overrides ',alacritty:RGB' - -# Open new windows from home directory -bind c new-window -c "${HOME}" - -# Open new splits from current directory -bind '"' split-window -v -c '#{pane_current_path}' -bind % split-window -h -c '#{pane_current_path}' - -# Switch panes like vim -set-window-option -g mode-keys vi -bind h select-pane -L -bind j select-pane -D -bind k select-pane -U -bind l select-pane -R - -# Set escape time to 10 for esc to work properly in Vim -set-option -sg escape-time 10 - -# Set focus-events to enable Neovim autoread -set-option -g focus-events on - -# Color scheme -set-option -g status-style 'fg=#414868' -set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' -set-option -g mode-style 'fg=#7aa2f7,bg=#3b4261' -set-option -g message-style 'fg=#7aa2f7,bg=#3b4261' -set-option -g pane-border-style 'fg=#3b4261' -set-option -g pane-active-border-style 'fg=#3b4261' -set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' - -# Unclutter status bar -set-option -g status-right '' -set-option -g status-left '' -set-window-option -g window-status-format " #I: #W " -set-window-option -g window-status-current-format " #I: #W " - -# Allow to use user namespace out of tmux on macOS -if-shell 'test "$(uname)" = "Darwin"' 'source ~/.config/tmux/tmux.macos.conf' diff --git a/tmux/tmux.macos.conf b/tmux/tmux.macos.conf deleted file mode 100644 index 200eb77..0000000 --- a/tmux/tmux.macos.conf +++ /dev/null @@ -1,2 +0,0 @@ -# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard -set-option -g default-command "reattach-to-user-namespace -l $SHELL" diff --git a/waybar/config.jsonc b/waybar/config.jsonc index c3ed8df..61d871c 100644 --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -2,7 +2,6 @@ "modules-left": ["sway/workspaces", "sway/mode"], "modules-center": ["custom/tasks"], "modules-right": [ - "custom/updates", "custom/containers", "wireplumber", "bluetooth", @@ -53,13 +52,6 @@ "exec-if": "which task", "interval": 60 }, - "custom/updates": { - "format": "󰣇 {}", - "exec": "~/.config/waybar/scripts/updates-arch-combined.sh", - "interval": 7200, - "on-click": "alacritty --command paru -Syu --noconfirm", - "signal": 8 - }, "custom/containers": { "exec": "~/.config/waybar/scripts/containers.sh", "exec-if": "which podman", diff --git a/waybar/scripts/updates-arch-combined.sh b/waybar/scripts/updates-arch-combined.sh deleted file mode 100755 index 0bcdb8a..0000000 --- a/waybar/scripts/updates-arch-combined.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -if ! update_count_pacman=$(checkupdates | wc -l); then - update_count_pacman=0 -fi - -if ! update_count_aur=$(paru -Qum 2>/dev/null | wc -l); then - update_count_aur=0 -fi - -update_count=$((update_count_pacman + update_count_aur)) - -if [ "$update_count" -gt 0 ]; then - echo "$update_count" -else - echo '' -fi diff --git a/wofi/style.css b/wofi/style.css deleted file mode 100644 index 3a0f987..0000000 --- a/wofi/style.css +++ /dev/null @@ -1,22 +0,0 @@ -#window { - font-family: "Fira Mono"; - background-color: #1a1b26; - color: #c0caf5; -} - -#input { - border-radius: 0; - border-color: transparent; - padding: 5px; - background-color: #1a1b26; - color: #c0caf5; -} - -#entry { - padding: 5px; -} - -#entry:selected { - outline: none; - background-color: #bb9af7; -} diff --git a/zsh/.zpreztorc b/zsh/.zpreztorc deleted file mode 100644 index eaaa5a7..0000000 --- a/zsh/.zpreztorc +++ /dev/null @@ -1,32 +0,0 @@ -# vim: ft=zsh - -fpath=(${HOME}/.zsh.d/themes $fpath) - -# Load Prezto modules -# The order matters. -zstyle ':prezto:load' pmodule \ - 'environment' \ - 'utility' \ - 'git' \ - 'completion' \ - 'syntax-highlighting' \ - 'history-substring-search' \ - 'prompt' \ - 'history' \ - 'autosuggestions' \ - 'editor' - -# Enable color output -zstyle ':prezto:*:*' color 'yes' - -# Enable advanced syntax highlighting for commands -zstyle ':prezto:module:syntax-highlighting' highlighters \ - 'main' \ - 'brackets' - -# Set the prompt theme to load -# Setting it to 'random' loads a random theme. -zstyle ':prezto:module:prompt' theme 'cloudlena' - -# Use vi keybindings -zstyle ':prezto:module:editor' key-bindings 'vi' diff --git a/zsh/.zsh.d/aliases.zsh b/zsh/.zsh.d/aliases.zsh deleted file mode 100644 index 3c6bbb5..0000000 --- a/zsh/.zsh.d/aliases.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# Easier navigation -alias ..='cd ..' -alias ...='cd ../..' -alias ....='cd ../../..' diff --git a/zsh/.zsh.d/themes/prompt_cloudlena_setup b/zsh/.zsh.d/themes/prompt_cloudlena_setup deleted file mode 100644 index 9f16fa5..0000000 --- a/zsh/.zsh.d/themes/prompt_cloudlena_setup +++ /dev/null @@ -1,49 +0,0 @@ -# vim: ft=zsh - -function prompt_cloudlena_precmd { - if (( $+functions[git-info] )); then - git-info - fi -} - -function prompt_cloudlena_setup { - setopt LOCAL_OPTIONS - unsetopt XTRACE KSH_ARRAYS - prompt_opts=(cr percent sp subst) - - # Load required functions - autoload -Uz add-zsh-hook - - # Add hook for calling git-info before each command - add-zsh-hook precmd prompt_cloudlena_precmd - - # Tell prezto we can manage this prompt - zstyle ':prezto:module:prompt' managed 'yes' - - # Set git-info parameters - zstyle ':prezto:module:git:info' verbose 'yes' - zstyle ':prezto:module:git:info:branch' format '%b' - zstyle ':prezto:module:git:info:position' format '%p' - zstyle ':prezto:module:git:info:commit' format '%.7c' - zstyle ':prezto:module:git:info:action' format '%F{yellow}[%s]%f' - zstyle ':prezto:module:git:info:deleted' format '%F{yellow}●%f' - zstyle ':prezto:module:git:info:modified' format '%F{yellow}●%f' - zstyle ':prezto:module:git:info:untracked' format '%F{yellow}●%f' - zstyle ':prezto:module:git:info:renamed' format '%F{green}●%f' - zstyle ':prezto:module:git:info:added' format '%F{green}●%f' - zstyle ':prezto:module:git:info:ahead' format '%F{yellow} ⬆%f' - zstyle ':prezto:module:git:info:behind' format '%F{yellow} ⬇%f' - zstyle ':prezto:module:git:info:stashed' format '%F{yellow} ★%f' - zstyle ':prezto:module:git:info:keys' format \ - 'prompt' ' %F{cyan}[$(coalesce "%b" "%p" "%c")%f${(e)git_info[status]}%F{cyan}]%f%s' \ - 'status' '$(coalesce "%a" "%r")$(coalesce "%d" "%m" "%u")%A%B%S' \ - - # Define prompts - PROMPT='%F{magenta}%c%f${(e)git_info[prompt]} ' -} - -function prompt_cloudlena_help { - echo 'This prompt is as minimalist as possible and cannot be customized.' -} - -prompt_cloudlena_setup "$@" diff --git a/zsh/.zshenv b/zsh/.zshenv deleted file mode 100644 index ffff56b..0000000 --- a/zsh/.zshenv +++ /dev/null @@ -1,27 +0,0 @@ -# Amend PATH -path+=("${HOME}/.local/bin") -path+=("${HOME}/.node_modules/bin") -path+=("${HOME}/.cargo/bin") -path+=("${HOME}/go/bin") -export PATH - -# Prefer US English and use UTF-8 -export LC_ALL='en_US.UTF-8' -export LANG='en_US.UTF-8' - -# Set default programs -export TERMINAL='alacritty' -export BROWSER='brave' -export PAGER='less' -export EDITOR='nvim' -export VISUAL="${EDITOR}" - -# Set correct TTY for GPG -# https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html -export GPG_TTY="$(tty)" - -# Set environment variables for Firefox on Wayland -if [[ -n "${WAYLAND_DISPLAY}" ]]; then - export MOZ_ENABLE_WAYLAND=1 - export XDG_CURRENT_DESKTOP=sway -fi diff --git a/zsh/.zshrc b/zsh/.zshrc deleted file mode 100644 index 629bbcb..0000000 --- a/zsh/.zshrc +++ /dev/null @@ -1,20 +0,0 @@ -# Source Prezto -if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then - source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" -fi - -# Load the shell dotfiles -# extra.zsh can be used for settings you don’t want to commit. -for file in ~/.zsh.d/*.zsh; do - source "$file" -done - -# History navigation commands -bindkey '^P' history-beginning-search-backward -bindkey '^N' history-beginning-search-forward - -# Start tmux for every terminal session -[[ -z "$TMUX" && $(tty) != /dev/tty[0-9] ]] && { tmux || exec tmux new-session && exit } - -# Initiate zoxide -eval "$(zoxide init zsh)" diff --git a/zsh/.zsh.d/functions.zsh b/zsh/functions.zsh similarity index 100% rename from zsh/.zsh.d/functions.zsh rename to zsh/functions.zsh From 35751863664419fef90545343ff24440835815c1 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Fri, 14 Jul 2023 18:26:30 +0200 Subject: [PATCH 08/29] Improve command line UX --- flake.lock | 12 ++-- home.nix | 15 +++-- nvim/init.lua | 18 ----- nvim/lua/config/autocmds.lua | 16 ----- nvim/lua/config/options.lua | 19 ------ nvim/lua/config/tools.lua | 35 ---------- nvim/lua/plugins/code_outline.lua | 11 ---- nvim/lua/plugins/colorscheme.lua | 13 ---- nvim/lua/plugins/completion.lua | 38 ----------- nvim/lua/plugins/convenience.lua | 19 ------ nvim/lua/plugins/debugging.lua | 49 -------------- nvim/lua/plugins/diagnostics.lua | 10 --- nvim/lua/plugins/diff_directories.lua | 10 --- nvim/lua/plugins/file_tree.lua | 25 ------- nvim/lua/plugins/focused_writing.lua | 17 ----- nvim/lua/plugins/fuzzy_finding.lua | 34 ---------- nvim/lua/plugins/git.lua | 61 ----------------- nvim/lua/plugins/lsp.lua | 95 --------------------------- nvim/lua/plugins/status_line.lua | 33 ---------- nvim/lua/plugins/testing.lua | 66 ------------------- nvim/lua/plugins/tools.lua | 50 -------------- nvim/lua/plugins/treesitter.lua | 42 ------------ vifm/colors/tokyonight.vifm | 10 --- vifm/vifmrc | 20 ------ 24 files changed, 16 insertions(+), 702 deletions(-) delete mode 100644 nvim/init.lua delete mode 100644 nvim/lua/config/autocmds.lua delete mode 100644 nvim/lua/config/options.lua delete mode 100644 nvim/lua/config/tools.lua delete mode 100644 nvim/lua/plugins/code_outline.lua delete mode 100644 nvim/lua/plugins/colorscheme.lua delete mode 100644 nvim/lua/plugins/completion.lua delete mode 100644 nvim/lua/plugins/convenience.lua delete mode 100644 nvim/lua/plugins/debugging.lua delete mode 100644 nvim/lua/plugins/diagnostics.lua delete mode 100644 nvim/lua/plugins/diff_directories.lua delete mode 100644 nvim/lua/plugins/file_tree.lua delete mode 100644 nvim/lua/plugins/focused_writing.lua delete mode 100644 nvim/lua/plugins/fuzzy_finding.lua delete mode 100644 nvim/lua/plugins/git.lua delete mode 100644 nvim/lua/plugins/lsp.lua delete mode 100644 nvim/lua/plugins/status_line.lua delete mode 100644 nvim/lua/plugins/testing.lua delete mode 100644 nvim/lua/plugins/tools.lua delete mode 100644 nvim/lua/plugins/treesitter.lua delete mode 100644 vifm/colors/tokyonight.vifm delete mode 100644 vifm/vifmrc diff --git a/flake.lock b/flake.lock index 42f9721..04a06ad 100644 --- a/flake.lock +++ b/flake.lock @@ -84,11 +84,11 @@ ] }, "locked": { - "lastModified": 1689134369, - "narHash": "sha256-0G9dutIvhS/WUr3Awcnqw71g8EVVvvkOhVDnDDbY4Fw=", + "lastModified": 1689432596, + "narHash": "sha256-Vixn4nhjeHjGG3o6hDAnSZbXsYMYA5b39+NwAbUPpi0=", "owner": "nix-community", "repo": "home-manager", - "rev": "e42fb59768f0305085abde0dd27ab5e0cc15420c", + "rev": "346032240c15d8b6034847dc7a5f53312a5a57fc", "type": "github" }, "original": { @@ -123,11 +123,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1689192006, - "narHash": "sha256-QM0f0d8oPphOTYJebsHioR9+FzJcy1QNIzREyubB91U=", + "lastModified": 1689282004, + "narHash": "sha256-VNhuyb10c9SV+3hZOlxwJwzEGytZ31gN9w4nPCnNvdI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2de8efefb6ce7f5e4e75bdf57376a96555986841", + "rev": "e74e68449c385db82de3170288a28cd0f608544f", "type": "github" }, "original": { diff --git a/home.nix b/home.nix index 7077921..a75c748 100644 --- a/home.nix +++ b/home.nix @@ -19,6 +19,7 @@ diff-so-fancy dig fd + file fira-mono fx gh @@ -36,6 +37,7 @@ kubectx lato libreoffice-fresh + lldb lolcat lutris moq @@ -77,7 +79,6 @@ tflint timewarrior tree - vifm vscode-langservers-extracted waybar wf-recorder @@ -94,6 +95,9 @@ home.shellAliases = { e = "$EDITOR"; + f = "joshuto"; + g = "gitui"; + t = "task"; ".." = "cd .."; "..." = "cd ../.."; }; @@ -118,6 +122,10 @@ }; diff-so-fancy.enable = true; }; + gitui.enable = true; + + # File manager + joshuto.enable = true; # GPG gpg.enable = true; @@ -218,7 +226,7 @@ enable = true; settings = { add_newline = false; - format = "$directory$git_branch$git_status$character"; + format = "$jobs$directory$git_branch$git_state$git_status$character"; }; }; @@ -370,10 +378,7 @@ xdg.configFile = { "gopass".source = ./gopass; "hypr".source = ./hyprland; - "nvim/init.lua".source = ./nvim/init.lua; - "nvim/lua".source = ./nvim/lua; "sway".source = ./sway; - "vifm".source = ./vifm; "wallpapers".source = ./wallpapers; "waybar".source = ./waybar; "workstyle".source = ./workstyle; diff --git a/nvim/init.lua b/nvim/init.lua deleted file mode 100644 index ec8bd43..0000000 --- a/nvim/init.lua +++ /dev/null @@ -1,18 +0,0 @@ --- Install Lazy if not installed yet -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "--single-branch", - "https://github.com/folke/lazy.nvim.git", - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - -require("config.options") -require("config.autocmds") - -require("lazy").setup("plugins", { defaults = { version = "*" } }) diff --git a/nvim/lua/config/autocmds.lua b/nvim/lua/config/autocmds.lua deleted file mode 100644 index 69d2a2d..0000000 --- a/nvim/lua/config/autocmds.lua +++ /dev/null @@ -1,16 +0,0 @@ --- Strip trailing whitespaces on save -local clean_whitespace_group = vim.api.nvim_create_augroup("CleanWhitespace", { clear = true }) -vim.api.nvim_create_autocmd("BufWritePre", { - group = clean_whitespace_group, - command = "%s/\\s\\+$//e", -}) - --- Enable spell checking for certain file types -local enable_spell_check_group = vim.api.nvim_create_augroup("EnableSpellCheck", { clear = true }) -vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - group = enable_spell_check_group, - pattern = { "*.txt", "*.md", "*.tex" }, - callback = function() - vim.opt_local.spell = true - end, -}) diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua deleted file mode 100644 index 369e72a..0000000 --- a/nvim/lua/config/options.lua +++ /dev/null @@ -1,19 +0,0 @@ -vim.g.mapleader = " " -- Set leader key -vim.g.maplocalleader = " " -- Set local leader key -vim.o.completeopt = "menuone,noselect" -- Have a better completion experience -vim.opt.breakindent = true -- Keep indentation for line breaks -vim.opt.clipboard = "unnamedplus" -- Use system clipboard -vim.opt.ignorecase = true -- Ignore case -vim.opt.inccommand = "split" -- Preview for find-replace command -vim.opt.laststatus = 3 -- Global status line -vim.opt.number = true -- Show line numbers -vim.opt.relativenumber = true -- Relative line numbers -vim.opt.shortmess = "I" -- Disable welcome screen -vim.opt.smartcase = true -- Do not ignore case with capitals -vim.opt.spelllang = "en_us" -- Set default spell language -vim.opt.splitbelow = true -- Put new windows below current -vim.opt.splitright = true -- Put new windows right of current -vim.opt.termguicolors = true -- True color support -vim.opt.tabstop = 4 -- Set tab width to 4 spaces - -vim.keymap.set({ "n", "v" }, "", "", { silent = true }) -- Reserve space for keymaps diff --git a/nvim/lua/config/tools.lua b/nvim/lua/config/tools.lua deleted file mode 100644 index 8a251b1..0000000 --- a/nvim/lua/config/tools.lua +++ /dev/null @@ -1,35 +0,0 @@ -return { - lsp = { - "bashls", - "cssls", - "dockerls", - "eslint", - "golangci_lint_ls", - "gopls", - "graphql", - "jsonls", - "pyright", - "rust_analyzer", - -- "lua_ls", - "svelte", - "terraformls", - "tsserver", - "yamlls", - }, - linter = { - "flake8", - "hadolint", - }, - formatter = { - "black", - "goimports", - "prettierd", - "shfmt", - "stylua", - }, - dap = { - "delve", - "node-debug2", - "python", - }, -} diff --git a/nvim/lua/plugins/code_outline.lua b/nvim/lua/plugins/code_outline.lua deleted file mode 100644 index 59e65c2..0000000 --- a/nvim/lua/plugins/code_outline.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - { - "simrat39/symbols-outline.nvim", - cmd = { "SymbolsOutline" }, - keys = { - { "k", "SymbolsOutline", desc = "Toggle code outline" }, - }, - config = true, - }, - "liuchengxu/vista.vim", -} diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua deleted file mode 100644 index 42f91dc..0000000 --- a/nvim/lua/plugins/colorscheme.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, - config = function() - require("tokyonight").setup({ - style = "night", - }) - vim.api.nvim_command("colorscheme tokyonight") - end, - }, -} diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua deleted file mode 100644 index e8d7e1b..0000000 --- a/nvim/lua/plugins/completion.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-vsnip", - "hrsh7th/vim-vsnip", - "onsails/lspkind-nvim", - }, - config = function() - local cmp = require("cmp") - - local sources = { - { name = "nvim_lua" }, - { name = "nvim_lsp" }, - { name = "path" }, - { name = "buffer" }, - } - - cmp.setup({ - snippet = { - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.confirm({ select = true }), - }), - sources = sources, - formatting = { format = require("lspkind").cmp_format() }, - }) - end, - }, -} diff --git a/nvim/lua/plugins/convenience.lua b/nvim/lua/plugins/convenience.lua deleted file mode 100644 index b85fd47..0000000 --- a/nvim/lua/plugins/convenience.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - -- Automatically set indent settings - { "tpope/vim-sleuth", event = "VeryLazy" }, - - -- Edit surrounds - { "kylechui/nvim-surround", event = "VeryLazy", config = true }, - - -- Allow to repeat plugin commands - { "tpope/vim-repeat", event = "VeryLazy" }, - - -- Autoclose pairs - { "windwp/nvim-autopairs", event = "InsertEnter", config = true }, - - -- Toggle comments - { "numToStr/Comment.nvim", keys = { "gc", { "gc", mode = "v" } }, config = true }, - - -- Highlight color definitions - { "NvChad/nvim-colorizer.lua", event = "VeryLazy", config = true }, -} diff --git a/nvim/lua/plugins/debugging.lua b/nvim/lua/plugins/debugging.lua deleted file mode 100644 index 940d79e..0000000 --- a/nvim/lua/plugins/debugging.lua +++ /dev/null @@ -1,49 +0,0 @@ -return { - { - "mfussenegger/nvim-dap", - dependencies = { - { "theHamsta/nvim-dap-virtual-text", config = true }, - { - "rcarriga/nvim-dap-ui", - config = function() - local dapui = require("dapui") - - dapui.setup() - - vim.keymap.set("n", "du", dapui.toggle, { desc = "Toggle debugging UI" }) - vim.keymap.set("n", "dK", function() - dapui.eval(nil, { enter = true }) - end, { desc = "Debug symbol under cursor" }) - end, - }, - }, - cmd = { "DapToggleBreakpoint" }, - keys = { - { - "db", - function() - require("dap").toggle_breakpoint() - end, - desc = "Toggle breakpoint", - }, - { - "dB", - function() - require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) - end, - desc = "Set breakpoint condition", - }, - }, - config = function() - local dap = require("dap") - - vim.fn.sign_define("DapBreakpoint", { text = "󰌖", texthl = "", linehl = "", numhl = "" }) - vim.fn.sign_define("DapBreakpointCondition", { text = "󰌕", texthl = "", linehl = "", numhl = "" }) - - vim.keymap.set("n", "dd", dap.continue, { desc = "Start/continue debugging" }) - vim.keymap.set("n", "dn", dap.step_over, { desc = "Step over" }) - vim.keymap.set("n", "di", dap.step_into, { desc = "Step into" }) - vim.keymap.set("n", "do", dap.step_out, { desc = "Step out" }) - end, - }, -} diff --git a/nvim/lua/plugins/diagnostics.lua b/nvim/lua/plugins/diagnostics.lua deleted file mode 100644 index dbc0483..0000000 --- a/nvim/lua/plugins/diagnostics.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - keys = { - { "s", "TroubleToggle workspace_diagnostics", desc = "Toggle diagnostics" }, - }, - config = true, - }, -} diff --git a/nvim/lua/plugins/diff_directories.lua b/nvim/lua/plugins/diff_directories.lua deleted file mode 100644 index 284da3a..0000000 --- a/nvim/lua/plugins/diff_directories.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - { - "will133/vim-dirdiff", - cmd = { "DirDiff" }, - config = function() - vim.g.DirDiffExcludes = - ".DS_Store,.git,.terraform,.gradle,bin,build,coverage,dist,node_modules,target,vendor" - end, - }, -} diff --git a/nvim/lua/plugins/file_tree.lua b/nvim/lua/plugins/file_tree.lua deleted file mode 100644 index 1fb313e..0000000 --- a/nvim/lua/plugins/file_tree.lua +++ /dev/null @@ -1,25 +0,0 @@ -return { - { - "nvim-tree/nvim-tree.lua", - dependencies = { "nvim-tree/nvim-web-devicons" }, - keys = { - { - "j", - "NvimTreeFindFileToggle", - desc = "Toggle file tree", - }, - }, - opts = { - filters = { - custom = { "^.DS_Store$", "^.git$" }, - }, - renderer = { - icons = { - show = { - git = false, - }, - }, - }, - }, - }, -} diff --git a/nvim/lua/plugins/focused_writing.lua b/nvim/lua/plugins/focused_writing.lua deleted file mode 100644 index 2b35587..0000000 --- a/nvim/lua/plugins/focused_writing.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - { - "folke/zen-mode.nvim", - cmd = { "ZenMode" }, - opts = { - window = { - backdrop = 1, - options = { - signcolumn = "no", - number = false, - relativenumber = false, - }, - }, - }, - }, - { "folke/twilight.nvim", config = true, lazy = true }, -} diff --git a/nvim/lua/plugins/fuzzy_finding.lua b/nvim/lua/plugins/fuzzy_finding.lua deleted file mode 100644 index 6c3e939..0000000 --- a/nvim/lua/plugins/fuzzy_finding.lua +++ /dev/null @@ -1,34 +0,0 @@ -return { - { - "nvim-telescope/telescope.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - "nvim-telescope/telescope-ui-select.nvim", - }, - cmd = { "Telescope" }, - keys = { - { - "", - "Telescope find_files find_command=fd,--type=file,--type=symlink,--hidden,--no-ignore,--exclude=.DS_Store,--exclude=.git,--exclude=.terraform,--exclude=.gradle,--exclude=.svelte-kit,--exclude=bin,--exclude=build,--exclude=coverage,--exclude=dist,--exclude=node_modules,--exclude=target,--exclude=vendor,--exclude=venv,--exclude=__pycache__", - desc = "Find files", - }, - { "/", "Telescope live_grep", desc = "Live grep" }, - }, - config = function() - local telescope = require("telescope") - - telescope.setup({ - defaults = { - mappings = { - i = { - [""] = require("telescope.actions").close, - }, - }, - }, - }) - telescope.load_extension("fzf") - telescope.load_extension("ui-select") - end, - }, -} diff --git a/nvim/lua/plugins/git.lua b/nvim/lua/plugins/git.lua deleted file mode 100644 index a42a36d..0000000 --- a/nvim/lua/plugins/git.lua +++ /dev/null @@ -1,61 +0,0 @@ -return { - { - "tpope/vim-fugitive", - cmd = { "Git", "Gread", "Gdiff", "Gvdiffsplit" }, - keys = { - { - "gg", - ":Git", - desc = "Git status", - }, - { - "gc", - ":Git commit", - desc = "Git commit", - }, - { - "gm", - ":Git mergetool | Gvdiffsplit!", - desc = "Git three-way merge", - }, - }, - }, - { - "lewis6991/gitsigns.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - event = "VeryLazy", - keys = { - { - "ga", - ":Gitsigns stage_hunk", - desc = "Git add hunk", - }, - { - "gu", - ":Gitsigns undo_stage_hunk", - desc = "Git unstage hunk", - }, - { - "gA", - ":Gitsigns stage_buffer", - desc = "Git add file", - }, - { - "gU", - ":Gitsigns reset_buffer", - desc = "Git reset file", - }, - { - "gd", - ":Gitsigns diffthis", - desc = "Git diff", - }, - { - "gb", - ":Gitsigns blame_line", - desc = "Git blame", - }, - }, - config = true, - }, -} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua deleted file mode 100644 index 643fa04..0000000 --- a/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -1,95 +0,0 @@ -local formatting_group = vim.api.nvim_create_augroup("LspFormatting", { clear = false }) - -return { - { - "neovim/nvim-lspconfig", - dependencies = { "williamboman/mason-lspconfig.nvim" }, - event = "VeryLazy", - config = function() - -- Set correct icons in sign column - local signs = { - Error = "󰅚 ", - Warn = "󰀪 ", - Hint = "󰌶 ", - Info = "󰋽 ", - } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl }) - end - - -- Set up keymaps - vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostics of current line" }) - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Move to previous diagnostic" }) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Move to next diagnostic" }) - - -- Add additional capabilities supported by nvim-cmp - local capabilities = require("cmp_nvim_lsp").default_capabilities() - - -- Use an on_attach function to only map the following keys - -- after the language server attaches to the current buffer - local on_attach = function(client, bufnr) - local telescope_builtin = require("telescope.builtin") - - local function buf_opts(desc) - return { noremap = true, silent = true, buffer = bufnr, desc = desc } - end - - vim.keymap.set("n", "K", vim.lsp.buf.hover, buf_opts("Show signature of current symbol")) - vim.keymap.set("n", "gd", telescope_builtin.lsp_definitions, buf_opts("Go to definiton")) - vim.keymap.set("n", "gi", telescope_builtin.lsp_implementations, buf_opts("Go to implementation")) - vim.keymap.set("n", "gr", telescope_builtin.lsp_references, buf_opts("Go to reference")) - vim.keymap.set("n", "r", vim.lsp.buf.rename, buf_opts("Rename current symbol")) - vim.keymap.set("n", "a", vim.lsp.buf.code_action, buf_opts("Run code action")) - vim.keymap.set("n", "f", function() - vim.lsp.buf.format({ async = true }) - end, buf_opts("Format current file")) - - -- Format on save - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = formatting_group, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = formatting_group, - buffer = bufnr, - callback = function() - vim.lsp.buf.format() - end, - }) - end - end - - require("mason-lspconfig").setup_handlers({ - function(server_name) - require("lspconfig")[server_name].setup({ - on_attach = on_attach, - capabilities = capabilities, - }) - end, - }) - end, - }, - { - "jose-elias-alvarez/null-ls.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - event = "VeryLazy", - config = function() - local null_ls = require("null-ls") - null_ls.setup({ - -- Sources can be configured in config/tools.lua - -- Format on save - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = formatting_group, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = formatting_group, - buffer = bufnr, - callback = function() - vim.lsp.buf.format({ timeout_ms = 5000 }) - end, - }) - end - end, - }) - end, - }, -} diff --git a/nvim/lua/plugins/status_line.lua b/nvim/lua/plugins/status_line.lua deleted file mode 100644 index ad5f0c6..0000000 --- a/nvim/lua/plugins/status_line.lua +++ /dev/null @@ -1,33 +0,0 @@ -return { - { - "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - local function get_words() - if vim.bo.filetype == "md" or vim.bo.filetype == "txt" or vim.bo.filetype == "markdown" then - if vim.fn.wordcount().visual_words == 1 then - return tostring(vim.fn.wordcount().visual_words) .. " word" - elseif not (vim.fn.wordcount().visual_words == nil) then - return tostring(vim.fn.wordcount().visual_words) .. " words" - else - return tostring(vim.fn.wordcount().words) .. " words" - end - else - return "" - end - end - - require("lualine").setup({ - sections = { - lualine_a = {}, - lualine_x = { "filetype" }, - lualine_z = { get_words }, - }, - extensions = { "nvim-tree" }, - options = { - theme = "tokyonight", - }, - }) - end, - }, -} diff --git a/nvim/lua/plugins/testing.lua b/nvim/lua/plugins/testing.lua deleted file mode 100644 index 5713084..0000000 --- a/nvim/lua/plugins/testing.lua +++ /dev/null @@ -1,66 +0,0 @@ -return { - { - "nvim-neotest/neotest", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-treesitter/nvim-treesitter", - "nvim-neotest/neotest-vim-test", - "vim-test/vim-test", - "nvim-neotest/neotest-go", - "haydenmeade/neotest-jest", - "nvim-neotest/neotest-python", - }, - keys = { - { - "tn", - function() - require("neotest").run.run() - end, - desc = "Run nearest test", - }, - { - "tf", - function() - require("neotest").run.run(vim.fn.expand("%")) - require("neotest").summary.open() - end, - desc = "Run all tests in file", - }, - { - "ta", - function() - require("neotest").run.run(vim.fn.getcwd()) - require("neotest").summary.open() - end, - desc = "Run all tests in suite", - }, - }, - config = function() - local neotest = require("neotest") - - neotest.setup({ - icons = { - failed = "󰅚", - passed = "󰗡", - running = "󰐍", - unknown = "󰘥", - }, - adapters = { - require("neotest-go"), - require("neotest-jest"), - require("neotest-python"), - require("neotest-vim-test")({ - ignore_filetypes = { - "go", - "python", - }, - }), - }, - }) - - vim.keymap.set("n", "tu", function() - neotest.summary.toggle() - end, { desc = "Toggle testing UI" }) - end, - }, -} diff --git a/nvim/lua/plugins/tools.lua b/nvim/lua/plugins/tools.lua deleted file mode 100644 index 4e2a6eb..0000000 --- a/nvim/lua/plugins/tools.lua +++ /dev/null @@ -1,50 +0,0 @@ -local tools = require("config.tools") - -return { - { - "williamboman/mason.nvim", - build = ":MasonUpdate", - config = true, - }, - { - "williamboman/mason-lspconfig.nvim", - dependencies = { "williamboman/mason.nvim" }, - event = "VeryLazy", - opts = { - ensure_installed = tools.lsp, - }, - }, - { - "jay-babu/mason-null-ls.nvim", - dependencies = { "williamboman/mason.nvim" }, - event = { "BufReadPre", "BufNewFile" }, - config = function() - local mason_null_ls = require("mason-null-ls") - - local null_ls_tools = tools.linter - for _, f in pairs(tools.formatter) do - table.insert(null_ls_tools, f) - end - - mason_null_ls.setup({ - ensure_installed = null_ls_tools, - handlers = {}, - }) - end, - }, - { - "jay-babu/mason-nvim-dap.nvim", - dependencies = { "williamboman/mason.nvim" }, - event = { "BufReadPre", "BufNewFile" }, - opts = { - ensure_installed = tools.dap, - handlers = {}, - }, - }, - { - "RubixDev/mason-update-all", - dependencies = { "williamboman/mason.nvim" }, - cmd = { "MasonUpdateAll" }, - config = true, - }, -} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua deleted file mode 100644 index a3e503c..0000000 --- a/nvim/lua/plugins/treesitter.lua +++ /dev/null @@ -1,42 +0,0 @@ -return { - { - "nvim-treesitter/nvim-treesitter", - build = function() - pcall(require("nvim-treesitter.install").update({ with_sync = true })) - end, - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = "all", - highlight = { enable = true }, - }) - end, - }, - { - "nvim-treesitter/nvim-treesitter-textobjects", - dependencies = { - "nvim-treesitter/nvim-treesitter", - }, - event = "VeryLazy", - config = function() - require("nvim-treesitter.configs").setup({ - textobjects = { - select = { - enable = true, - keymaps = { - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["ac"] = "@class.outer", - ["ic"] = "@class.inner", - }, - }, - }, - }) - end, - }, - { - "nvim-treesitter/nvim-treesitter-context", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - event = "VeryLazy", - config = true, - }, -} diff --git a/vifm/colors/tokyonight.vifm b/vifm/colors/tokyonight.vifm deleted file mode 100644 index cdf4011..0000000 --- a/vifm/colors/tokyonight.vifm +++ /dev/null @@ -1,10 +0,0 @@ -highlight clear - -highlight Win cterm=none ctermfg=default ctermbg=none - -highlight TopLine cterm=none ctermfg=default ctermbg=black -highlight StatusLine cterm=bold ctermfg=default ctermbg=black -highlight Border cterm=none ctermfg=default ctermbg=black - -highlight Selected cterm=bold ctermfg=magenta ctermbg=default -highlight CurrLine cterm=bold ctermfg=236 ctermbg=magenta diff --git a/vifm/vifmrc b/vifm/vifmrc deleted file mode 100644 index 603c472..0000000 --- a/vifm/vifmrc +++ /dev/null @@ -1,20 +0,0 @@ -" Use Neovim -set vicmd=nvim - -" Show hidden files -set dotfiles - -" File preview -view -fileviewer *.png,*.jpg,*.jpeg,*.webp,*.svg chafa %c -fileviewer *.pdf pdftotext %c - -fileviewer *.zip unzip -l %c -fileviewer *.tar,*.tar.gz tar tf %c - -" Open files -filetype *.png,*.jpg,*.jpeg,*.webp,*.svg imv %c & -filetype *.mp3,*.mp4,*.mov,*.wav mpv --quiet %c & -filetype *.pdf zathura %c & - -" Set color scheme -colorscheme tokyonight From 59a2acdb8b63cb0bea29970aacc7b1bc63aa344a Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Sun, 16 Jul 2023 00:43:09 +0200 Subject: [PATCH 09/29] Nixify Sway setup --- flake.lock | 12 +- home.nix | 269 ++++++++++++++++++++++++++++++++--- sway/config | 16 +-- waybar/config.jsonc | 61 -------- waybar/scripts/containers.sh | 21 --- waybar/scripts/tasks.sh | 21 --- waybar/style.css | 65 --------- 7 files changed, 255 insertions(+), 210 deletions(-) delete mode 100644 waybar/config.jsonc delete mode 100755 waybar/scripts/containers.sh delete mode 100755 waybar/scripts/tasks.sh delete mode 100644 waybar/style.css diff --git a/flake.lock b/flake.lock index 04a06ad..601e028 100644 --- a/flake.lock +++ b/flake.lock @@ -84,11 +84,11 @@ ] }, "locked": { - "lastModified": 1689432596, - "narHash": "sha256-Vixn4nhjeHjGG3o6hDAnSZbXsYMYA5b39+NwAbUPpi0=", + "lastModified": 1689495077, + "narHash": "sha256-hmAqKvtDGlwNa41pZHP6mUoZq0yBnhkawcr8dxRzo6g=", "owner": "nix-community", "repo": "home-manager", - "rev": "346032240c15d8b6034847dc7a5f53312a5a57fc", + "rev": "232fe3d450dac73e55cf6fd2d73600c6cb82cd8b", "type": "github" }, "original": { @@ -123,11 +123,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1689282004, - "narHash": "sha256-VNhuyb10c9SV+3hZOlxwJwzEGytZ31gN9w4nPCnNvdI=", + "lastModified": 1689444953, + "narHash": "sha256-0o56bfb2LC38wrinPdCGLDScd77LVcr7CrH1zK7qvDg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e74e68449c385db82de3170288a28cd0f608544f", + "rev": "8acef304efe70152463a6399f73e636bcc363813", "type": "github" }, "original": { diff --git a/home.nix b/home.nix index a75c748..9b9595c 100644 --- a/home.nix +++ b/home.nix @@ -37,6 +37,7 @@ kubectx lato libreoffice-fresh + libwebp lldb lolcat lutris @@ -72,15 +73,12 @@ slurp stylua swaybg - swayidle - swaylock terraform terraform-ls tflint timewarrior tree vscode-langservers-extracted - waybar wf-recorder whois wine @@ -111,6 +109,207 @@ # Let Home Manager install and manage itself home-manager.enable = true; + # Window manager + # sway = { + # enable = true; + # modifier = "Mod4"; + # terminal = "alacritty"; + # colors.focused = { + # border = "#bb9af7"; + # text = "#c0caf5"; + # }; + # seat."*".hide_cursor = 8000; + # input = { + # "type:touchpad" = { + # tap = "enabled"; + # natural_scroll = "enabled"; + # }; + # "type:keyboard" = { + # xkb_options = "caps:escape,compose:ralt"; + # }; + # }; + # output."*".bg = "~/.local/share/wallpapers/bespinian.png fill"; + # }; + + # Status bar + waybar = { + enable = true; + settings = { + mainBar = { + modules-left = [ "sway/workspaces" "sway/mode" ]; + modules-center = [ "custom/tasks" ]; + modules-right = [ + "custom/containers" + "wireplumber" + "bluetooth" + "network" + "battery" + "clock" + ]; + battery = { + states = { + warning = 20; + critical = 1; + }; + format = "{icon}"; + format-icons = { + default = [ "󰁺" "󰁻" "󰁼" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; + charging = [ "󰢜" "󰂆" "󰂇" "󰂈" "󰢝" "󰂉" "󰢞" "󰂊" "󰂋" "󰂅" ]; + critical = [ "󱃍" ]; + }; + tooltip-format = "Battery at {capacity}%"; + }; + clock = { + format = "{:%a %d %b %H:%M}"; + tooltip-format = "{:%B %Y}\n\n{calendar}"; + }; + network = { + format-ethernet = "󰈀"; + format-wifi = "{icon}"; + format-linked = "󰈀"; + format-disconnected = "󰖪"; + format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; + tooltip-format-wifi = "{essid} at {signalStrength}%"; + }; + wireplumber = { + format = "{icon}"; + format-muted = "󰸈"; + format-icons = [ "󰕿" "󰖀" "󰕾" ]; + tooltip-format = "Volume at {volume}%"; + }; + bluetooth = { + format = ""; + format-on = "󰂯"; + format-connected = "󰂱"; + tooltip-format-on = "Bluetooth {status}"; + tooltip-format-connected = "Connected to {device_alias}"; + }; + "custom/tasks" = { + exec = pkgs.writeShellScript "waybar-tasks" '' + #!/bin/sh + + set -u + + if [ ! -x "$(command -v task)" ]; then + exit 1 + fi + + active_task=$(task rc.verbose=nothing rc.report.activedesc.filter=+ACTIVE rc.report.activedesc.columns:description rc.report.activedesc.sort:urgency- rc.report.activedesc.columns:description activedesc limit:1 | head -n 1) + if [ -n "$active_task" ]; then + echo "󰐌 $active_task" + exit 0 + fi + + ready_task=$(task rc.verbose=nothing rc.report.readydesc.filter=+READY rc.report.readydesc.columns:description rc.report.readydesc.sort:urgency- rc.report.readydesc.columns:description readydesc limit:1 | head -n 1) + if [ -z "$ready_task" ]; then + echo "" + exit 0 + fi + + echo "󰳟 $ready_task" + ''; + exec-if = "which task"; + interval = 6; + }; + "custom/containers" = { + exec = pkgs.writeShellScript "waybar-containers" '' + #!/bin/sh + + set -u + + if [ ! -x "$(command -v podman)" ]; then + exit 1 + fi + + running_container_count=$(podman ps --noheading | wc -l) + + if [ "$running_container_count" -eq 0 ]; then + echo "" + exit 0 + fi + + suffix="" + if [ "$running_container_count" -gt 1 ]; then + suffix = "s" + fi + + echo "{\"text\": \"󰡨\", \"tooltip\": \"$running_container_count container$suffix running\"}" + ''; + exec-if = "which podman"; + interval = 60; + return-type = "json"; + }; + }; + }; + style = '' + /* General */ + * { + border-radius: 0; + font-family: "FiraCode Nerd Font"; + font-size: 13px; + color: #c0caf5; + } + + window#waybar { + background-color: #1a1b26; + } + + tooltip { + background-color: #15161e; + } + + /* Workspaces */ + #workspaces button { + margin: 4px; + padding: 0 8px; + border-radius: 9999px; + } + + #workspaces button:hover { + border-color: transparent; + box-shadow: none; + background: #414868; + } + + #workspaces button.focused, + #workspaces button.active { + padding: 0 13px; + background: #2f334d; + } + + /* Modules */ + #clock, + #network, + #wireplumber, + #bluetooth, + #battery, + #custom-updates, + #custom-tasks, + #custom-containers, + #mode { + margin: 4px; + padding: 0 13px; + border-radius: 9999px; + background-color: #2f334d; + } + + #network { + padding: 0 15px 0 11px; + } + + #mode, + #custom-updates { + color: #bb9af7; + font-weight: bold; + } + + #battery.critical { + color: #f7768e; + font-weight: bold; + } + ''; + }; + # Git git = { enable = true; @@ -170,6 +369,7 @@ { name = "markdown"; formatter = { command = "prettier"; args = [ "--parser" "markdown" ]; }; } { name = "javascript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } { name = "typescript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } + { name = "svelte"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "svelte" ]; }; } { name = "go"; config = { formatting.gofumpt = true; }; } { name = "nix"; auto-format = true; formatter = { command = "nixpkgs-fmt"; }; } { name = "bash"; auto-format = true; formatter = { command = "shfmt"; args = [ "-i" "4" ]; }; } @@ -235,26 +435,26 @@ enable = true; style = '' #window { - font-family: "Fira Mono"; - background-color: #1a1b26; - color: #c0caf5; + font-family: "Fira Mono"; + background-color: #1a1b26; + color: #c0caf5; } #input { - border-radius: 0; - border-color: transparent; - padding: 5px; - background-color: #1a1b26; - color: #c0caf5; + border-radius: 0; + border-color: transparent; + padding: 5px; + background-color: #1a1b26; + color: #c0caf5; } #entry { - padding: 5px; + padding: 5px; } #entry:selected { - outline: none; - background-color: #bb9af7; + outline: none; + background-color: #bb9af7; } ''; }; @@ -267,11 +467,11 @@ customPaneNavigationAndResize = true; terminal = "tmux-256color"; extraConfig = '' - # Set correct terminal - set-option -sa terminal-features ',alacritty:RGB' + # Set correct terminal + set-option -sa terminal-features ',alacritty:RGB' - # Open new splits from current directory - bind '"' split-window -v -c '#{pane_current_path}' + # Open new splits from current directory + bind '"' split-window -v -c '#{pane_current_path}' bind % split-window -h -c '#{pane_current_path}' # Color scheme @@ -287,7 +487,7 @@ set-option -g status-right "" set-option -g status-left "" set-window-option -g window-status-format " #I: #W " - set-window-option -g window-status-current-format " #I: #W " + set-window-option -g window-status-current-format " #I: #W " ''; }; tmate.enable = true; @@ -348,12 +548,36 @@ updates.auto_update = true; }; }; + + # Lock screen manager + swaylock = { + enable = true; + settings = { + image = "~/.local/share/wallpapers/bespinian.png"; + }; + }; }; services = { # GPG gpg-agent.enable = true; + # Idle manager + swayidle = { + enable = true; + timeouts = [ + { timeout = 900; command = "swaylock -f"; } + { timeout = 1200; command = "swaymsg 'output * dpms off'"; } + { timeout = 1800; command = "systemctl suspend"; } + ]; + events = [ + { event = "lock"; command = "swaylock -f"; } + { event = "before-sleep"; command = "playerctl pause"; } + { event = "before-sleep"; command = "swaylock -f"; } + { event = "after-resume"; command = "swaymsg 'output * dpms on'"; } + ]; + }; + # Notification daemon mako = { enable = true; @@ -379,9 +603,12 @@ "gopass".source = ./gopass; "hypr".source = ./hyprland; "sway".source = ./sway; - "wallpapers".source = ./wallpapers; - "waybar".source = ./waybar; "workstyle".source = ./workstyle; "zsh".source = ./zsh; }; + + xdg.dataFile = { + "wallpapers".source = ./wallpapers; + }; } + diff --git a/sway/config b/sway/config index 0d9e15c..482cc0b 100644 --- a/sway/config +++ b/sway/config @@ -6,7 +6,7 @@ set $mod Mod4 # Colors set $foreground #c0caf5 set $highlight #bb9af7 -set $wallpaper ~/.config/wallpapers/bespinian.png +set $wallpaper ~/.local/share/wallpapers/bespinian.png set $lock_cmd swaylock --daemonize --image $wallpaper set $sleep_cmd systemctl suspend set $launcher_cmd wofi --show drun --no-actions --insensitive --prompt 'Run' | xargs swaymsg exec -- @@ -19,20 +19,6 @@ client.focused $highlight $highlight $foreground # Set wallpaper output * bg $wallpaper fill -### Idle - -# Lock the screen after 300 seconds of inactivity, then turn off -# all displays after another 300 seconds, and turn the screens back on when -# resumed. It will also lock the screen before the computer goes to sleep. -exec swayidle -w \ - timeout 900 '$lock_cmd' \ - timeout 1200 'swaymsg "output * dpms off"' \ - resume 'swaymsg "output * dpms on"' \ - timeout 1800 '$sleep_cmd' \ - before-sleep 'playerctl pause' \ - before-sleep '$lock_cmd' \ - lock '$lock_cmd' - # Inhibit idle if a window is in fullscreen for_window [shell=".*"] inhibit_idle fullscreen diff --git a/waybar/config.jsonc b/waybar/config.jsonc deleted file mode 100644 index 61d871c..0000000 --- a/waybar/config.jsonc +++ /dev/null @@ -1,61 +0,0 @@ -{ - "modules-left": ["sway/workspaces", "sway/mode"], - "modules-center": ["custom/tasks"], - "modules-right": [ - "custom/containers", - "wireplumber", - "bluetooth", - "network", - "battery", - "clock" - ], - "battery": { - "states": { - "warning": 20, - "critical": 10 - }, - "format": "{icon}", - "format-icons": { - "default": ["󰁺", "󰁻", "󰁼", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"], - "charging": ["󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"], - "critical": ["󱃍"] - }, - "tooltip-format": "Battery at {capacity}%" - }, - "clock": { - "format": "{:%a %d %b %H:%M}", - "tooltip-format": "{:%B %Y}\n\n{calendar}" - }, - "network": { - "format-ethernet": "󰈀", - "format-wifi": "{icon}", - "format-linked": "󰈀", - "format-disconnected": "󰖪", - "format-icons": ["󰤯", "󰤟", "󰤢", "󰤥", "󰤨"], - "tooltip-format-wifi": "{essid} at {signalStrength}%" - }, - "wireplumber": { - "format": "{icon}", - "format-muted": "󰸈", - "format-icons": ["󰕿", "󰖀", "󰕾"], - "tooltip-format": "Volume at {volume}%" - }, - "bluetooth": { - "format": "", - "format-on": "󰂯", - "format-connected": "󰂱", - "tooltip-format-on": "Bluetooth {status}", - "tooltip-format-connected": "Connected to {device_alias}" - }, - "custom/tasks": { - "exec": "~/.config/waybar/scripts/tasks.sh", - "exec-if": "which task", - "interval": 60 - }, - "custom/containers": { - "exec": "~/.config/waybar/scripts/containers.sh", - "exec-if": "which podman", - "interval": 60, - "return-type": "json" - } -} diff --git a/waybar/scripts/containers.sh b/waybar/scripts/containers.sh deleted file mode 100755 index 6feba73..0000000 --- a/waybar/scripts/containers.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -u - -if [ ! -x "$(command -v podman)" ]; then - exit 1 -fi - -running_container_count=$(podman ps --noheading | wc -l) - -if [ "$running_container_count" -eq 0 ]; then - echo '' - exit 0 -fi - -suffix="" -if [ "$running_container_count" -gt 1 ]; then - suffix="s" -fi - -echo "{\"text\": \"󰡨\", \"tooltip\": \"${running_container_count} container${suffix} running\"}" diff --git a/waybar/scripts/tasks.sh b/waybar/scripts/tasks.sh deleted file mode 100755 index 5fde618..0000000 --- a/waybar/scripts/tasks.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -u - -if [ ! -x "$(command -v task)" ]; then - exit 1 -fi - -active_task=$(task rc.verbose=nothing rc.report.activedesc.filter=+ACTIVE rc.report.activedesc.columns:description rc.report.activedesc.sort:urgency- rc.report.activedesc.columns:description activedesc limit:1 | head -n 1) -if [ -n "$active_task" ]; then - echo "󰐌 $active_task" - exit 0 -fi - -ready_task=$(task rc.verbose=nothing rc.report.readydesc.filter=+READY rc.report.readydesc.columns:description rc.report.readydesc.sort:urgency- rc.report.readydesc.columns:description readydesc limit:1 | head -n 1) -if [ -z "$ready_task" ]; then - echo "" - exit 0 -fi - -echo "󰳟 $ready_task" diff --git a/waybar/style.css b/waybar/style.css deleted file mode 100644 index cd67060..0000000 --- a/waybar/style.css +++ /dev/null @@ -1,65 +0,0 @@ -/* General */ -* { - border-radius: 0; - font-family: "FiraCode Nerd Font"; - font-size: 13px; - color: #c0caf5; -} - -window#waybar { - background-color: #1a1b26; -} - -tooltip { - background-color: #15161e; -} - -/* Workspaces */ -#workspaces button { - margin: 4px; - padding: 0 8px; - border-radius: 9999px; -} - -#workspaces button:hover { - border-color: transparent; - box-shadow: none; - background: #414868; -} - -#workspaces button.focused, -#workspaces button.active { - padding: 0 13px; - background: #2f334d; -} - -/* Modules */ -#clock, -#network, -#wireplumber, -#bluetooth, -#battery, -#custom-updates, -#custom-tasks, -#custom-containers, -#mode { - margin: 4px; - padding: 0 13px; - border-radius: 9999px; - background-color: #2f334d; -} - -#network { - padding: 0 15px 0 11px; -} - -#mode, -#custom-updates { - color: #bb9af7; - font-weight: bold; -} - -#battery.critical { - color: #f7768e; - font-weight: bold; -} From 54bb17f55ffb6183bdf3268a2bbb9030ecaaa37c Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:04:21 +0200 Subject: [PATCH 10/29] Switch to Hyprland --- Makefile | 11 + README.md | 4 +- flake.lock | 93 ++- flake.nix | 9 +- home.nix | 614 ------------------ home/default.nix | 20 + home/editor.nix | 65 ++ home/file-manager.nix | 24 + {gopass => home/gopass}/config | 0 {hyprland => home/hyprland}/hyprland.conf | 13 +- home/joshuto/preview_file.sh | 81 +++ home/terminal.nix | 138 ++++ home/tools.nix | 129 ++++ {wallpapers => home/wallpapers}/bespinian.png | Bin home/window-manager.nix | 288 ++++++++ {workstyle => home/workstyle}/config.toml | 0 home/zsh/functions.zsh | 93 +++ sway/config | 173 ----- configuration.nix => system/default.nix | 53 +- system/encryption.nix | 11 + .../hardware-configuration.nix | 0 system/secure-boot.nix | 11 + system/sound.nix | 7 + zsh/functions.zsh | 245 ------- 24 files changed, 983 insertions(+), 1099 deletions(-) create mode 100644 Makefile delete mode 100644 home.nix create mode 100644 home/default.nix create mode 100644 home/editor.nix create mode 100644 home/file-manager.nix rename {gopass => home/gopass}/config (100%) rename {hyprland => home/hyprland}/hyprland.conf (94%) create mode 100644 home/joshuto/preview_file.sh create mode 100644 home/terminal.nix create mode 100644 home/tools.nix rename {wallpapers => home/wallpapers}/bespinian.png (100%) create mode 100644 home/window-manager.nix rename {workstyle => home/workstyle}/config.toml (100%) create mode 100644 home/zsh/functions.zsh delete mode 100644 sway/config rename configuration.nix => system/default.nix (59%) create mode 100644 system/encryption.nix rename hardware-configuration.nix => system/hardware-configuration.nix (100%) create mode 100644 system/secure-boot.nix create mode 100644 system/sound.nix delete mode 100644 zsh/functions.zsh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7d7e42e --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +.PHONY: update +update: + nix flake update + +.PHONY: system +system: + sudo nixos-rebuild switch --flake . + +.PHONY: home +home: + home-manager switch --flake . \ No newline at end of file diff --git a/README.md b/README.md index 2d5d8ce..476e79e 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,5 @@ It uses [Flakes](https://nixos.wiki/wiki/Flakes) under the hood. ## Usage 1. Clone this repo -1. Run `sudo nixos-rebuild switch --flake .` -1. Run `home-manager switch --flake .` +1. Run `make system` +1. Run `make home` diff --git a/flake.lock b/flake.lock index 601e028..2ba5ade 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,38 @@ { "nodes": { + "crane": { + "inputs": { + "flake-compat": [ + "lanzaboote", + "flake-compat" + ], + "flake-utils": [ + "lanzaboote", + "flake-utils" + ], + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ], + "rust-overlay": [ + "lanzaboote", + "rust-overlay" + ] + }, + "locked": { + "lastModified": 1681177078, + "narHash": "sha256-ZNIjBDou2GOabcpctiQykEQVkI8BDwk7TyvlWlI4myE=", + "owner": "ipetkov", + "repo": "crane", + "rev": "0c9f468ff00576577d83f5019a66c557ede5acf6", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -24,11 +57,11 @@ ] }, "locked": { - "lastModified": 1683560683, - "narHash": "sha256-XAygPMN5Xnk/W2c1aW0jyEa6lfMDZWlQgiNtmHXytPc=", + "lastModified": 1680392223, + "narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "006c75898cf814ef9497252b022e91c946ba8e17", + "rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5", "type": "github" }, "original": { @@ -84,11 +117,11 @@ ] }, "locked": { - "lastModified": 1689495077, - "narHash": "sha256-hmAqKvtDGlwNa41pZHP6mUoZq0yBnhkawcr8dxRzo6g=", + "lastModified": 1689891262, + "narHash": "sha256-Pc4wDczbdgd6QXKJIXprgxe7L9AVDsoAkMnvm5vmpUU=", "owner": "nix-community", "repo": "home-manager", - "rev": "232fe3d450dac73e55cf6fd2d73600c6cb82cd8b", + "rev": "ee5673246de0254186e469935909e821b8f4ec15", "type": "github" }, "original": { @@ -99,35 +132,38 @@ }, "lanzaboote": { "inputs": { + "crane": "crane", "flake-compat": "flake-compat", "flake-parts": "flake-parts", "flake-utils": "flake-utils", "nixpkgs": [ "nixpkgs" ], - "pre-commit-hooks-nix": "pre-commit-hooks-nix" + "pre-commit-hooks-nix": "pre-commit-hooks-nix", + "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1687124707, - "narHash": "sha256-BEC2y7zwDI/Saeupr9rijLvwb0OoqTD9vntlcyciyrM=", + "lastModified": 1682802423, + "narHash": "sha256-Fb5TeRTdvUlo/5Yi2d+FC8a6KoRLk2h1VE0/peMhWPs=", "owner": "nix-community", "repo": "lanzaboote", - "rev": "c758cdad465e0c8174db57dc493f51a89f0e3372", + "rev": "64b903ca87d18cef2752c19c098af275c6e51d63", "type": "github" }, "original": { "owner": "nix-community", + "ref": "v0.3.0", "repo": "lanzaboote", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1689444953, - "narHash": "sha256-0o56bfb2LC38wrinPdCGLDScd77LVcr7CrH1zK7qvDg=", + "lastModified": 1689850295, + "narHash": "sha256-fUYf6WdQlhd2H+3aR8jST5dhFH1d0eE22aes8fNIfyk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8acef304efe70152463a6399f73e636bcc363813", + "rev": "5df4d78d54f7a34e9ea1f84a22b4fd9baebc68d0", "type": "github" }, "original": { @@ -171,11 +207,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1684842236, - "narHash": "sha256-rYWsIXHvNhVQ15RQlBUv67W3YnM+Pd+DuXGMvCBq2IE=", + "lastModified": 1681413034, + "narHash": "sha256-/t7OjNQcNkeWeSq/CFLYVBfm+IEnkjoSm9iKvArnUUI=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "61e567d6497bc9556f391faebe5e410e6623217f", + "rev": "d3de8f69ca88fb6f8b09e5b598be5ac98d28ede5", "type": "github" }, "original": { @@ -191,6 +227,31 @@ "nixpkgs": "nixpkgs" } }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "lanzaboote", + "flake-utils" + ], + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682129965, + "narHash": "sha256-1KRPIorEL6pLpJR04FwAqqnt4Tzcm4MqD84yhlD+XSk=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "2c417c0460b788328220120c698630947547ee83", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 85c1a5b..815dee0 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,7 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; lanzaboote = { - url = "github:nix-community/lanzaboote"; + url = "github:nix-community/lanzaboote/v0.3.0"; inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { @@ -18,18 +18,19 @@ system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; - in { + in + { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { inherit system; modules = [ lanzaboote.nixosModules.lanzaboote - ./configuration.nix + ./system ]; }; homeConfigurations.lena = home-manager.lib.homeManagerConfiguration { inherit pkgs; - modules = [ ./home.nix ]; + modules = [ ./home ]; }; }; } diff --git a/home.nix b/home.nix deleted file mode 100644 index 9b9595c..0000000 --- a/home.nix +++ /dev/null @@ -1,614 +0,0 @@ -{ config, pkgs, ... }: - -{ - home.username = "lena"; - home.homeDirectory = "/home/lena"; - - home.packages = with pkgs; [ - altair - autotiling-rs - awscli2 - black - brave - brightnessctl - cargo - chafa - chromium - clipman - delve - diff-so-fancy - dig - fd - file - fira-mono - fx - gh - gimp - golangci-lint - gopass - gopls - grim - gron - hugo - inkscape - jpegoptim - kanshi - kubectl - kubectx - lato - libreoffice-fresh - libwebp - lldb - lolcat - lutris - moq - ncdu - (nerdfonts.override { fonts = [ "FiraCode" ]; }) - nil - nixpkgs-fmt - nmap - nodejs - nodePackages.bash-language-server - nodePackages.prettier - nodePackages.svelte-language-server - nodePackages.svgo - nodePackages.typescript-language-server - nodePackages.yaml-language-server - noto-fonts-cjk - noto-fonts-emoji - optipng - playerctl - poetry - protobuf - pwgen - python3 - python311Packages.python-lsp-server - quickemu - realvnc-vnc-viewer - rust-analyzer - rustc - shellcheck - shfmt - signal-desktop - slurp - stylua - swaybg - terraform - terraform-ls - tflint - timewarrior - tree - vscode-langservers-extracted - wf-recorder - whois - wine - wl-clipboard - workstyle - ]; - - home.sessionVariables = { - TERMINAL = "alacritty"; - BROWSER = "brave"; - }; - - home.shellAliases = { - e = "$EDITOR"; - f = "joshuto"; - g = "gitui"; - t = "task"; - ".." = "cd .."; - "..." = "cd ../.."; - }; - - home.stateVersion = "23.05"; - - nixpkgs.config.allowUnfree = true; - nixpkgs.config.allowUnfreePredicate = pkg: true; - - programs = { - # Let Home Manager install and manage itself - home-manager.enable = true; - - # Window manager - # sway = { - # enable = true; - # modifier = "Mod4"; - # terminal = "alacritty"; - # colors.focused = { - # border = "#bb9af7"; - # text = "#c0caf5"; - # }; - # seat."*".hide_cursor = 8000; - # input = { - # "type:touchpad" = { - # tap = "enabled"; - # natural_scroll = "enabled"; - # }; - # "type:keyboard" = { - # xkb_options = "caps:escape,compose:ralt"; - # }; - # }; - # output."*".bg = "~/.local/share/wallpapers/bespinian.png fill"; - # }; - - # Status bar - waybar = { - enable = true; - settings = { - mainBar = { - modules-left = [ "sway/workspaces" "sway/mode" ]; - modules-center = [ "custom/tasks" ]; - modules-right = [ - "custom/containers" - "wireplumber" - "bluetooth" - "network" - "battery" - "clock" - ]; - battery = { - states = { - warning = 20; - critical = 1; - }; - format = "{icon}"; - format-icons = { - default = [ "󰁺" "󰁻" "󰁼" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; - charging = [ "󰢜" "󰂆" "󰂇" "󰂈" "󰢝" "󰂉" "󰢞" "󰂊" "󰂋" "󰂅" ]; - critical = [ "󱃍" ]; - }; - tooltip-format = "Battery at {capacity}%"; - }; - clock = { - format = "{:%a %d %b %H:%M}"; - tooltip-format = "{:%B %Y}\n\n{calendar}"; - }; - network = { - format-ethernet = "󰈀"; - format-wifi = "{icon}"; - format-linked = "󰈀"; - format-disconnected = "󰖪"; - format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; - tooltip-format-wifi = "{essid} at {signalStrength}%"; - }; - wireplumber = { - format = "{icon}"; - format-muted = "󰸈"; - format-icons = [ "󰕿" "󰖀" "󰕾" ]; - tooltip-format = "Volume at {volume}%"; - }; - bluetooth = { - format = ""; - format-on = "󰂯"; - format-connected = "󰂱"; - tooltip-format-on = "Bluetooth {status}"; - tooltip-format-connected = "Connected to {device_alias}"; - }; - "custom/tasks" = { - exec = pkgs.writeShellScript "waybar-tasks" '' - #!/bin/sh - - set -u - - if [ ! -x "$(command -v task)" ]; then - exit 1 - fi - - active_task=$(task rc.verbose=nothing rc.report.activedesc.filter=+ACTIVE rc.report.activedesc.columns:description rc.report.activedesc.sort:urgency- rc.report.activedesc.columns:description activedesc limit:1 | head -n 1) - if [ -n "$active_task" ]; then - echo "󰐌 $active_task" - exit 0 - fi - - ready_task=$(task rc.verbose=nothing rc.report.readydesc.filter=+READY rc.report.readydesc.columns:description rc.report.readydesc.sort:urgency- rc.report.readydesc.columns:description readydesc limit:1 | head -n 1) - if [ -z "$ready_task" ]; then - echo "" - exit 0 - fi - - echo "󰳟 $ready_task" - ''; - exec-if = "which task"; - interval = 6; - }; - "custom/containers" = { - exec = pkgs.writeShellScript "waybar-containers" '' - #!/bin/sh - - set -u - - if [ ! -x "$(command -v podman)" ]; then - exit 1 - fi - - running_container_count=$(podman ps --noheading | wc -l) - - if [ "$running_container_count" -eq 0 ]; then - echo "" - exit 0 - fi - - suffix="" - if [ "$running_container_count" -gt 1 ]; then - suffix = "s" - fi - - echo "{\"text\": \"󰡨\", \"tooltip\": \"$running_container_count container$suffix running\"}" - ''; - exec-if = "which podman"; - interval = 60; - return-type = "json"; - }; - }; - }; - style = '' - /* General */ - * { - border-radius: 0; - font-family: "FiraCode Nerd Font"; - font-size: 13px; - color: #c0caf5; - } - - window#waybar { - background-color: #1a1b26; - } - - tooltip { - background-color: #15161e; - } - - /* Workspaces */ - #workspaces button { - margin: 4px; - padding: 0 8px; - border-radius: 9999px; - } - - #workspaces button:hover { - border-color: transparent; - box-shadow: none; - background: #414868; - } - - #workspaces button.focused, - #workspaces button.active { - padding: 0 13px; - background: #2f334d; - } - - /* Modules */ - #clock, - #network, - #wireplumber, - #bluetooth, - #battery, - #custom-updates, - #custom-tasks, - #custom-containers, - #mode { - margin: 4px; - padding: 0 13px; - border-radius: 9999px; - background-color: #2f334d; - } - - #network { - padding: 0 15px 0 11px; - } - - #mode, - #custom-updates { - color: #bb9af7; - font-weight: bold; - } - - #battery.critical { - color: #f7768e; - font-weight: bold; - } - ''; - }; - - # Git - git = { - enable = true; - userName = "Lena Fuhrimann"; - userEmail = "6780471+cloudlena@users.noreply.github.com"; - signing = { - key = null; - signByDefault = true; - }; - diff-so-fancy.enable = true; - }; - gitui.enable = true; - - # File manager - joshuto.enable = true; - - # GPG - gpg.enable = true; - - # Fuzzy finder - fzf.enable = true; - - # Fast grepping - ripgrep.enable = true; - - # Quick navigation - zoxide.enable = true; - - # Password manager - browserpass.enable = true; - - # JSON parser - jq.enable = true; - - # PDF viewer - zathura.enable = true; - - # Text editor - helix = { - enable = true; - defaultEditor = true; - settings = { - theme = "tokyonight"; - editor = { - line-number = "relative"; - mouse = false; - cursor-shape.insert = "bar"; - file-picker.hidden = false; - }; - }; - languages = { - language = [ - { name = "html"; formatter = { command = "prettier"; args = [ "--parser" "html" ]; }; } - { name = "json"; formatter = { command = "prettier"; args = [ "--parser" "json" ]; }; } - { name = "css"; formatter = { command = "prettier"; args = [ "--parser" "css" ]; }; } - { name = "yaml"; formatter = { command = "prettier"; args = [ "--parser" "yaml" ]; }; } - { name = "markdown"; formatter = { command = "prettier"; args = [ "--parser" "markdown" ]; }; } - { name = "javascript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } - { name = "typescript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } - { name = "svelte"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "svelte" ]; }; } - { name = "go"; config = { formatting.gofumpt = true; }; } - { name = "nix"; auto-format = true; formatter = { command = "nixpkgs-fmt"; }; } - { name = "bash"; auto-format = true; formatter = { command = "shfmt"; args = [ "-i" "4" ]; }; } - ]; - }; - }; - - # Task management - taskwarrior = { - enable = true; - config = { - taskd = { - certificate = "~/.config/task/private.certificate.pem"; - key = "~/.config/task/private.key.pem"; - ca = "~/.config/task/ca.cert.pem"; - server = "inthe.am:53589"; - credentials = "inthe_am/lena/c214a5a3-b0b2-4132-958c-ebef8d83fd25"; - trust = "strict"; - }; - }; - }; - - # Media player - mpv.enable = true; - - # Image viewer - imv.enable = true; - - # Go - go = { - enable = true; - goPath = ".local/share/go"; - }; - - # Shell - zsh = { - enable = true; - enableAutosuggestions = true; - syntaxHighlighting.enable = true; - defaultKeymap = "viins"; - historySubstringSearch = { - enable = true; - searchDownKey = "^N"; - searchUpKey = "^P"; - }; - initExtra = '' - source ~/.config/zsh/* - [[ -z "$TMUX" && $(tty) != /dev/tty[0-9] ]] && { tmux || exec tmux new-session && exit } - ''; - }; - - # Shell prompt - starship = { - enable = true; - settings = { - add_newline = false; - format = "$jobs$directory$git_branch$git_state$git_status$character"; - }; - }; - - # Launcher - wofi = { - enable = true; - style = '' - #window { - font-family: "Fira Mono"; - background-color: #1a1b26; - color: #c0caf5; - } - - #input { - border-radius: 0; - border-color: transparent; - padding: 5px; - background-color: #1a1b26; - color: #c0caf5; - } - - #entry { - padding: 5px; - } - - #entry:selected { - outline: none; - background-color: #bb9af7; - } - ''; - }; - - # Terminal multiplexer - tmux = { - enable = true; - keyMode = "vi"; - escapeTime = 10; - customPaneNavigationAndResize = true; - terminal = "tmux-256color"; - extraConfig = '' - # Set correct terminal - set-option -sa terminal-features ',alacritty:RGB' - - # Open new splits from current directory - bind '"' split-window -v -c '#{pane_current_path}' - bind % split-window -h -c '#{pane_current_path}' - - # Color scheme - set-option -g status-style 'fg=#414868' - set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' - set-option -g mode-style 'fg=#7aa2f7,bg=#3b4261' - set-option -g message-style 'fg=#7aa2f7,bg=#3b4261' - set-option -g pane-border-style 'fg=#3b4261' - set-option -g pane-active-border-style 'fg=#3b4261' - set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' - - # Unclutter status bar - set-option -g status-right "" - set-option -g status-left "" - set-window-option -g window-status-format " #I: #W " - set-window-option -g window-status-current-format " #I: #W " - ''; - }; - tmate.enable = true; - - # Terminal emulator - alacritty = { - enable = true; - settings = { - window = { - padding = { - x = 5; - y = 5; - }; - decorations = "none"; - startup_mode = "Maximized"; - }; - font = { - normal.family = "FiraCode Nerd Font"; - size = 12; - }; - colors = { - primary = { - background = "#1a1b26"; - foreground = "#c0caf5"; - }; - normal = { - black = "#15161e"; - red = "#f7768e"; - green = "#9ece6a"; - yellow = "#e0af68"; - blue = "#7aa2f7"; - magenta = "#bb9af7"; - cyan = "#7dcfff"; - white = "#a9b1d6"; - }; - bright = { - black = "#414868"; - red = "#f7768e"; - green = "#9ece6a"; - yellow = "#e0af68"; - blue = "#7aa2f7"; - magenta = "#bb9af7"; - cyan = "#7dcfff"; - white = "#c0caf5"; - }; - indexed_colors = [ - { index = 16; color = "#ff9e64"; } - { index = 17; color = "#db4b4b"; } - ]; - }; - }; - }; - - # Simplified manuals - tealdeer = { - enable = true; - settings = { - updates.auto_update = true; - }; - }; - - # Lock screen manager - swaylock = { - enable = true; - settings = { - image = "~/.local/share/wallpapers/bespinian.png"; - }; - }; - }; - - services = { - # GPG - gpg-agent.enable = true; - - # Idle manager - swayidle = { - enable = true; - timeouts = [ - { timeout = 900; command = "swaylock -f"; } - { timeout = 1200; command = "swaymsg 'output * dpms off'"; } - { timeout = 1800; command = "systemctl suspend"; } - ]; - events = [ - { event = "lock"; command = "swaylock -f"; } - { event = "before-sleep"; command = "playerctl pause"; } - { event = "before-sleep"; command = "swaylock -f"; } - { event = "after-resume"; command = "swaymsg 'output * dpms on'"; } - ]; - }; - - # Notification daemon - mako = { - enable = true; - font = "Fira Mono 9"; - backgroundColor = "#1a1b26"; - textColor = "#c0caf5"; - borderColor = "#bb9af7"; - defaultTimeout = 8000; - groupBy = "app-name,summary"; - }; - - # Adjust color temperature to reduce eye strain - gammastep = { - enable = true; - provider = "geoclue2"; - }; - - # Battery signal daemon - batsignal.enable = true; - }; - - xdg.configFile = { - "gopass".source = ./gopass; - "hypr".source = ./hyprland; - "sway".source = ./sway; - "workstyle".source = ./workstyle; - "zsh".source = ./zsh; - }; - - xdg.dataFile = { - "wallpapers".source = ./wallpapers; - }; -} - diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..c4e0f29 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,20 @@ +{ + nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowUnfreePredicate = pkg: true; + + home.username = "lena"; + home.homeDirectory = "/home/lena"; + + home.stateVersion = "23.05"; + + # Let Home Manager install and manage itself + programs.home-manager.enable = true; + + imports = [ + ./window-manager.nix + ./terminal.nix + ./editor.nix + ./file-manager.nix + ./tools.nix + ]; +} diff --git a/home/editor.nix b/home/editor.nix new file mode 100644 index 0000000..1dfb08c --- /dev/null +++ b/home/editor.nix @@ -0,0 +1,65 @@ +{ pkgs, ... }: + +{ + programs.helix = { + enable = true; + defaultEditor = true; + settings = { + theme = "tokyonight"; + editor = { + line-number = "relative"; + soft-wrap.enable = true; + cursor-shape.insert = "bar"; + file-picker.hidden = false; + }; + }; + languages = { + language = [ + { name = "bash"; auto-format = true; formatter = { command = "shfmt"; }; } + { name = "css"; formatter = { command = "prettier"; args = [ "--parser" "css" ]; }; } + { name = "go"; config = { formatting.gofumpt = true; }; } + { name = "html"; formatter = { command = "prettier"; args = [ "--parser" "html" ]; }; } + { name = "javascript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } + { name = "json"; formatter = { command = "prettier"; args = [ "--parser" "json" ]; }; } + { name = "markdown"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "markdown" ]; }; } + { name = "nix"; auto-format = true; formatter = { command = "nixpkgs-fmt"; }; } + { name = "python"; auto-format = true; formatter = { command = "black"; args = [ "--quiet" "-" ]; }; } + { name = "svelte"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "svelte" ]; }; } + { name = "typescript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } + { name = "yaml"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "yaml" ]; }; } + ]; + }; + }; + + home.packages = with pkgs; [ + # Language servers + cmake-language-server + gopls + marksman + nil + nodePackages.bash-language-server + nodePackages.dockerfile-language-server-nodejs + nodePackages.svelte-language-server + nodePackages.typescript-language-server + nodePackages.yaml-language-server + python311Packages.python-lsp-server + rust-analyzer + terraform-ls + vscode-langservers-extracted + + # Debuggers + delve + lldb + + # Linters + golangci-lint + shellcheck + tflint + + # Formatters + black + nixpkgs-fmt + nodePackages.prettier + shfmt + ]; +} diff --git a/home/file-manager.nix b/home/file-manager.nix new file mode 100644 index 0000000..78c6aa8 --- /dev/null +++ b/home/file-manager.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: + +{ + programs.joshuto = { + enable = true; + settings = { + preview.preview_script = "~/.config/joshuto/preview_file.sh"; + }; + }; + + home.packages = with pkgs; [ + # File previewers + chafa + file + poppler_utils + ]; + + xdg.configFile = { + "joshuto/preview_file.sh" = { + source = ./joshuto/preview_file.sh; + executable = true; + }; + }; +} diff --git a/gopass/config b/home/gopass/config similarity index 100% rename from gopass/config rename to home/gopass/config diff --git a/hyprland/hyprland.conf b/home/hyprland/hyprland.conf similarity index 94% rename from hyprland/hyprland.conf rename to home/hyprland/hyprland.conf index 7126a2a..f7cd28d 100644 --- a/hyprland/hyprland.conf +++ b/home/hyprland/hyprland.conf @@ -2,8 +2,8 @@ $mainMod = SUPER $colorActive = rgb(bb9af7) -$wallpaper = ~/.config/wallpapers/bespinian.png -$lockCmd = swaylock --daemonize --image $wallpaper +$wallpaper = ~/.local/share/wallpapers/bespinian.png +$lockCmd = swaylock --daemonize $sleepCmd = systemctl suspend $launcherCmd = wofi --show drun --no-actions --insensitive --prompt 'Run' @@ -47,13 +47,12 @@ dwindle { monitor = eDP-1, preferred, auto, 1.5 # Run helper programs -exec-once = workstyle &> /tmp/workstyle.log exec-once = waybar -exec-once = mako exec-once = gammastep -exec-once = swaybg --mode fill --image $wallpaper -exec-once = wl-paste --type text --watch clipman store exec-once = swayidle -w timeout 900 '$lockCmd' timeout 1200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' timeout 1800 '$sleepCmd' before-sleep 'playerctl pause' before-sleep '$lockCmd' lock '$lockCmd' +exec-once = workstyle &> /tmp/workstyle.log +exec-once = swaybg --image $wallpaper --mode fill +exec-once = wl-paste --type text --watch clipman store ### Binds @@ -64,7 +63,7 @@ bind = $mainMod, F, fullscreen # Shortcuts bind = $mainMod, Space, exec, $launcherCmd -bind = $mainMod, Return, exec, alacritty +bind = $mainMod, Return, exec, $TERMINAL bind = $mainMod, W, exec, brave bind = $mainMod, V, exec, clipman pick --tool wofi bind = SUPER_CTRL, Q, exec, $lockCmd diff --git a/home/joshuto/preview_file.sh b/home/joshuto/preview_file.sh new file mode 100644 index 0000000..e5634e5 --- /dev/null +++ b/home/joshuto/preview_file.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +IFS=$'\n' + +# Security measures: +# * noclobber prevents you from overwriting a file with `>` +# * noglob prevents expansion of wild cards +# * nounset causes bash to fail if an undeclared variable is used (e.g. typos) +# * pipefail causes a pipeline to fail also if a command other than the last one fails +set -o noclobber -o noglob -o nounset -o pipefail + +file_path="" +preview_width=10 +preview_height=10 + +while [ "$#" -gt 0 ]; do + case "$1" in + "--path") + shift + file_path="$1" + ;; + "--preview-width") + shift + preview_width="$1" + ;; + "--preview-height") + shift + preview_height="$1" + ;; + esac + shift +done + +handle_extension() { + case "${file_extension_lower}" in + ## Archive + zip) + ## Avoid password prompt by providing empty password + unzip -l "${file_path}" && exit 0 + exit 1 + ;; + + ## PDF + pdf) + ## Preview as text conversion + pdftotext -l 10 -nopgbrk -q -- "${file_path}" - | + fmt -w "${preview_width}" && exit 0 + exit 1 + ;; + esac +} + +handle_mime() { + local mimetype="${1}" + + case "${mimetype}" in + ## Text + text/* | */xml | */json | */yaml) + bat --color=always --paging=never \ + --style=plain \ + --terminal-width="${preview_width}" \ + "${file_path}" && exit 0 + cat "${file_path}" && exit 0 + exit 1 + ;; + + ## Image + image/*) + chafa "${file_path}" && exit 0 + exit 1 + ;; + esac +} + +file_extension="${file_path##*.}" +file_extension_lower="$(printf "%s" "${file_extension}" | tr '[:upper:]' '[:lower:]')" +handle_extension +mimetype="$(file --dereference --brief --mime-type -- "${file_path}")" +handle_mime "${mimetype}" + +exit 1 diff --git a/home/terminal.nix b/home/terminal.nix new file mode 100644 index 0000000..85a7599 --- /dev/null +++ b/home/terminal.nix @@ -0,0 +1,138 @@ +{ + home.sessionVariables = { + TERMINAL = "alacritty"; + BROWSER = "brave"; + }; + + home.shellAliases = { + e = "$EDITOR"; + f = "joshuto"; + g = "gitui"; + t = "task"; + ".." = "cd .."; + "..." = "cd ../.."; + }; + + programs = { + # Terminal emulator + alacritty = { + enable = true; + settings = { + window = { + padding = { + x = 5; + y = 5; + }; + decorations = "none"; + startup_mode = "Maximized"; + }; + font = { + normal.family = "FiraCode Nerd Font"; + size = 12; + }; + colors = { + primary = { + background = "#1a1b26"; + foreground = "#c0caf5"; + }; + normal = { + black = "#15161e"; + red = "#f7768e"; + green = "#9ece6a"; + yellow = "#e0af68"; + blue = "#7aa2f7"; + magenta = "#bb9af7"; + cyan = "#7dcfff"; + white = "#a9b1d6"; + }; + bright = { + black = "#414868"; + red = "#f7768e"; + green = "#9ece6a"; + yellow = "#e0af68"; + blue = "#7aa2f7"; + magenta = "#bb9af7"; + cyan = "#7dcfff"; + white = "#c0caf5"; + }; + indexed_colors = [ + { index = 16; color = "#ff9e64"; } + { index = 17; color = "#db4b4b"; } + ]; + }; + }; + }; + + # Terminal multiplexer + tmux = { + enable = true; + keyMode = "vi"; + escapeTime = 10; + customPaneNavigationAndResize = true; + terminal = "tmux-256color"; + extraConfig = '' + # Set correct terminal + set-option -sa terminal-features ',alacritty:RGB' + + # Open new splits from current directory + bind '"' split-window -v -c '#{pane_current_path}' + bind % split-window -h -c '#{pane_current_path}' + + # Color scheme + set-option -g status-style 'fg=#414868' + set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' + set-option -g mode-style 'fg=#7aa2f7,bg=#3b4261' + set-option -g message-style 'fg=#7aa2f7,bg=#3b4261' + set-option -g pane-border-style 'fg=#3b4261' + set-option -g pane-active-border-style 'fg=#3b4261' + set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' + + # Unclutter status bar + set-option -g status-right "" + set-option -g status-left "" + set-window-option -g window-status-format " #I: #W " + set-window-option -g window-status-current-format " #I: #W " + ''; + }; + tmate.enable = true; + + # Shell + zsh = { + enable = true; + enableAutosuggestions = true; + syntaxHighlighting.enable = true; + defaultKeymap = "viins"; + historySubstringSearch = { + enable = true; + searchDownKey = "^N"; + searchUpKey = "^P"; + }; + initExtra = '' + source ~/.config/zsh/* + [[ -z "$TMUX" && $(tty) != /dev/tty[0-9] ]] && { tmux || exec tmux new-session && exit } + ''; + loginExtra = '' + # Start window manager + if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then + exec Hyprland + fi + ''; + }; + + # Shell prompt + starship = { + enable = true; + settings = { + add_newline = false; + aws.disabled = true; + cmd_duration.disabled = true; + package.disabled = true; + }; + }; + }; + + # Helper functions + xdg.configFile = { + "zsh/functions.zsh".source = ./zsh/functions.zsh; + }; +} diff --git a/home/tools.nix b/home/tools.nix new file mode 100644 index 0000000..cbb9e8a --- /dev/null +++ b/home/tools.nix @@ -0,0 +1,129 @@ +{ pkgs, ... }: + +{ + programs = { + # Git + git = { + enable = true; + userName = "Lena Fuhrimann"; + userEmail = "6780471+cloudlena@users.noreply.github.com"; + signing = { + key = null; + signByDefault = true; + }; + diff-so-fancy.enable = true; + }; + gitui.enable = true; + + # Encryption + gpg.enable = true; + + # Fuzzy finder + fzf.enable = true; + + # Fast grepping + ripgrep.enable = true; + + # Quick navigation + zoxide.enable = true; + + # Password manager + browserpass.enable = true; + + # JSON parser + jq.enable = true; + + # PDF viewer + zathura.enable = true; + + # Task management + taskwarrior = { + enable = true; + config = { + taskd = { + certificate = "~/.config/task/private.certificate.pem"; + key = "~/.config/task/private.key.pem"; + ca = "~/.config/task/ca.cert.pem"; + server = "inthe.am:53589"; + credentials = "inthe_am/lena/c214a5a3-b0b2-4132-958c-ebef8d83fd25"; + trust = "strict"; + }; + }; + }; + + # Media player + mpv.enable = true; + + # Image viewer + imv.enable = true; + + # Go + go = { + enable = true; + goPath = ".local/share/go"; + }; + + # Simplified manuals + tealdeer = { + enable = true; + settings = { + updates.auto_update = true; + }; + }; + }; + + services = { + # GPG + gpg-agent.enable = true; + }; + + home.packages = with pkgs; [ + altair + awscli2 + brave + cargo + chromium + diff-so-fancy + dig + fd + fx + gh + gimp + gopass + hugo + inkscape + jpegoptim + kubectl + kubectx + libreoffice-fresh + libwebp + lolcat + lutris + moq + ncdu + nmap + nodejs + nodePackages.svgo + optipng + poetry + pwgen + python3 + quickemu + realvnc-vnc-viewer + rustc + signal-desktop + termshark + terraform + timewarrior + tree + via + whois + wine + wl-clipboard + yq + ]; + + xdg.configFile = { + "gopass/config".source = ./gopass/config; + }; +} diff --git a/wallpapers/bespinian.png b/home/wallpapers/bespinian.png similarity index 100% rename from wallpapers/bespinian.png rename to home/wallpapers/bespinian.png diff --git a/home/window-manager.nix b/home/window-manager.nix new file mode 100644 index 0000000..4371207 --- /dev/null +++ b/home/window-manager.nix @@ -0,0 +1,288 @@ +{ pkgs, ... }: + +{ + # Window manager + xdg.configFile = { + "hypr/hyprland.conf".source = ./hyprland/hyprland.conf; + }; + + programs = { + # Status bar + waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + modules-left = [ "hyprland/workspaces" ]; + modules-center = [ "custom/tasks" ]; + modules-right = [ + "custom/updates" + "custom/containers" + "wireplumber" + "bluetooth" + "network" + "battery" + "clock" + ]; + battery = { + states = { + warning = 20; + critical = 1; + }; + format = "{icon}"; + format-icons = { + default = [ "󰁺" "󰁻" "󰁼" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; + charging = [ "󰢜" "󰂆" "󰂇" "󰂈" "󰢝" "󰂉" "󰢞" "󰂊" "󰂋" "󰂅" ]; + critical = [ "󱃍" ]; + }; + tooltip-format = "Battery at {capacity}%"; + }; + clock = { + format = "{:%a %d %b %H:%M}"; + tooltip-format = "{:%B %Y}\n\n{calendar}"; + }; + network = { + format-ethernet = "󰈀"; + format-wifi = "{icon}"; + format-linked = "󰈀"; + format-disconnected = "󰖪"; + format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; + tooltip-format-wifi = "{essid} at {signalStrength}%"; + }; + wireplumber = { + format = "{icon}"; + format-muted = "󰸈"; + format-icons = [ "󰕿" "󰖀" "󰕾" ]; + tooltip-format = "Volume at {volume}%"; + }; + bluetooth = { + format = ""; + format-on = "󰂯"; + format-connected = "󰂱"; + tooltip-format-on = "Bluetooth {status}"; + tooltip-format-connected = "Connected to {device_alias}"; + }; + "custom/tasks" = { + exec = pkgs.writeShellScript "waybar-tasks" '' + set -u + + if [ ! -x "$(command -v task)" ]; then + exit 1 + fi + + active_task=$(task rc.verbose=nothing rc.report.activedesc.filter=+ACTIVE rc.report.activedesc.columns:description rc.report.activedesc.sort:urgency- rc.report.activedesc.columns:description activedesc limit:1 | head -n 1) + if [ -n "$active_task" ]; then + echo "󰐌 $active_task" + exit 0 + fi + + ready_task=$(task rc.verbose=nothing rc.report.readydesc.filter=+READY rc.report.readydesc.columns:description rc.report.readydesc.sort:urgency- rc.report.readydesc.columns:description readydesc limit:1 | head -n 1) + if [ -z "$ready_task" ]; then + echo "" + exit 0 + fi + + echo "󰳟 $ready_task" + ''; + exec-if = "which task"; + interval = 6; + }; + "custom/containers" = { + exec = pkgs.writeShellScript "waybar-containers" '' + set -u + + if [ ! -x "$(command -v podman)" ]; then + exit 1 + fi + + running_container_count=$(podman ps --noheading | wc -l) + + if [ "$running_container_count" -eq 0 ]; then + echo "" + exit 0 + fi + + suffix="" + if [ "$running_container_count" -gt 1 ]; then + suffix = "s" + fi + + echo "{\"text\": \"󰡨\", \"tooltip\": \"$running_container_count container$suffix running\"}" + ''; + exec-if = "which podman"; + interval = 60; + return-type = "json"; + }; + "custom/updates" = { + format = "{}"; + exec = pkgs.writeShellScript "waybar-updates" '' + set -u + + current_timestamp=$(nix flake metadata ~/.nixfiles --json | jq '.locks.nodes.nixpkgs.locked.lastModified') + latest_timestamp=$(nix flake metadata github:NixOS/nixpkgs/nixos-unstable --json | jq '.locked.lastModified') + + if [ "$latest_timestamp" -le "$current_timestamp" ]; then + echo "" + exit 0 + fi + + echo "{\"text\": \"󱄅\", \"tooltip\": \"Updates available\"}" + ''; + exec-if = "test -d ~/.nixfiles"; + interval = 21600; # 6h + return-type = "json"; + }; + }; + }; + style = '' + /* General */ + * { + border-radius: 0; + font-family: "FiraCode Nerd Font"; + font-size: 13px; + color: #c0caf5; + } + + window#waybar { + background-color: #1a1b26; + } + + tooltip { + background-color: #15161e; + } + + /* Workspaces */ + #workspaces button { + margin: 4px; + padding: 0 8px; + border-radius: 9999px; + } + + #workspaces button:hover { + border-color: transparent; + box-shadow: none; + background: #414868; + } + + #workspaces button.focused, + #workspaces button.active { + padding: 0 13px; + background: #2f334d; + } + + /* Modules */ + #clock, + #network, + #wireplumber, + #bluetooth, + #battery, + #custom-updates, + #custom-tasks, + #custom-containers, + #mode { + margin: 4px; + padding: 0 13px; + border-radius: 9999px; + background-color: #2f334d; + } + + #network { + padding: 0 15px 0 11px; + } + + #mode, + #custom-updates { + color: #bb9af7; + font-weight: bold; + } + + #battery.critical { + color: #f7768e; + font-weight: bold; + } + ''; + }; + + # Launcher + wofi = { + enable = true; + style = '' + #window { + font-family: "Fira Mono"; + background-color: #1a1b26; + color: #c0caf5; + } + + #input { + border-radius: 0; + border-color: transparent; + padding: 5px; + background-color: #1a1b26; + color: #c0caf5; + } + + #entry { + padding: 5px; + } + + #entry:selected { + outline: none; + background-color: #bb9af7; + } + ''; + }; + + # Lock screen manager + swaylock = { + enable = true; + settings = { + image = "~/.local/share/wallpapers/bespinian.png"; + }; + }; + }; + + services = { + # Notification daemon + mako = { + enable = true; + font = "Fira Mono 9"; + backgroundColor = "#1a1b26"; + textColor = "#c0caf5"; + borderColor = "#bb9af7"; + defaultTimeout = 8000; + groupBy = "app-name,summary"; + }; + + # Adjust color temperature to reduce eye strain + gammastep = { + enable = true; + provider = "geoclue2"; + }; + }; + + home.packages = with pkgs; [ + # Utilities + brightnessctl + clipman + grim + gron + playerctl + slurp + swaybg + swayidle + wf-recorder + workstyle + + # Fonts + fira-mono + lato + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + noto-fonts-cjk + noto-fonts-emoji + ]; + + # Wallpaper + xdg.dataFile = { + "wallpapers/bespinian.png".source = ./wallpapers/bespinian.png; + }; +} diff --git a/workstyle/config.toml b/home/workstyle/config.toml similarity index 100% rename from workstyle/config.toml rename to home/workstyle/config.toml diff --git a/home/zsh/functions.zsh b/home/zsh/functions.zsh new file mode 100644 index 0000000..30eae32 --- /dev/null +++ b/home/zsh/functions.zsh @@ -0,0 +1,93 @@ +# Create a directory and enter it +mkcd() { + mkdir --parents "$@" && cd "$_" || exit +} + +# Checkout Git branches or tags using fuzzy search +fco() { + local tags branches target + tags=$( + git tag | awk '{print "\x1b[31;1mtag\x1b[m\t" $1}' + ) || return + branches=$( + git branch --all | grep -v HEAD | + sed "s/.* //" | sed "s#remotes/[^/]*/##" | + sort -u | awk '{print "\x1b[34;1mbranch\x1b[m\t" $1}' + ) || return + target=$( + ( + echo "$tags" + echo "$branches" + ) | + fzf-tmux -l30 -- --no-hscroll --ansi +m -d "\t" -n 2 + ) || return + git checkout "$(echo "$target" | awk '{print $2}')" +} + +# Kill any process with fuzzy search +fkill() { + local pid + if [ "$UID" != "0" ]; then + pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}') + else + pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') + fi + + if [ "x$pid" != "x" ]; then + echo "$pid" | xargs kill "-${1:-9}" + fi +} + +# Git commit browser with fuzzy search +fshow() { + git log --graph --color=always \ + --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | + fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ + --bind "ctrl-m:execute: + (grep -o '[a-f0-9]\{7\}' | head -1 | + xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' + {} +FZF-EOF" +} + +# Update project dependencies +depu() { + # Git submodules + if [ -e .gitmodules ]; then + printf "Updating Git submodules for %s...\n\n" "${PWD##*/}" + git submodule update --init --remote --rebase --recursive + fi + + # npm + if [ -e package-lock.json ]; then + printf "Updating npm dependencies for %s...\n\n" "${PWD##*/}" + npm update + npm outdated + fi + + # Go + if [ -e go.mod ]; then + printf "Updating Go dependencies for %s...\n\n" "${PWD##*/}" + go get -t -u ./... + go mod tidy + fi + + # Rust + if [ -e Cargo.toml ]; then + printf "Updating Cargo dependencies for %s...\n\n" "${PWD##*/}" + cargo update + fi + + # Python + if [ -e poetry.lock ]; then + printf "Updating Python dependencies for %s...\n\n" "${PWD##*/}" + poetry update + poetry show --outdated + fi + + # Terraform + if [ -e .terraform.lock.hcl ]; then + printf "Updating Terraform dependencies for %s...\n\n" "${PWD##*/}" + terraform init -upgrade + fi +} diff --git a/sway/config b/sway/config deleted file mode 100644 index 482cc0b..0000000 --- a/sway/config +++ /dev/null @@ -1,173 +0,0 @@ -### Variables - -# Set logo key as main modifier -set $mod Mod4 - -# Colors -set $foreground #c0caf5 -set $highlight #bb9af7 -set $wallpaper ~/.local/share/wallpapers/bespinian.png -set $lock_cmd swaylock --daemonize --image $wallpaper -set $sleep_cmd systemctl suspend -set $launcher_cmd wofi --show drun --no-actions --insensitive --prompt 'Run' | xargs swaymsg exec -- - -# Set color for focused window -client.focused $highlight $highlight $foreground - -### Outputs - -# Set wallpaper -output * bg $wallpaper fill - -# Inhibit idle if a window is in fullscreen -for_window [shell=".*"] inhibit_idle fullscreen - -# Prevent Brave from inhibiting shortcuts -for_window [app_id="^brave-.*-.*$"] shortcuts_inhibitor disable - -### Status Bar - -bar { - swaybar_command waybar -} - -### Windows - -# Hide window title bars and borders -default_border pixel -hide_edge_borders smart - -### Inputs - -# Mouse -# Hide mouse cursor when not used -seat * hide_cursor 8000 - -# Touchpad -input type:touchpad { - tap enabled - natural_scroll enabled -} - -# Keyboard -input type:keyboard { - # Map caps lock to escape and use right alt as compose key to create umlauts - # To actually create them, type the following keys in a sequence: - # ralt + " + u --> ü - xkb_options caps:escape,compose:ralt -} - -### Key bindings - -# App launcher -bindsym $mod+space exec $launcher_cmd - -# Launch terminal -bindsym $mod+Return exec $TERMINAL - -# Launch browser -bindsym $mod+w exec $BROWSER - -# Take screenshots -bindsym Print exec grim "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png" -bindsym Print+$mod exec grim -g "$(slurp)" "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png" - -# Lock screen -bindsym $mod+ctrl+q exec loginctl lock-session - -# Media control -bindsym --locked XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ -bindsym --locked XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- -bindsym --locked XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle -bindsym --locked XF86AudioMicMute exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle -bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%- -bindsym --locked XF86MonBrightnessUp exec brightnessctl set +5% -bindsym --locked XF86AudioPlay exec playerctl play-pause -bindsym --locked XF86AudioNext exec playerctl next -bindsym --locked XF86AudioPrev exec playerctl previous -bindsym XF86Search exec $launcher_cmd - -# Kill focused window -bindsym $mod+q kill - -# Reload the configuration file -bindsym $mod+Shift+c reload - -# Move focus around -bindsym $mod+h focus left -bindsym $mod+j focus down -bindsym $mod+k focus up -bindsym $mod+l focus right - -# Move the focused window with the same, but add Shift -bindsym $mod+Shift+h move left -bindsym $mod+Shift+j move down -bindsym $mod+Shift+k move up -bindsym $mod+Shift+l move right - -# Switch to workspace -bindsym $mod+1 workspace number 1 -bindsym $mod+2 workspace number 2 -bindsym $mod+3 workspace number 3 -bindsym $mod+4 workspace number 4 -bindsym $mod+5 workspace number 5 -bindsym $mod+6 workspace number 6 -bindsym $mod+7 workspace number 7 -bindsym $mod+8 workspace number 8 -bindsym $mod+9 workspace number 9 -bindsym $mod+0 workspace number 10 -bindsym $mod+tab workspace back_and_forth - -# Move focused container to workspace -bindsym $mod+Shift+1 move container to workspace number 1; workspace number 1 -bindsym $mod+Shift+2 move container to workspace number 2; workspace number 2 -bindsym $mod+Shift+3 move container to workspace number 3; workspace number 3 -bindsym $mod+Shift+4 move container to workspace number 4; workspace number 4 -bindsym $mod+Shift+5 move container to workspace number 5; workspace number 5 -bindsym $mod+Shift+6 move container to workspace number 6; workspace number 6 -bindsym $mod+Shift+7 move container to workspace number 7; workspace number 7 -bindsym $mod+Shift+8 move container to workspace number 8; workspace number 8 -bindsym $mod+Shift+9 move container to workspace number 9; workspace number 9 -bindsym $mod+Shift+0 move container to workspace number 10 - -# Splitting direction -bindsym $mod+b split toggle - -# Make current focus fullscreen -bindsym $mod+f fullscreen - -# Resizing containers -bindsym $mod+r mode 'resize' -mode 'resize' { - # Resizing keys - bindsym h resize shrink width 10px - bindsym j resize grow height 10px - bindsym k resize shrink height 10px - bindsym l resize grow width 10px - - # Return to default mode - bindsym Escape mode 'default' -} - -### Gesture bindings - -# Swipe back and forth between workspaces -bindgesture swipe:3:left workspace prev_on_output -bindgesture swipe:3:right workspace next_on_output - -### Processes - -# Automatically manage outputs -exec kanshi - -# Autotiling -exec autotiling-rs - -# Waybar Icons -exec_always --no-startup-id workstyle &> /tmp/workstyle.log - -# Clipboard manager -exec wl-paste --type text --watch clipman store -bindsym $mod+v exec clipman pick --tool wofi - -include /etc/sway/config.d/* diff --git a/configuration.nix b/system/default.nix similarity index 59% rename from configuration.nix rename to system/default.nix index d6dba0d..cb68e25 100644 --- a/configuration.nix +++ b/system/default.nix @@ -1,8 +1,13 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { # Import hardware specific configuration - imports = [ ./hardware-configuration.nix ]; + imports = [ + ./hardware-configuration.nix + ./secure-boot.nix + ./encryption.nix + ./sound.nix + ]; # Bluetooth hardware.bluetooth = { @@ -10,41 +15,18 @@ powerOnBoot = false; }; - # Secure boot - boot = { - loader.systemd-boot.enable = pkgs.lib.mkForce false; - lanzaboote = { - enable = true; - pkiBundle = "/etc/secureboot"; - }; - }; - boot.loader.efi.canTouchEfiVariables = true; - - # Set up keyfile - boot.initrd.secrets = { - "/crypto_keyfile.bin" = null; - }; - - # Enable swap on luks - boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".device = "/dev/disk/by-uuid/58a9f60d-bf2d-4c94-8f08-8e29a4083728"; - boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".keyFile = "/crypto_keyfile.bin"; - # Network manager networking.networkmanager.enable = true; # Time zone time.timeZone = "Europe/Zurich"; - # Sound - sound.enable = true; - services.pipewire = { - enable = true; - pulse.enable = true; - }; - # AppArmor security.apparmor.enable = true; + # Temporary fix for Swaylock issue + security.pam.services.swaylock = { }; + # Containers virtualisation.podman.enable = true; @@ -61,7 +43,10 @@ nix.settings.experimental-features = [ "nix-command" "flakes" ]; # Garbage collection - nix.gc.automatic = true; + nix.gc = { + automatic = true; + dates = "weekly"; + }; # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -79,18 +64,10 @@ ]; # Window manager - programs.sway.enable = true; - xdg.portal.wlr.enable = true; + programs.hyprland.enable = true; environment.sessionVariables.NIXOS_OZONE_WL = "1"; - environment.sessionVariables.GTK_THEME = "Adwaita:dark"; programs = { - # Neovim - neovim = { - enable = true; - defaultEditor = true; - }; - # ZSH zsh.enable = true; diff --git a/system/encryption.nix b/system/encryption.nix new file mode 100644 index 0000000..e35af2c --- /dev/null +++ b/system/encryption.nix @@ -0,0 +1,11 @@ +{ + # Set up keyfile + boot.initrd.secrets = { + "/crypto_keyfile.bin" = null; + }; + + # Enable swap on luks + boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".device = "/dev/disk/by-uuid/58a9f60d-bf2d-4c94-8f08-8e29a4083728"; + boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".keyFile = "/crypto_keyfile.bin"; +} + diff --git a/hardware-configuration.nix b/system/hardware-configuration.nix similarity index 100% rename from hardware-configuration.nix rename to system/hardware-configuration.nix diff --git a/system/secure-boot.nix b/system/secure-boot.nix new file mode 100644 index 0000000..e31a123 --- /dev/null +++ b/system/secure-boot.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: + +{ + boot = { + loader.systemd-boot.enable = pkgs.lib.mkForce false; + lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + }; +} diff --git a/system/sound.nix b/system/sound.nix new file mode 100644 index 0000000..a6bba2f --- /dev/null +++ b/system/sound.nix @@ -0,0 +1,7 @@ +{ + sound.enable = true; + services.pipewire = { + enable = true; + pulse.enable = true; + }; +} diff --git a/zsh/functions.zsh b/zsh/functions.zsh deleted file mode 100644 index e936024..0000000 --- a/zsh/functions.zsh +++ /dev/null @@ -1,245 +0,0 @@ -# Create a directory and enter it -mkcd() { - mkdir --parents "$@" && cd "$_" || exit -} - -# cd into directory using fuzzy search -fcd() { - local dir - dir=$(fd --type d --follow | fzf --preview 'tree -l -L 1 {}' +m) && - cd "$dir" -} - -# Edit a directory or a file using fuzzy search -fe() { - local target fzf_cmd - fzf_cmd='fd --follow --hidden --no-ignore \ - --exclude .git \ - --exclude vendor \ - --exclude node_modules \ - --exclude .terraform \ - --exclude target \ - --exclude bin \ - --exclude build \ - --exclude dist \ - --exclude coverage \ - --exclude .DS_Store' - target=$(eval $fzf_cmd | fzf +m) && - if [ -d "$target" ]; then - cd "$target" && "$EDITOR" - fi - if [ -f "$target" ]; then - "$EDITOR" "$target" - fi -} - -# Checkout Git branches or tags using fuzzy search -fco() { - local tags branches target - tags=$( - git tag | awk '{print "\x1b[31;1mtag\x1b[m\t" $1}' - ) || return - branches=$( - git branch --all | grep -v HEAD | - sed "s/.* //" | sed "s#remotes/[^/]*/##" | - sort -u | awk '{print "\x1b[34;1mbranch\x1b[m\t" $1}' - ) || return - target=$( - ( - echo "$tags" - echo "$branches" - ) | - fzf-tmux -l30 -- --no-hscroll --ansi +m -d "\t" -n 2 - ) || return - git checkout "$(echo "$target" | awk '{print $2}')" -} - -# Kill any process with fuzzy search -fkill() { - local pid - if [ "$UID" != "0" ]; then - pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}') - else - pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') - fi - - if [ "x$pid" != "x" ]; then - echo "$pid" | xargs kill "-${1:-9}" - fi -} - -# Git commit browser with fuzzy search -fshow() { - git log --graph --color=always \ - --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | - fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ - --bind "ctrl-m:execute: - (grep -o '[a-f0-9]\{7\}' | head -1 | - xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' - {} -FZF-EOF" -} - -# Open tmux and Vim in an IDE like layout -ide() { - if [ -n "$1" ]; then - cd "$1" || exit - fi - - if [ -z "${TMUX}" ]; then - tmux new-session -A -s ide - fi - - tmux split-window -vb -p 90 - tmux select-pane -t 0 - - tmux send-keys 'nvim -c NvimTreeOpen' C-m -} - -# Update project dependencies -depu() { - # Git submodules - if [ -e .gitmodules ]; then - printf "Updating Git submodules for %s...\n\n" "${PWD##*/}" - git submodule update --init --remote --rebase --recursive - fi - - # npm - if [ -e package-lock.json ]; then - printf "Updating npm dependencies for %s...\n\n" "${PWD##*/}" - npm update - npm outdated - fi - - # Go - if [ -e go.mod ]; then - printf "Updating Go dependencies for %s...\n\n" "${PWD##*/}" - go get -t -u ./... - go mod tidy - fi - - # Rust - if [ -e Cargo.toml ]; then - printf "Updating Cargo dependencies for %s...\n\n" "${PWD##*/}" - cargo update - fi - - # Python - if [ -e poetry.lock ]; then - printf "Updating Python dependencies for %s...\n\n" "${PWD##*/}" - poetry update - poetry show --outdated - fi - - # Terraform - if [ -e .terraform.lock.hcl ]; then - printf "Updating Terraform dependencies for %s...\n\n" "${PWD##*/}" - terraform init -upgrade - fi -} - -# System update -pacu() { - processes=() - - # Dotfiles repo - printf '\e[1mUpdating dotfiles repo\e[0m\n' - (cd "${HOME}/dotfiles" && git pull) - - case "$(uname)" in - - 'Linux') - # On Linux, use the respective package manager - if [ -x "$(command -v paru)" ]; then - printf '\e[1mUpdating Paru packages\e[0m\n' - paru -Syu --noconfirm - orphans=$(paru -Qtdq) || orphans='' - if [ -n "${orphans}" ]; then - printf '\e[1mRemoving orphan packages\e[0m\n' - paru -Rns $orphans --noconfirm - fi - paru -Sc --noconfirm - paru --clean --noconfirm - elif [ -x "$(command -v pacman)" ]; then - printf '\e[1mUpdating pacman packages\e[0m\n' - sudo pacman -Syu --noconfirm - orphans=$(sudo pacman -Qtdq) || orphans='' - if [ -n "${orphans}" ]; then - printf '\e[1mRemoving orphan packages\e[0m\n' - sudo pacman -Rns $orphans --noconfirm - fi - sudo pacman -Sc --noconfirm - fi - if [ -x "$(command -v pacmanfile)" ]; then - printf '\e[1mSyncing packages with pacmanfile\e[0m\n' - pacmanfile sync - fi - if [ -x "$(command -v pacdiff)" ]; then - printf '\e[1mChecking for Pacman maintenance issues\e[0m\n' - sudo DIFFPROG="${EDITOR} -d" pacdiff - fi - - # Update status bar indicator for pending updates - pkill -SIGRTMIN+8 waybar - - # Update firmwares - if [ -x "$(command -v fwupdmgr)" ]; then - printf '\e[1mUpdating firmwares\e[0m\n' - fwupdmgr refresh - fwupdmgr update - fi - ;; - - 'Darwin') - # On macOS, use mas and Homebrew - if [ -x "$(command -v mas)" ]; then - printf '\e[1mUpdating App Store apps\e[0m\n' - mas upgrade - fi - - if [ -x "$(command -v brew)" ]; then - printf '\e[1mUpdating Homebrew packages\e[0m\n' - brew update - brew upgrade - cat ~/.config/homebrew/*Brewfile | brew bundle --file=- - cat ~/.config/homebrew/*Brewfile | brew bundle cleanup --force --file=- - brew cu --all --yes --cleanup - brew cleanup --prune 7 - fi - ;; - esac - - # zprezto - if type zprezto-update 2>/dev/null | grep -q function; then - printf '\e[1mUpdating zprezto\e[0m\n' - zprezto-update & - processes+=("$!") - fi - - # npm - if [ -x "$(command -v npm)" ]; then - printf '\e[1mUpdating globally installed npm packages\e[0m\n' - npm update -g - fi - - # Yarn - if [ -x "$(command -v yarn)" ]; then - printf '\e[1mUpdating globally installed Yarn packages\e[0m\n' - (yarn global upgrade >/dev/null) & - processes+=("$!") - fi - - # Neovim - if [ -x "$(command -v nvim)" ]; then - printf '\e[1mUpdating Neovim plugins\e[0m\n' - nvim --headless -c 'Lazy! sync' -c 'qa' - nvim --headless -c 'autocmd User MasonUpdateAllComplete quitall' -c 'MasonUpdateAll' - fi - - # Wait for all processes to finish - for p in ${processes[*]}; do - wait "$p" - done - - printf '\n\e[1mSystem update finished\e[0m\n' -} From 0c980855f4fd403fb75e41c809190b7501bb6cd8 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Fri, 21 Jul 2023 15:22:55 +0200 Subject: [PATCH 11/29] Use Hyprland home manager module --- flake.lock | 12 +-- home/default.nix | 20 +++-- home/editor.nix | 33 +++----- home/file-manager.nix | 90 ++++++++++++++++---- home/gopass/config | 5 -- home/hyprland/hyprland.conf | 119 -------------------------- home/joshuto/preview_file.sh | 81 ------------------ home/terminal.nix | 134 +++++++++++++++++++++++++++--- home/tools.nix | 47 ++++++++--- home/window-manager.nix | 131 ++++++++++++++++++++++++----- home/zsh/functions.zsh | 93 --------------------- system/bluetooth.nix | 6 ++ system/default.nix | 34 ++------ system/hardware-configuration.nix | 2 +- 14 files changed, 390 insertions(+), 417 deletions(-) delete mode 100644 home/gopass/config delete mode 100644 home/hyprland/hyprland.conf delete mode 100644 home/joshuto/preview_file.sh delete mode 100644 home/zsh/functions.zsh create mode 100644 system/bluetooth.nix diff --git a/flake.lock b/flake.lock index 2ba5ade..fbfbb53 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1689891262, - "narHash": "sha256-Pc4wDczbdgd6QXKJIXprgxe7L9AVDsoAkMnvm5vmpUU=", + "lastModified": 1690982105, + "narHash": "sha256-32AzoLuwhtxBItcULRiCnxRfJcbVXbPZSH9TDVg21mU=", "owner": "nix-community", "repo": "home-manager", - "rev": "ee5673246de0254186e469935909e821b8f4ec15", + "rev": "b2ac1d2c32ac11b8d231d23622cdc4b2f28d07d2", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1689850295, - "narHash": "sha256-fUYf6WdQlhd2H+3aR8jST5dhFH1d0eE22aes8fNIfyk=", + "lastModified": 1690881714, + "narHash": "sha256-h/nXluEqdiQHs1oSgkOOWF+j8gcJMWhwnZ9PFabN6q0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5df4d78d54f7a34e9ea1f84a22b4fd9baebc68d0", + "rev": "9e1960bc196baf6881340d53dccb203a951745a2", "type": "github" }, "original": { diff --git a/home/default.nix b/home/default.nix index c4e0f29..d49bc96 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,20 +1,22 @@ +{ config, ... }: + { + imports = [ + ./window-manager.nix + ./terminal.nix + ./editor.nix + ./file-manager.nix + ./tools.nix + ]; + nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfreePredicate = pkg: true; home.username = "lena"; - home.homeDirectory = "/home/lena"; + home.homeDirectory = "/home/${config.home.username}"; home.stateVersion = "23.05"; # Let Home Manager install and manage itself programs.home-manager.enable = true; - - imports = [ - ./window-manager.nix - ./terminal.nix - ./editor.nix - ./file-manager.nix - ./tools.nix - ]; } diff --git a/home/editor.nix b/home/editor.nix index 1dfb08c..a6454ee 100644 --- a/home/editor.nix +++ b/home/editor.nix @@ -15,18 +15,18 @@ }; languages = { language = [ - { name = "bash"; auto-format = true; formatter = { command = "shfmt"; }; } - { name = "css"; formatter = { command = "prettier"; args = [ "--parser" "css" ]; }; } + { name = "bash"; auto-format = true; formatter = { command = "${pkgs.shfmt}/bin/shfmt"; }; } + { name = "css"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "css" ]; }; } { name = "go"; config = { formatting.gofumpt = true; }; } - { name = "html"; formatter = { command = "prettier"; args = [ "--parser" "html" ]; }; } - { name = "javascript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } - { name = "json"; formatter = { command = "prettier"; args = [ "--parser" "json" ]; }; } - { name = "markdown"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "markdown" ]; }; } - { name = "nix"; auto-format = true; formatter = { command = "nixpkgs-fmt"; }; } - { name = "python"; auto-format = true; formatter = { command = "black"; args = [ "--quiet" "-" ]; }; } - { name = "svelte"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "svelte" ]; }; } - { name = "typescript"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "typescript" ]; }; } - { name = "yaml"; auto-format = true; formatter = { command = "prettier"; args = [ "--parser" "yaml" ]; }; } + { name = "html"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "html" ]; }; } + { name = "javascript"; auto-format = true; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "typescript" ]; }; } + { name = "json"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "json" ]; }; } + { name = "markdown"; auto-format = true; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "markdown" ]; }; } + { name = "nix"; auto-format = true; formatter = { command = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt"; }; } + { name = "python"; auto-format = true; formatter = { command = "${pkgs.black}/bin/black"; args = [ "--quiet" "-" ]; }; } + { name = "svelte"; auto-format = true; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "svelte" ]; }; } + { name = "typescript"; auto-format = true; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "typescript" ]; }; } + { name = "yaml"; auto-format = true; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "yaml" ]; }; } ]; }; }; @@ -50,16 +50,5 @@ # Debuggers delve lldb - - # Linters - golangci-lint - shellcheck - tflint - - # Formatters - black - nixpkgs-fmt - nodePackages.prettier - shfmt ]; } diff --git a/home/file-manager.nix b/home/file-manager.nix index 78c6aa8..05f8a5c 100644 --- a/home/file-manager.nix +++ b/home/file-manager.nix @@ -4,21 +4,83 @@ programs.joshuto = { enable = true; settings = { - preview.preview_script = "~/.config/joshuto/preview_file.sh"; - }; - }; + preview.preview_script = pkgs.writeShellScript "joshuto-preview" '' + IFS=$'\n' + + # Security measures: + # * noclobber prevents you from overwriting a file with `>` + # * noglob prevents expansion of wild cards + # * nounset causes bash to fail if an undeclared variable is used (e.g. typos) + # * pipefail causes a pipeline to fail also if a command other than the last one fails + set -o noclobber -o noglob -o nounset -o pipefail + + file_path="" + preview_width=10 + preview_height=10 + + while [ "$#" -gt 0 ]; do + case "$1" in + "--path") + shift + file_path="$1" + ;; + "--preview-width") + shift + preview_width="$1" + ;; + "--preview-height") + shift + preview_height="$1" + ;; + esac + shift + done + + handle_extension() { + case "$file_extension_lower" in + ## Archive + zip) + ## Avoid password prompt by providing empty password + ${pkgs.unzip}/bin/unzip -l "$file_path" && exit 0 + exit 1 + ;; + + ## PDF + pdf) + ## Preview as text conversion + ${pkgs.poppler_utils}/bin/pdftotext -l 10 -nopgbrk -q -- "$file_path" - | + fmt -w "$preview_width" && exit 0 + exit 1 + ;; + esac + } + + handle_mime() { + local mimetype="$1" + + case "$mimetype" in + ## Text + text/* | */xml | */json | */yaml) + cat "$file_path" && exit 0 + exit 1 + ;; + + ## Image + image/*) + ${pkgs.chafa}/bin/chafa --size "''${preview_width}x''${preview_height}" "$file_path" && exit 0 + exit 1 + ;; + esac + } + + file_extension="''${file_path##*.}" + file_extension_lower="$(printf "%s" "$file_extension" | tr '[:upper:]' '[:lower:]')" + handle_extension + mimetype="$(${pkgs.file}/bin/file --dereference --brief --mime-type -- "$file_path")" + handle_mime "$mimetype" - home.packages = with pkgs; [ - # File previewers - chafa - file - poppler_utils - ]; - - xdg.configFile = { - "joshuto/preview_file.sh" = { - source = ./joshuto/preview_file.sh; - executable = true; + exit 1 + ''; }; }; } diff --git a/home/gopass/config b/home/gopass/config deleted file mode 100644 index a3ea754..0000000 --- a/home/gopass/config +++ /dev/null @@ -1,5 +0,0 @@ -[core] - notifications = false - showsafecontent = true -[mounts] - path = ~/.password-store diff --git a/home/hyprland/hyprland.conf b/home/hyprland/hyprland.conf deleted file mode 100644 index f7cd28d..0000000 --- a/home/hyprland/hyprland.conf +++ /dev/null @@ -1,119 +0,0 @@ -### Variables - -$mainMod = SUPER -$colorActive = rgb(bb9af7) -$wallpaper = ~/.local/share/wallpapers/bespinian.png -$lockCmd = swaylock --daemonize -$sleepCmd = systemctl suspend -$launcherCmd = wofi --show drun --no-actions --insensitive --prompt 'Run' - -general { - border_size = 2 - gaps_in = 0 - gaps_out = 0 - col.active_border = $colorActive - col.group_border_active = $colorActive - cursor_inactive_timeout = 8 -} - -input { - kb_options = caps:escape,compose:ralt - touchpad { - natural_scroll = yes - } -} - -gestures { - workspace_swipe = yes - workspace_swipe_min_speed_to_force = 5 -} - -misc { - disable_hyprland_logo = true - disable_splash_rendering = true -} - -### Dwindle - -dwindle { - # Put new splits on the right/bottom - force_split = 2 - no_gaps_when_only = true -} - -### Monitors - -# Scale built in monitor correctly -monitor = eDP-1, preferred, auto, 1.5 - -# Run helper programs -exec-once = waybar -exec-once = gammastep -exec-once = swayidle -w timeout 900 '$lockCmd' timeout 1200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' timeout 1800 '$sleepCmd' before-sleep 'playerctl pause' before-sleep '$lockCmd' lock '$lockCmd' -exec-once = workstyle &> /tmp/workstyle.log -exec-once = swaybg --image $wallpaper --mode fill -exec-once = wl-paste --type text --watch clipman store - -### Binds - -# Window manager -bind = $mainMod, Tab, focusurgentorlast -bind = $mainMod, Q, killactive, -bind = $mainMod, F, fullscreen - -# Shortcuts -bind = $mainMod, Space, exec, $launcherCmd -bind = $mainMod, Return, exec, $TERMINAL -bind = $mainMod, W, exec, brave -bind = $mainMod, V, exec, clipman pick --tool wofi -bind = SUPER_CTRL, Q, exec, $lockCmd - -# Media keys -bind = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ -bind = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- -bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle -bind = , XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle -bind = , XF86MonBrightnessDown, exec, brightnessctl set 5%- -bind = , XF86MonBrightnessUp, exec, brightnessctl set +5% -bind = , XF86AudioPlay, exec, playerctl play-pause -bind = , XF86AudioNext, exec, playerctl next -bind = , XF86AudioPrev, exec, playerctl previous -bind = , XF86Search, exec, $launcherCmd - -# Screenshots -bind = , Print ,exec, grim "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png" -bind = $mainMod, Print , exec, grim -g "$(slurp)" "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png" - -# Move window focus -bind = $mainMod, H, movefocus, l -bind = $mainMod, J, movefocus, d -bind = $mainMod, K, movefocus, u -bind = $mainMod, L, movefocus, r - -# Switch workspaces -bind = $mainMod, 1, workspace, 1 -bind = $mainMod, 2, workspace, 2 -bind = $mainMod, 3, workspace, 3 -bind = $mainMod, 4, workspace, 4 -bind = $mainMod, 5, workspace, 5 -bind = $mainMod, 6, workspace, 6 -bind = $mainMod, 7, workspace, 7 -bind = $mainMod, 8, workspace, 8 -bind = $mainMod, 9, workspace, 9 -bind = $mainMod, 0, togglespecialworkspace - -# Move active window to workspace -bind = $mainMod SHIFT, 1, movetoworkspace, 1 -bind = $mainMod SHIFT, 2, movetoworkspace, 2 -bind = $mainMod SHIFT, 3, movetoworkspace, 3 -bind = $mainMod SHIFT, 4, movetoworkspace, 4 -bind = $mainMod SHIFT, 5, movetoworkspace, 5 -bind = $mainMod SHIFT, 6, movetoworkspace, 6 -bind = $mainMod SHIFT, 7, movetoworkspace, 7 -bind = $mainMod SHIFT, 8, movetoworkspace, 8 -bind = $mainMod SHIFT, 9, movetoworkspace, 9 -bind = $mainMod SHIFT, 0, movetoworkspace, special - -# Move/resize windows with mouse -bindm = $mainMod, mouse:272, movewindow -bindm = $mainMod, mouse:273, resizewindow diff --git a/home/joshuto/preview_file.sh b/home/joshuto/preview_file.sh deleted file mode 100644 index e5634e5..0000000 --- a/home/joshuto/preview_file.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env bash - -IFS=$'\n' - -# Security measures: -# * noclobber prevents you from overwriting a file with `>` -# * noglob prevents expansion of wild cards -# * nounset causes bash to fail if an undeclared variable is used (e.g. typos) -# * pipefail causes a pipeline to fail also if a command other than the last one fails -set -o noclobber -o noglob -o nounset -o pipefail - -file_path="" -preview_width=10 -preview_height=10 - -while [ "$#" -gt 0 ]; do - case "$1" in - "--path") - shift - file_path="$1" - ;; - "--preview-width") - shift - preview_width="$1" - ;; - "--preview-height") - shift - preview_height="$1" - ;; - esac - shift -done - -handle_extension() { - case "${file_extension_lower}" in - ## Archive - zip) - ## Avoid password prompt by providing empty password - unzip -l "${file_path}" && exit 0 - exit 1 - ;; - - ## PDF - pdf) - ## Preview as text conversion - pdftotext -l 10 -nopgbrk -q -- "${file_path}" - | - fmt -w "${preview_width}" && exit 0 - exit 1 - ;; - esac -} - -handle_mime() { - local mimetype="${1}" - - case "${mimetype}" in - ## Text - text/* | */xml | */json | */yaml) - bat --color=always --paging=never \ - --style=plain \ - --terminal-width="${preview_width}" \ - "${file_path}" && exit 0 - cat "${file_path}" && exit 0 - exit 1 - ;; - - ## Image - image/*) - chafa "${file_path}" && exit 0 - exit 1 - ;; - esac -} - -file_extension="${file_path##*.}" -file_extension_lower="$(printf "%s" "${file_extension}" | tr '[:upper:]' '[:lower:]')" -handle_extension -mimetype="$(file --dereference --brief --mime-type -- "${file_path}")" -handle_mime "${mimetype}" - -exit 1 diff --git a/home/terminal.nix b/home/terminal.nix index 85a7599..c926087 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -1,14 +1,16 @@ +{ config, pkgs, ... }: + { home.sessionVariables = { - TERMINAL = "alacritty"; - BROWSER = "brave"; + TERMINAL = "${pkgs.alacritty}/bin/alacritty"; + BROWSER = "${pkgs.brave}/bin/brave"; }; home.shellAliases = { e = "$EDITOR"; - f = "joshuto"; - g = "gitui"; - t = "task"; + f = "${pkgs.joshuto}/bin/joshuto"; + g = "${pkgs.gitui}/bin/gitui"; + t = "${pkgs.taskwarrior}/bin/task"; ".." = "cd .."; "..." = "cd ../.."; }; @@ -94,7 +96,6 @@ set-window-option -g window-status-current-format " #I: #W " ''; }; - tmate.enable = true; # Shell zsh = { @@ -108,13 +109,15 @@ searchUpKey = "^P"; }; initExtra = '' - source ~/.config/zsh/* - [[ -z "$TMUX" && $(tty) != /dev/tty[0-9] ]] && { tmux || exec tmux new-session && exit } + setopt HIST_IGNORE_ALL_DUPS + HISTORY_SUBSTRING_SEARCH_PREFIXED=true + source ${config.xdg.configHome}/zsh/* + [[ -z "$TMUX" && $(tty) != /dev/tty[0-9] ]] && { ${pkgs.tmux}/bin/tmux || exec ${pkgs.tmux}/bin/tmux new-session && exit } ''; loginExtra = '' # Start window manager if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then - exec Hyprland + exec ${pkgs.hyprland}/bin/Hyprland fi ''; }; @@ -133,6 +136,117 @@ # Helper functions xdg.configFile = { - "zsh/functions.zsh".source = ./zsh/functions.zsh; + "zsh/functions.zsh".source = pkgs.writeShellScript "waybar-tasks" '' + # Create a directory and enter it + mkcd() { + mkdir --parents "$@" && cd "$_" || exit + } + + # Checkout Git branches or tags using fuzzy search + fco() { + local tags branches target + tags=$( + ${pkgs.git}/bin/git tag | awk '{print "\x1b[31;1mtag\x1b[m\t" $1}' + ) || return + branches=$( + ${pkgs.git}/bin/git branch --all | grep -v HEAD | + sed "s/.* //" | sed "s#remotes/[^/]*/##" | + sort -u | awk '{print "\x1b[34;1mbranch\x1b[m\t" $1}' + ) || return + target=$( + ( + echo "$tags" + echo "$branches" + ) | + ${pkgs.fzf}/bin/fzf-tmux -l30 -- --no-hscroll --ansi +m -d "\t" -n 2 + ) || return + ${pkgs.git}/bin/git checkout "$(echo "$target" | awk '{print $2}')" + } + + # Kill any process with fuzzy search + fkill() { + local pid + if [ "$UID" != "0" ]; then + pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}') + else + pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') + fi + + if [ "x$pid" != "x" ]; then + echo "$pid" | xargs kill "-''${1:-9}" + fi + } + + # Git commit browser with fuzzy search + fshow() { + ${pkgs.git}/bin/git log --graph --color=always \ + --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | + ${pkgs.fzf}/bin/fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ + --bind "ctrl-m:execute: + (grep -o '[a-f0-9]\{7\}' | head -1 | + xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' + {} + FZF-EOF" + } + + # Update system + pacu() { + pushd ${config.home.homeDirectory}/.nixfiles + ${pkgs.gnumake}/bin/make update + ${pkgs.gnumake}/bin/make system + ${pkgs.gnumake}/bin/make home + popd + ${pkgs.fwupd}/bin/fwupdmgr refresh + ${pkgs.fwupd}/bin/fwupdmgr update + } + + # Update project dependencies + depu() { + # Git submodules + if [ -e .gitmodules ]; then + printf "Updating Git submodules for %s...\n\n" "''${PWD##*/}" + git submodule update --init --remote --rebase --recursive + fi + + # Nix flakes + if [ -e flake.nix ]; then + printf "Updating Nix flake for %s...\n\n" "''${PWD##*/}" + nix flake update + fi + + # npm + if [ -e package-lock.json ]; then + printf "Updating npm dependencies for %s...\n\n" "''${PWD##*/}" + npm update + npm outdated + fi + + # Go + if [ -e go.mod ]; then + printf "Updating Go dependencies for %s...\n\n" "''${PWD##*/}" + go get -t -u ./... + go mod tidy + fi + + # Rust + if [ -e Cargo.toml ]; then + printf "Updating Cargo dependencies for %s...\n\n" "''${PWD##*/}" + cargo update + fi + + # Python + if [ -e poetry.lock ]; then + printf "Updating Python dependencies for %s...\n\n" "''${PWD##*/}" + poetry update + poetry show --outdated + fi + + # Terraform + if [ -e .terraform.lock.hcl ]; then + printf "Updating Terraform dependencies for %s...\n\n" "''${PWD##*/}" + terraform init -upgrade + fi + } + ''; }; } diff --git a/home/tools.nix b/home/tools.nix index cbb9e8a..a331e8f 100644 --- a/home/tools.nix +++ b/home/tools.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: { programs = { @@ -24,6 +24,9 @@ # Fast grepping ripgrep.enable = true; + # Process viewer + htop.enable = true; + # Quick navigation zoxide.enable = true; @@ -36,14 +39,17 @@ # PDF viewer zathura.enable = true; + # Share terminal sessions + tmate.enable = true; + # Task management taskwarrior = { enable = true; config = { taskd = { - certificate = "~/.config/task/private.certificate.pem"; - key = "~/.config/task/private.key.pem"; - ca = "~/.config/task/ca.cert.pem"; + certificate = "${config.xdg.configHome}/task/private.certificate.pem"; + key = "${config.xdg.configHome}/task/private.key.pem"; + ca = "${config.xdg.configHome}/task/ca.cert.pem"; server = "inthe.am:53589"; credentials = "inthe_am/lena/c214a5a3-b0b2-4132-958c-ebef8d83fd25"; trust = "strict"; @@ -54,14 +60,14 @@ # Media player mpv.enable = true; + # GitHub CLI + gh.enable = true; + # Image viewer imv.enable = true; # Go - go = { - enable = true; - goPath = ".local/share/go"; - }; + go.enable = true; # Simplified manuals tealdeer = { @@ -83,12 +89,15 @@ brave cargo chromium + curl diff-so-fancy dig fd fx - gh + gcc gimp + gnumake + golangci-lint gopass hugo inkscape @@ -111,19 +120,35 @@ quickemu realvnc-vnc-viewer rustc + shellcheck signal-desktop termshark terraform + tflint timewarrior tree - via + unzip + wget whois wine wl-clipboard yq + zip ]; xdg.configFile = { - "gopass/config".source = ./gopass/config; + "gopass/config".text = '' + [core] + notifications = false + showsafecontent = true + [mounts] + path = ${config.home.homeDirectory}/.password-store + ''; + }; + xdg.dataFile = { + "task/hooks/on-modify.timewarrior" = { + source = "${pkgs.timewarrior}/share/doc/timew/ext/on-modify.timewarrior"; + executable = true; + }; }; } diff --git a/home/window-manager.nix b/home/window-manager.nix index 4371207..f213c33 100644 --- a/home/window-manager.nix +++ b/home/window-manager.nix @@ -1,9 +1,115 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: { - # Window manager - xdg.configFile = { - "hypr/hyprland.conf".source = ./hyprland/hyprland.conf; + home.sessionVariables = { + NIXOS_OZONE_WL = "1"; + }; + + wayland.windowManager.hyprland = { + enable = true; + settings = { + "$mainMod" = "SUPER"; + "$wallpaper" = "${config.xdg.dataHome}/wallpapers/bespinian.png"; + "$lockCmd" = "${pkgs.swaylock}/bin/swaylock --daemonize"; + "$sleepCmd" = "systemctl suspend"; + "$launcherCmd" = "${pkgs.wofi}/bin/wofi --show drun --no-actions --insensitive --prompt 'Run'"; + general = { + border_size = 2; + gaps_in = 0; + gaps_out = 0; + "col.active_border" = "rgb(bb9af7)"; + "col.group_border_active" = "rgb(bb9af7)"; + cursor_inactive_timeout = 8; + }; + input = { + kb_options = "caps:escape,compose:ralt"; + touchpad.natural_scroll = true; + }; + gestures = { + workspace_swipe = true; + workspace_swipe_min_speed_to_force = 5; + }; + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + }; + dwindle = { + # Put new splits on the right/bottom + force_split = 2; + no_gaps_when_only = true; + }; + exec-once = [ + "${pkgs.waybar}/bin/waybar" + "${pkgs.gammastep}/bin/gammastep" + "${pkgs.swayidle}/bin/swayidle -w timeout 900 '$lockCmd' timeout 1200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' timeout 1800 '$sleepCmd' before-sleep 'playerctl pause' before-sleep '$lockCmd' lock '$lockCmd'" + "${pkgs.workstyle}/workstyle &> /tmp/workstyle.log" + "${pkgs.swaybg}/bin/swaybg --image $wallpaper --mode fill" + "${pkgs.wl-clipboard}/bin/wl-paste --type text --watch ${pkgs.clipman}/bin/clipman store" + ]; + bind = [ + # Window manager + "$mainMod, Tab, focusurgentorlast" + "$mainMod, Q, killactive," + "$mainMod, F, fullscreen" + + # Shortcuts + "$mainMod, Space, exec, $launcherCmd" + "$mainMod, Return, exec, $TERMINAL" + "$mainMod, W, exec, ${pkgs.brave}/bin/brave" + "$mainMod, V, exec, ${pkgs.clipman}/bin/clipman pick --tool wofi" + "SUPER_CTRL, Q, exec, $lockCmd" + + # Media keys + ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" + ", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ", XF86AudioMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ", XF86AudioMicMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + ", XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 5%-" + ", XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl set +5%" + ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause" + ", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next" + ", XF86AudioPrev, exec, ${pkgs.playerctl}playerctl previous" + ", XF86Search, exec, $launcherCmd" + + # Screenshots + ", Print ,exec, ${pkgs.grim}/bin/grim ${config.xdg.userDirs.download}/screenshot-$(date +'%F-%H-%M-%S').png" + "$mainMod, Print , exec, ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" ${config.xdg.userDirs.download}/screenshot-$(date +'%F-%H-%M-%S').png" + + # Move window focus + "$mainMod, H, movefocus, l" + "$mainMod, J, movefocus, d" + "$mainMod, K, movefocus, u" + "$mainMod, L, movefocus, r" + + # Switch workspaces + "$mainMod, 1, workspace, 1" + "$mainMod, 2, workspace, 2" + "$mainMod, 3, workspace, 3" + "$mainMod, 4, workspace, 4" + "$mainMod, 5, workspace, 5" + "$mainMod, 6, workspace, 6" + "$mainMod, 7, workspace, 7" + "$mainMod, 8, workspace, 8" + "$mainMod, 9, workspace, 9" + "$mainMod, 0, togglespecialworkspace" + + # Move active window to workspace + "$mainMod SHIFT, 1, movetoworkspace, 1" + "$mainMod SHIFT, 2, movetoworkspace, 2" + "$mainMod SHIFT, 3, movetoworkspace, 3" + "$mainMod SHIFT, 4, movetoworkspace, 4" + "$mainMod SHIFT, 5, movetoworkspace, 5" + "$mainMod SHIFT, 6, movetoworkspace, 6" + "$mainMod SHIFT, 7, movetoworkspace, 7" + "$mainMod SHIFT, 8, movetoworkspace, 8" + "$mainMod SHIFT, 9, movetoworkspace, 9" + "$mainMod SHIFT, 0, movetoworkspace, special" + ]; + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + }; }; programs = { @@ -164,7 +270,6 @@ background: #414868; } - #workspaces button.focused, #workspaces button.active { padding: 0 13px; background: #2f334d; @@ -236,7 +341,7 @@ swaylock = { enable = true; settings = { - image = "~/.local/share/wallpapers/bespinian.png"; + image = "${config.xdg.dataHome}/wallpapers/bespinian.png"; }; }; }; @@ -260,20 +365,8 @@ }; }; + # Fonts home.packages = with pkgs; [ - # Utilities - brightnessctl - clipman - grim - gron - playerctl - slurp - swaybg - swayidle - wf-recorder - workstyle - - # Fonts fira-mono lato (nerdfonts.override { fonts = [ "FiraCode" ]; }) diff --git a/home/zsh/functions.zsh b/home/zsh/functions.zsh deleted file mode 100644 index 30eae32..0000000 --- a/home/zsh/functions.zsh +++ /dev/null @@ -1,93 +0,0 @@ -# Create a directory and enter it -mkcd() { - mkdir --parents "$@" && cd "$_" || exit -} - -# Checkout Git branches or tags using fuzzy search -fco() { - local tags branches target - tags=$( - git tag | awk '{print "\x1b[31;1mtag\x1b[m\t" $1}' - ) || return - branches=$( - git branch --all | grep -v HEAD | - sed "s/.* //" | sed "s#remotes/[^/]*/##" | - sort -u | awk '{print "\x1b[34;1mbranch\x1b[m\t" $1}' - ) || return - target=$( - ( - echo "$tags" - echo "$branches" - ) | - fzf-tmux -l30 -- --no-hscroll --ansi +m -d "\t" -n 2 - ) || return - git checkout "$(echo "$target" | awk '{print $2}')" -} - -# Kill any process with fuzzy search -fkill() { - local pid - if [ "$UID" != "0" ]; then - pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}') - else - pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') - fi - - if [ "x$pid" != "x" ]; then - echo "$pid" | xargs kill "-${1:-9}" - fi -} - -# Git commit browser with fuzzy search -fshow() { - git log --graph --color=always \ - --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | - fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ - --bind "ctrl-m:execute: - (grep -o '[a-f0-9]\{7\}' | head -1 | - xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' - {} -FZF-EOF" -} - -# Update project dependencies -depu() { - # Git submodules - if [ -e .gitmodules ]; then - printf "Updating Git submodules for %s...\n\n" "${PWD##*/}" - git submodule update --init --remote --rebase --recursive - fi - - # npm - if [ -e package-lock.json ]; then - printf "Updating npm dependencies for %s...\n\n" "${PWD##*/}" - npm update - npm outdated - fi - - # Go - if [ -e go.mod ]; then - printf "Updating Go dependencies for %s...\n\n" "${PWD##*/}" - go get -t -u ./... - go mod tidy - fi - - # Rust - if [ -e Cargo.toml ]; then - printf "Updating Cargo dependencies for %s...\n\n" "${PWD##*/}" - cargo update - fi - - # Python - if [ -e poetry.lock ]; then - printf "Updating Python dependencies for %s...\n\n" "${PWD##*/}" - poetry update - poetry show --outdated - fi - - # Terraform - if [ -e .terraform.lock.hcl ]; then - printf "Updating Terraform dependencies for %s...\n\n" "${PWD##*/}" - terraform init -upgrade - fi -} diff --git a/system/bluetooth.nix b/system/bluetooth.nix new file mode 100644 index 0000000..0544450 --- /dev/null +++ b/system/bluetooth.nix @@ -0,0 +1,6 @@ +{ + hardware.bluetooth = { + enable = true; + powerOnBoot = false; + }; +} diff --git a/system/default.nix b/system/default.nix index cb68e25..58cb8c6 100644 --- a/system/default.nix +++ b/system/default.nix @@ -1,20 +1,14 @@ { pkgs, ... }: { - # Import hardware specific configuration imports = [ ./hardware-configuration.nix ./secure-boot.nix ./encryption.nix ./sound.nix + ./bluetooth.nix ]; - # Bluetooth - hardware.bluetooth = { - enable = true; - powerOnBoot = false; - }; - # Network manager networking.networkmanager.enable = true; @@ -35,7 +29,7 @@ description = "Lena"; isNormalUser = true; extraGroups = [ "wheel" "networkmanager" ]; - password = "changeme"; + initialPassword = "changeme"; }; users.defaultUserShell = pkgs.zsh; @@ -46,6 +40,7 @@ nix.gc = { automatic = true; dates = "weekly"; + options = "--delete-older-than 30d"; }; # Allow unfree packages @@ -53,32 +48,17 @@ # System packages environment.systemPackages = with pkgs; [ - curl - gcc - gnumake home-manager sbctl - unzip - wget - zip ]; - # Window manager - programs.hyprland.enable = true; - environment.sessionVariables.NIXOS_OZONE_WL = "1"; programs = { - # ZSH - zsh.enable = true; + # Window manager + hyprland.enable = true; - # Git - git.enable = true; - - # Process viewer - htop.enable = true; - - # Terminal multiplexer - tmux.enable = true; + # Shell + zsh.enable = true; # Gaming steam.enable = true; diff --git a/system/hardware-configuration.nix b/system/hardware-configuration.nix index 0b8b41d..3470396 100644 --- a/system/hardware-configuration.nix +++ b/system/hardware-configuration.nix @@ -29,7 +29,7 @@ }; swapDevices = - [{ device = "/dev/disk/by-uuid/598c997a-f989-4c93-bf3b-0e8eaa6908d6"; }]; + [{ device = "/dev/disk/by-label/swap"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's From c715084216183809a473ca522f6e311fb8fdf57f Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Wed, 2 Aug 2023 18:31:55 +0200 Subject: [PATCH 12/29] Clean up terminal setup --- flake.lock | 12 ++++---- home/editor.nix | 3 ++ home/terminal.nix | 65 ++++++++++++++++++++--------------------- home/tools.nix | 2 -- home/window-manager.nix | 3 +- system/default.nix | 8 ++++- 6 files changed, 49 insertions(+), 44 deletions(-) diff --git a/flake.lock b/flake.lock index fbfbb53..222099c 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1690982105, - "narHash": "sha256-32AzoLuwhtxBItcULRiCnxRfJcbVXbPZSH9TDVg21mU=", + "lastModified": 1691506824, + "narHash": "sha256-Z2Ms7036CCEAfCmDBDy+sFauO6/7fx2UN3aoPCpp4tA=", "owner": "nix-community", "repo": "home-manager", - "rev": "b2ac1d2c32ac11b8d231d23622cdc4b2f28d07d2", + "rev": "7b8d43fbaf8450c30caaed5eab876897d0af891b", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1690881714, - "narHash": "sha256-h/nXluEqdiQHs1oSgkOOWF+j8gcJMWhwnZ9PFabN6q0=", + "lastModified": 1691368598, + "narHash": "sha256-ia7li22keBBbj02tEdqjVeLtc7ZlSBuhUk+7XTUFr14=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9e1960bc196baf6881340d53dccb203a951745a2", + "rev": "5a8e9243812ba528000995b294292d3b5e120947", "type": "github" }, "original": { diff --git a/home/editor.nix b/home/editor.nix index a6454ee..0526cc0 100644 --- a/home/editor.nix +++ b/home/editor.nix @@ -50,5 +50,8 @@ # Debuggers delve lldb + + # Formatters + rustfmt ]; } diff --git a/home/terminal.nix b/home/terminal.nix index c926087..b0fc207 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -1,13 +1,8 @@ { config, pkgs, ... }: { - home.sessionVariables = { - TERMINAL = "${pkgs.alacritty}/bin/alacritty"; - BROWSER = "${pkgs.brave}/bin/brave"; - }; - home.shellAliases = { - e = "$EDITOR"; + e = "${pkgs.helix}/bin/hx"; f = "${pkgs.joshuto}/bin/joshuto"; g = "${pkgs.gitui}/bin/gitui"; t = "${pkgs.taskwarrior}/bin/task"; @@ -25,8 +20,6 @@ x = 5; y = 5; }; - decorations = "none"; - startup_mode = "Maximized"; }; font = { normal.family = "FiraCode Nerd Font"; @@ -65,12 +58,41 @@ }; }; + # Shell + zsh = { + enable = true; + enableAutosuggestions = true; + syntaxHighlighting.enable = true; + defaultKeymap = "viins"; + history.ignoreAllDups = true; + historySubstringSearch = { + enable = true; + searchDownKey = "^N"; + searchUpKey = "^P"; + }; + loginExtra = '' + # Start window manager + if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then + exec ${pkgs.hyprland}/bin/Hyprland + fi + ''; + initExtra = '' + HISTORY_SUBSTRING_SEARCH_PREFIXED=true + source ${config.xdg.configHome}/zsh/* + if [[ $(tty) != /dev/tty[0-9] ]]; then + if [ -z "$TMUX" ]; then + exec ${pkgs.tmux}/bin/tmux || exit + fi + ${pkgs.krabby}/bin/krabby random 1 --no-title + fi + ''; + }; + # Terminal multiplexer tmux = { enable = true; keyMode = "vi"; escapeTime = 10; - customPaneNavigationAndResize = true; terminal = "tmux-256color"; extraConfig = '' # Set correct terminal @@ -97,31 +119,6 @@ ''; }; - # Shell - zsh = { - enable = true; - enableAutosuggestions = true; - syntaxHighlighting.enable = true; - defaultKeymap = "viins"; - historySubstringSearch = { - enable = true; - searchDownKey = "^N"; - searchUpKey = "^P"; - }; - initExtra = '' - setopt HIST_IGNORE_ALL_DUPS - HISTORY_SUBSTRING_SEARCH_PREFIXED=true - source ${config.xdg.configHome}/zsh/* - [[ -z "$TMUX" && $(tty) != /dev/tty[0-9] ]] && { ${pkgs.tmux}/bin/tmux || exec ${pkgs.tmux}/bin/tmux new-session && exit } - ''; - loginExtra = '' - # Start window manager - if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then - exec ${pkgs.hyprland}/bin/Hyprland - fi - ''; - }; - # Shell prompt starship = { enable = true; diff --git a/home/tools.nix b/home/tools.nix index a331e8f..96f2dd7 100644 --- a/home/tools.nix +++ b/home/tools.nix @@ -119,7 +119,6 @@ python3 quickemu realvnc-vnc-viewer - rustc shellcheck signal-desktop termshark @@ -130,7 +129,6 @@ unzip wget whois - wine wl-clipboard yq zip diff --git a/home/window-manager.nix b/home/window-manager.nix index f213c33..99356f3 100644 --- a/home/window-manager.nix +++ b/home/window-manager.nix @@ -38,6 +38,7 @@ force_split = 2; no_gaps_when_only = true; }; + monitor = "eDP-1,preferred,auto,1.5"; exec-once = [ "${pkgs.waybar}/bin/waybar" "${pkgs.gammastep}/bin/gammastep" @@ -54,7 +55,7 @@ # Shortcuts "$mainMod, Space, exec, $launcherCmd" - "$mainMod, Return, exec, $TERMINAL" + "$mainMod, Return, exec, ${pkgs.alacritty}/bin/alacritty" "$mainMod, W, exec, ${pkgs.brave}/bin/brave" "$mainMod, V, exec, ${pkgs.clipman}/bin/clipman pick --tool wofi" "SUPER_CTRL, Q, exec, $lockCmd" diff --git a/system/default.nix b/system/default.nix index 58cb8c6..09c69b6 100644 --- a/system/default.nix +++ b/system/default.nix @@ -9,7 +9,13 @@ ./bluetooth.nix ]; - # Network manager + # Bootloader + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + # Networking networking.networkmanager.enable = true; # Time zone From 1d6358d4ca630519f6559e8db21bf0c3a14b5e61 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Tue, 8 Aug 2023 19:14:17 +0200 Subject: [PATCH 13/29] Add diff outputs for switching --- .github/workflows/main.yml | 14 ++++++++++++++ flake.lock | 12 ++++++------ home/default.nix | 1 + home/editor.nix | 2 +- home/terminal.nix | 22 ++++++++++++++-------- home/tools.nix | 19 +++++-------------- home/upgrade-diff.nix | 7 +++++++ system/default.nix | 4 ++-- system/upgrade-diff.nix | 10 ++++++++++ 9 files changed, 60 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/main.yml create mode 100644 home/upgrade-diff.nix create mode 100644 system/upgrade-diff.nix diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..9fe64b0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,14 @@ +name: Validate + +on: + pull_request: + push: + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 + - run: nix run nixpkgs#nixpkgs-fmt -- --check . + - run: nix flake check diff --git a/flake.lock b/flake.lock index 222099c..23e1341 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1691506824, - "narHash": "sha256-Z2Ms7036CCEAfCmDBDy+sFauO6/7fx2UN3aoPCpp4tA=", + "lastModified": 1694643239, + "narHash": "sha256-pv2k/5FvyirDE8g4TNehzwZ0T4UOMMmqWSQnM/luRtE=", "owner": "nix-community", "repo": "home-manager", - "rev": "7b8d43fbaf8450c30caaed5eab876897d0af891b", + "rev": "d9b88b43524db1591fb3d9410a21428198d75d49", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1691368598, - "narHash": "sha256-ia7li22keBBbj02tEdqjVeLtc7ZlSBuhUk+7XTUFr14=", + "lastModified": 1694767346, + "narHash": "sha256-5uH27SiVFUwsTsqC5rs3kS7pBoNhtoy9QfTP9BmknGk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5a8e9243812ba528000995b294292d3b5e120947", + "rev": "ace5093e36ab1e95cb9463863491bee90d5a4183", "type": "github" }, "original": { diff --git a/home/default.nix b/home/default.nix index d49bc96..847d45d 100644 --- a/home/default.nix +++ b/home/default.nix @@ -7,6 +7,7 @@ ./editor.nix ./file-manager.nix ./tools.nix + ./upgrade-diff.nix ]; nixpkgs.config.allowUnfree = true; diff --git a/home/editor.nix b/home/editor.nix index 0526cc0..2390d01 100644 --- a/home/editor.nix +++ b/home/editor.nix @@ -17,7 +17,7 @@ language = [ { name = "bash"; auto-format = true; formatter = { command = "${pkgs.shfmt}/bin/shfmt"; }; } { name = "css"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "css" ]; }; } - { name = "go"; config = { formatting.gofumpt = true; }; } + { name = "go"; config = { "formatting.gofumpt" = true; }; } { name = "html"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "html" ]; }; } { name = "javascript"; auto-format = true; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "typescript" ]; }; } { name = "json"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "json" ]; }; } diff --git a/home/terminal.nix b/home/terminal.nix index b0fc207..b1fc9c4 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -64,12 +64,19 @@ enableAutosuggestions = true; syntaxHighlighting.enable = true; defaultKeymap = "viins"; + completionInit = '' + autoload -Uz compinit && compinit + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' + ''; history.ignoreAllDups = true; historySubstringSearch = { enable = true; searchDownKey = "^N"; searchUpKey = "^P"; }; + localVariables = { + HISTORY_SUBSTRING_SEARCH_PREFIXED = "true"; + }; loginExtra = '' # Start window manager if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then @@ -77,13 +84,12 @@ fi ''; initExtra = '' - HISTORY_SUBSTRING_SEARCH_PREFIXED=true source ${config.xdg.configHome}/zsh/* if [[ $(tty) != /dev/tty[0-9] ]]; then if [ -z "$TMUX" ]; then exec ${pkgs.tmux}/bin/tmux || exit fi - ${pkgs.krabby}/bin/krabby random 1 --no-title + ${pkgs.krabby}/bin/krabby random 1 --no-title --padding-left 1 fi ''; }; @@ -102,6 +108,12 @@ bind '"' split-window -v -c '#{pane_current_path}' bind % split-window -h -c '#{pane_current_path}' + # Unclutter status bar + set-option -g status-right "" + set-option -g status-left "" + set-window-option -g window-status-format " #I: #W " + set-window-option -g window-status-current-format " #I: #W " + # Color scheme set-option -g status-style 'fg=#414868' set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' @@ -110,12 +122,6 @@ set-option -g pane-border-style 'fg=#3b4261' set-option -g pane-active-border-style 'fg=#3b4261' set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' - - # Unclutter status bar - set-option -g status-right "" - set-option -g status-left "" - set-window-option -g window-status-format " #I: #W " - set-window-option -g window-status-current-format " #I: #W " ''; }; diff --git a/home/tools.nix b/home/tools.nix index 96f2dd7..7d7a0bb 100644 --- a/home/tools.nix +++ b/home/tools.nix @@ -43,19 +43,7 @@ tmate.enable = true; # Task management - taskwarrior = { - enable = true; - config = { - taskd = { - certificate = "${config.xdg.configHome}/task/private.certificate.pem"; - key = "${config.xdg.configHome}/task/private.key.pem"; - ca = "${config.xdg.configHome}/task/ca.cert.pem"; - server = "inthe.am:53589"; - credentials = "inthe_am/lena/c214a5a3-b0b2-4132-958c-ebef8d83fd25"; - trust = "strict"; - }; - }; - }; + taskwarrior.enable = true; # Media player mpv.enable = true; @@ -104,12 +92,13 @@ jpegoptim kubectl kubectx - libreoffice-fresh + libreoffice libwebp lolcat lutris moq ncdu + ncpamixer nmap nodejs nodePackages.svgo @@ -119,8 +108,10 @@ python3 quickemu realvnc-vnc-viewer + rustc shellcheck signal-desktop + slides termshark terraform tflint diff --git a/home/upgrade-diff.nix b/home/upgrade-diff.nix new file mode 100644 index 0000000..3c76dc5 --- /dev/null +++ b/home/upgrade-diff.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.activation.report-changes = config.lib.dag.entryAnywhere '' + ${pkgs.nix}/bin/nix store diff-closures "$oldGenPath" "$newGenPath" + ''; +} diff --git a/system/default.nix b/system/default.nix index 09c69b6..36f1fc5 100644 --- a/system/default.nix +++ b/system/default.nix @@ -7,6 +7,7 @@ ./encryption.nix ./sound.nix ./bluetooth.nix + ./upgrade-diff.nix ]; # Bootloader @@ -32,8 +33,8 @@ # Users users.users.lena = { - description = "Lena"; isNormalUser = true; + description = "Lena"; extraGroups = [ "wheel" "networkmanager" ]; initialPassword = "changeme"; }; @@ -58,7 +59,6 @@ sbctl ]; - programs = { # Window manager hyprland.enable = true; diff --git a/system/upgrade-diff.nix b/system/upgrade-diff.nix new file mode 100644 index 0000000..5618be2 --- /dev/null +++ b/system/upgrade-diff.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + system.activationScripts.diff = { + supportsDryActivation = true; + text = '' + ${pkgs.nix}/bin/nix store diff-closures /run/current-system "$systemConfig" + ''; + }; +} From 459e3a1050f5a496451e18fee0f38bd294d2f8fb Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Mon, 18 Sep 2023 13:08:16 +0200 Subject: [PATCH 14/29] Use broot as file manager --- flake.lock | 12 +++--- home/default.nix | 1 - home/file-manager.nix | 86 ------------------------------------------- home/terminal.nix | 3 +- home/tools.nix | 18 +++++++++ system/bluetooth.nix | 6 --- system/default.nix | 25 +++++++++++-- system/encryption.nix | 11 ------ system/sound.nix | 7 ---- 9 files changed, 48 insertions(+), 121 deletions(-) delete mode 100644 home/file-manager.nix delete mode 100644 system/bluetooth.nix delete mode 100644 system/encryption.nix delete mode 100644 system/sound.nix diff --git a/flake.lock b/flake.lock index 23e1341..326cbdc 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1694643239, - "narHash": "sha256-pv2k/5FvyirDE8g4TNehzwZ0T4UOMMmqWSQnM/luRtE=", + "lastModified": 1695738267, + "narHash": "sha256-LTNAbTQ96xSj17xBfsFrFS9i56U2BMLpD0BduhrsVkU=", "owner": "nix-community", "repo": "home-manager", - "rev": "d9b88b43524db1591fb3d9410a21428198d75d49", + "rev": "0f4e5b4999fd6a42ece5da8a3a2439a50e48e486", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1694767346, - "narHash": "sha256-5uH27SiVFUwsTsqC5rs3kS7pBoNhtoy9QfTP9BmknGk=", + "lastModified": 1695644571, + "narHash": "sha256-asS9dCCdlt1lPq0DLwkVBbVoEKuEuz+Zi3DG7pR/RxA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ace5093e36ab1e95cb9463863491bee90d5a4183", + "rev": "6500b4580c2a1f3d0f980d32d285739d8e156d92", "type": "github" }, "original": { diff --git a/home/default.nix b/home/default.nix index 847d45d..6303355 100644 --- a/home/default.nix +++ b/home/default.nix @@ -5,7 +5,6 @@ ./window-manager.nix ./terminal.nix ./editor.nix - ./file-manager.nix ./tools.nix ./upgrade-diff.nix ]; diff --git a/home/file-manager.nix b/home/file-manager.nix deleted file mode 100644 index 05f8a5c..0000000 --- a/home/file-manager.nix +++ /dev/null @@ -1,86 +0,0 @@ -{ pkgs, ... }: - -{ - programs.joshuto = { - enable = true; - settings = { - preview.preview_script = pkgs.writeShellScript "joshuto-preview" '' - IFS=$'\n' - - # Security measures: - # * noclobber prevents you from overwriting a file with `>` - # * noglob prevents expansion of wild cards - # * nounset causes bash to fail if an undeclared variable is used (e.g. typos) - # * pipefail causes a pipeline to fail also if a command other than the last one fails - set -o noclobber -o noglob -o nounset -o pipefail - - file_path="" - preview_width=10 - preview_height=10 - - while [ "$#" -gt 0 ]; do - case "$1" in - "--path") - shift - file_path="$1" - ;; - "--preview-width") - shift - preview_width="$1" - ;; - "--preview-height") - shift - preview_height="$1" - ;; - esac - shift - done - - handle_extension() { - case "$file_extension_lower" in - ## Archive - zip) - ## Avoid password prompt by providing empty password - ${pkgs.unzip}/bin/unzip -l "$file_path" && exit 0 - exit 1 - ;; - - ## PDF - pdf) - ## Preview as text conversion - ${pkgs.poppler_utils}/bin/pdftotext -l 10 -nopgbrk -q -- "$file_path" - | - fmt -w "$preview_width" && exit 0 - exit 1 - ;; - esac - } - - handle_mime() { - local mimetype="$1" - - case "$mimetype" in - ## Text - text/* | */xml | */json | */yaml) - cat "$file_path" && exit 0 - exit 1 - ;; - - ## Image - image/*) - ${pkgs.chafa}/bin/chafa --size "''${preview_width}x''${preview_height}" "$file_path" && exit 0 - exit 1 - ;; - esac - } - - file_extension="''${file_path##*.}" - file_extension_lower="$(printf "%s" "$file_extension" | tr '[:upper:]' '[:lower:]')" - handle_extension - mimetype="$(${pkgs.file}/bin/file --dereference --brief --mime-type -- "$file_path")" - handle_mime "$mimetype" - - exit 1 - ''; - }; - }; -} diff --git a/home/terminal.nix b/home/terminal.nix index b1fc9c4..e261c61 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -3,9 +3,10 @@ { home.shellAliases = { e = "${pkgs.helix}/bin/hx"; - f = "${pkgs.joshuto}/bin/joshuto"; + f = "br"; g = "${pkgs.gitui}/bin/gitui"; t = "${pkgs.taskwarrior}/bin/task"; + o = "${pkgs.xdg-utils}/bin/xdg-open"; ".." = "cd .."; "..." = "cd ../.."; }; diff --git a/home/tools.nix b/home/tools.nix index 7d7a0bb..fcdb05c 100644 --- a/home/tools.nix +++ b/home/tools.nix @@ -15,6 +15,14 @@ }; gitui.enable = true; + # File manager + broot = { + enable = true; + settings.verbs = [ + { invocation = "edit"; shortcut = "e"; execution = "$EDITOR {file}:{line}"; } + ]; + }; + # Encryption gpg.enable = true; @@ -121,6 +129,7 @@ wget whois wl-clipboard + xdg-utils yq zip ]; @@ -140,4 +149,13 @@ executable = true; }; }; + xdg.mimeApps = { + enable = true; + defaultApplications = { + "application/pdf" = [ "org.pwmt.zathura.desktop" ]; + "image/png" = [ "imv.desktop" ]; + "image/jpeg" = [ "imv.desktop" ]; + "image/svg" = [ "imv.desktop" ]; + }; + }; } diff --git a/system/bluetooth.nix b/system/bluetooth.nix deleted file mode 100644 index 0544450..0000000 --- a/system/bluetooth.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - hardware.bluetooth = { - enable = true; - powerOnBoot = false; - }; -} diff --git a/system/default.nix b/system/default.nix index 36f1fc5..4bfdeb6 100644 --- a/system/default.nix +++ b/system/default.nix @@ -4,9 +4,6 @@ imports = [ ./hardware-configuration.nix ./secure-boot.nix - ./encryption.nix - ./sound.nix - ./bluetooth.nix ./upgrade-diff.nix ]; @@ -16,6 +13,15 @@ efi.canTouchEfiVariables = true; }; + # Set up keyfile + boot.initrd.secrets = { + "/crypto_keyfile.bin" = null; + }; + + # Enable swap on luks + boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".device = "/dev/disk/by-uuid/58a9f60d-bf2d-4c94-8f08-8e29a4083728"; + boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".keyFile = "/crypto_keyfile.bin"; + # Networking networking.networkmanager.enable = true; @@ -31,6 +37,19 @@ # Containers virtualisation.podman.enable = true; + # Bluetooth + hardware.bluetooth = { + enable = true; + powerOnBoot = false; + }; + + # Sound + sound.enable = true; + services.pipewire = { + enable = true; + pulse.enable = true; + }; + # Users users.users.lena = { isNormalUser = true; diff --git a/system/encryption.nix b/system/encryption.nix deleted file mode 100644 index e35af2c..0000000 --- a/system/encryption.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - # Set up keyfile - boot.initrd.secrets = { - "/crypto_keyfile.bin" = null; - }; - - # Enable swap on luks - boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".device = "/dev/disk/by-uuid/58a9f60d-bf2d-4c94-8f08-8e29a4083728"; - boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".keyFile = "/crypto_keyfile.bin"; -} - diff --git a/system/sound.nix b/system/sound.nix deleted file mode 100644 index a6bba2f..0000000 --- a/system/sound.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - sound.enable = true; - services.pipewire = { - enable = true; - pulse.enable = true; - }; -} From ad8b5c604ca67616b34ab2f0d03c61569f9a78ae Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Wed, 27 Sep 2023 23:27:18 +0200 Subject: [PATCH 15/29] Switch from wofi to rofi --- home/window-manager.nix | 75 ++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/home/window-manager.nix b/home/window-manager.nix index 99356f3..a59c8d2 100644 --- a/home/window-manager.nix +++ b/home/window-manager.nix @@ -12,7 +12,7 @@ "$wallpaper" = "${config.xdg.dataHome}/wallpapers/bespinian.png"; "$lockCmd" = "${pkgs.swaylock}/bin/swaylock --daemonize"; "$sleepCmd" = "systemctl suspend"; - "$launcherCmd" = "${pkgs.wofi}/bin/wofi --show drun --no-actions --insensitive --prompt 'Run'"; + "$launcherCmd" = "${pkgs.rofi-wayland}/bin/rofi -show drun -show-icons"; general = { border_size = 2; gaps_in = 0; @@ -45,19 +45,20 @@ "${pkgs.swayidle}/bin/swayidle -w timeout 900 '$lockCmd' timeout 1200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' timeout 1800 '$sleepCmd' before-sleep 'playerctl pause' before-sleep '$lockCmd' lock '$lockCmd'" "${pkgs.workstyle}/workstyle &> /tmp/workstyle.log" "${pkgs.swaybg}/bin/swaybg --image $wallpaper --mode fill" - "${pkgs.wl-clipboard}/bin/wl-paste --type text --watch ${pkgs.clipman}/bin/clipman store" + "${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store --max-items 20" ]; bind = [ # Window manager "$mainMod, Tab, focusurgentorlast" - "$mainMod, Q, killactive," + "$mainMod, Q, killactive" "$mainMod, F, fullscreen" # Shortcuts "$mainMod, Space, exec, $launcherCmd" "$mainMod, Return, exec, ${pkgs.alacritty}/bin/alacritty" - "$mainMod, W, exec, ${pkgs.brave}/bin/brave" - "$mainMod, V, exec, ${pkgs.clipman}/bin/clipman pick --tool wofi" + "$mainMod, B, exec, ${pkgs.brave}/bin/brave" + "$mainMod, W, exec, ${pkgs.rofi-wayland}/bin/rofi -show window -show-icons" + "$mainMod, V, exec, ${pkgs.cliphist}/bin/cliphist list | ${pkgs.rofi-wayland}/bin/rofi -dmenu -display-columns 2 | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy" "SUPER_CTRL, Q, exec, $lockCmd" # Media keys @@ -310,32 +311,46 @@ }; # Launcher - wofi = { + rofi = { enable = true; - style = '' - #window { - font-family: "Fira Mono"; - background-color: #1a1b26; - color: #c0caf5; - } - - #input { - border-radius: 0; - border-color: transparent; - padding: 5px; - background-color: #1a1b26; - color: #c0caf5; - } - - #entry { - padding: 5px; - } - - #entry:selected { - outline: none; - background-color: #bb9af7; - } - ''; + package = pkgs.rofi-wayland; + font = "Fira Mono 12"; + theme = + let + inherit (config.lib.formats.rasi) mkLiteral; + in + { + "*" = { + background = mkLiteral "#2e3440"; + background-color = mkLiteral "transparent"; + text-color = mkLiteral "#c0caf5"; + accent-color = mkLiteral "#bb9af7"; + }; + window = { + background-color = mkLiteral "@background"; + }; + inputbar = { + padding = mkLiteral "8px 12px"; + spacing = mkLiteral "8px"; + }; + listview = { + lines = 10; + }; + element = { + padding = mkLiteral "8px"; + spacing = mkLiteral "8px"; + }; + "element normal active" = { + text-color = mkLiteral "@accent-color"; + }; + "element selected" = { + background-color = mkLiteral "@accent-color"; + text-color = mkLiteral "@background"; + }; + element-text = { + text-color = mkLiteral "inherit"; + }; + }; }; # Lock screen manager From 5629b8e4972934458e8137255c35f4492d62a0ac Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Tue, 3 Oct 2023 22:58:14 +0200 Subject: [PATCH 16/29] =?UTF-8?q?=E2=9C=A8=20Switch=20from=20rofi=20to=20f?= =?UTF-8?q?uzzel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 12 ++++--- flake.lock | 12 +++---- flake.nix | 2 ++ home/default.nix | 2 +- home/editor.nix | 1 - home/tools.nix | 52 ++++++++++++++-------------- home/window-manager.nix | 71 +++++++++++++------------------------- home/workstyle/config.toml | 55 ----------------------------- 8 files changed, 67 insertions(+), 140 deletions(-) delete mode 100644 home/workstyle/config.toml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9fe64b0..3947177 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,11 @@ jobs: validate: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v22 - - run: nix run nixpkgs#nixpkgs-fmt -- --check . - - run: nix flake check + - name: Checkout repo + uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v22 + - name: Check formatting + run: nix run nixpkgs#nixpkgs-fmt -- --check . + - name: Check flake + run: nix flake check diff --git a/flake.lock b/flake.lock index 326cbdc..eb9dfbd 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1695738267, - "narHash": "sha256-LTNAbTQ96xSj17xBfsFrFS9i56U2BMLpD0BduhrsVkU=", + "lastModified": 1697611555, + "narHash": "sha256-8nYMduRQfGSQJr2cDMyodsuGlRcJAy0Ko8K4KkjurP8=", "owner": "nix-community", "repo": "home-manager", - "rev": "0f4e5b4999fd6a42ece5da8a3a2439a50e48e486", + "rev": "05649393ac1f34980a5cf6a6e89de77626c9182b", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1695644571, - "narHash": "sha256-asS9dCCdlt1lPq0DLwkVBbVoEKuEuz+Zi3DG7pR/RxA=", + "lastModified": 1697456312, + "narHash": "sha256-roiSnrqb5r+ehnKCauPLugoU8S36KgmWraHgRqVYndo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6500b4580c2a1f3d0f980d32d285739d8e156d92", + "rev": "ca012a02bf8327be9e488546faecae5e05d7d749", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 815dee0..7bdac2c 100644 --- a/flake.nix +++ b/flake.nix @@ -32,5 +32,7 @@ inherit pkgs; modules = [ ./home ]; }; + + formatter.${system} = pkgs.nixpkgs-fmt; }; } diff --git a/home/default.nix b/home/default.nix index 6303355..1891c6e 100644 --- a/home/default.nix +++ b/home/default.nix @@ -10,7 +10,7 @@ ]; nixpkgs.config.allowUnfree = true; - nixpkgs.config.allowUnfreePredicate = pkg: true; + nixpkgs.config.allowUnfreePredicate = _: true; home.username = "lena"; home.homeDirectory = "/home/${config.home.username}"; diff --git a/home/editor.nix b/home/editor.nix index 2390d01..269db0c 100644 --- a/home/editor.nix +++ b/home/editor.nix @@ -33,7 +33,6 @@ home.packages = with pkgs; [ # Language servers - cmake-language-server gopls marksman nil diff --git a/home/tools.nix b/home/tools.nix index fcdb05c..baea922 100644 --- a/home/tools.nix +++ b/home/tools.nix @@ -33,7 +33,7 @@ ripgrep.enable = true; # Process viewer - htop.enable = true; + bottom.enable = true; # Quick navigation zoxide.enable = true; @@ -47,9 +47,6 @@ # PDF viewer zathura.enable = true; - # Share terminal sessions - tmate.enable = true; - # Task management taskwarrior.enable = true; @@ -106,12 +103,12 @@ lutris moq ncdu - ncpamixer nmap nodejs nodePackages.svgo optipng poetry + pulsemixer pwgen python3 quickemu @@ -126,6 +123,7 @@ timewarrior tree unzip + upterm wget whois wl-clipboard @@ -134,28 +132,30 @@ zip ]; - xdg.configFile = { - "gopass/config".text = '' - [core] - notifications = false - showsafecontent = true - [mounts] - path = ${config.home.homeDirectory}/.password-store - ''; - }; - xdg.dataFile = { - "task/hooks/on-modify.timewarrior" = { - source = "${pkgs.timewarrior}/share/doc/timew/ext/on-modify.timewarrior"; - executable = true; + xdg = { + configFile = { + "gopass/config".text = '' + [core] + notifications = false + showsafecontent = true + [mounts] + path = ${config.home.homeDirectory}/.password-store + ''; }; - }; - xdg.mimeApps = { - enable = true; - defaultApplications = { - "application/pdf" = [ "org.pwmt.zathura.desktop" ]; - "image/png" = [ "imv.desktop" ]; - "image/jpeg" = [ "imv.desktop" ]; - "image/svg" = [ "imv.desktop" ]; + dataFile = { + "task/hooks/on-modify.timewarrior" = { + source = "${pkgs.timewarrior}/share/doc/timew/ext/on-modify.timewarrior"; + executable = true; + }; + }; + mimeApps = { + enable = true; + defaultApplications = { + "application/pdf" = [ "org.pwmt.zathura.desktop" ]; + "image/png" = [ "imv.desktop" ]; + "image/jpeg" = [ "imv.desktop" ]; + "image/svg" = [ "imv.desktop" ]; + }; }; }; } diff --git a/home/window-manager.nix b/home/window-manager.nix index a59c8d2..6d82c91 100644 --- a/home/window-manager.nix +++ b/home/window-manager.nix @@ -12,7 +12,7 @@ "$wallpaper" = "${config.xdg.dataHome}/wallpapers/bespinian.png"; "$lockCmd" = "${pkgs.swaylock}/bin/swaylock --daemonize"; "$sleepCmd" = "systemctl suspend"; - "$launcherCmd" = "${pkgs.rofi-wayland}/bin/rofi -show drun -show-icons"; + "$launcherCmd" = "${pkgs.fuzzel}/bin/fuzzel --prompt 'Run '"; general = { border_size = 2; gaps_in = 0; @@ -43,7 +43,6 @@ "${pkgs.waybar}/bin/waybar" "${pkgs.gammastep}/bin/gammastep" "${pkgs.swayidle}/bin/swayidle -w timeout 900 '$lockCmd' timeout 1200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' timeout 1800 '$sleepCmd' before-sleep 'playerctl pause' before-sleep '$lockCmd' lock '$lockCmd'" - "${pkgs.workstyle}/workstyle &> /tmp/workstyle.log" "${pkgs.swaybg}/bin/swaybg --image $wallpaper --mode fill" "${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store --max-items 20" ]; @@ -56,9 +55,8 @@ # Shortcuts "$mainMod, Space, exec, $launcherCmd" "$mainMod, Return, exec, ${pkgs.alacritty}/bin/alacritty" - "$mainMod, B, exec, ${pkgs.brave}/bin/brave" - "$mainMod, W, exec, ${pkgs.rofi-wayland}/bin/rofi -show window -show-icons" - "$mainMod, V, exec, ${pkgs.cliphist}/bin/cliphist list | ${pkgs.rofi-wayland}/bin/rofi -dmenu -display-columns 2 | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy" + "$mainMod, W, exec, ${pkgs.brave}/bin/brave" + "$mainMod, C, exec, ${pkgs.cliphist}/bin/cliphist list | ${pkgs.fuzzel}/bin/fuzzel --dmenu --prompt 'Copy ' | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy" "SUPER_CTRL, Q, exec, $lockCmd" # Media keys @@ -94,6 +92,7 @@ "$mainMod, 8, workspace, 8" "$mainMod, 9, workspace, 9" "$mainMod, 0, togglespecialworkspace" + "$mainMod, N, workspace, empty" # Move active window to workspace "$mainMod SHIFT, 1, movetoworkspace, 1" @@ -311,46 +310,26 @@ }; # Launcher - rofi = { + fuzzel = { enable = true; - package = pkgs.rofi-wayland; - font = "Fira Mono 12"; - theme = - let - inherit (config.lib.formats.rasi) mkLiteral; - in - { - "*" = { - background = mkLiteral "#2e3440"; - background-color = mkLiteral "transparent"; - text-color = mkLiteral "#c0caf5"; - accent-color = mkLiteral "#bb9af7"; - }; - window = { - background-color = mkLiteral "@background"; - }; - inputbar = { - padding = mkLiteral "8px 12px"; - spacing = mkLiteral "8px"; - }; - listview = { - lines = 10; - }; - element = { - padding = mkLiteral "8px"; - spacing = mkLiteral "8px"; - }; - "element normal active" = { - text-color = mkLiteral "@accent-color"; - }; - "element selected" = { - background-color = mkLiteral "@accent-color"; - text-color = mkLiteral "@background"; - }; - element-text = { - text-color = mkLiteral "inherit"; - }; + settings = { + main = { + width = 70; + horizontal-pad = 10; + vertical-pad = 10; + inner-pad = 10; + line-height = 25; }; + colors = { + background = "1a1b26ff"; + text = "c0caf5ff"; + match = "ffffffff"; + selection = "bb9af7ff"; + selection-text = "ffffffff"; + selection-match = "1a1b26ff"; + }; + border.radius = 0; + }; }; # Lock screen manager @@ -366,7 +345,7 @@ # Notification daemon mako = { enable = true; - font = "Fira Mono 9"; + font = "FiraCode Nerd Font 9"; backgroundColor = "#1a1b26"; textColor = "#c0caf5"; borderColor = "#bb9af7"; @@ -382,12 +361,10 @@ }; # Fonts + fonts.fontconfig.enable = true; home.packages = with pkgs; [ - fira-mono lato (nerdfonts.override { fonts = [ "FiraCode" ]; }) - noto-fonts-cjk - noto-fonts-emoji ]; # Wallpaper diff --git a/home/workstyle/config.toml b/home/workstyle/config.toml deleted file mode 100644 index 480ee11..0000000 --- a/home/workstyle/config.toml +++ /dev/null @@ -1,55 +0,0 @@ -# Config for workstyle -# -# Format: -# "pattern" = "icon" -# -# The pattern will be used to match against the application name, class_id or WM_CLASS. -# The icon will be used to represent that application. -# -# Note if multiple patterns are present in the same application name, -# precedence is given in order of apparition in this file. - -# Apps -"alacritty" = "" -"blender" = "󰂫" -"calendar" = "󰃭" -"gimp" = "󱇤" -"imv" = "󰥶" -"inkscape" = "󰕙" -"kde connect" = "󰄜" -"krita" = "󰃣" -"libreoffice calc" = "󱀭" -"libreoffice impress" = "󱀵" -"libreoffice writer" = "󱀾" -"libreoffice" = "󱀲" -"mail" = "󰇰" -"mpv" = "󰐋" -"pinentry" = "󰌆" -"qemu" = "󰹑" -"signal" = "󰻞" -"slack" = "󰒱" -"spotify" = "󰓇" -"steam" = "󰓓" -"thunderbird" = "󰇰" -"zathura" = "󰈦" - -# Websites -"discord" = "󰙯" -"feeds" = "" -"github" = "󰊤" -"gitlab" = "󰮠" -"linkedin" = "󰌻" -"mastodon" = "󰫑" -"pinterest" = "󰐇" -"reddit" = "󰑍" -"twitter" = "󰕄" -"youtube" = "󰗃" - -# Browsers -"brave" = "󰊯" -"chromium" = "󰊯" -"firefox" = "󰈹" - -[other] -fallback_icon = "󰘔" -deduplicate_icons = true From 02df3a64bff623d7f644482eede41368806266bf Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Wed, 18 Oct 2023 11:02:42 +0200 Subject: [PATCH 17/29] Prefer emoji over nerd font icons --- flake.lock | 12 ++++++------ home/terminal.nix | 8 ++++---- home/tools.nix | 3 ++- home/window-manager.nix | 23 ++++++++++++++++++++--- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index eb9dfbd..bd85920 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1697611555, - "narHash": "sha256-8nYMduRQfGSQJr2cDMyodsuGlRcJAy0Ko8K4KkjurP8=", + "lastModified": 1698162493, + "narHash": "sha256-Zehw3cWiTXGGlDDjzTgIX1BhWG+049D/RcSMAiypAcM=", "owner": "nix-community", "repo": "home-manager", - "rev": "05649393ac1f34980a5cf6a6e89de77626c9182b", + "rev": "14b54157201fd574b0fa1b3ce7394c9d3a87fbc1", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697456312, - "narHash": "sha256-roiSnrqb5r+ehnKCauPLugoU8S36KgmWraHgRqVYndo=", + "lastModified": 1697723726, + "narHash": "sha256-SaTWPkI8a5xSHX/rrKzUe+/uVNy6zCGMXgoeMb7T9rg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ca012a02bf8327be9e488546faecae5e05d7d749", + "rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0", "type": "github" }, "original": { diff --git a/home/terminal.nix b/home/terminal.nix index e261c61..b7d4faa 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -23,7 +23,7 @@ }; }; font = { - normal.family = "FiraCode Nerd Font"; + normal.family = "Fira Code"; size = 12; }; colors = { @@ -245,10 +245,10 @@ poetry show --outdated fi - # Terraform + # OpenTofu if [ -e .terraform.lock.hcl ]; then - printf "Updating Terraform dependencies for %s...\n\n" "''${PWD##*/}" - terraform init -upgrade + printf "Updating OpenTofu dependencies for %s...\n\n" "''${PWD##*/}" + tofu init -upgrade fi } ''; diff --git a/home/tools.nix b/home/tools.nix index baea922..1e364f8 100644 --- a/home/tools.nix +++ b/home/tools.nix @@ -82,6 +82,7 @@ brave cargo chromium + clippy curl diff-so-fancy dig @@ -106,6 +107,7 @@ nmap nodejs nodePackages.svgo + opentofu optipng poetry pulsemixer @@ -118,7 +120,6 @@ signal-desktop slides termshark - terraform tflint timewarrior tree diff --git a/home/window-manager.nix b/home/window-manager.nix index 6d82c91..fb7b2c3 100644 --- a/home/window-manager.nix +++ b/home/window-manager.nix @@ -192,7 +192,7 @@ echo "󰳟 $ready_task" ''; exec-if = "which task"; - interval = 6; + interval = 60; }; "custom/containers" = { exec = pkgs.writeShellScript "waybar-containers" '' @@ -345,7 +345,7 @@ # Notification daemon mako = { enable = true; - font = "FiraCode Nerd Font 9"; + font = "Fira Code 9"; backgroundColor = "#1a1b26"; textColor = "#c0caf5"; borderColor = "#bb9af7"; @@ -363,9 +363,26 @@ # Fonts fonts.fontconfig.enable = true; home.packages = with pkgs; [ + fira-mono + fira-code-nerdfont lato - (nerdfonts.override { fonts = [ "FiraCode" ]; }) ]; + xdg.configFile = { + "fontconfig/conf.d/75-prefer-emoji.conf".text = '' + + + + Prefer color emoji to nerd font icons + + Fira Code + + Noto Color Emoji + FiraCode Nerd Font + + + + ''; + }; # Wallpaper xdg.dataFile = { From b67816115fe0bdacf6e7b24687be25abd09a7dd3 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Wed, 25 Oct 2023 10:10:47 +0200 Subject: [PATCH 18/29] Replace fzf with skim --- flake.lock | 12 ++++++------ home/editor.nix | 2 +- home/terminal.nix | 38 ++++++++++++++++---------------------- home/tools.nix | 2 +- home/window-manager.nix | 1 - 5 files changed, 24 insertions(+), 31 deletions(-) diff --git a/flake.lock b/flake.lock index bd85920..c7a8b93 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1698162493, - "narHash": "sha256-Zehw3cWiTXGGlDDjzTgIX1BhWG+049D/RcSMAiypAcM=", + "lastModified": 1698479159, + "narHash": "sha256-rJHBDwW4LbADEfhkgGHjKGfL2dF44NrlyXdXeZrQahs=", "owner": "nix-community", "repo": "home-manager", - "rev": "14b54157201fd574b0fa1b3ce7394c9d3a87fbc1", + "rev": "f92a54fef4eacdbe86b0a2054054dd58b0e2a2a4", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697723726, - "narHash": "sha256-SaTWPkI8a5xSHX/rrKzUe+/uVNy6zCGMXgoeMb7T9rg=", + "lastModified": 1698318101, + "narHash": "sha256-gUihHt3yPD7bVqg+k/UVHgngyaJ3DMEBchbymBMvK1E=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0", + "rev": "63678e9f3d3afecfeafa0acead6239cdb447574c", "type": "github" }, "original": { diff --git a/home/editor.nix b/home/editor.nix index 269db0c..f59f487 100644 --- a/home/editor.nix +++ b/home/editor.nix @@ -14,10 +14,10 @@ }; }; languages = { + language-server.gopls.config = { "formatting.gofumpt" = true; }; language = [ { name = "bash"; auto-format = true; formatter = { command = "${pkgs.shfmt}/bin/shfmt"; }; } { name = "css"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "css" ]; }; } - { name = "go"; config = { "formatting.gofumpt" = true; }; } { name = "html"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "html" ]; }; } { name = "javascript"; auto-format = true; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "typescript" ]; }; } { name = "json"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "json" ]; }; } diff --git a/home/terminal.nix b/home/terminal.nix index b7d4faa..7324001 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -148,32 +148,26 @@ # Checkout Git branches or tags using fuzzy search fco() { - local tags branches target - tags=$( - ${pkgs.git}/bin/git tag | awk '{print "\x1b[31;1mtag\x1b[m\t" $1}' - ) || return - branches=$( - ${pkgs.git}/bin/git branch --all | grep -v HEAD | - sed "s/.* //" | sed "s#remotes/[^/]*/##" | - sort -u | awk '{print "\x1b[34;1mbranch\x1b[m\t" $1}' - ) || return - target=$( - ( - echo "$tags" - echo "$branches" - ) | - ${pkgs.fzf}/bin/fzf-tmux -l30 -- --no-hscroll --ansi +m -d "\t" -n 2 - ) || return - ${pkgs.git}/bin/git checkout "$(echo "$target" | awk '{print $2}')" + local tags branches target + branches=$( + ${pkgs.git}/bin/git --no-pager branch --all \ + --format="%(if)%(HEAD)%(then)%(else)%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)%1B[0;34;1mbranch%09%1B[m%(refname:short)%(end)%(end)" \ + | sed '/^$/d') || return + tags=$(${pkgs.git}/bin/git --no-pager tag | awk '{print "\x1b[35;1mtag\x1b[m\t" $1}') || return + target=$( + (echo "$branches"; echo "$tags") | + ${pkgs.skim}/bin/sk --no-hscroll --no-multi -n 2 \ + --ansi --preview="git --no-pager log -150 --pretty=format:%s '..{2}'") || return + ${pkgs.git}/bin/git checkout $(awk '{print $2}' <<<"$target" ) } # Kill any process with fuzzy search fkill() { local pid if [ "$UID" != "0" ]; then - pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}') + pid=$(ps -f -u $UID | sed 1d | ${pkgs.skim}/bin/sk -m | awk '{print $2}') else - pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') + pid=$(ps -ef | sed 1d | ${pkgs.skim}/bin/sk -m | awk '{print $2}') fi if [ "x$pid" != "x" ]; then @@ -185,12 +179,12 @@ fshow() { ${pkgs.git}/bin/git log --graph --color=always \ --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | - ${pkgs.fzf}/bin/fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ + ${pkgs.skim}/bin/sk --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ --bind "ctrl-m:execute: (grep -o '[a-f0-9]\{7\}' | head -1 | - xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' + xargs -I % sh -c 'git show --color=always % | less -R') << 'SK-EOF' {} - FZF-EOF" + SK-EOF" } # Update system diff --git a/home/tools.nix b/home/tools.nix index 1e364f8..1492f14 100644 --- a/home/tools.nix +++ b/home/tools.nix @@ -27,7 +27,7 @@ gpg.enable = true; # Fuzzy finder - fzf.enable = true; + skim.enable = true; # Fast grepping ripgrep.enable = true; diff --git a/home/window-manager.nix b/home/window-manager.nix index fb7b2c3..f9c8a3a 100644 --- a/home/window-manager.nix +++ b/home/window-manager.nix @@ -18,7 +18,6 @@ gaps_in = 0; gaps_out = 0; "col.active_border" = "rgb(bb9af7)"; - "col.group_border_active" = "rgb(bb9af7)"; cursor_inactive_timeout = 8; }; input = { From 1709f2d2dde9769e3d369beb1373829d7e937f55 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Mon, 30 Oct 2023 21:20:56 +0100 Subject: [PATCH 19/29] Make language server config more extensible --- flake.lock | 12 ++++++------ home/editor.nix | 4 +++- home/window-manager.nix | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index c7a8b93..60320b2 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1698479159, - "narHash": "sha256-rJHBDwW4LbADEfhkgGHjKGfL2dF44NrlyXdXeZrQahs=", + "lastModified": 1698873617, + "narHash": "sha256-FfGFcfbULwbK1vD+H0rslIOfmy4g8f2hXiPkQG3ZCTk=", "owner": "nix-community", "repo": "home-manager", - "rev": "f92a54fef4eacdbe86b0a2054054dd58b0e2a2a4", + "rev": "48b0a30202516e25d9885525fbb200a045f23f26", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1698318101, - "narHash": "sha256-gUihHt3yPD7bVqg+k/UVHgngyaJ3DMEBchbymBMvK1E=", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63678e9f3d3afecfeafa0acead6239cdb447574c", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", "type": "github" }, "original": { diff --git a/home/editor.nix b/home/editor.nix index f59f487..d7724e6 100644 --- a/home/editor.nix +++ b/home/editor.nix @@ -14,7 +14,9 @@ }; }; languages = { - language-server.gopls.config = { "formatting.gofumpt" = true; }; + language-server = { + gopls = { config."formatting.gofumpt" = true; }; + }; language = [ { name = "bash"; auto-format = true; formatter = { command = "${pkgs.shfmt}/bin/shfmt"; }; } { name = "css"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "css" ]; }; } diff --git a/home/window-manager.nix b/home/window-manager.nix index f9c8a3a..17f5468 100644 --- a/home/window-manager.nix +++ b/home/window-manager.nix @@ -50,6 +50,7 @@ "$mainMod, Tab, focusurgentorlast" "$mainMod, Q, killactive" "$mainMod, F, fullscreen" + "$mainMod, S, togglefloating" # Shortcuts "$mainMod, Space, exec, $launcherCmd" @@ -103,7 +104,7 @@ "$mainMod SHIFT, 7, movetoworkspace, 7" "$mainMod SHIFT, 8, movetoworkspace, 8" "$mainMod SHIFT, 9, movetoworkspace, 9" - "$mainMod SHIFT, 0, movetoworkspace, special" + "$mainMod SHIFT, 0, movetoworkspacesilent, special" ]; bindm = [ "$mainMod, mouse:272, movewindow" From efda3b8ca69b2afd9d1a1d64bb795167d31fe5cb Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:13:55 +0100 Subject: [PATCH 20/29] Revert prioritizing emoji over nerd font --- flake.lock | 12 ++++++------ home/terminal.nix | 2 +- home/window-manager.nix | 18 +----------------- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/flake.lock b/flake.lock index 60320b2..ebea52d 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1698873617, - "narHash": "sha256-FfGFcfbULwbK1vD+H0rslIOfmy4g8f2hXiPkQG3ZCTk=", + "lastModified": 1699783872, + "narHash": "sha256-4zTwLT2LL45Nmo6iwKB3ls3hWodVP9DiSWxki/oewWE=", "owner": "nix-community", "repo": "home-manager", - "rev": "48b0a30202516e25d9885525fbb200a045f23f26", + "rev": "280721186ab75a76537713ec310306f0eba3e407", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1698611440, - "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "lastModified": 1699099776, + "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", "type": "github" }, "original": { diff --git a/home/terminal.nix b/home/terminal.nix index 7324001..97e186d 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -23,7 +23,7 @@ }; }; font = { - normal.family = "Fira Code"; + normal.family = "FiraCode Nerd Font"; size = 12; }; colors = { diff --git a/home/window-manager.nix b/home/window-manager.nix index 17f5468..337e7da 100644 --- a/home/window-manager.nix +++ b/home/window-manager.nix @@ -345,7 +345,7 @@ # Notification daemon mako = { enable = true; - font = "Fira Code 9"; + font = "FiraCode Nerd Font 9"; backgroundColor = "#1a1b26"; textColor = "#c0caf5"; borderColor = "#bb9af7"; @@ -367,22 +367,6 @@ fira-code-nerdfont lato ]; - xdg.configFile = { - "fontconfig/conf.d/75-prefer-emoji.conf".text = '' - - - - Prefer color emoji to nerd font icons - - Fira Code - - Noto Color Emoji - FiraCode Nerd Font - - - - ''; - }; # Wallpaper xdg.dataFile = { From bc36a71de368b07bf2ef4c477bf87597b5b9d986 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:16:03 +0100 Subject: [PATCH 21/29] Update inputs --- flake.lock | 12 ++++++------ home/terminal.nix | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index ebea52d..d04cfbe 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1699783872, - "narHash": "sha256-4zTwLT2LL45Nmo6iwKB3ls3hWodVP9DiSWxki/oewWE=", + "lastModified": 1700087144, + "narHash": "sha256-LJP1RW0hKNWmv2yRhnjkUptMXInKpn/rV6V6ofuZkHU=", "owner": "nix-community", "repo": "home-manager", - "rev": "280721186ab75a76537713ec310306f0eba3e407", + "rev": "ab1459a1fb646c40419c732d05ec0bf2416d4506", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1699099776, - "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", + "lastModified": 1699781429, + "narHash": "sha256-UYefjidASiLORAjIvVsUHG6WBtRhM67kTjEY4XfZOFs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", + "rev": "e44462d6021bfe23dfb24b775cc7c390844f773d", "type": "github" }, "original": { diff --git a/home/terminal.nix b/home/terminal.nix index 97e186d..65a1d9b 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -208,7 +208,7 @@ # Nix flakes if [ -e flake.nix ]; then - printf "Updating Nix flake for %s...\n\n" "''${PWD##*/}" + printf "Updating Nix flake inputs for %s...\n\n" "''${PWD##*/}" nix flake update fi From a8cc2e640d9ed35150e72069f829ecfc235d5fe9 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Sun, 19 Nov 2023 09:27:09 +0100 Subject: [PATCH 22/29] Use fzf instead of skim Skim seems unmaintained --- flake.lock | 12 ++++++------ home/terminal.nix | 15 ++++++++------- home/tools.nix | 3 ++- home/window-manager.nix | 1 + system/default.nix | 2 +- system/secure-boot.nix | 3 +++ 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index d04cfbe..46e42fc 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1700087144, - "narHash": "sha256-LJP1RW0hKNWmv2yRhnjkUptMXInKpn/rV6V6ofuZkHU=", + "lastModified": 1701071203, + "narHash": "sha256-lQywA7QU/vzTdZ1apI0PfgCWNyQobXUYghVrR5zuIeM=", "owner": "nix-community", "repo": "home-manager", - "rev": "ab1459a1fb646c40419c732d05ec0bf2416d4506", + "rev": "db1878f013b52ba5e4034db7c1b63e8d04173a86", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1699781429, - "narHash": "sha256-UYefjidASiLORAjIvVsUHG6WBtRhM67kTjEY4XfZOFs=", + "lastModified": 1700794826, + "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e44462d6021bfe23dfb24b775cc7c390844f773d", + "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8", "type": "github" }, "original": { diff --git a/home/terminal.nix b/home/terminal.nix index 65a1d9b..ad05f02 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -156,18 +156,19 @@ tags=$(${pkgs.git}/bin/git --no-pager tag | awk '{print "\x1b[35;1mtag\x1b[m\t" $1}') || return target=$( (echo "$branches"; echo "$tags") | - ${pkgs.skim}/bin/sk --no-hscroll --no-multi -n 2 \ + ${pkgs.fzf}/bin/fzf --no-hscroll --no-multi -n 2 \ --ansi --preview="git --no-pager log -150 --pretty=format:%s '..{2}'") || return - ${pkgs.git}/bin/git checkout $(awk '{print $2}' <<<"$target" ) + echo "$target" + ${pkgs.git}/bin/git checkout $(awk '{print $2}' <<<"$target" | sed 's/^[^\/]*\///') } # Kill any process with fuzzy search fkill() { local pid if [ "$UID" != "0" ]; then - pid=$(ps -f -u $UID | sed 1d | ${pkgs.skim}/bin/sk -m | awk '{print $2}') + pid=$(ps -f -u $UID | sed 1d | ${pkgs.fzf}/bin/fzf -m | awk '{print $2}') else - pid=$(ps -ef | sed 1d | ${pkgs.skim}/bin/sk -m | awk '{print $2}') + pid=$(ps -ef | sed 1d | ${pkgs.fzf}/bin/fzf -m | awk '{print $2}') fi if [ "x$pid" != "x" ]; then @@ -179,12 +180,12 @@ fshow() { ${pkgs.git}/bin/git log --graph --color=always \ --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | - ${pkgs.skim}/bin/sk --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ + ${pkgs.fzf}/bin/fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ --bind "ctrl-m:execute: (grep -o '[a-f0-9]\{7\}' | head -1 | - xargs -I % sh -c 'git show --color=always % | less -R') << 'SK-EOF' + xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' {} - SK-EOF" + FZF-EOF" } # Update system diff --git a/home/tools.nix b/home/tools.nix index 1492f14..0fbdf2d 100644 --- a/home/tools.nix +++ b/home/tools.nix @@ -27,7 +27,7 @@ gpg.enable = true; # Fuzzy finder - skim.enable = true; + fzf.enable = true; # Fast grepping ripgrep.enable = true; @@ -125,6 +125,7 @@ tree unzip upterm + wf-recorder wget whois wl-clipboard diff --git a/home/window-manager.nix b/home/window-manager.nix index 337e7da..52a64ab 100644 --- a/home/window-manager.nix +++ b/home/window-manager.nix @@ -300,6 +300,7 @@ #custom-updates { color: #bb9af7; font-weight: bold; + padding: 0 15px 0 12px; } #battery.critical { diff --git a/system/default.nix b/system/default.nix index 4bfdeb6..fbe6e65 100644 --- a/system/default.nix +++ b/system/default.nix @@ -74,8 +74,8 @@ # System packages environment.systemPackages = with pkgs; [ + git home-manager - sbctl ]; programs = { diff --git a/system/secure-boot.nix b/system/secure-boot.nix index e31a123..ec3052b 100644 --- a/system/secure-boot.nix +++ b/system/secure-boot.nix @@ -8,4 +8,7 @@ pkiBundle = "/etc/secureboot"; }; }; + environment.systemPackages = with pkgs; [ + sbctl + ]; } From 66469f1a6184fd037657f1b84ad39b47cb1911d3 Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:45:01 +0100 Subject: [PATCH 23/29] Update nixpkgs --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 46e42fc..dd5d221 100644 --- a/flake.lock +++ b/flake.lock @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700794826, - "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=", + "lastModified": 1701068326, + "narHash": "sha256-vmMceA+q6hG1yrjb+MP8T0YFDQIrW3bl45e7z24IEts=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8", + "rev": "8cfef6986adfb599ba379ae53c9f5631ecd2fd9c", "type": "github" }, "original": { From 98e5f8b2a44063f100b58cd79b7546fb9a20bf6f Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Thu, 30 Nov 2023 00:21:06 +0100 Subject: [PATCH 24/29] Upgrade system state version to 23.11 --- flake.lock | 12 ++++++------ system/default.nix | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index dd5d221..85732eb 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1701071203, - "narHash": "sha256-lQywA7QU/vzTdZ1apI0PfgCWNyQobXUYghVrR5zuIeM=", + "lastModified": 1701728041, + "narHash": "sha256-x0pyrI1vC8evVDxCxyO6olOyr4wlFg9+VS3C3p4xFYQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "db1878f013b52ba5e4034db7c1b63e8d04173a86", + "rev": "ac7216918cd65f3824ba7817dea8f22e61221eaf", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1701068326, - "narHash": "sha256-vmMceA+q6hG1yrjb+MP8T0YFDQIrW3bl45e7z24IEts=", + "lastModified": 1701436327, + "narHash": "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8cfef6986adfb599ba379ae53c9f5631ecd2fd9c", + "rev": "91050ea1e57e50388fa87a3302ba12d188ef723a", "type": "github" }, "original": { diff --git a/system/default.nix b/system/default.nix index fbe6e65..9dbeaee 100644 --- a/system/default.nix +++ b/system/default.nix @@ -101,5 +101,5 @@ thermald.enable = true; }; - system.stateVersion = "23.05"; + system.stateVersion = "23.11"; } From c3104149e3ecb6728f17c03ca3cfd1a113853c3f Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Wed, 6 Dec 2023 23:18:29 +0100 Subject: [PATCH 25/29] Update nixpkgs input --- flake.lock | 12 ++++++------ home/default.nix | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 85732eb..3630278 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1701728041, - "narHash": "sha256-x0pyrI1vC8evVDxCxyO6olOyr4wlFg9+VS3C3p4xFYQ=", + "lastModified": 1702203126, + "narHash": "sha256-4BhN2Vji19MzRC7SUfPZGmtZ2WZydQeUk/ogfRBIZMs=", "owner": "nix-community", "repo": "home-manager", - "rev": "ac7216918cd65f3824ba7817dea8f22e61221eaf", + "rev": "defbb9c5857e157703e8fc7cf3c2ceb01cb95883", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1701436327, - "narHash": "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE=", + "lastModified": 1702151865, + "narHash": "sha256-9VAt19t6yQa7pHZLDbil/QctAgVsA66DLnzdRGqDisg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "91050ea1e57e50388fa87a3302ba12d188ef723a", + "rev": "666fc80e7b2afb570462423cb0e1cf1a3a34fedd", "type": "github" }, "original": { diff --git a/home/default.nix b/home/default.nix index 1891c6e..481cb6b 100644 --- a/home/default.nix +++ b/home/default.nix @@ -15,7 +15,7 @@ home.username = "lena"; home.homeDirectory = "/home/${config.home.username}"; - home.stateVersion = "23.05"; + home.stateVersion = "23.11"; # Let Home Manager install and manage itself programs.home-manager.enable = true; From c90fea4c31884b3c8168b5954f306d2d9a98a86b Mon Sep 17 00:00:00 2001 From: Lena Fuhrimann <6780471+cloudlena@users.noreply.github.com> Date: Tue, 12 Dec 2023 10:21:44 +0100 Subject: [PATCH 26/29] Add FS trim for SSDs --- home/terminal.nix | 2 +- system/default.nix | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/home/terminal.nix b/home/terminal.nix index ad05f02..4201cb0 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -140,7 +140,7 @@ # Helper functions xdg.configFile = { - "zsh/functions.zsh".source = pkgs.writeShellScript "waybar-tasks" '' + "zsh/functions.zsh".source = pkgs.writeShellScript "shell-functions" '' # Create a directory and enter it mkcd() { mkdir --parents "$@" && cd "$_" || exit diff --git a/system/default.nix b/system/default.nix index 9dbeaee..41a7963 100644 --- a/system/default.nix +++ b/system/default.nix @@ -99,6 +99,9 @@ # Power optimization auto-cpufreq.enable = true; thermald.enable = true; + + # Periodically trim SSD + fstrim.enable = true; }; system.stateVersion = "23.11"; From a63981d3e1fabf9e122e90ba0cbb3ffd74b84ebd Mon Sep 17 00:00:00 2001 From: Mathis Kretz Date: Tue, 12 Dec 2023 17:15:07 +0100 Subject: [PATCH 27/29] Add changes for my mac --- Makefile | 6 +- flake.lock | 225 ---------------------------------------------- flake.nix | 20 +---- home/default.nix | 14 +-- home/editor.nix | 2 + home/terminal.nix | 14 +-- 6 files changed, 20 insertions(+), 261 deletions(-) diff --git a/Makefile b/Makefile index 7d7e42e..af49e7f 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,6 @@ update: nix flake update -.PHONY: system -system: - sudo nixos-rebuild switch --flake . - .PHONY: home home: - home-manager switch --flake . \ No newline at end of file + home-manager switch --flake . diff --git a/flake.lock b/flake.lock index 3630278..17ba556 100644 --- a/flake.lock +++ b/flake.lock @@ -1,115 +1,5 @@ { "nodes": { - "crane": { - "inputs": { - "flake-compat": [ - "lanzaboote", - "flake-compat" - ], - "flake-utils": [ - "lanzaboote", - "flake-utils" - ], - "nixpkgs": [ - "lanzaboote", - "nixpkgs" - ], - "rust-overlay": [ - "lanzaboote", - "rust-overlay" - ] - }, - "locked": { - "lastModified": 1681177078, - "narHash": "sha256-ZNIjBDou2GOabcpctiQykEQVkI8BDwk7TyvlWlI4myE=", - "owner": "ipetkov", - "repo": "crane", - "rev": "0c9f468ff00576577d83f5019a66c557ede5acf6", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": [ - "lanzaboote", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1680392223, - "narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "lanzaboote", - "pre-commit-hooks-nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -130,33 +20,6 @@ "type": "github" } }, - "lanzaboote": { - "inputs": { - "crane": "crane", - "flake-compat": "flake-compat", - "flake-parts": "flake-parts", - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ], - "pre-commit-hooks-nix": "pre-commit-hooks-nix", - "rust-overlay": "rust-overlay" - }, - "locked": { - "lastModified": 1682802423, - "narHash": "sha256-Fb5TeRTdvUlo/5Yi2d+FC8a6KoRLk2h1VE0/peMhWPs=", - "owner": "nix-community", - "repo": "lanzaboote", - "rev": "64b903ca87d18cef2752c19c098af275c6e51d63", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "v0.3.0", - "repo": "lanzaboote", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1702151865, @@ -173,99 +36,11 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1678872516, - "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "pre-commit-hooks-nix": { - "inputs": { - "flake-compat": [ - "lanzaboote", - "flake-compat" - ], - "flake-utils": [ - "lanzaboote", - "flake-utils" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "lanzaboote", - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1681413034, - "narHash": "sha256-/t7OjNQcNkeWeSq/CFLYVBfm+IEnkjoSm9iKvArnUUI=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "d3de8f69ca88fb6f8b09e5b598be5ac98d28ede5", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "home-manager": "home-manager", - "lanzaboote": "lanzaboote", "nixpkgs": "nixpkgs" } - }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "lanzaboote", - "flake-utils" - ], - "nixpkgs": [ - "lanzaboote", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1682129965, - "narHash": "sha256-1KRPIorEL6pLpJR04FwAqqnt4Tzcm4MqD84yhlD+XSk=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "2c417c0460b788328220120c698630947547ee83", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 7bdac2c..bbf0517 100644 --- a/flake.nix +++ b/flake.nix @@ -1,34 +1,22 @@ { - description = "System configuration of CloudLena"; + description = "System configuration of mkretz"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - lanzaboote = { - url = "github:nix-community/lanzaboote/v0.3.0"; - inputs.nixpkgs.follows = "nixpkgs"; - }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { nixpkgs, lanzaboote, home-manager, ... }: + outputs = { nixpkgs, home-manager, ... }: let - system = "x86_64-linux"; + system = "x86_64-darwin"; pkgs = import nixpkgs { inherit system; }; in { - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { - inherit system; - modules = [ - lanzaboote.nixosModules.lanzaboote - ./system - ]; - }; - - homeConfigurations.lena = home-manager.lib.homeManagerConfiguration { + homeConfigurations.mathiskretz = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ ./home ]; }; diff --git a/home/default.nix b/home/default.nix index 481cb6b..2946e3f 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,19 +1,23 @@ -{ config, ... }: +{ config, pkgs, ... }: { imports = [ - ./window-manager.nix ./terminal.nix ./editor.nix - ./tools.nix + # ./tools.nix ./upgrade-diff.nix ]; + nix = { + package = pkgs.nix; + settings.experimental-features = [ "nix-command" "flakes" ]; + }; + nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfreePredicate = _: true; - home.username = "lena"; - home.homeDirectory = "/home/${config.home.username}"; + home.username = "mathiskretz"; + home.homeDirectory = "/Users/${config.home.username}"; home.stateVersion = "23.11"; diff --git a/home/editor.nix b/home/editor.nix index d7724e6..cf0f31a 100644 --- a/home/editor.nix +++ b/home/editor.nix @@ -19,6 +19,7 @@ }; language = [ { name = "bash"; auto-format = true; formatter = { command = "${pkgs.shfmt}/bin/shfmt"; }; } + { name = "c-sharp"; auto-format = true; } { name = "css"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "css" ]; }; } { name = "html"; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "html" ]; }; } { name = "javascript"; auto-format = true; formatter = { command = "${pkgs.nodePackages.prettier}/bin/prettier"; args = [ "--parser" "typescript" ]; }; } @@ -43,6 +44,7 @@ nodePackages.svelte-language-server nodePackages.typescript-language-server nodePackages.yaml-language-server + omnisharp-roslyn python311Packages.python-lsp-server rust-analyzer terraform-ls diff --git a/home/terminal.nix b/home/terminal.nix index 4201cb0..19d8d86 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -6,7 +6,7 @@ f = "br"; g = "${pkgs.gitui}/bin/gitui"; t = "${pkgs.taskwarrior}/bin/task"; - o = "${pkgs.xdg-utils}/bin/xdg-open"; + o = "open"; ".." = "cd .."; "..." = "cd ../.."; }; @@ -78,12 +78,6 @@ localVariables = { HISTORY_SUBSTRING_SEARCH_PREFIXED = "true"; }; - loginExtra = '' - # Start window manager - if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then - exec ${pkgs.hyprland}/bin/Hyprland - fi - ''; initExtra = '' source ${config.xdg.configHome}/zsh/* if [[ $(tty) != /dev/tty[0-9] ]]; then @@ -123,6 +117,9 @@ set-option -g pane-border-style 'fg=#3b4261' set-option -g pane-active-border-style 'fg=#3b4261' set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' + + # https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard + set-option -g default-command "reattach-to-user-namespace -l $SHELL" ''; }; @@ -192,11 +189,8 @@ pacu() { pushd ${config.home.homeDirectory}/.nixfiles ${pkgs.gnumake}/bin/make update - ${pkgs.gnumake}/bin/make system ${pkgs.gnumake}/bin/make home popd - ${pkgs.fwupd}/bin/fwupdmgr refresh - ${pkgs.fwupd}/bin/fwupdmgr update } # Update project dependencies From 1a00d4d641acdcb1d873ae826d0fe9b3ad229de4 Mon Sep 17 00:00:00 2001 From: Mathis Kretz Date: Fri, 22 Mar 2024 16:46:44 +0100 Subject: [PATCH 28/29] Add initial macos config --- flake.lock | 12 ++-- home/default.nix | 1 + home/editor.nix | 1 + home/fonts.nix | 9 +++ home/terminal.nix | 62 ++++++++--------- home/tools.nix | 36 +--------- system/default.nix | 108 ------------------------------ system/hardware-configuration.nix | 44 ------------ system/secure-boot.nix | 14 ---- system/upgrade-diff.nix | 10 --- 10 files changed, 48 insertions(+), 249 deletions(-) create mode 100644 home/fonts.nix delete mode 100644 system/default.nix delete mode 100644 system/hardware-configuration.nix delete mode 100644 system/secure-boot.nix delete mode 100644 system/upgrade-diff.nix diff --git a/flake.lock b/flake.lock index 17ba556..021cb88 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1702203126, - "narHash": "sha256-4BhN2Vji19MzRC7SUfPZGmtZ2WZydQeUk/ogfRBIZMs=", + "lastModified": 1710401383, + "narHash": "sha256-jskq7uDpKXrRoY4hDpNqykmSSKHUXYlo7ZFc/se7fus=", "owner": "nix-community", "repo": "home-manager", - "rev": "defbb9c5857e157703e8fc7cf3c2ceb01cb95883", + "rev": "1ab3cec3a1bbb065b2d52b913d1431366028d5b5", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1702151865, - "narHash": "sha256-9VAt19t6yQa7pHZLDbil/QctAgVsA66DLnzdRGqDisg=", + "lastModified": 1710272261, + "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "666fc80e7b2afb570462423cb0e1cf1a3a34fedd", + "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", "type": "github" }, "original": { diff --git a/home/default.nix b/home/default.nix index 2946e3f..eb52e0f 100644 --- a/home/default.nix +++ b/home/default.nix @@ -2,6 +2,7 @@ { imports = [ + ./fonts.nix ./terminal.nix ./editor.nix # ./tools.nix diff --git a/home/editor.nix b/home/editor.nix index cf0f31a..1f3dfca 100644 --- a/home/editor.nix +++ b/home/editor.nix @@ -44,6 +44,7 @@ nodePackages.svelte-language-server nodePackages.typescript-language-server nodePackages.yaml-language-server + dotnet-sdk_7 omnisharp-roslyn python311Packages.python-lsp-server rust-analyzer diff --git a/home/fonts.nix b/home/fonts.nix new file mode 100644 index 0000000..92c0ce1 --- /dev/null +++ b/home/fonts.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +{ + home.packages = with pkgs; [ + fira-mono + fira-code-nerdfont + lato + ]; +} diff --git a/home/terminal.nix b/home/terminal.nix index 19d8d86..8e5651e 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -17,6 +17,7 @@ enable = true; settings = { window = { + decorations = "None"; padding = { x = 5; y = 5; @@ -70,14 +71,7 @@ zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' ''; history.ignoreAllDups = true; - historySubstringSearch = { - enable = true; - searchDownKey = "^N"; - searchUpKey = "^P"; - }; - localVariables = { - HISTORY_SUBSTRING_SEARCH_PREFIXED = "true"; - }; + historySubstringSearch.enable = true; initExtra = '' source ${config.xdg.configHome}/zsh/* if [[ $(tty) != /dev/tty[0-9] ]]; then @@ -96,30 +90,30 @@ escapeTime = 10; terminal = "tmux-256color"; extraConfig = '' - # Set correct terminal - set-option -sa terminal-features ',alacritty:RGB' - - # Open new splits from current directory - bind '"' split-window -v -c '#{pane_current_path}' - bind % split-window -h -c '#{pane_current_path}' - - # Unclutter status bar - set-option -g status-right "" - set-option -g status-left "" - set-window-option -g window-status-format " #I: #W " - set-window-option -g window-status-current-format " #I: #W " - - # Color scheme - set-option -g status-style 'fg=#414868' - set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' - set-option -g mode-style 'fg=#7aa2f7,bg=#3b4261' - set-option -g message-style 'fg=#7aa2f7,bg=#3b4261' - set-option -g pane-border-style 'fg=#3b4261' - set-option -g pane-active-border-style 'fg=#3b4261' - set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' - - # https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard - set-option -g default-command "reattach-to-user-namespace -l $SHELL" + # Set correct terminal + set-option -sa terminal-features ',alacritty:RGB' + + # Open new splits from current directory + bind '"' split-window -v -c '#{pane_current_path}' + bind % split-window -h -c '#{pane_current_path}' + + # Unclutter status bar + set-option -g status-right "" + set-option -g status-left "" + set-window-option -g window-status-format " #I: #W " + set-window-option -g window-status-current-format " #I: #W " + + # Color scheme + set-option -g status-style 'fg=#414868' + set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' + set-option -g mode-style 'fg=#7aa2f7,bg=#3b4261' + set-option -g message-style 'fg=#7aa2f7,bg=#3b4261' + set-option -g pane-border-style 'fg=#3b4261' + set-option -g pane-active-border-style 'fg=#3b4261' + set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' + + # https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard + set-option -g default-command "reattach-to-user-namespace -l $SHELL" ''; }; @@ -129,6 +123,8 @@ settings = { add_newline = false; aws.disabled = true; + azure.disabled = true; + gcloud.disabled = true; cmd_duration.disabled = true; package.disabled = true; }; @@ -186,7 +182,7 @@ } # Update system - pacu() { + nixpacu() { pushd ${config.home.homeDirectory}/.nixfiles ${pkgs.gnumake}/bin/make update ${pkgs.gnumake}/bin/make home diff --git a/home/tools.nix b/home/tools.nix index 0fbdf2d..3631a44 100644 --- a/home/tools.nix +++ b/home/tools.nix @@ -5,8 +5,8 @@ # Git git = { enable = true; - userName = "Lena Fuhrimann"; - userEmail = "6780471+cloudlena@users.noreply.github.com"; + userName = "Mathis Kretz"; + userEmail = "2479543+mkretz@users.noreply.github.com"; signing = { key = null; signByDefault = true; @@ -71,11 +71,6 @@ }; }; - services = { - # GPG - gpg-agent.enable = true; - }; - home.packages = with pkgs; [ altair awscli2 @@ -133,31 +128,4 @@ yq zip ]; - - xdg = { - configFile = { - "gopass/config".text = '' - [core] - notifications = false - showsafecontent = true - [mounts] - path = ${config.home.homeDirectory}/.password-store - ''; - }; - dataFile = { - "task/hooks/on-modify.timewarrior" = { - source = "${pkgs.timewarrior}/share/doc/timew/ext/on-modify.timewarrior"; - executable = true; - }; - }; - mimeApps = { - enable = true; - defaultApplications = { - "application/pdf" = [ "org.pwmt.zathura.desktop" ]; - "image/png" = [ "imv.desktop" ]; - "image/jpeg" = [ "imv.desktop" ]; - "image/svg" = [ "imv.desktop" ]; - }; - }; - }; } diff --git a/system/default.nix b/system/default.nix deleted file mode 100644 index 41a7963..0000000 --- a/system/default.nix +++ /dev/null @@ -1,108 +0,0 @@ -{ pkgs, ... }: - -{ - imports = [ - ./hardware-configuration.nix - ./secure-boot.nix - ./upgrade-diff.nix - ]; - - # Bootloader - boot.loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; - - # Set up keyfile - boot.initrd.secrets = { - "/crypto_keyfile.bin" = null; - }; - - # Enable swap on luks - boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".device = "/dev/disk/by-uuid/58a9f60d-bf2d-4c94-8f08-8e29a4083728"; - boot.initrd.luks.devices."luks-58a9f60d-bf2d-4c94-8f08-8e29a4083728".keyFile = "/crypto_keyfile.bin"; - - # Networking - networking.networkmanager.enable = true; - - # Time zone - time.timeZone = "Europe/Zurich"; - - # AppArmor - security.apparmor.enable = true; - - # Temporary fix for Swaylock issue - security.pam.services.swaylock = { }; - - # Containers - virtualisation.podman.enable = true; - - # Bluetooth - hardware.bluetooth = { - enable = true; - powerOnBoot = false; - }; - - # Sound - sound.enable = true; - services.pipewire = { - enable = true; - pulse.enable = true; - }; - - # Users - users.users.lena = { - isNormalUser = true; - description = "Lena"; - extraGroups = [ "wheel" "networkmanager" ]; - initialPassword = "changeme"; - }; - users.defaultUserShell = pkgs.zsh; - - # Enable Flakes - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - # Garbage collection - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # System packages - environment.systemPackages = with pkgs; [ - git - home-manager - ]; - - programs = { - # Window manager - hyprland.enable = true; - - # Shell - zsh.enable = true; - - # Gaming - steam.enable = true; - }; - - services = { - # Firmware updater - fwupd.enable = true; - - # Geolocation service - geoclue2.enable = true; - - # Power optimization - auto-cpufreq.enable = true; - thermald.enable = true; - - # Periodically trim SSD - fstrim.enable = true; - }; - - system.stateVersion = "23.11"; -} diff --git a/system/hardware-configuration.nix b/system/hardware-configuration.nix deleted file mode 100644 index 3470396..0000000 --- a/system/hardware-configuration.nix +++ /dev/null @@ -1,44 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { - device = "/dev/disk/by-uuid/c515aa2a-c2d8-4a09-869e-948fb393cdc2"; - fsType = "ext4"; - }; - - boot.initrd.luks.devices."luks-3287adf5-afa8-45c8-a958-fea13766dbeb".device = "/dev/disk/by-uuid/3287adf5-afa8-45c8-a958-fea13766dbeb"; - - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/B81C-4766"; - fsType = "vfat"; - }; - - swapDevices = - [{ device = "/dev/disk/by-label/swap"; }]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/system/secure-boot.nix b/system/secure-boot.nix deleted file mode 100644 index ec3052b..0000000 --- a/system/secure-boot.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, ... }: - -{ - boot = { - loader.systemd-boot.enable = pkgs.lib.mkForce false; - lanzaboote = { - enable = true; - pkiBundle = "/etc/secureboot"; - }; - }; - environment.systemPackages = with pkgs; [ - sbctl - ]; -} diff --git a/system/upgrade-diff.nix b/system/upgrade-diff.nix deleted file mode 100644 index 5618be2..0000000 --- a/system/upgrade-diff.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, ... }: - -{ - system.activationScripts.diff = { - supportsDryActivation = true; - text = '' - ${pkgs.nix}/bin/nix store diff-closures /run/current-system "$systemConfig" - ''; - }; -} From d7e0554901f895d216d69bd6194514c32caec113 Mon Sep 17 00:00:00 2001 From: Mathis Kretz Date: Wed, 8 May 2024 12:05:45 +0200 Subject: [PATCH 29/29] Fix colors in editor --- flake.lock | 12 ++++++------ home/editor.nix | 1 + home/terminal.nix | 44 ++++++++++++++++++++++---------------------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/flake.lock b/flake.lock index 021cb88..920f9ec 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1710401383, - "narHash": "sha256-jskq7uDpKXrRoY4hDpNqykmSSKHUXYlo7ZFc/se7fus=", + "lastModified": 1715077503, + "narHash": "sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0=", "owner": "nix-community", "repo": "home-manager", - "rev": "1ab3cec3a1bbb065b2d52b913d1431366028d5b5", + "rev": "6e277d9566de9976f47228dd8c580b97488734d4", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1710272261, - "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", + "lastModified": 1714906307, + "narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", + "rev": "25865a40d14b3f9cf19f19b924e2ab4069b09588", "type": "github" }, "original": { diff --git a/home/editor.nix b/home/editor.nix index 1f3dfca..371e311 100644 --- a/home/editor.nix +++ b/home/editor.nix @@ -11,6 +11,7 @@ soft-wrap.enable = true; cursor-shape.insert = "bar"; file-picker.hidden = false; + true-color = true; }; }; languages = { diff --git a/home/terminal.nix b/home/terminal.nix index 8e5651e..e5ed19e 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -63,7 +63,7 @@ # Shell zsh = { enable = true; - enableAutosuggestions = true; + autosuggestion.enable = true; syntaxHighlighting.enable = true; defaultKeymap = "viins"; completionInit = '' @@ -90,27 +90,27 @@ escapeTime = 10; terminal = "tmux-256color"; extraConfig = '' - # Set correct terminal - set-option -sa terminal-features ',alacritty:RGB' - - # Open new splits from current directory - bind '"' split-window -v -c '#{pane_current_path}' - bind % split-window -h -c '#{pane_current_path}' - - # Unclutter status bar - set-option -g status-right "" - set-option -g status-left "" - set-window-option -g window-status-format " #I: #W " - set-window-option -g window-status-current-format " #I: #W " - - # Color scheme - set-option -g status-style 'fg=#414868' - set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' - set-option -g mode-style 'fg=#7aa2f7,bg=#3b4261' - set-option -g message-style 'fg=#7aa2f7,bg=#3b4261' - set-option -g pane-border-style 'fg=#3b4261' - set-option -g pane-active-border-style 'fg=#3b4261' - set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' + # Set correct terminal + set-option -sa terminal-overrides ',tmux*:RGB' + + # Open new splits from current directory + bind '"' split-window -v -c '#{pane_current_path}' + bind % split-window -h -c '#{pane_current_path}' + + # Unclutter status bar + set-option -g status-right "" + set-option -g status-left "" + set-window-option -g window-status-format " #I: #W " + set-window-option -g window-status-current-format " #I: #W " + + # Color scheme + set-option -g status-style 'fg=#414868' + set-option -g window-status-current-style 'fg=#1a1b26,bg=#414868,bold' + set-option -g mode-style 'fg=#7aa2f7,bg=#3b4261' + set-option -g message-style 'fg=#7aa2f7,bg=#3b4261' + set-option -g pane-border-style 'fg=#3b4261' + set-option -g pane-active-border-style 'fg=#3b4261' + set-option -g message-command-style 'fg=#7aa2f7,bg=#3b4261' # https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard set-option -g default-command "reattach-to-user-namespace -l $SHELL"