From a124a33224203372e8006dab75b377853c101bc6 Mon Sep 17 00:00:00 2001 From: buffet Date: Fri, 19 Jan 2024 15:36:08 +0100 Subject: [PATCH] update config --- LICENSE | 374 ------------ README.md | 1 - alice/default.nix | 42 -- common.nix | 159 ----- fanya/default.nix | 30 - fanya/hardware-configuration.nix | 62 -- flake.lock | 305 +++------- flake.nix | 106 +--- {programs => hosts/alice}/borg.nix | 2 +- hosts/alice/default.nix | 60 ++ hosts/alice/earlyoom.nix | 10 + hosts/alice/gpg.nix | 7 + .../alice}/hardware-configuration.nix | 8 +- hosts/alice/keyd.nix | 11 + {programs => hosts/alice}/pipewire.nix | 1 + hosts/alice/sway.nix | 11 + system.nix => hosts/alice/system.nix | 10 +- hosts/alice/tlp.nix | 18 + impermanence.nix | 83 --- overlay/apl386/default.nix | 26 - overlay/default.nix | 5 +- overlay/fennel-ls/default.nix | 25 - programs/gpg.nix | 11 - programs/keyd.nix | 19 - programs/mako.nix | 21 - programs/newsboat.nix | 32 - programs/nvim.nix | 559 ------------------ programs/sbcl.nix | 14 - programs/senpai.nix | 11 - programs/sioyek.nix | 11 - programs/sway.nix | 224 ------- theme.nix | 52 -- {programs => users/buffet}/bash.nix | 39 +- {programs => users/buffet}/cargo.nix | 0 users/buffet/colors.nix | 39 ++ users/buffet/default.nix | 103 ++++ {programs => users/buffet}/firefox.nix | 29 +- {programs => users/buffet}/foot.nix | 17 +- {programs => users/buffet}/git.nix | 9 +- users/buffet/gpg.nix | 5 + {programs => users/buffet}/ime.nix | 0 users/buffet/mako.nix | 21 + programs/lsd.nix => users/buffet/nvim.nix | 4 +- users/buffet/sway.nix | 210 +++++++ 44 files changed, 660 insertions(+), 2126 deletions(-) delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 alice/default.nix delete mode 100644 common.nix delete mode 100644 fanya/default.nix delete mode 100644 fanya/hardware-configuration.nix rename {programs => hosts/alice}/borg.nix (94%) create mode 100644 hosts/alice/default.nix create mode 100644 hosts/alice/earlyoom.nix create mode 100644 hosts/alice/gpg.nix rename {alice => hosts/alice}/hardware-configuration.nix (91%) create mode 100644 hosts/alice/keyd.nix rename {programs => hosts/alice}/pipewire.nix (99%) create mode 100644 hosts/alice/sway.nix rename system.nix => hosts/alice/system.nix (83%) create mode 100644 hosts/alice/tlp.nix delete mode 100644 impermanence.nix delete mode 100644 overlay/apl386/default.nix delete mode 100644 overlay/fennel-ls/default.nix delete mode 100644 programs/gpg.nix delete mode 100644 programs/keyd.nix delete mode 100644 programs/mako.nix delete mode 100644 programs/newsboat.nix delete mode 100644 programs/nvim.nix delete mode 100644 programs/sbcl.nix delete mode 100644 programs/senpai.nix delete mode 100644 programs/sioyek.nix delete mode 100644 programs/sway.nix delete mode 100644 theme.nix rename {programs => users/buffet}/bash.nix (56%) rename {programs => users/buffet}/cargo.nix (100%) create mode 100644 users/buffet/colors.nix create mode 100644 users/buffet/default.nix rename {programs => users/buffet}/firefox.nix (56%) rename {programs => users/buffet}/foot.nix (62%) rename {programs => users/buffet}/git.nix (80%) create mode 100644 users/buffet/gpg.nix rename {programs => users/buffet}/ime.nix (100%) create mode 100644 users/buffet/mako.nix rename programs/lsd.nix => users/buffet/nvim.nix (58%) create mode 100644 users/buffet/sway.nix diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 398385c..0000000 --- a/LICENSE +++ /dev/null @@ -1,374 +0,0 @@ - Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" -means each individual or legal entity that creates, contributes to -the creation of, or owns Covered Software. - -1.2. "Contributor Version" -means the combination of the Contributions of others (if any) used -by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" -means Covered Software of a particular Contributor. - -1.4. "Covered Software" -means Source Code Form to which the initial Contributor has attached -the notice in Exhibit A, the Executable Form of such Source Code -Form, and Modifications of such Source Code Form, in each case -including portions thereof. - -1.5. "Incompatible With Secondary Licenses" -means - -(a) that the initial Contributor has attached the notice described -in Exhibit B to the Covered Software; or - -(b) that the Covered Software was made available under the terms of -version 1.1 or earlier of the License, but not also under the -terms of a Secondary License. - -1.6. "Executable Form" -means any form of the work other than Source Code Form. - -1.7. "Larger Work" -means a work that combines Covered Software with other material, in -a separate file or files, that is not Covered Software. - -1.8. "License" -means this document. - -1.9. "Licensable" -means having the right to grant, to the maximum extent possible, -whether at the time of the initial grant or subsequently, any and -all of the rights conveyed by this License. - -1.10. "Modifications" -means any of the following: - -(a) any file in Source Code Form that results from an addition to, -deletion from, or modification of the contents of Covered -Software; or - -(b) any new file in Source Code Form that contains any Covered -Software. - -1.11. "Patent Claims" of a Contributor -means any patent claim(s), including without limitation, method, -process, and apparatus claims, in any patent Licensable by such -Contributor that would be infringed, but for the grant of the -License, by the making, using, selling, offering for sale, having -made, import, or transfer of either its Contributions or its -Contributor Version. - -1.12. "Secondary License" -means either the GNU General Public License, Version 2.0, the GNU -Lesser General Public License, Version 2.1, the GNU Affero General -Public License, Version 3.0, or any later versions of those -licenses. - -1.13. "Source Code Form" -means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") -means an individual or a legal entity exercising rights under this -License. For legal entities, "You" includes any entity that -controls, is controlled by, or is under common control with You. For -purposes of this definition, "control" means (a) the power, direct -or indirect, to cause the direction or management of such entity, -whether by contract or otherwise, or (b) ownership of more than -fifty percent (50%) of the outstanding shares or beneficial -ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) -Licensable by such Contributor to use, reproduce, make available, -modify, display, perform, distribute, and otherwise exploit its -Contributions, either on an unmodified basis, with Modifications, or -as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer -for sale, have made, import, and otherwise transfer either its -Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; -or - -(b) for infringements caused by: (i) Your and any other third party's -modifications of Covered Software, or (ii) the combination of its -Contributions with other software (except as part of its Contributor -Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of -its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code -Form, as described in Section 3.1, and You must inform recipients of -the Executable Form how they can obtain a copy of such Source Code -Form by reasonable means in a timely manner, at a charge no more -than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this -License, or sublicense it under different terms, provided that the -license for the Executable Form does not attempt to limit or alter -the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - -This Source Code Form is "Incompatible With Secondary Licenses", as -defined by the Mozilla Public License, v. 2.0. - diff --git a/README.md b/README.md deleted file mode 100644 index 96bf7ed..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# dotfiles diff --git a/alice/default.nix b/alice/default.nix deleted file mode 100644 index 3a73adb..0000000 --- a/alice/default.nix +++ /dev/null @@ -1,42 +0,0 @@ -{nixos-hardware, ...}: let - password = "$y$j9T$g/a4KaQ5VitWI9ZtAh9i3/$wjejk5W8LMc0gaVgw69kwrKLqBgZ95ekaOl/GaTOZVC"; -in { - imports = [ - nixos-hardware.nixosModules.lenovo-thinkpad-x270 - ./hardware-configuration.nix - ]; - - # Don't change! - system.stateVersion = "23.05"; - home-manager.users.buffet.home.stateVersion = "23.05"; - - users.users.buffet.hashedPassword = password; - users.users.root.hashedPassword = password; - - networking.hostName = "alice"; - - services = { - tlp = { - enable = true; - - settings = { - START_CHARGE_THRESH_BAT0 = 40; - STOP_CHARGE_THRESH_BAT0 = 60; - - START_CHARGE_THRESH_BAT1 = 40; - STOP_CHARGE_THRESH_BAT1 = 60; - }; - }; - - keyd = { - enable = true; - settings = { - main = { - "102nd" = "layer(shift)"; # < as shift - "enter" = "\\"; - "\\" = "enter"; - }; - }; - }; - }; -} diff --git a/common.nix b/common.nix deleted file mode 100644 index 37e6544..0000000 --- a/common.nix +++ /dev/null @@ -1,159 +0,0 @@ -{pkgs, ...}: { - imports = [ - ./programs/bash.nix - ./programs/borg.nix - ./programs/cargo.nix - ./programs/firefox.nix - ./programs/foot.nix - ./programs/git.nix - ./programs/gpg.nix - ./programs/ime.nix - ./programs/keyd.nix - ./programs/lsd.nix - ./programs/mako.nix - ./programs/newsboat.nix - ./programs/nvim.nix - ./programs/pipewire.nix - ./programs/sbcl.nix - ./programs/sioyek.nix - ./programs/sway.nix - ]; - - environment.systemPackages = with pkgs; [ - gitFull - neovim - ]; - - fonts.fonts = with pkgs; [ - apl386 - dejavu_fonts - noto-fonts - noto-fonts-cjk - ]; - - home-manager.users.buffet = { - home = { - sessionVariables = { - ANKI_WAYLAND = 1; - }; - - packages = with pkgs; [ - unstable.anki - - SDL2 - SDL2.dev - alejandra - bear - black - c2ffi - cage - cairo - chromium - ed - gcc - gnumake - mpv - python3 - - cargo - cargo-crev - cargo-limit - mosh - cargo-nextest - du-dust - fd - gdb - github-cli - htop - hyperfine - jq - kcachegrind - linuxPackages.perf - man-pages - man-pages-posix - okular - pavucontrol - radare2 - ripgrep - rr - rustfmt - strace - tokei - trash-cli - tree - valgrind - wget - wl-clipboard - - (luajit.withPackages (ps: - with ps; [ - fennel - inspect - luv - ])) - - (retroarch.override { - cores = with libretro; [ - genesis-plus-gx - ]; - }) - ]; - - pointerCursor = { - package = pkgs.phinger-cursors; - name = "phinger-cursors-light"; - gtk.enable = true; - }; - }; - - programs.direnv = { - enable = true; - nix-direnv.enable = true; - enableBashIntegration = true; - }; - }; - - users.users.buffet = { - isNormalUser = true; - uid = 1000; - extraGroups = [ - "docker" - "networkmanager" - "sway" - "uinput" - "wheel" - ]; - }; - - systemd.coredump.enable = true; - - hardware = { - bluetooth.enable = true; - uinput.enable = true; - }; - - virtualisation = { - docker.enable = true; - libvirtd.enable = true; - }; - - powerManagement = { - enable = true; - powertop.enable = true; - }; - - services = { - earlyoom = { - enable = true; - enableNotifications = true; - }; - - mullvad-vpn = { - enable = true; - package = pkgs.mullvad-vpn; # enable gui - }; - - systembus-notify.enable = true; - upower.enable = true; - }; -} diff --git a/fanya/default.nix b/fanya/default.nix deleted file mode 100644 index f01693e..0000000 --- a/fanya/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{lib, ...}: let - password = "$6$FHwMlUwmRdAsPqS4$4XND0L0EEVf2Mhc/tvo6y3ZLIrMTOlsIZrG3w69EeXvtVZhdeNyoDOkPNIe.GBB8.PrchuUKDacqbvcvyuPkt0"; -in { - imports = [ - ./hardware-configuration.nix - ]; - - # Don't change! - system.stateVersion = "22.05"; - home-manager.users.buffet.home.stateVersion = "22.05"; - - users.users.buffet.hashedPassword = password; - users.users.root.hashedPassword = password; - - networking.hostName = "fanya"; - - services.tlp.enable = true; - - home-manager.users.buffet = { - programs.foot = let - theme = import ../theme.nix; - in { - settings.main.font = lib.mkForce "${theme.font.family}:size=${toString (theme.font.size - 1)}"; - }; - - wayland.windowManager.sway = { - config.gaps.inner = lib.mkForce 5; - }; - }; -} diff --git a/fanya/hardware-configuration.nix b/fanya/hardware-configuration.nix deleted file mode 100644 index b113d98..0000000 --- a/fanya/hardware-configuration.nix +++ /dev/null @@ -1,62 +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" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/d2c87f01-cdb7-4871-ae9d-c3a843e1199d"; - fsType = "btrfs"; - options = ["subvol=@"]; - }; - - fileSystems."/old" = { - device = "/dev/disk/by-uuid/d2c87f01-cdb7-4871-ae9d-c3a843e1199d"; - fsType = "btrfs"; - options = ["subvol=@old"]; - }; - - fileSystems."/persist" = { - device = "/dev/disk/by-uuid/d2c87f01-cdb7-4871-ae9d-c3a843e1199d"; - fsType = "btrfs"; - options = ["subvol=@persist"]; - }; - - fileSystems."/nix" = { - device = "/dev/disk/by-uuid/d2c87f01-cdb7-4871-ae9d-c3a843e1199d"; - fsType = "btrfs"; - options = ["subvol=@nix"]; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/29E0-A9D9"; - fsType = "vfat"; - }; - - swapDevices = [ - {device = "/dev/disk/by-uuid/c7344d44-0e66-461d-ba99-a177a8efe982";} - ]; - - # 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.enp0s25.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; - - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/flake.lock b/flake.lock index 4bcfe59..9ce078d 100644 --- a/flake.lock +++ b/flake.lock @@ -4,16 +4,15 @@ "inputs": { "darwin": "darwin", "home-manager": "home-manager", - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs", + "systems": "systems" }, "locked": { - "lastModified": 1690228878, - "narHash": "sha256-9Xe7JV0krp4RJC9W9W9WutZVlw6BlHTFMiUP/k48LQY=", + "lastModified": 1703433843, + "narHash": "sha256-nmtA4KqFboWxxoOAA6Y1okHbZh+HsXaMPFkYHsoDRDw=", "owner": "ryantm", "repo": "agenix", - "rev": "d8c973fd228949736dedf61b7f8cc1ece3236792", + "rev": "417caa847f9383e111d1397039c9d4337d024bf0", "type": "github" }, "original": { @@ -22,86 +21,6 @@ "type": "github" } }, - "apl386": { - "flake": false, - "locked": { - "lastModified": 1646646198, - "narHash": "sha256-oHk4e7NRgAjGtZzQmZToYz7wCZETaj7/yRwZMeeYF2M=", - "owner": "abrudz", - "repo": "APL386", - "rev": "6332c9dbb588946a0e8c9d7984dd0c003eeea266", - "type": "github" - }, - "original": { - "owner": "abrudz", - "repo": "APL386", - "type": "github" - } - }, - "cmp-conventionalcommits": { - "flake": false, - "locked": { - "lastModified": 1665962366, - "narHash": "sha256-PAEWX0U8qbBwC3DqfCrDDlTLoIRIlcbwS1eDu3yarTc=", - "owner": "davidsierradz", - "repo": "cmp-conventionalcommits", - "rev": "a4dfacf0601130b7f8afa7c948d735c27802fb7f", - "type": "github" - }, - "original": { - "owner": "davidsierradz", - "repo": "cmp-conventionalcommits", - "type": "github" - } - }, - "cmp-git": { - "flake": false, - "locked": { - "lastModified": 1685409535, - "narHash": "sha256-McIYDGXu+tSaY/U6eu1XouSHto/mSpJ/i4Z4UKYa+mk=", - "owner": "petertriho", - "repo": "cmp-git", - "rev": "f900a4cf117300fdc3ba31d26f8b6223ccd9c574", - "type": "github" - }, - "original": { - "owner": "petertriho", - "repo": "cmp-git", - "type": "github" - } - }, - "copilot-cmp": { - "flake": false, - "locked": { - "lastModified": 1683831407, - "narHash": "sha256-+MzEGnhlrYRvAfskOwmw69OC1CsPXt7s3z+xPe9XPqs=", - "owner": "zbirenbaum", - "repo": "copilot-cmp", - "rev": "c2cdb3c0f5078b0619055af192295830a7987790", - "type": "github" - }, - "original": { - "owner": "zbirenbaum", - "repo": "copilot-cmp", - "type": "github" - } - }, - "copilot-lua": { - "flake": false, - "locked": { - "lastModified": 1691165896, - "narHash": "sha256-lAj7LKVbxTnLUpjJeuPTT3JBo1LQJWffiZmTyU+Y5uw=", - "owner": "zbirenbaum", - "repo": "copilot.lua", - "rev": "f306957de0f9730de4298bb1ea85c3735ef7cc43", - "type": "github" - }, - "original": { - "owner": "zbirenbaum", - "repo": "copilot.lua", - "type": "github" - } - }, "darwin": { "inputs": { "nixpkgs": [ @@ -110,11 +29,11 @@ ] }, "locked": { - "lastModified": 1673295039, - "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", "type": "github" }, "original": { @@ -124,38 +43,6 @@ "type": "github" } }, - "fennel-ls": { - "flake": false, - "locked": { - "lastModified": 1689863239, - "narHash": "sha256-xPTgGmeILJSNsC++r9x+ussS7ttG7a5Cgl/D02auTgE=", - "owner": "~xerool", - "repo": "fennel-ls", - "rev": "e7c642e12a15c6d452559414ee1890b30f4e8406", - "type": "sourcehut" - }, - "original": { - "owner": "~xerool", - "repo": "fennel-ls", - "type": "sourcehut" - } - }, - "gh-nvim": { - "flake": false, - "locked": { - "lastModified": 1682521998, - "narHash": "sha256-R+vzppfF3AAAGAUdH1kEPpX7XjHowBlilWNJfHyzZ10=", - "owner": "ldelossa", - "repo": "gh.nvim", - "rev": "2b5551656c1b896bf4ae06546eaaab00311f9a18", - "type": "github" - }, - "original": { - "owner": "ldelossa", - "repo": "gh.nvim", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -164,11 +51,11 @@ ] }, "locked": { - "lastModified": 1682203081, - "narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", "owner": "nix-community", "repo": "home-manager", - "rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", "type": "github" }, "original": { @@ -184,42 +71,27 @@ ] }, "locked": { - "lastModified": 1687871164, - "narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=", + "lastModified": 1705273357, + "narHash": "sha256-JAlkxgJbWh7+auiT0rJL3IUXXtkULRqygfxQA6mvLgc=", "owner": "nix-community", "repo": "home-manager", - "rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38", + "rev": "924d91e1e4c802fd8e60279a022dbae5acb36f2d", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.05", + "ref": "release-23.11", "repo": "home-manager", "type": "github" } }, - "impermanence": { - "locked": { - "lastModified": 1690797372, - "narHash": "sha256-GImz19e33SeVcIvBB7NnhbJSbTpFFmNtWLh7Z85Y188=", - "owner": "nix-community", - "repo": "impermanence", - "rev": "e3a7acd113903269a1b5c8b527e84ce7ee859851", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "impermanence", - "type": "github" - } - }, "nixos-hardware": { "locked": { - "lastModified": 1691305349, - "narHash": "sha256-0Pig7jnmuRH3c5dOTVTOvTLwo2CRzYTyvJRQ82HWRSo=", + "lastModified": 1705312285, + "narHash": "sha256-rd+dY+v61Y8w3u9bukO/hB55Xl4wXv4/yC8rCGVnK5U=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "5426a95071d0b9782b3209b3995cde1f5689616e", + "rev": "bee2202bec57e521e3bd8acd526884b9767d7fa0", "type": "github" }, "original": { @@ -230,27 +102,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1691328192, - "narHash": "sha256-w59N1zyDQ7SupfMJLFvtms/SIVbdryqlw5AS4+DiH+Y=", + "lastModified": 1703013332, + "narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "61676e4dcfeeb058f255294bcb08ea7f3bc3ce56", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1691368598, - "narHash": "sha256-ia7li22keBBbj02tEdqjVeLtc7ZlSBuhUk+7XTUFr14=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5a8e9243812ba528000995b294292d3b5e120947", + "rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6", "type": "github" }, "original": { @@ -260,104 +116,75 @@ "type": "github" } }, - "nur": { + "nixpkgs-unstable": { "locked": { - "lastModified": 1691426742, - "narHash": "sha256-NNyk6xL6E8lAI1wQ3ErzC4s+BOypXAZ+qPcyKNScxUQ=", - "owner": "nix-community", - "repo": "NUR", - "rev": "33fc23d321725093266f69e0f948a27adf02c0b8", + "lastModified": 1705133751, + "narHash": "sha256-rCIsyE80jgiOU78gCWN3A0wE0tR2GI5nH6MlS+HaaSQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b19f5e77dd906cb52dade0b7bd280339d2a1f3d", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "NUR", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", "type": "github" } }, - "nvim-cmp-vlime": { - "flake": false, + "nixpkgs_2": { "locked": { - "lastModified": 1672313103, - "narHash": "sha256-ejjJWNGjx28viKz8tsaifCkJ9HHYAOkbOZAdlR8gQJo=", - "owner": "HiPhish", - "repo": "nvim-cmp-vlime", - "rev": "5bc7fa02f255f6faed0ba5fda5f4883b46a66676", - "type": "gitlab" + "lastModified": 1705183652, + "narHash": "sha256-rnfkyUH0x72oHfiSDhuCHDHg3gFgF+lF8zkkg5Zihsw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "428544ae95eec077c7f823b422afae5f174dee4b", + "type": "github" }, "original": { - "owner": "HiPhish", - "repo": "nvim-cmp-vlime", - "type": "gitlab" + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "locked": { + "lastModified": 1705351485, + "narHash": "sha256-K3WLvgyMoL4FOU4iUS2nREWz7xzA0WGEN9ETcrB0zAg=", + "owner": "nix-community", + "repo": "NUR", + "rev": "ec97b3e21ab3140eee5c53ad40f4802769d7c5a5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" } }, "root": { "inputs": { "agenix": "agenix", - "apl386": "apl386", - "cmp-conventionalcommits": "cmp-conventionalcommits", - "cmp-git": "cmp-git", - "copilot-cmp": "copilot-cmp", - "copilot-lua": "copilot-lua", - "fennel-ls": "fennel-ls", - "gh-nvim": "gh-nvim", "home-manager": "home-manager_2", - "impermanence": "impermanence", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", - "nur": "nur", - "nvim-cmp-vlime": "nvim-cmp-vlime", - "rust-tools-nvim": "rust-tools-nvim", - "vim-hy": "vim-hy", - "vlime": "vlime" + "nur": "nur" } }, - "rust-tools-nvim": { - "flake": false, + "systems": { "locked": { - "lastModified": 1689033186, - "narHash": "sha256-jtfyDxifchznUupLSao6nmpVqaX1yO0xN+NhqS9fgxg=", - "owner": "simrat39", - "repo": "rust-tools.nvim", - "rev": "0cc8adab23117783a0292a0c8a2fbed1005dc645", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { - "owner": "simrat39", - "repo": "rust-tools.nvim", - "type": "github" - } - }, - "vim-hy": { - "flake": false, - "locked": { - "lastModified": 1688564453, - "narHash": "sha256-FwVWUxC4T0qCz/4XgBv8BsUsD+nsOb9g2hQXqVGlQuA=", - "owner": "hylang", - "repo": "vim-hy", - "rev": "dbd001668db9deae19a8f631a38a9d96ef441c27", - "type": "github" - }, - "original": { - "owner": "hylang", - "repo": "vim-hy", - "type": "github" - } - }, - "vlime": { - "flake": false, - "locked": { - "lastModified": 1688286786, - "narHash": "sha256-t96BZl2qEnFYPnXnVNRUUI2vICdz/0lnnmw+LT0PzLU=", - "owner": "vlime", - "repo": "vlime", - "rev": "c1ac16c1a50bec4c30da87cd4ce2af12e26fb022", - "type": "github" - }, - "original": { - "owner": "vlime", - "repo": "vlime", + "owner": "nix-systems", + "repo": "default", "type": "github" } } diff --git a/flake.nix b/flake.nix index 5961b70..289e54b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,110 +1,34 @@ +# TODO: encryption { inputs = { - impermanence.url = "github:nix-community/impermanence"; + agenix.url = "github:ryantm/agenix"; nixos-hardware.url = "github:NixOS/nixos-hardware"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; nur.url = "github:nix-community/NUR"; - agenix = { - url = "github:ryantm/agenix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - apl386 = { - url = "github:abrudz/APL386"; - flake = false; - }; - - cmp-conventionalcommits = { - url = "github:davidsierradz/cmp-conventionalcommits"; - flake = false; - }; - - cmp-git = { - url = "github:petertriho/cmp-git"; - flake = false; - }; - - copilot-cmp = { - url = "github:zbirenbaum/copilot-cmp"; - flake = false; - }; - - copilot-lua = { - url = "github:zbirenbaum/copilot.lua"; - flake = false; - }; - - fennel-ls = { - url = "sourcehut:~xerool/fennel-ls"; - flake = false; - }; - - gh-nvim = { - url = "github:ldelossa/gh.nvim"; - flake = false; - }; - home-manager = { - url = "github:nix-community/home-manager/release-23.05"; + url = "github:nix-community/home-manager/release-23.11"; inputs.nixpkgs.follows = "nixpkgs"; }; - - nvim-cmp-vlime = { - url = "gitlab:HiPhish/nvim-cmp-vlime"; - flake = false; - }; - - # work around for nixpkgs version being too old - rust-tools-nvim = { - url = "github:simrat39/rust-tools.nvim"; - flake = false; - }; - - vim-hy = { - url = "github:hylang/vim-hy"; - flake = false; - }; - - vlime = { - url = "github:vlime/vlime"; - flake = false; - }; }; outputs = { - agenix, - home-manager, - nur, - nixpkgs-unstable, nixpkgs, + nixpkgs-unstable, ... } @ args: { - nixosConfigurations = let - mkSystem = system: module: - nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = args; - modules = let - overlay-unstable = final: prev: { - unstable = nixpkgs-unstable.legacyPackages.${prev.system}; - }; - in [ - module - - agenix.nixosModules.default - home-manager.nixosModule - nur.nixosModules.nur - ./common.nix - ./impermanence.nix - ./system.nix - (_: {nixpkgs.overlays = [(import ./overlay args) overlay-unstable];}) - ]; + nixosConfigurations.alice = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = args; + modules = let + overlay-unstable = final: prev: { + unstable = nixpkgs-unstable.legacyPackages.${prev.system}; }; - in { - alice = mkSystem "x86_64-linux" ./alice; - fanya = mkSystem "x86_64-linux" ./fanya; + in [ + ./hosts/alice + (_: {nixpkgs.overlays = [(import ./overlay args) overlay-unstable];}) + ]; }; }; } diff --git a/programs/borg.nix b/hosts/alice/borg.nix similarity index 94% rename from programs/borg.nix rename to hosts/alice/borg.nix index 34054e4..66df1a9 100644 --- a/programs/borg.nix +++ b/hosts/alice/borg.nix @@ -5,7 +5,7 @@ }: let host = "11967@prio.ch-s011.rsync.net"; in { - age.secrets.borgpassword.file = ../secrets/borgpassword.age; + age.secrets.borgpassword.file = ../../secrets/borgpassword.age; services.borgbackup = { jobs.backup = { diff --git a/hosts/alice/default.nix b/hosts/alice/default.nix new file mode 100644 index 0000000..46482ba --- /dev/null +++ b/hosts/alice/default.nix @@ -0,0 +1,60 @@ +{ + agenix, + home-manager, + nixos-hardware, + nur, + pkgs, + ... +}: { + imports = [ + ./hardware-configuration.nix + ./system.nix + agenix.nixosModules.default + home-manager.nixosModule + nur.nixosModules.nur + + ./borg.nix + ./earlyoom.nix + ./gpg.nix + ./keyd.nix + ./pipewire.nix + ./sway.nix + ./tlp.nix + + ../../users/buffet + ]; + + # TODO: find out why this is required + age.identityPaths = ["/home/buffet/.ssh/id_agenix"]; + networking.hostName = "alice"; + users.users.root.hashedPassword = "*"; + + environment.systemPackages = with pkgs; [ + gitFull + neovim + ]; + + fonts.packages = with pkgs; [ + apl386 + dejavu_fonts + noto-fonts + noto-fonts-cjk + ]; + + powerManagement.enable = true; + systemd.coredump.enable = true; + + hardware = { + bluetooth.enable = true; + uinput.enable = true; + }; + + services = { + upower.enable = true; + + mullvad-vpn = { + enable = true; + package = pkgs.mullvad-vpn; # enable gui + }; + }; +} diff --git a/hosts/alice/earlyoom.nix b/hosts/alice/earlyoom.nix new file mode 100644 index 0000000..ad30f21 --- /dev/null +++ b/hosts/alice/earlyoom.nix @@ -0,0 +1,10 @@ +_: { + services = { + systembus-notify.enable = true; + + earlyoom = { + enable = true; + enableNotifications = true; + }; + }; +} diff --git a/hosts/alice/gpg.nix b/hosts/alice/gpg.nix new file mode 100644 index 0000000..06d14b7 --- /dev/null +++ b/hosts/alice/gpg.nix @@ -0,0 +1,7 @@ +_: { + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryFlavor = "gnome3"; + }; +} diff --git a/alice/hardware-configuration.nix b/hosts/alice/hardware-configuration.nix similarity index 91% rename from alice/hardware-configuration.nix rename to hosts/alice/hardware-configuration.nix index fe2d74e..2ee3580 100644 --- a/alice/hardware-configuration.nix +++ b/hosts/alice/hardware-configuration.nix @@ -23,7 +23,7 @@ options = ["subvol=@"]; }; - fileSystems."/persist" = { + fileSystems."/home" = { device = "/dev/disk/by-uuid/ad5a4aba-eb04-45e7-874e-375e7a9e4ea0"; fsType = "btrfs"; options = ["subvol=@persist"]; @@ -40,12 +40,6 @@ fsType = "vfat"; }; - fileSystems."/old" = { - device = "/dev/disk/by-uuid/ad5a4aba-eb04-45e7-874e-375e7a9e4ea0"; - fsType = "btrfs"; - options = ["subvol=@old"]; - }; - swapDevices = [ {device = "/dev/disk/by-uuid/2df05abc-60cb-4269-86ae-7c16a4a05369";} ]; diff --git a/hosts/alice/keyd.nix b/hosts/alice/keyd.nix new file mode 100644 index 0000000..24a3186 --- /dev/null +++ b/hosts/alice/keyd.nix @@ -0,0 +1,11 @@ +_: { + services.keyd = { + enable = true; + keyboards.default.settings = { + main = { + "capslock" = "overload(control, esc)"; + "esc" = "capslock"; + }; + }; + }; +} diff --git a/programs/pipewire.nix b/hosts/alice/pipewire.nix similarity index 99% rename from programs/pipewire.nix rename to hosts/alice/pipewire.nix index 4951ddd..b8055b7 100644 --- a/programs/pipewire.nix +++ b/hosts/alice/pipewire.nix @@ -1,5 +1,6 @@ _: { security.rtkit.enable = true; + services.pipewire = { enable = true; alsa.enable = true; diff --git a/hosts/alice/sway.nix b/hosts/alice/sway.nix new file mode 100644 index 0000000..7938ac7 --- /dev/null +++ b/hosts/alice/sway.nix @@ -0,0 +1,11 @@ +{pkgs, ...}: { + programs.sway.enable = true; + + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-gtk + ]; + }; +} diff --git a/system.nix b/hosts/alice/system.nix similarity index 83% rename from system.nix rename to hosts/alice/system.nix index 95e4a46..ad251d7 100644 --- a/system.nix +++ b/hosts/alice/system.nix @@ -1,8 +1,15 @@ { nixpkgs, nixpkgs-unstable, + nixos-hardware, ... }: { + imports = [ + nixos-hardware.nixosModules.lenovo-thinkpad-x270 + ]; + + system.stateVersion = "23.11"; + time.timeZone = "Europe/Berlin"; i18n.defaultLocale = "en_US.UTF-8"; @@ -13,8 +20,8 @@ fileSystems = { "/".options = ["compress=zstd"]; + "/home".options = ["compress=zstd"]; "/nix".options = ["compress=zstd" "noatime"]; - "/persist".options = ["compress=zstd"]; }; networking = { @@ -27,6 +34,7 @@ nixpkgs.flake = nixpkgs; nixpkgs-unstable.flake = nixpkgs-unstable; }; + settings = { auto-optimise-store = true; trusted-users = ["root" "buffet"]; diff --git a/hosts/alice/tlp.nix b/hosts/alice/tlp.nix new file mode 100644 index 0000000..9a31c6f --- /dev/null +++ b/hosts/alice/tlp.nix @@ -0,0 +1,18 @@ +_: { + services = { + tlp = { + enable = true; + + settings = let + start_charge = 40; + stop_charge = 60; + in { + START_CHARGE_THRESH_BAT0 = start_charge; + STOP_CHARGE_THRESH_BAT0 = stop_charge; + + START_CHARGE_THRESH_BAT1 = start_charge; + STOP_CHARGE_THRESH_BAT1 = stop_charge; + }; + }; + }; +} diff --git a/impermanence.nix b/impermanence.nix deleted file mode 100644 index a041eec..0000000 --- a/impermanence.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ - config, - lib, - impermanence, - ... -}: { - imports = [ - "${impermanence}/nixos.nix" - ]; - - environment.persistence."/persist/system" = { - directories = [ - "/etc/NetworkManager/system-connections" - "/etc/nixos" - "/root/.ssh" - "/srv" - "/var/lib/bluetooth" - "/var/lib/docker" - "/var/lib/machines" - "/var/lib/portables" - "/var/log" - ]; - - files = []; - }; - - programs.fuse.userAllowOther = true; # required for allowOther - home-manager.users.buffet = { - imports = [ - "${impermanence}/home-manager.nix" - ]; - - home.persistence."/persist/buffet" = { - removePrefixDirectory = true; - allowOther = true; - - directories = [ - "anki/.local/share/Anki" - "anki/.local/share/Anki2" - "crev/.local/share/crev" - "data/books" - "data/docs" - "data/git" - "data/proj" - "data/reminders" - "data/rice" - "data/uni" - "direnv/.local/share/direnv" - "firefox/.cache/mozilla" - "firefox/.mozilla" - "gpg/.gnupg" - "newsboat/.local/share/newsboat" - "ssh/.ssh" - "trash/.local/share/Trash" - ]; - - files = [ - "bash/.bash_history" - ]; - }; - }; - - fileSystems."/persist".neededForBoot = true; - - boot = { - supportedFilesystems = ["btrfs"]; - - # recreate the root subvolume at boot - initrd.postDeviceCommands = lib.mkBefore '' - echo "recreating root subvolume..." - mkdir -p /mnt - mount ${config.fileSystems."/".device} /mnt - btrfs subvolume delete /mnt/@old - mv /mnt/@ /mnt/@old - btrfs subvolume create /mnt/@ - umount /mnt - echo "done recreating subvolume" - ''; - }; - - # workaround for agenix running before /etc impermanence gets set up - age.identityPaths = ["/persist/buffet/ssh/.ssh/id_agenix"]; -} diff --git a/overlay/apl386/default.nix b/overlay/apl386/default.nix deleted file mode 100644 index 76049ff..0000000 --- a/overlay/apl386/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - inputs, - lib, - stdenvNoCC, -}: -stdenvNoCC.mkDerivation { - name = "apl386"; - - src = inputs.apl386; - - installPhase = '' - runHook preInstall - - install -Dm644 APL386.ttf -t $out/share/fonts/apl386 - - runHook postInstall - ''; - - meta = with lib; { - description = "APL385 Unicode font evolved "; - homepage = "https://github.com/abrudz/APL386"; - license = licenses.unlicense; - maintainers = with maintainers; [buffet]; - platforms = platforms.all; - }; -} diff --git a/overlay/default.nix b/overlay/default.nix index d4db3db..6103be9 100644 --- a/overlay/default.nix +++ b/overlay/default.nix @@ -1,6 +1,3 @@ -inputs: self: super: { +inputs: final: prev: { inherit inputs; - - apl386 = super.callPackage ./apl386 {}; - fennel-ls = super.callPackage ./fennel-ls {}; } diff --git a/overlay/fennel-ls/default.nix b/overlay/fennel-ls/default.nix deleted file mode 100644 index bc8f560..0000000 --- a/overlay/fennel-ls/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - inputs, - lib, - stdenvNoCC, - lua, - luaPackages, -}: -stdenvNoCC.mkDerivation { - name = "fennel-ls"; - - src = inputs.fennel-ls; - - nativeBuildInputs = [luaPackages.fennel]; - buildInputs = [lua]; - - makeFlags = ["PREFIX=$(out)"]; - - meta = with lib; { - description = "A language server for fennel-ls."; - homepage = "https://git.sr.ht/~xerool/fennel-ls"; - license = licenses.mit; - platforms = lua.meta.platforms; - maintainers = with maintainers; [buffet]; - }; -} diff --git a/programs/gpg.nix b/programs/gpg.nix deleted file mode 100644 index f640db8..0000000 --- a/programs/gpg.nix +++ /dev/null @@ -1,11 +0,0 @@ -{pkgs, ...}: { - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - pinentryFlavor = "curses"; - }; - - home-manager.users.buffet = { - programs.gpg.enable = true; - }; -} diff --git a/programs/keyd.nix b/programs/keyd.nix deleted file mode 100644 index b3d9a5a..0000000 --- a/programs/keyd.nix +++ /dev/null @@ -1,19 +0,0 @@ -_: { - services.keyd = { - enable = true; - settings = { - main = { - "capslock" = "overload(control, esc)"; - "esc" = "capslock"; - "rightalt" = "layer(symbols)"; - }; - - symbols = { - "h" = "left"; - "j" = "down"; - "k" = "up"; - "l" = "right"; - }; - }; - }; -} diff --git a/programs/mako.nix b/programs/mako.nix deleted file mode 100644 index 28f5d76..0000000 --- a/programs/mako.nix +++ /dev/null @@ -1,21 +0,0 @@ -{pkgs, ...}: { - home-manager.users.buffet = { - services.mako = let - theme = import ../theme.nix; - in { - enable = true; - - anchor = "top-right"; - - backgroundColor = theme.primary.background; - borderColor = theme.wm.focused.border; - progressColor = theme.primary.foreground; - textColor = theme.primary.foreground; - borderSize = 1; - - defaultTimeout = 4000; - - font = with theme; "${font.family} ${toString font.size}"; - }; - }; -} diff --git a/programs/newsboat.nix b/programs/newsboat.nix deleted file mode 100644 index e931844..0000000 --- a/programs/newsboat.nix +++ /dev/null @@ -1,32 +0,0 @@ -{lib, ...}: { - home-manager.users.buffet = { - programs.newsboat = { - enable = true; - autoReload = true; - - extraConfig = '' - color listnormal black white - color listfocus white yellow - color listnormal_unread black white bold - color listfocus_unread white yellow bold - color title white blue bold - color info yellow white bold - color hint-key default white bold - color hint-keys-delimiter default white - color hint-separator default white bold - color hint-description default white - ''; - - urls = lib.mapAttrsToList (title: url: {inherit title url;}) { - drew = "https://drewdevault.com/blog/index.xml"; - ducko = "https://goose.icu/index.xml"; - emersion = "https://emersion.fr/blog/atom.xml"; - fasterthanlime = "https://fasterthanli.me/index.xml"; - matklad = "https://matklad.github.io/feed.xml"; - neeasade = "https://notes.neeasade.net/rss_full.xml"; - sammyette = "https://sammy.is-a.dev/blog/index.xml"; - xkcd = "https://xkcd.com/rss.xml"; - }; - }; - }; -} diff --git a/programs/nvim.nix b/programs/nvim.nix deleted file mode 100644 index 273267e..0000000 --- a/programs/nvim.nix +++ /dev/null @@ -1,559 +0,0 @@ -{ - lib, - pkgs, - ... -} @ inputs: { - # TODO: use some flake - home-manager.users.buffet = { - home.sessionVariables = { - EDITOR = "nvim"; - }; - - home.packages = with pkgs; [ - clang-tools - fennel-ls - nil - rust-analyzer - sumneko-lua-language-server - ]; - - programs.neovim = let - leader = ","; - in { - enable = true; - plugins = let - buildPlugin = pname: - pkgs.vimUtils.buildVimPluginFrom2Nix { - inherit pname; - version = "unknown"; - src = inputs."${pname}"; - }; - buildPlugins = names: lib.attrsets.genAttrs names buildPlugin; - plugins = buildPlugins [ - "cmp-conventionalcommits" - "cmp-git" - "gh-nvim" - "nvim-cmp-vlime" - "rust-tools-nvim" - "vim-hy" - "vlime" - ]; - in - with pkgs.vimPlugins; - with plugins; [ - {plugin = cmp-buffer;} - {plugin = cmp-calc;} - {plugin = cmp-conventionalcommits;} - {plugin = cmp-latex-symbols;} - {plugin = cmp-nvim-lsp;} - {plugin = cmp-path;} - {plugin = cmp-treesitter;} - {plugin = cmp-vsnip;} - {plugin = editorconfig-nvim;} - {plugin = fennel-vim;} - {plugin = friendly-snippets;} - {plugin = fugitive;} - {plugin = lualine-lsp-progress;} - {plugin = nvim-cmp-vlime;} - {plugin = parinfer-rust;} - {plugin = pest-vim;} - {plugin = playground;} - {plugin = rust-vim;} - {plugin = tabular;} - {plugin = vim-nix;} - {plugin = vim-hy;} - {plugin = vim-repeat;} - {plugin = vlime;} - - { - plugin = cmp-git; - config = "lua require 'cmp_git'.setup {}"; - } - - { - plugin = crates-nvim; - config = '' - lua require 'crates'.setup {} - - nnoremap ${leader}ct :lua require('crates').toggle() - nnoremap ${leader}cr :lua require('crates').reload() - - nnoremap ${leader}cv :lua require('crates').show_versions_popup() - nnoremap ${leader}cf :lua require('crates').show_features_popup() - nnoremap ${leader}cd :lua require('crates').show_dependencies_popup() - - nnoremap ${leader}cu :lua require('crates').update_crate() - vnoremap ${leader}cu :lua require('crates').update_crates() - nnoremap ${leader}ca :lua require('crates').update_all_crates() - nnoremap ${leader}cU :lua require('crates').upgrade_crate() - vnoremap ${leader}cU :lua require('crates').upgrade_crates() - nnoremap ${leader}cA :lua require('crates').upgrade_all_crates() - - nnoremap ${leader}cH :lua require('crates').open_homepage() - nnoremap ${leader}cR :lua require('crates').open_repository() - nnoremap ${leader}cD :lua require('crates').open_documentation() - nnoremap ${leader}cC :lua require('crates').open_crates_io() - ''; - } - - { - plugin = gh-nvim; - config = '' - lua < ${leader}qcc :GHCloseCommit - nnoremap ${leader}qce :GHExpandCommit - nnoremap ${leader}qct :GHOpenToCommit - nnoremap ${leader}qcp :GHPopOutCommit - nnoremap ${leader}qcz :GHCollapseCommit - - nnoremap ${leader}qip :GHPreviewIssue - - nnoremap ${leader}qrb :GHStartReview - nnoremap ${leader}qrc :GHCloseReview - nnoremap ${leader}qrd :GHDeleteReview - nnoremap ${leader}qre :GHExpandReview - nnoremap ${leader}qrs :GHSubmitReview - nnoremap ${leader}qrz :GHCollapseReview - - nnoremap ${leader}qpc :GHClosePR - nnoremap ${leader}qpd :GHPRDetails - nnoremap ${leader}qpe :GHExpandPR - nnoremap ${leader}qpo :GHOpenPR - nnoremap ${leader}qpp :GHPopOutPR - nnoremap ${leader}qpr :GHRefreshPR - nnoremap ${leader}qpt :GHOpenToPR - nnoremap ${leader}qpz :GHCollapsePR - - nnoremap ${leader}qtc :GHCreateThread - nnoremap ${leader}qtn :GHNextThread - nnoremap ${leader}qt :GHToggleThread - ''; - } - - { - plugin = gitsigns-nvim; - config = '' - lua < ${leader}lt :LTPanel - ''; - } - - { - plugin = litee-calltree-nvim; - config = '' - lua require 'litee.calltree'.setup {} - - nnoremap ${leader}lci :lua vim.lsp.buf.incoming_calls() - nnoremap ${leader}lco :lua vim.lsp.buf.outgoing_calls() - ''; - } - - { - plugin = litee-symboltree-nvim; - config = '' - lua require 'litee.symboltree'.setup {} - - nnoremap ${leader}ls :lua vim.lsp.buf.document_symbol() - ''; - } - - { - plugin = lualine-nvim; - config = '' - lua < ${leader}a :Lspsaga code_action - nnoremap ${leader}r :Lspsaga rename - nnoremap gd :lua vim.lsp.buf.definition() - nnoremap gD :lua vim.lsp.buf.declaration() - ''; - } - - { - plugin = nvim-cmp; - config = '' - set completeopt=menu,menuone,noselect - - lua <'] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.select_prev_item(select_opts), - [''] = cmp.mapping.select_next_item(select_opts), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.abort(), - }, - sources = cmp.config.sources { - { name = 'buffer' }, - { name = 'calc' }, - { name = 'conventionalcommits' }, - { name = 'crates' }, - { name = 'git' }, - { name = 'latex_symbols' }, - { name = 'nvim_lsp' }, - { name = 'path' }, - { name = 'treesitter' }, - { name = 'vlime' }, - { name = 'vsnip' }, - }, - } - EOF - ''; - } - - { - plugin = nvim-dap; - config = '' - nnoremap lua require 'dap'.continue() - nnoremap lua require 'dap'.step_over() - nnoremap lua require 'dap'.step_into() - nnoremap lua require 'dap'.step_out() - nnoremap ${leader}db lua require'dap'.toggle_breakpoint() - nnoremap ${leader}dB lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) - nnoremap ${leader}dr lua require'dap'.repl.open() - nnoremap ${leader}dl lua require'dap'.run_last() - - lua < ${leader}f :Telescope find_files - nnoremap ${leader}F :Telescope find_files hidden=true no_ignore=true - nnoremap ${leader}g :Telescope live_grep - nnoremap ${leader}b :Telescope buffers - nnoremap ${leader}: :Telescope commands - ''; - } - - { - plugin = trouble-nvim; - config = '' - nnoremap ${leader}t :TroubleToggle - ''; - } - - { - plugin = vim-vsnip; - config = '' - imap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' - smap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' - imap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' - smap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' - ''; - } - - { - plugin = vimwiki; - # TODO: vimwiki config - } - ]; - - extraConfig = let - theme = import ../theme.nix; - in '' - " keybinds - let mapleader = "${leader}" - let g:mapleader = "${leader}" - - inoremap kj - - vnoremap < >gv - - nnoremap h - nnoremap j - nnoremap k - nnoremap l - - nnoremap s :w - - " misc - set termguicolors - set mouse=a - set undofile - set hidden - set encoding=utf-8 - set hlsearch - set incsearch - set ignorecase - set smartcase - set lazyredraw - set splitbelow - set splitright - set matchtime=2 - set showmatch - set wrap - set breakindent - set nowritebackup - set updatetime=250 - set colorcolumn=+1 - set cursorline - set signcolumn=yes - - set shiftwidth=4 - set tabstop=4 - set expandtab - - set shiftround - set autoindent - set smartindent - - highlight! ExtraWhitespace guibg=${theme.normal.red} - match ExtraWhitespace /\s\+$/ - - autocmd FileType lisp setlocal shiftwidth=2 tabstop=2 - autocmd FileType c setlocal noexpandtab shiftwidth=8 tabstop=8 - - lua </dev/tty + if [[ $col != 1 ]]; then + printf '%s' $'\e[0;7m%\n\e[0m' + fi + + PS1='\[\e[0;1m\][' + + case $status in + 0) PS1+='\[\e[32m\]' ;; + *) PS1+='\[\e[31m\]' ;; + esac + + if [[ "$PWD" == "$HOME" ]]; then + PS1+="~" + elif [[ "$PWD" == / ]]; then + PS1+=/ + else + PS1+="''${PWD##*/}" + fi + + PS1+='\[\e[0;1m\]]\[\e[0m\]' + + [[ $CONTAINER_ID ]] && PS1+="'" + + PS1+=' ' + } + PROMPT_COMMAND=__prompt bind '"\C-o": "\C-a\C-k fg; if [[ $? == 1 ]]; then nvim; fi\n"' bind '"\e\C-m": "\C-e | nvim\C-m"' diff --git a/programs/cargo.nix b/users/buffet/cargo.nix similarity index 100% rename from programs/cargo.nix rename to users/buffet/cargo.nix diff --git a/users/buffet/colors.nix b/users/buffet/colors.nix new file mode 100644 index 0000000..ff8904f --- /dev/null +++ b/users/buffet/colors.nix @@ -0,0 +1,39 @@ +rec { + wallpaper = "#e6e6e6"; + focused = "#e96161"; + unfocused = "#5c5c5c"; + + primary = { + foreground = "#000000"; + background = "#ffffff"; + }; + + cursor = { + foreground = "#dcd7ba"; + background = "#6f6f78"; + }; + + normal = { + black = "#393939"; + red = "#e96161"; + green = "#3cc970"; + yellow = "#e6d250"; + blue = "#4f9afa"; + magenta = "#d949d9"; + cyan = "#31d6c8"; + white = "#d6d6d6"; + }; + + bright = { + black = "#5c5c5c"; + red = "#ff5353"; + green = "#62ec75"; + yellow = "#ffea2e"; + blue = "#56c7ff"; + magenta = "#fd5cff"; + cyan = "#55f2ea"; + white = "#ffffff"; + }; + + borders = normal.red; +} diff --git a/users/buffet/default.nix b/users/buffet/default.nix new file mode 100644 index 0000000..669e0bc --- /dev/null +++ b/users/buffet/default.nix @@ -0,0 +1,103 @@ +{pkgs, ...}: { + imports = [ + ./bash.nix + ./cargo.nix + ./firefox.nix + ./foot.nix + ./git.nix + ./gpg.nix + ./ime.nix + ./mako.nix + ./nvim.nix + ./sway.nix + ]; + + users.users.buffet = { + isNormalUser = true; + uid = 1000; + hashedPassword = "$y$j9T$g/a4KaQ5VitWI9ZtAh9i3/$wjejk5W8LMc0gaVgw69kwrKLqBgZ95ekaOl/GaTOZVC"; + extraGroups = [ + "networkmanager" + "sway" + "uinput" + "wheel" + ]; + }; + + home-manager.users.buffet = { + home = { + stateVersion = "23.11"; + + packages = with pkgs; [ + #SDL2 + #SDL2.dev + #alejandra + #bear + #black + #c2ffi + #cage + #cairo + #chromium + #ed + #gcc + #gnumake + #mpv + #python3 + + cargo + cargo-crev + cargo-limit + mosh + cargo-nextest + du-dust + fd + gdb + github-cli + htop + hyperfine + jq + kcachegrind + linuxPackages.perf + man-pages + man-pages-posix + okular + pavucontrol + radare2 + ripgrep + rr + rustfmt + strace + tokei + trash-cli + tree + valgrind + wget + wl-clipboard + + #(luajit.withPackages (ps: + # with ps; [ + # fennel + # inspect + # luv + # ])) + + #(retroarch.override { + # cores = with libretro; [ + # genesis-plus-gx + # ]; + #}) + ]; + + pointerCursor = { + package = pkgs.phinger-cursors; + name = "phinger-cursors-light"; + gtk.enable = true; + }; + }; + + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + }; +} diff --git a/programs/firefox.nix b/users/buffet/firefox.nix similarity index 56% rename from programs/firefox.nix rename to users/buffet/firefox.nix index 95f6968..4bfb1ce 100644 --- a/programs/firefox.nix +++ b/users/buffet/firefox.nix @@ -4,6 +4,12 @@ pkgs, ... }: { + # sins + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "tampermonkey" + ]; + home-manager.users.buffet = { programs.firefox = { enable = true; @@ -11,14 +17,16 @@ profiles."buffet" = { extensions = with config.nur.repos.rycee.firefox-addons; [ - config.nur.repos.rycee.firefox-addons."10ten-ja-reader" bitwarden clearurls + config.nur.repos.rycee.firefox-addons."10ten-ja-reader" decentraleyes - fediact istilldontcareaboutcookies - refined-github + noscript + privacy-badger sidebery + stylus + tampermonkey ublock-origin ]; @@ -28,7 +36,20 @@ userChrome = '' #TabsToolbar { - visibility: collapse !important; + display: none; + } + + #nav-bar { + background: #ffffff !important; + } + + #sidebar-splitter { + background: #ffffff !important; + width: 0 !important; + } + + ##sidebar-header { + display: none; } ''; }; diff --git a/programs/foot.nix b/users/buffet/foot.nix similarity index 62% rename from programs/foot.nix rename to users/buffet/foot.nix index f4a90ee..7d984ce 100644 --- a/programs/foot.nix +++ b/users/buffet/foot.nix @@ -5,16 +5,16 @@ server.enable = true; settings = let - theme = import ../theme.nix; + colors = import ./colors.nix; dehash = lib.attrsets.mapAttrs (_: lib.strings.removePrefix "#"); - normal = dehash theme.normal; - bright = dehash theme.bright; + primary = dehash colors.primary; + normal = dehash colors.normal; + bright = dehash colors.bright; in { main = { - font = "${theme.font.family}:size=${toString (theme.font.size - 2)}"; - #font-italic = "${theme.font.family}:size=${toString (theme.font.size - 2)}"; - #font-bold-italic = "${theme.font.family}:style=Bold:size=${toString (theme.font.size - 2)}"; - pad = "${toString theme.font.size}x${toString theme.font.size}"; + term = "xterm-256color"; + font = "APL386 Unicode:weight=bold:size=8"; + pad = "12x8"; }; scrollback.lines = 10000; @@ -28,8 +28,7 @@ }; colors = { - foreground = lib.strings.removePrefix "#" theme.primary.foreground; - background = lib.strings.removePrefix "#" theme.primary.background; + inherit (primary) foreground background; regular0 = normal.black; regular1 = normal.red; diff --git a/programs/git.nix b/users/buffet/git.nix similarity index 80% rename from programs/git.nix rename to users/buffet/git.nix index 1b4d44d..54947ba 100644 --- a/programs/git.nix +++ b/users/buffet/git.nix @@ -4,16 +4,13 @@ _: { enable = true; userEmail = "dev@buffet.sh"; userName = "buffet"; + difftastic = { enable = true; - background = - if (import ../theme.nix).light - then "light" - else "dark"; + background = "light"; }; aliases = { - a = "add"; b = "branch"; c = "commit --verbose"; m = "commit --amend --verbose"; @@ -24,8 +21,6 @@ _: { l = "log"; s = "status -s"; - co = "checkout"; - cob = "checkout -b"; }; signing = { diff --git a/users/buffet/gpg.nix b/users/buffet/gpg.nix new file mode 100644 index 0000000..cfe20e4 --- /dev/null +++ b/users/buffet/gpg.nix @@ -0,0 +1,5 @@ +_: { + home-manager.users.buffet = { + programs.gpg.enable = true; + }; +} diff --git a/programs/ime.nix b/users/buffet/ime.nix similarity index 100% rename from programs/ime.nix rename to users/buffet/ime.nix diff --git a/users/buffet/mako.nix b/users/buffet/mako.nix new file mode 100644 index 0000000..395e80e --- /dev/null +++ b/users/buffet/mako.nix @@ -0,0 +1,21 @@ +{pkgs, ...}: { + home-manager.users.buffet = { + services.mako = let + colors = import ./colors.nix; + in { + enable = true; + + anchor = "top-right"; + + backgroundColor = colors.primary.background; + borderColor = colors.borders; + progressColor = colors.primary.foreground; + textColor = colors.primary.foreground; + borderSize = 1; + + defaultTimeout = 4000; + + font = "APL386 Unicode 8"; + }; + }; +} diff --git a/programs/lsd.nix b/users/buffet/nvim.nix similarity index 58% rename from programs/lsd.nix rename to users/buffet/nvim.nix index a44d3a4..e6cc165 100644 --- a/programs/lsd.nix +++ b/users/buffet/nvim.nix @@ -1,8 +1,8 @@ _: { home-manager.users.buffet = { - programs.lsd = { + programs.neovim = { enable = true; - enableAliases = true; + defaultEditor = true; }; }; } diff --git a/users/buffet/sway.nix b/users/buffet/sway.nix new file mode 100644 index 0000000..91b12bd --- /dev/null +++ b/users/buffet/sway.nix @@ -0,0 +1,210 @@ +{ + pkgs, + lib, + ... +}: let + colors = import ./colors.nix; +in { + home-manager.users.buffet = { + wayland.windowManager.sway = { + enable = true; + systemd.enable = true; + wrapperFeatures.gtk = true; + + config = let + mod = "Mod4"; + in { + input."*" = { + xkb_layout = "us"; + xkb_options = "compose:prsc"; + }; + + seat."*" = {hide_cursor = "when-typing enable";}; + floating.modifier = mod; + + # TODO: screenshot keybinds + keybindings = let + makeWorkspaceBinds = num: let + ws = toString num; + in { + "${mod}+${ws}" = "workspace ${ws}"; + "${mod}+Shift+${ws}" = "move container to workspace ${ws}"; + }; + + joinAttrSets = builtins.foldl' (x: y: x // y) {}; + in + { + "${mod}+Return" = "exec ${pkgs.foot}/bin/foot"; + "${mod}+i" = "exec ${pkgs.firefox-wayland}/bin/firefox"; + "${mod}+Shift+y" = "exec swaylock"; + # TODO: menu? + + "${mod}+z" = "exec ${pkgs.light}/bin/light -U 0.5"; + "${mod}+x" = "exec ${pkgs.light}/bin/light -A 0.5"; + "${mod}+Shift+z" = "exec ${pkgs.light}/bin/light -U 5"; + "${mod}+Shift+x" = "exec ${pkgs.light}/bin/light -A 5"; + + "${mod}+Shift+1" = "kill"; + "${mod}+Shift+c" = "reload"; + "${mod}+Shift+e" = "exit"; + + "${mod}+h" = "focus left"; + "${mod}+j" = "focus down"; + "${mod}+k" = "focus up"; + "${mod}+l" = "focus right"; + + "${mod}+Left" = "focus left"; + "${mod}+Down" = "focus down"; + "${mod}+Up" = "focus up"; + "${mod}+Right" = "focus right"; + + "${mod}+Shift+h" = "move left"; + "${mod}+Shift+j" = "move down"; + "${mod}+Shift+k" = "move up"; + "${mod}+Shift+l" = "move right"; + + "${mod}+o" = "splith"; + "${mod}+u" = "splitv"; + + "${mod}+s" = "layout stacking"; + "${mod}+t" = "layout tabbed"; + "${mod}+e" = "layout toggle split"; + "${mod}+f" = "fullscreen"; + + "${mod}+Shift+space" = "floating toggle"; + + "${mod}+Shift+minus" = "move scratchpad"; + "${mod}+minus" = "scratchpad show"; + } + // (joinAttrSets (map makeWorkspaceBinds (lib.range 1 9))); + + output."*" = { + bg = "${colors.wallpaper} solid_color"; + }; + + gaps = { + inner = 12; + left = 8; + right = 8; + bottom = 8; + top = 0; + }; + + window.border = 1; + fonts = { + names = ["APL386 Unicode"]; + style = "Bold"; + size = 8.0; + }; + + colors = rec { + focused = rec { + border = colors.focused; + childBorder = border; + background = border; + text = border; + indicator = border; + }; + + unfocused = rec { + border = colors.unfocused; + childBorder = border; + background = border; + text = border; + indicator = border; + }; + + focusedInactive = unfocused; + }; + + bars = [ + { + position = "top"; + + fonts = { + names = ["APL386 Unicode"]; + style = "Bold"; + size = 8.0; + }; + + statusCommand = toString (pkgs.writeScript "status_command" '' + #!/bin/sh + + while :; do + energy_full=0 + energy_now=0 + charging= + + for bat in /sys/class/power_supply/*/capacity; do + bat="''${bat%/*}" + read -r full <"$bat/energy_full" + read -r now <"$bat/energy_now" + energy_full=$((energy_full + full)) + energy_now=$((energy_now + now)) + done + + if cat /sys/class/power_supply/*/status | grep -q Charging; then + charging=+ + fi + + percentage=$((energy_now * 100 / energy_full)) + + printf '%s %s ' "$charging$percentage%" "$(date +'%H:%M:%S')" + sleep 1 + done + ''); + + colors = rec { + statusline = colors.primary.foreground; + inherit (colors.primary) background; + + focusedWorkspace = rec { + background = colors.focused; + border = background; + text = colors.primary.background; + }; + + inactiveWorkspace = rec { + inherit (colors.primary) background; + border = background; + text = colors.primary.foreground; + }; + }; + + extraConfig = '' + gaps 16 20 + ''; + } + ]; + }; + + extraConfig = '' + for_window [title="."] title_format "" + for_window [title="^oyster$"] floating enable + ''; + }; + + # TODO: use colors.nix + programs.swaylock = { + enable = true; + settings = { + ignore-empty-password = true; + color = "#ffffff"; + key-hl-color = "#3cc970"; + bs-hl-color = "#e96161"; + caps-lock-key-hl-color = "#3cc970"; + caps-lock-bs-hl-color = "#e96161"; + inside-color = "#ffffff"; + inside-clear-color = "#ffffff"; + inside-caps-lock-color = "#ffffff"; + inside-ver-color = "#ffffff"; + inside-wrong-color = "#ffffff"; + ring-color = "#ffffff"; + ring-clear-color = "#ffffff"; + ring-caps-lock-color = "#ffffff"; + ring-ver-color = "#ffffff"; + ring-wrong-color = "#ffffff"; + }; + }; + }; +}