diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..03bd412 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.env diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 93972a0..0000000 --- a/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2024 Luxzi - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 2e54a8a..0000000 --- a/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# NixOS configuration files - -Configured for KDE Plasma Wayland on Nvidia. - -## Customizing user settings - -To change your username or any additional user settings, you must: - -- Create `./nixos/users/.nix`, this can be copied from `luxzi.nix` in the same directory. -- Import the newly created file in `./nixos/configuration.nix`. -- Edit `./home-manager/home.nix` to the corresponding username and home directory. - -## Adjusting hardware configuration - -> [!NOTE] -> If you use an older Nvidia graphics card (i.e. before RTX 20 series), you do not need to modify `./nixos/hardware/nvidia.nix`. -> Although if you use a newer Nvidia graphics card, it is advised to enable `open` to use the open-source kernel driver. - -To use AMD graphics cards: - -- Create `./nixos/hardware/amd.nix` -- Add `services.xserver.videoDrivers = [ "amdgpu" ];` - -## Deployment - -If you would like to use these configuration files as is: - -- Mount and format desired filesystems (as described in the NixOS manual). -- Run the following git clone command while also making sure to replace `` with your desired username: -``` sh -git clone git@codeberg.org:luxzi/nixos /mnt/home//.dotfiles -``` -- Make any desired changes. -- Install the system with the command below, again, making sure to replace `` with your desired username: -``` sh -nixos-install --flake /mnt/home//.dotfiles -``` - -For more modified versions of this configuration, I recommend forking this repository. - diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100644 index 09296e2..0000000 --- a/bootstrap.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -nix-channel --add https://nixos.org/channels/nixos-unstable nixos -nixos-rebuild switch --upgrade -nixos-install --flake /mnt/home/luxzi/.dotfiles diff --git a/flake.lock b/flake.lock index 793d90f..f732535 100644 --- a/flake.lock +++ b/flake.lock @@ -1,35 +1,118 @@ { "nodes": { - "catppuccin": { + "agenix": { "inputs": { - "nixpkgs": "nixpkgs" + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "systems": "systems" }, "locked": { - "lastModified": 1737579274, - "narHash": "sha256-8kBIYfn8TI9jbffhDNS12SdbQHb9ITXflwcgIJBeGqw=", - "owner": "catppuccin", - "repo": "nix", - "rev": "06f0ea19334bcc8112e6d671fd53e61f9e3ad63a", + "lastModified": 1736955230, + "narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=", + "owner": "ryantm", + "repo": "agenix", + "rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c", "type": "github" }, "original": { - "owner": "catppuccin", - "repo": "nix", + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1741352980, + "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1741352980, + "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", "type": "github" } }, "home-manager": { "inputs": { "nixpkgs": [ + "agenix", "nixpkgs" ] }, "locked": { - "lastModified": 1737762889, - "narHash": "sha256-5HGG09bh/Yx0JA8wtBMAzt0HMCL1bYZ93x4IqzVExio=", + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", "owner": "nix-community", "repo": "home-manager", - "rev": "daf04c5950b676f47a794300657f1d3d14c1a120", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", "type": "github" }, "original": { @@ -38,13 +121,81 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1742234739, + "narHash": "sha256-zFL6zsf/5OztR1NSNQF33dvS1fL/BzVUjabZq4qrtY4=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "f6af7280a3390e65c2ad8fd059cdc303426cbd59", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.11", + "repo": "home-manager", + "type": "github" + } + }, + "ixx": { + "inputs": { + "flake-utils": [ + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "nixvim", + "nuschtosSearch", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729958008, + "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.6", + "repo": "ixx", + "type": "github" + } + }, + "nix-gaming": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1742262357, + "narHash": "sha256-6JGR5I4cuFFun3AJKPnMPz6PKUPywIH+AFYROUFRvYQ=", + "owner": "fufexan", + "repo": "nix-gaming", + "rev": "53eda8bba79a2c28782734bca51d70ecffb82d74", + "type": "github" + }, + "original": { + "owner": "fufexan", + "repo": "nix-gaming", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1736012469, - "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=", + "lastModified": 1703013332, + "narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d", + "rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6", "type": "github" }, "original": { @@ -54,27 +205,152 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1740877520, + "narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "147dee35aab2193b174e4c0868bd80ead5ce755c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1742288794, + "narHash": "sha256-Txwa5uO+qpQXrNG4eumPSD+hHzzYi/CdaM80M9XRLCo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b6eaf97c6960d97350c584de1b6dcff03c9daf42", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { - "lastModified": 1737885589, - "narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=", + "lastModified": 1741865919, + "narHash": "sha256-4thdbnP6dlbdq+qZWTsm4ffAwoS8Tiq1YResB+RP6WE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8", + "rev": "573c650e8a14b2faa0041645ab18aed7e60f0c9a", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1742268799, + "narHash": "sha256-IhnK4LhkBlf14/F8THvUy3xi/TxSQkp9hikfDZRD4Ic=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "da044451c6a70518db5b730fe277b70f494188f1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "nixpkgs" + ], + "nuschtosSearch": "nuschtosSearch" + }, + "locked": { + "lastModified": 1742396414, + "narHash": "sha256-e9Uv44rVDAG2ohNejttl9Pq5r4dxIzWxt+1hvKTQK5E=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "d79c291d5d80d587d518e0f530cc55adb0638c80", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils", + "ixx": "ixx", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1741886583, + "narHash": "sha256-sScfYKtxp3CYv5fJcHQDvQjqBL+tPNQqS9yf9Putd+s=", + "owner": "NuschtOS", + "repo": "search", + "rev": "2974bc5fa3441a319fba943f3ca41f7dcd1a1467", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, "root": { "inputs": { - "catppuccin": "catppuccin", - "home-manager": "home-manager", - "nixpkgs": "nixpkgs_2" + "agenix": "agenix", + "home-manager": "home-manager_2", + "nix-gaming": "nix-gaming", + "nixpkgs": "nixpkgs_3", + "nixpkgs-unstable": "nixpkgs-unstable", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 168f604..ed0a138 100644 --- a/flake.nix +++ b/flake.nix @@ -1,30 +1,127 @@ { - description = "Luxzi's NixOS system configuration"; + description = "Your new nix config"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - home-manager.url = "github:nix-community/home-manager"; + # Nixpkgs + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + # You can access packages and modules from different nixpkgs revs + # at the same time. Here's an working example: + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. + # Home manager home-manager.inputs.nixpkgs.follows = "nixpkgs"; - - catppuccin.url = "github:catppuccin/nix"; + home-manager.url = "github:nix-community/home-manager/release-24.11"; + agenix.url = "github:ryantm/agenix"; + nixvim.url = "github:nix-community/nixvim"; + nixvim.inputs.nixpkgs.follows = "nixpkgs"; + nix-gaming.url = "github:fufexan/nix-gaming"; }; - outputs = { self, nixpkgs, home-manager, catppuccin, ... }: - let - lib = nixpkgs.lib; - pkgs = nixpkgs.legacyPackages."x86_64-linux"; - in { - nixosConfigurations = { - nixos = lib.nixosSystem { - specialArgs = { inherit self; }; - modules = [ ./nixos/configuration.nix catppuccin.nixosModules.catppuccin ]; + outputs = { + self, + nixpkgs, + home-manager, + agenix, + nixvim, + ... + } @ inputs: let + inherit (self) outputs; + # Supported systems for your flake packages, shell, etc. + systems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + forAllSystems = nixpkgs.lib.genAttrs systems; + in { + # Your custom packages + # Accessible through 'nix build', 'nix shell', etc + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + # Formatter for your nix files, available through 'nix fmt' + # Other options beside 'alejandra' include 'nixpkgs-fmt' + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); + + # Your custom packages and modifications, exported as overlays + overlays = import ./overlays {inherit inputs;}; + + nixosModules = builtins.listToAttrs ( + (map (x: { + name = x; + value = import (./modules + "/${x}"); + }) (builtins.attrNames (builtins.readDir ./modules))) + ++ [ + { + name = "agenix"; + value = agenix.nixosModules.default; + } + ] + ); + + homeManagerModules = + builtins.listToAttrs + ( + map + (name: { + inherit name; + value = import (./home-manager/modules + "/${name}"); + }) + (builtins.attrNames (builtins.readDir ./home-manager/modules)) + ) + // { + nix = {pkgs, ...}: { + imports = [ + inputs.nixvim.homeManagerModules.nixvim + # inputs.plasma-manager.homeManagerModules.plasma-manager + # inputs.wall-utils.homeManagerModules.wall-utils + ]; }; }; - homeConfigurations = { - luxzi = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ ./home-manager/home.nix catppuccin.homeManagerModules.catppuccin ]; - }; + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' + # GreenMachine = nixpkgs.lib.nixosSystem { + # specialArgs = {inherit inputs outputs;}; + # modules = [ + # # > Our main nixos configuration file < + # ./nixos/GreenMachine/configuration.nix + # agenix.nixosModules.default + # ]; + # }; + # }; + nixosConfigurations = + builtins.listToAttrs + ( + map + (x: { + name = x; + value = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + flake-self = self; + }; + modules = + builtins.attrValues self.nixosModules + ++ [ + inputs.home-manager.nixosModules.home-manager + inputs.nix-gaming.nixosModules.platformOptimizations + inputs.nixvim.nixosModules.nixvim + (import "${./.}/machines/${x}/configuration.nix" {inherit self;}) + ]; + }; + }) + (builtins.attrNames (builtins.readDir ./machines)) + ); + homeConfigurations = { + lily = {...}: { + imports = + [ + ./home-manager/profiles/desktop.nix + ] + ++ builtins.attrValues self.homeManagerModules; }; }; + }; } diff --git a/home-manager/home.nix b/home-manager/home.nix deleted file mode 100644 index 1499e1c..0000000 --- a/home-manager/home.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = - [ - ./packages/packages.nix - ]; - - programs.home-manager.enable = true; - - home.username = "luxzi"; - home.homeDirectory = "/home/luxzi"; - home.stateVersion = "24.05"; -} diff --git a/home-manager/modules/chromium/default.nix b/home-manager/modules/chromium/default.nix new file mode 100644 index 0000000..4bc2a70 --- /dev/null +++ b/home-manager/modules/chromium/default.nix @@ -0,0 +1,27 @@ +{ + config, + lib, + ... +}: let + cfg = config.lily.chromium; +in { + options.lily.chromium = { + enable = lib.mkEnableOption "activate chromium"; + }; + config = lib.mkIf cfg.enable { + programs.chromium = { + enable = true; + extensions = [ + {id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";} # ublock origin + {id = "pkehgijcmpdhfbdbbnkijodmdjhbjlgp";} # privacy badger + {id = "ldpochfccmkkmhdbclfhpagapcfdljkj";} # decentraleyes + {id = "mnjggcdmjocbbbhaepdhchncahnbgone";} # sponsor block + {id = "gebbhagfogifgggkldgodflihgfeippi";} # return youtube dislike (just cuz) + ]; + commandLineArgs = [ + "--enable-features=UseOzonePlatform" + "--ozone-platform=wayland" + ]; + }; + }; +} diff --git a/home-manager/modules/ghostty/default.nix b/home-manager/modules/ghostty/default.nix new file mode 100644 index 0000000..5226865 --- /dev/null +++ b/home-manager/modules/ghostty/default.nix @@ -0,0 +1,37 @@ +{ + config, + lib, + ... +}: let + cfg = config.lily.ghostty; +in { + options.lily.ghostty = { + enable = lib.mkEnableOption "activate ghostty"; + }; + + config = lib.mkIf cfg.enable { + home.file.".config/ghostty/shaders" = { + source = ./shaders; + recursive = true; + }; + programs.ghostty = { + enable = true; + + settings = { + background-blur-radius = 0; + #theme = "dark:catppuccin-mocha,light:catppuccin-latte"; + window-theme = "dark"; + background-opacity = 0.75; + minimum-contrast = 1.1; + window-padding-x = 5; + window-padding-y = 5; + gtk-adwaita = false; + gtk-titlebar = false; + # custom-shader = "shaders/crt.glsl"; + # custom-shader = "shaders/glow.glsl"; + confirm-close-surface = false; + custom-shader-animation = true; + }; + }; + }; +} diff --git a/home-manager/modules/ghostty/shaders/crt.glsl b/home-manager/modules/ghostty/shaders/crt.glsl new file mode 100644 index 0000000..ecce90d --- /dev/null +++ b/home-manager/modules/ghostty/shaders/crt.glsl @@ -0,0 +1,153 @@ +// First it does a "chromatic aberration" by splitting the rgb signals by a product of sin functions +// over time, then it does a glow effect in a perceptual color space +// Based on kalgynirae's Ghostty passable glow shader and NickWest's Chromatic Aberration shader demo +// Passable glow: https://github.com/kalgynirae/dotfiles/blob/main/ghostty/glow.glsl +// "Chromatic Aberration": https://www.shadertoy.com/view/Mds3zn + +// sRGB linear -> nonlinear transform from https://bottosson.github.io/posts/colorwrong/ +float f(float x) { + if (x >= 0.0031308) { + return 1.055 * pow(x, 1.0 / 2.4) - 0.055; + } else { + return 12.92 * x; + } +} + +float f_inv(float x) { + if (x >= 0.04045) { + return pow((x + 0.055) / 1.055, 2.4); + } else { + return x / 12.92; + } +} + +// Oklab <-> linear sRGB conversions from https://bottosson.github.io/posts/oklab/ +vec4 toOklab(vec4 rgb) { + vec3 c = vec3(f_inv(rgb.r), f_inv(rgb.g), f_inv(rgb.b)); + float l = 0.4122214708 * c.r + 0.5363325363 * c.g + 0.0514459929 * c.b; + float m = 0.2119034982 * c.r + 0.6806995451 * c.g + 0.1073969566 * c.b; + float s = 0.0883024619 * c.r + 0.2817188376 * c.g + 0.6299787005 * c.b; + float l_ = pow(l, 1.0 / 3.0); + float m_ = pow(m, 1.0 / 3.0); + float s_ = pow(s, 1.0 / 3.0); + return vec4( + 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_, + 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_, + 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_, + rgb.a + ); +} + +vec4 toRgb(vec4 oklab) { + vec3 c = oklab.rgb; + float l_ = c.r + 0.3963377774 * c.g + 0.2158037573 * c.b; + float m_ = c.r - 0.1055613458 * c.g - 0.0638541728 * c.b; + float s_ = c.r - 0.0894841775 * c.g - 1.2914855480 * c.b; + float l = l_ * l_ * l_; + float m = m_ * m_ * m_; + float s = s_ * s_ * s_; + vec3 linear_srgb = vec3( + 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, + -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, + -0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s + ); + return vec4( + clamp(f(linear_srgb.r), 0.0, 1.0), + clamp(f(linear_srgb.g), 0.0, 1.0), + clamp(f(linear_srgb.b), 0.0, 1.0), + oklab.a + ); +} + +// Bloom samples from https://gist.github.com/qwerasd205/c3da6c610c8ffe17d6d2d3cc7068f17f +const vec3[24] samples = { + vec3(0.1693761725038636, 0.9855514761735895, 1), + vec3(-1.333070830962943, 0.4721463328627773, 0.7071067811865475), + vec3(-0.8464394909806497, -1.51113870578065, 0.5773502691896258), + vec3(1.554155680728463, -1.2588090085709776, 0.5), + vec3(1.681364377589461, 1.4741145918052656, 0.4472135954999579), + vec3(-1.2795157692199817, 2.088741103228784, 0.4082482904638631), + vec3(-2.4575847530631187, -0.9799373355024756, 0.3779644730092272), + vec3(0.5874641440200847, -2.7667464429345077, 0.35355339059327373), + vec3(2.997715703369726, 0.11704939884745152, 0.3333333333333333), + vec3(0.41360842451688395, 3.1351121305574803, 0.31622776601683794), + vec3(-3.167149933769243, 0.9844599011770256, 0.30151134457776363), + vec3(-1.5736713846521535, -3.0860263079123245, 0.2886751345948129), + vec3(2.888202648340422, -2.1583061557896213, 0.2773500981126146), + vec3(2.7150778983300325, 2.5745586041105715, 0.2672612419124244), + vec3(-2.1504069972377464, 3.2211410627650165, 0.2581988897471611), + vec3(-3.6548858794907493, -1.6253643308191343, 0.25), + vec3(1.0130775986052671, -3.9967078676335834, 0.24253562503633297), + vec3(4.229723673607257, 0.33081361055181563, 0.23570226039551587), + vec3(0.40107790291173834, 4.340407413572593, 0.22941573387056174), + vec3(-4.319124570236028, 1.159811599693438, 0.22360679774997896), + vec3(-1.9209044802827355, -4.160543952132907, 0.2182178902359924), + vec3(3.8639122286635708, -2.6589814382925123, 0.21320071635561041), + vec3(3.3486228404946234, 3.4331800232609, 0.20851441405707477), + vec3(-2.8769733643574344, 3.9652268864187157, 0.20412414523193154) +}; + +float offsetFunction(float iTime) { + float amount = 1.0; + const float periods[4] = {6.0, 16.0, 19.0, 27.0}; + for (int i = 0; i < 4; i++) { + amount *= 1.0 + 0.5 * sin(iTime*periods[i]); + } + //return amount; + return amount * periods[3]; +} + +const float DIM_CUTOFF = 0.35; +const float BRIGHT_CUTOFF = 0.65; +const float ABBERATION_FACTOR = 0.05; + +void mainImage(out vec4 fragColor, in vec2 fragCoord) { + vec2 uv = fragCoord.xy / iResolution.xy; + + // Sample the original color + vec4 originalColor = texture(iChannel0, uv); + + // Check if the pixel is part of the text (assuming alpha > 0.0) + if (originalColor.a > 0.0) { + float amount = offsetFunction(iTime); + + vec3 col; + col.r = texture( iChannel0, vec2(uv.x-ABBERATION_FACTOR*amount / iResolution.x, uv.y) ).r; + col.g = texture( iChannel0, uv ).g; + col.b = texture( iChannel0, vec2(uv.x+ABBERATION_FACTOR*amount / iResolution.x, uv.y) ).b; + + vec4 splittedColor = vec4(col, originalColor.a); // Keep the original alpha + vec4 source = toOklab(splittedColor); + vec4 dest = source; + + if (source.x > DIM_CUTOFF) { + dest.x *= 1.2; + // dest.x = 1.2; + } else { + vec2 step = vec2(1.414) / iResolution.xy; + vec3 glow = vec3(0.0); + for (int i = 0; i < 24; i++) { + vec3 s = samples[i]; + float weight = s.z; + vec4 c = toOklab(texture(iChannel0, uv + s.xy * step)); + if (c.x > DIM_CUTOFF) { + glow.yz += c.yz * weight * 0.3; + if (c.x <= BRIGHT_CUTOFF) { + glow.x += c.x * weight * 0.05; + } else { + glow.x += c.x * weight * 0.10; + } + } + } + // float lightness_diff = clamp(glow.x - dest.x, 0.0, 1.0); + // dest.x = lightness_diff; + // dest.yz = dest.yz * (1.0 - lightness_diff) + glow.yz * lightness_diff; + dest.xyz += glow.xyz; + } + + fragColor = toRgb(dest); + } else { + // If the pixel is background, set alpha to 0.0 for transparency + fragColor = vec4(originalColor.rgb, 0.0); + } +} diff --git a/home-manager/modules/ghostty/shaders/glow.glsl b/home-manager/modules/ghostty/shaders/glow.glsl new file mode 100644 index 0000000..83bef9c --- /dev/null +++ b/home-manager/modules/ghostty/shaders/glow.glsl @@ -0,0 +1,145 @@ +// First it does a "chromatic aberration" by splitting the rgb signals by a product of sin functions +// over time, then it does a glow effect in a perceptual color space +// Based on kalgynirae's Ghostty passable glow shader and NickWest's Chromatic Aberration shader demo +// Passable glow: https://github.com/kalgynirae/dotfiles/blob/main/ghostty/glow.glsl +// "Chromatic Aberration": https://www.shadertoy.com/view/Mds3zn + +// sRGB linear -> nonlinear transform from https://bottosson.github.io/posts/colorwrong/ +float f(float x) { + if (x >= 0.0031308) { + return 1.055 * pow(x, 1.0 / 2.4) - 0.055; + } else { + return 12.92 * x; + } +} + +float f_inv(float x) { + if (x >= 0.04045) { + return pow((x + 0.055) / 1.055, 2.4); + } else { + return x / 12.92; + } +} + +// Oklab <-> linear sRGB conversions from https://bottosson.github.io/posts/oklab/ +vec4 toOklab(vec4 rgb) { + vec3 c = vec3(f_inv(rgb.r), f_inv(rgb.g), f_inv(rgb.b)); + float l = 0.4122214708 * c.r + 0.5363325363 * c.g + 0.0514459929 * c.b; + float m = 0.2119034982 * c.r + 0.6806995451 * c.g + 0.1073969566 * c.b; + float s = 0.0883024619 * c.r + 0.2817188376 * c.g + 0.6299787005 * c.b; + float l_ = pow(l, 1.0 / 3.0); + float m_ = pow(m, 1.0 / 3.0); + float s_ = pow(s, 1.0 / 3.0); + return vec4( + 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_, + 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_, + 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_, + rgb.a + ); +} + +vec4 toRgb(vec4 oklab) { + vec3 c = oklab.rgb; + float l_ = c.r + 0.3963377774 * c.g + 0.2158037573 * c.b; + float m_ = c.r - 0.1055613458 * c.g - 0.0638541728 * c.b; + float s_ = c.r - 0.0894841775 * c.g - 1.2914855480 * c.b; + float l = l_ * l_ * l_; + float m = m_ * m_ * m_; + float s = s_ * s_ * s_; + vec3 linear_srgb = vec3( + 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, + -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, + -0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s + ); + return vec4( + clamp(f(linear_srgb.r), 0.0, 1.0), + clamp(f(linear_srgb.g), 0.0, 1.0), + clamp(f(linear_srgb.b), 0.0, 1.0), + oklab.a + ); +} + +// Bloom samples from https://gist.github.com/qwerasd205/c3da6c610c8ffe17d6d2d3cc7068f17f +const vec3[24] samples = { + vec3(0.1693761725038636, 0.9855514761735895, 1), + vec3(-1.333070830962943, 0.4721463328627773, 0.7071067811865475), + vec3(-0.8464394909806497, -1.51113870578065, 0.5773502691896258), + vec3(1.554155680728463, -1.2588090085709776, 0.5), + vec3(1.681364377589461, 1.4741145918052656, 0.4472135954999579), + vec3(-1.2795157692199817, 2.088741103228784, 0.4082482904638631), + vec3(-2.4575847530631187, -0.9799373355024756, 0.3779644730092272), + vec3(0.5874641440200847, -2.7667464429345077, 0.35355339059327373), + vec3(2.997715703369726, 0.11704939884745152, 0.3333333333333333), + vec3(0.41360842451688395, 3.1351121305574803, 0.31622776601683794), + vec3(-3.167149933769243, 0.9844599011770256, 0.30151134457776363), + vec3(-1.5736713846521535, -3.0860263079123245, 0.2886751345948129), + vec3(2.888202648340422, -2.1583061557896213, 0.2773500981126146), + vec3(2.7150778983300325, 2.5745586041105715, 0.2672612419124244), + vec3(-2.1504069972377464, 3.2211410627650165, 0.2581988897471611), + vec3(-3.6548858794907493, -1.6253643308191343, 0.25), + vec3(1.0130775986052671, -3.9967078676335834, 0.24253562503633297), + vec3(4.229723673607257, 0.33081361055181563, 0.23570226039551587), + vec3(0.40107790291173834, 4.340407413572593, 0.22941573387056174), + vec3(-4.319124570236028, 1.159811599693438, 0.22360679774997896), + vec3(-1.9209044802827355, -4.160543952132907, 0.2182178902359924), + vec3(3.8639122286635708, -2.6589814382925123, 0.21320071635561041), + vec3(3.3486228404946234, 3.4331800232609, 0.20851441405707477), + vec3(-2.8769733643574344, 3.9652268864187157, 0.20412414523193154) +}; + +float offsetFunction(float iTime) { + float amount = 1.0; + const float periods[4] = {6.0, 16.0, 19.0, 27.0}; + for (int i = 0; i < 4; i++) { + amount *= 1.0 + 0.5 * sin(iTime*periods[i]); + } + //return amount; + return amount * periods[3]; +} + +const float DIM_CUTOFF = 0.35; +const float BRIGHT_CUTOFF = 0.65; +const float ABBERATION_FACTOR = 0.05; + +void mainImage(out vec4 fragColor, in vec2 fragCoord) { + vec2 uv = fragCoord.xy / iResolution.xy; + + float amount = offsetFunction(iTime); + + vec3 col; + col.r = texture( iChannel0, vec2(uv.x-ABBERATION_FACTOR*amount / iResolution.x, uv.y) ).r; + col.g = texture( iChannel0, uv ).g; + col.b = texture( iChannel0, vec2(uv.x+ABBERATION_FACTOR*amount / iResolution.x, uv.y) ).b; + + vec4 splittedColor = vec4(col, 1.0); + vec4 source = toOklab(splittedColor); + vec4 dest = source; + + if (source.x > DIM_CUTOFF) { + dest.x *= 1.2; + // dest.x = 1.2; + } else { + vec2 step = vec2(1.414) / iResolution.xy; + vec3 glow = vec3(0.0); + for (int i = 0; i < 24; i++) { + vec3 s = samples[i]; + float weight = s.z; + vec4 c = toOklab(texture(iChannel0, uv + s.xy * step)); + if (c.x > DIM_CUTOFF) { + glow.yz += c.yz * weight * 0.3; + if (c.x <= BRIGHT_CUTOFF) { + glow.x += c.x * weight * 0.05; + } else { + glow.x += c.x * weight * 0.10; + } + } + } + // float lightness_diff = clamp(glow.x - dest.x, 0.0, 1.0); + // dest.x = lightness_diff; + // dest.yz = dest.yz * (1.0 - lightness_diff) + glow.yz * lightness_diff; + dest.xyz += glow.xyz; + dest.a = 0.5; + } + + fragColor = toRgb(dest); +} diff --git a/home-manager/modules/git/default.nix b/home-manager/modules/git/default.nix new file mode 100644 index 0000000..9dd52b3 --- /dev/null +++ b/home-manager/modules/git/default.nix @@ -0,0 +1,33 @@ +{ + config, + lib, + ... +}: let + cfg = config.lily.git; +in { + options.lily.git = { + enable = lib.mkEnableOption "activate git"; + }; + + config = lib.mkIf cfg.enable { + programs.git = { + enable = true; + lfs.enable = true; + extraConfig = { + user = { + name = "Lily"; + email = "Caznix01@gmail.com"; + signingKey = "Caznix"; + }; + commit.gpgsign = true; + init.defaultBranch = "main"; + merge = { + ff = "no"; + no-commit = "yes"; + }; + pull.ff = "only"; + push = {autoSetupRemote = true;}; + }; + }; + }; +} diff --git a/home-manager/modules/hyprland/default.nix b/home-manager/modules/hyprland/default.nix new file mode 100644 index 0000000..1651a5c --- /dev/null +++ b/home-manager/modules/hyprland/default.nix @@ -0,0 +1,116 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.lily.hyprland; +in { + options.lily.hyprland = { + enable = lib.mkEnableOption "activate hyprland"; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + wl-clipboard + ]; + programs.kitty.enable = true; # required for the default Hyprland config + wayland.windowManager.hyprland = { + enable = true; + settings = { + decoration = { + rounding = 10; + # rounding_power = 2; + blur = { + enabled = true; + size = 10; + passes = 3; + popups = true; + + xray = true; + }; + }; + blurls = "waybar"; + dwindle = { + pseudotile = true; # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true; # You probably want this + }; + general = { + resize_on_border = true; # Enables resizing by dragging window borders + extend_border_grab_area = 15; # Extends the clickable area around the border for resizing + hover_icon_on_border = true; # Shows a cursor icon when + layout = "dwindle"; + "col.active_border" = "rgba(C55900ee) rgba(FFAA63ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + border_size = 2; + gaps_out = 10; + }; + exec-once = [ + "${pkgs.kdePackages.kwallet-pam}/libexec/pam_kwallet_init" + "${pkgs.networkmanagerapplet}/bin/nm-applet" + "${pkgs.blueman}/bin/blueman-applet" + ]; + "$super" = "SUPER"; + "$alt_super" = "CTRL"; + + bind = [ + "$super, Q, killactive" + "$alt_super $super,Q,exit" + # Screenshot region + "$super SHIFT,S, exec, GRIM_DEFAULT_DIR=${config.home.homeDirectory}/Pictures/Screenshots/ ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" - | wl-copy " + "$super,T, exec, ghostty" + "$super, L,exec, hyprlock --immediate" + "$super, B,exec, chromium" + "$super,F,fullscreen" + "$super SHIFT,F,togglefloating" + "$super,E,exec,kate" + + "ALT,SPACE,exec, rofi -show drun" + "$super, P, pseudo," + + "$super, 1, workspace, 1" + "$super, 2, workspace, 2" + "$super, 3, workspace, 3" + "$super, 4, workspace, 4" + "$super, 5, workspace, 5" + "$super, 6, workspace, 6" + "$super, 7, workspace, 7" + "$super, 8, workspace, 8" + "$super, 9, workspace, 9" + "$super, 0, workspace, 10" + + # Move active window to a workspace iwth mainMod + SHIFT + j + "$super SHIFT, 1, movetoworkspace, 1" + "$super SHIFT, 2, movetoworkspace, 2" + "$super SHIFT, 3, movetoworkspace, 3" + "$super SHIFT, 4, movetoworkspace, 4" + "$super SHIFT, 5, movetoworkspace, 5" + "$super SHIFT, 6, movetoworkspace, 6" + "$super SHIFT, 7, movetoworkspace, 7" + "$super SHIFT, 8, movetoworkspace, 8" + "$super SHIFT, 9, movetoworkspace, 9" + "$super SHIFT, 0, movetoworkspace, 10" + + "$super, J, togglesplit" + + "$super, left, movefocus, l" + "$super, right, movefocus, r" + "$super, up, movefocus, u" + "$super, down, movefocus, d" + ]; + bindm = [ + "$super, mouse:272, movewindow" + "$super, mouse:273, resizewindow" + ]; + bindel = [ + ",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" + ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + ",XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl s 10%+" + ",XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl s 10%-" + ]; + }; + }; + }; +} diff --git a/home-manager/modules/neovim/colorscheme.nix b/home-manager/modules/neovim/colorscheme.nix new file mode 100644 index 0000000..20d2df5 --- /dev/null +++ b/home-manager/modules/neovim/colorscheme.nix @@ -0,0 +1,42 @@ +{...}: { + programs.nixvim = { + colorschemes.catppuccin = { + enable = true; + settings = { + flavour = "mocha"; + background = { + light = "latte"; + dark = "mocha"; + }; + transparent_background = true; + show_end_of_buffer = false; + term_colors = false; + dim_inactive.enabled = false; + no_italic = false; + no_bold = false; + styles = { + comments = ["italic"]; + conditionals = ["italic"]; + loops = null; + functions = null; + keywords = null; + strings = null; + variables = null; + numbers = null; + booleans = null; + properties = null; + types = null; + operators = null; + }; + integrations = { + cmp = true; + gitsigns = true; + nvimtree = true; + telescope = true; + notify = false; + mini = false; + }; + }; + }; + }; +} diff --git a/home-manager/modules/neovim/default.nix b/home-manager/modules/neovim/default.nix new file mode 100644 index 0000000..0876035 --- /dev/null +++ b/home-manager/modules/neovim/default.nix @@ -0,0 +1,32 @@ +{ + pkgs, + nixvim, + config, + lib, + ... +}: let + cfg = config.lily.neovim; +in { + imports = [ + # ./colorscheme.nix + ./plugins + ./keybinds.nix + ]; + options.lily.neovim = { + enable = lib.mkEnableOption "activate neovim"; + }; + config = lib.mkIf cfg.enable { + programs.nixvim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + + performance = { + byteCompileLua.enable = true; + combinePlugins = {}; + }; + }; + }; +} diff --git a/home-manager/modules/neovim/keybinds.nix b/home-manager/modules/neovim/keybinds.nix new file mode 100644 index 0000000..1ebf6ab --- /dev/null +++ b/home-manager/modules/neovim/keybinds.nix @@ -0,0 +1,32 @@ +{...}: { + programs.nixvim = { + globals = { + mapleader = " "; + maplocalleader = " "; + }; + keymaps = [ + { + mode = ["n" "v"]; + key = ""; + action = ""; + options.silent = true; + } + + { + mode = "n"; + key = ","; + action = "A,"; + options.silent = true; + } + { + mode = "n"; + key = "sf"; + action.__raw = "require('telescope.builtin').find_files"; + options = { + silent = true; + desc = "[S]earch [F]iles"; + }; + } + ]; + }; +} diff --git a/home-manager/modules/neovim/plugins/default.nix b/home-manager/modules/neovim/plugins/default.nix new file mode 100644 index 0000000..8031650 --- /dev/null +++ b/home-manager/modules/neovim/plugins/default.nix @@ -0,0 +1,24 @@ +{...}: { + imports = [ + ./telescope.nix + ./lualine.nix + ./treesitter.nix + ./gitsigns.nix + ./tree.nix + ./lsp + # ./dap.nix + ]; + programs.nixvim.plugins = { + sleuth.enable = true; + comment.enable = true; + indent-blankline.enable = true; + web-devicons.enable = true; + fugitive.enable = true; + markdown-preview.enable = true; + + git-worktree = { + enable = true; + enableTelescope = true; + }; + }; +} diff --git a/home-manager/modules/neovim/plugins/gitsigns.nix b/home-manager/modules/neovim/plugins/gitsigns.nix new file mode 100644 index 0000000..ac877f5 --- /dev/null +++ b/home-manager/modules/neovim/plugins/gitsigns.nix @@ -0,0 +1,45 @@ +{...}: { + programs.nixvim.plugins.gitsigns = { + enable = true; + settings = { + signs = { + add.text = "▎"; + change.text = "▎"; + delete.text = ""; + topdelete.text = ""; + changedelete.text = "▎"; + }; + + signs_staged_enable = true; + signcolumn = true; + numhl = false; + linehl = false; + word_diff = false; + watch_gitdir = { + interval = 1000; + follow_files = true; + }; + attach_to_untracked = true; + current_line_blame = false; + current_line_blame_opts = { + virt_text = true; + virt_text_pos = "eol"; + delay = 100; + ignore_whitespace = true; + }; + + current_line_blame_formatter = ", "; + sign_priority = 6; + status_formatter = null; + update_debounce = 200; + max_file_length = 40000; + preview_config = { + border = "rounded"; + style = "minimal"; + relative = "cursor"; + row = 0; + col = 1; + }; + }; + }; +} diff --git a/home-manager/modules/neovim/plugins/lsp/cmp.nix b/home-manager/modules/neovim/plugins/lsp/cmp.nix new file mode 100644 index 0000000..cb9fa0f --- /dev/null +++ b/home-manager/modules/neovim/plugins/lsp/cmp.nix @@ -0,0 +1,85 @@ +{...}: { + programs.nixvim.plugins = { + cmp = { + autoEnableSources = false; + enable = true; + settings = { + snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; + formatting = { + fields = ["kind" "abbr" "menu"]; + format = '' + function(entry, vim_item) + local kind_icons = { + Text = "󰉿", + Method = "󰆧", + Function = "󰊕", + Constructor = "", + Field = " ", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "", + Event = "", + Operator = "󰆕", + TypeParameter = " ", + Misc = " ", + } + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + vim_item.abbr = vim_item.abbr .. " " .. (vim_item.menu and vim_item.menu or "") + if vim.fn.strchars(vim_item.abbr) > 50 then + vim_item.abbr = vim.fn.strcharpart(vim_item.abbr, 0, 50) .. "..." + end + vim_item.menu = ({ + nvim_lsp = "[LSP]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]" + })[entry.source.name] + return vim_item + end + ''; + }; + mapping.__raw = '' cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + })''; + window = { + completion.__raw = "cmp.config.window.bordered()"; + documentation.__raw = "cmp.config.window.bordered()"; + }; + sources = [ + {name = "nvim_lsp";} + {name = "luasnip";} + {name = "path";} + {name = "buffer";} + {name = "crates";} + ]; + }; + }; + cmp_luasnip.enable = true; + cmp-buffer.enable = true; + cmp-path.enable = true; + cmp-nvim-lsp.enable = true; + luasnip.enable = true; + }; +} diff --git a/home-manager/modules/neovim/plugins/lsp/default.nix b/home-manager/modules/neovim/plugins/lsp/default.nix new file mode 100644 index 0000000..1b5ce1e --- /dev/null +++ b/home-manager/modules/neovim/plugins/lsp/default.nix @@ -0,0 +1,192 @@ +{pkgs, ...}: { + imports = [ + ./cmp.nix + ]; + programs.nixvim.plugins = { + crates.enable = true; # Does not work + dressing.enable = true; + }; + programs.nixvim.extraConfigVim = '' + augroup unrecognized_filetypes + autocmd! + autocmd BufRead,BufNewFile *.vert set filetype=glsl + autocmd BufRead,BufNewFile *.tesc set filetype=glsl + autocmd BufRead,BufNewFile *.tese set filetype=glsl + autocmd BufRead,BufNewFile *.frag set filetype=glsl + autocmd BufRead,BufNewFile *.geom set filetype=glsl + autocmd BufRead,BufNewFile *.comp set filetype=glsl + autocmd BufRead,BufNewFile *.qml set filetype=qml + autocmd BufRead,BufNewFile *.slint set filetype=slint + autocmd BufRead,BufNewFile *.typ set filetype=typst + augroup END + ''; + programs.nixvim.plugins.lsp = { + enable = true; + + capabilities = '' + capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + capabilities.textDocument.completion.completionItem.snippetSupport = true''; + preConfig = '' + local border = { + { "╭", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, + { "╯", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, + { "│", "FloatBorder" } + } + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }) + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border }) + ''; + + inlayHints = true; + servers = { + clangd = { + enable = true; + settings.arguments = [ + "--clang-tidy" + "--background-index" + "--completion-style=detailed" + "--cross-file-rename" + "--header-insertion=iwyu" + "--all-scopes-completion" + ]; + }; + # jdtls.enable = true; + emmet_ls.enable = true; + ts_ls.enable = true; + cssls.enable = true; + # glsl_analyzer.enable = true; + glslls.enable = true; + pyright.enable = true; + nixd.enable = true; + lua_ls = { + enable = true; + settings = { + telemetry.enable = false; + workspace.checkThirdParty = false; + }; + }; + svelte = { + enable = true; + settings.enable_ts_plugin = true; + }; + slint_lsp.enable = true; + zls.enable = true; + rust_analyzer = { + enable = true; + installRustc = false; + installCargo = false; + settings = { + imports = { + granularity.group = "crate"; + prefix = "self"; + preferNoStd = true; + }; + check = { + command = "clippy"; + allTargets = true; + }; + completion = { + fullFunctionSignatures.enable = false; + autoimport.enable = true; + }; + cargo = { + allTargets = true; + features = "all"; + }; + procMacro.enable = true; + }; + }; + }; + keymaps = { + silent = true; + extra = [ + { + mode = "n"; + key = "rn"; + action.__raw = "vim.lsp.buf.rename"; + } + { + mode = "n"; + key = "ca"; + action.__raw = "vim.lsp.buf.code_action"; + } + { + mode = "n"; + key = "di"; + action.__raw = "vim.diagnostic.open_float"; + } + { + mode = "n"; + key = "dv"; + action.__raw = "require('telescope.builtin').diagnostics"; + } + + { + mode = "n"; + key = "gd"; + action.__raw = "vim.lsp.buf.definition"; + } + { + mode = "n"; + key = "gr"; + action.__raw = "require('telescope.builtin').lsp_references"; + } + { + mode = "n"; + key = "gI"; + action.__raw = "vim.lsp.buf.implementation"; + } + { + mode = "n"; + key = "D"; + action.__raw = "vim.lsp.buf.type_definition"; + } + { + mode = "n"; + key = "ds"; + action.__raw = "require('telescope.builtin').lsp_document_symbols"; + } + { + mode = "n"; + key = "ws"; + action.__raw = "require('telescope.builtin').lsp_dynamic_workspace_symbols"; + } + { + mode = "n"; + key = "K"; + action.__raw = "vim.lsp.buf.hover"; + } + { + mode = "n"; + key = "k"; + action.__raw = "vim.lsp.buf.signature_help"; + } + + { + mode = "n"; + key = "gD"; + action.__raw = "vim.lsp.buf.declaration"; + } + { + mode = "n"; + key = "wa"; + action.__raw = "vim.lsp.buf.add_workspace_folder"; + } + { + mode = "n"; + key = "wr"; + action.__raw = "vim.lsp.buf.remove_workspace_folder"; + } + { + mode = "n"; + key = "wl"; + action.__raw = "function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end"; + } + ]; + }; + }; +} diff --git a/home-manager/modules/neovim/plugins/lualine.nix b/home-manager/modules/neovim/plugins/lualine.nix new file mode 100644 index 0000000..a56b133 --- /dev/null +++ b/home-manager/modules/neovim/plugins/lualine.nix @@ -0,0 +1,21 @@ +{...}: { + programs.nixvim.plugins.lualine = { + enable = true; + settings = { + options = { + icons_enabled = true; + component_seperators = { + left = "|"; + right = "|"; + }; + section_seperators = { + left = ""; + right = ""; + }; + disabled_filetypes.statusline = ["NvimTree" "alpha"]; + disabled_filetypes.winbar = ["NvimTree" "alpha"]; + theme = null; + }; + }; + }; +} diff --git a/home-manager/modules/neovim/plugins/telescope.nix b/home-manager/modules/neovim/plugins/telescope.nix new file mode 100644 index 0000000..1a3c2de --- /dev/null +++ b/home-manager/modules/neovim/plugins/telescope.nix @@ -0,0 +1,47 @@ +{...}: { + programs.nixvim.plugins.telescope = { + enable = true; + extensions = { + fzf-native.enable = true; + file-browser.enable = true; + }; + settings = { + theme = "dropdown"; + defaults = { + prompt_prefix = " "; + selection_caret = " "; + entry_prefix = " "; + initial_mode = "insert"; + selection_strategy = "reset"; + layout_config = {}; + mappings.i = { + "" = false; + "" = false; + }; + file_ignore_patters = {}; + path_display = "smart"; + winblend = 0; + border = {}; + borderchars = null; + color_devicons = true; + set_env = {COLORTERM = "truecolor";}; + }; + pickers = { + planets = { + show_pluto = true; + show_moon = true; + }; + git_files = { + hidden = true; + show_untracked = true; + }; + colorscheme = { + enable_preview = true; + }; + find_files = { + hidden = true; + }; + }; + }; + }; +} diff --git a/home-manager/modules/neovim/plugins/tree.nix b/home-manager/modules/neovim/plugins/tree.nix new file mode 100644 index 0000000..98c3779 --- /dev/null +++ b/home-manager/modules/neovim/plugins/tree.nix @@ -0,0 +1,17 @@ +{ + programs.nixvim.plugins.nvim-tree = { + enable = true; + disableNetrw = true; + hijackNetrw = true; + diagnostics.enable = true; + preferStartupRoot = false; + syncRootWithCwd = true; + view = { + side = "left"; + width = 30; + }; + renderer.groupEmpty = true; + actions.openFile.resizeWindow = true; + git.ignore = false; + }; +} diff --git a/home-manager/modules/neovim/plugins/treesitter.nix b/home-manager/modules/neovim/plugins/treesitter.nix new file mode 100644 index 0000000..96f94ab --- /dev/null +++ b/home-manager/modules/neovim/plugins/treesitter.nix @@ -0,0 +1,19 @@ +{config, ...}: { + programs.nixvim.plugins.treesitter = { + enable = true; + nixvimInjections = true; + settings = { + indent.enable = true; + incremental_selection = { + enable = true; + # keymaps = { + # init_selection = ""; + # node_incremental = ""; + # scope_incremental = " C++ == 1 - ;;clojure ; java with a lisp - ;;common-lisp ; if you've seen one lisp, you've seen them all - ;;coq ; proofs-as-programs - ;;crystal ; ruby at the speed of c - ;;csharp ; unity, .NET, and mono shenanigans - ;;data ; config/data formats - ;;(dart +flutter) ; paint ui and not much else - ;;dhall - ;;elixir ; erlang done right - ;;elm ; care for a cup of TEA? - emacs-lisp ; drown in parentheses - ;;erlang ; an elegant language for a more civilized age - ;;ess ; emacs speaks statistics - ;;factor - ;;faust ; dsp, but you get to keep your soul - ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) - ;;fsharp ; ML stands for Microsoft's Language - ;;fstar ; (dependent) types and (monadic) effects and Z3 - ;;gdscript ; the language you waited for - ;;(go +lsp) ; the hipster dialect - ;;(graphql +lsp) ; Give queries a REST - (haskell +lsp) ; a language that's lazier than I am - ;;hy ; readability of scheme w/ speed of python - ;;idris ; a language you can depend on - ;;json ; At least it ain't XML - ;;(java +lsp) ; the poster child for carpal tunnel syndrome - ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) - ;;julia ; a better, faster MATLAB - ;;kotlin ; a better, slicker Java(Script) - latex ; writing papers in Emacs has never been so fun - ;;lean ; for folks with too much to prove - ;;ledger ; be audit you can be - ;;lua ; one-based indices? one-based indices - markdown ; writing docs for people to ignore - ;;nim ; python + lisp at the speed of c - nix ; I hereby declare "nix geht mehr!" - ;;ocaml ; an objective camel - org ; organize your plain life in plain text - ;;php ; perl's insecure younger brother - ;;plantuml ; diagrams for confusing people more - ;;purescript ; javascript, but functional - python ; beautiful is better than ugly - ;;qt ; the 'cutest' gui framework ever - ;;racket ; a DSL for DSLs - ;;raku ; the artist formerly known as perl6 - ;;rest ; Emacs as a REST client - ;;rst ; ReST in peace - ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} - (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() - ;;scala ; java, but good - ;;(scheme +guile) ; a fully conniving family of lisps - sh ; she sells {ba,z,fi}sh shells on the C xor - ;;sml - ;;solidity ; do you need a blockchain? No. - ;;swift ; who asked for emoji variables? - ;;terra ; Earth and Moon in alignment for performance. - ;;web ; the tubes - ;;yaml ; JSON, but readable - ;;zig ; C, but simpler - - :email - ;;(mu4e +org +gmail) - ;;notmuch - ;;(wanderlust +gmail) - - :app - ;;calendar - ;;emms - ;;everywhere ; *leave* Emacs!? You must be joking - ;;irc ; how neckbeards socialize - ;;(rss +org) ; emacs as an RSS reader - - :config - ;;literate - (default +bindings +smartparens)) diff --git a/home-manager/packages/doom-emacs/.doom.d/packages.el b/home-manager/packages/doom-emacs/.doom.d/packages.el deleted file mode 100644 index 4047ab8..0000000 --- a/home-manager/packages/doom-emacs/.doom.d/packages.el +++ /dev/null @@ -1,63 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; $DOOMDIR/packages.el - -;; To install a package with Doom you must declare them here and run 'doom sync' -;; on the command line, then restart Emacs for the changes to take effect -- or -;; use 'M-x doom/reload'. - - -;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: -;; (package! some-package) - -;; To install a package directly from a remote git repo, you must specify a -;; `:recipe'. You'll find documentation on what `:recipe' accepts here: -;; https://github.com/radian-software/straight.el#the-recipe-format -;; (package! another-package -;; :recipe (:host github :repo "username/repo")) - -;; If the package you are trying to install does not contain a PACKAGENAME.el -;; file, or is located in a subdirectory of the repo, you'll need to specify -;; `:files' in the `:recipe': -;; (package! this-package -;; :recipe (:host github :repo "username/repo" -;; :files ("some-file.el" "src/lisp/*.el"))) - -;; If you'd like to disable a package included with Doom, you can do so here -;; with the `:disable' property: -;; (package! builtin-package :disable t) - -;; You can override the recipe of a built in package without having to specify -;; all the properties for `:recipe'. These will inherit the rest of its recipe -;; from Doom or MELPA/ELPA/Emacsmirror: -;; (package! builtin-package :recipe (:nonrecursive t)) -;; (package! builtin-package-2 :recipe (:repo "myfork/package")) - -;; Specify a `:branch' to install a package from a particular branch or tag. -;; This is required for some packages whose default branch isn't 'master' (which -;; our package manager can't deal with; see radian-software/straight.el#279) -;; (package! builtin-package :recipe (:branch "develop")) - -;; Use `:pin' to specify a particular commit to install. -;; (package! builtin-package :pin "1a2b3c4d5e") - - -;; Doom's packages are pinned to a specific commit and updated from release to -;; release. The `unpin!' macro allows you to unpin single packages... -;; (unpin! pinned-package) -;; ...or multiple packages -;; (unpin! pinned-package another-pinned-package) -;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) -;; (unpin! t) - -(package! elcord) -(package! catppuccin-theme) -(package! org-view-mode) -(package! org-superstar) -(package! lsp-ui) -(package! svelte-mode) -(package! typescript-mode) - -(setq lsp-log-io t) -(add-hook 'org-mode-hook - (lambda () - (org-superstar-mode 1))) diff --git a/home-manager/packages/doom-emacs/.gitignore b/home-manager/packages/doom-emacs/.gitignore deleted file mode 100644 index 6daab5a..0000000 --- a/home-manager/packages/doom-emacs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!.doom.d/ diff --git a/home-manager/packages/emacs.nix b/home-manager/packages/emacs.nix deleted file mode 100644 index 6d1e57d..0000000 --- a/home-manager/packages/emacs.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ pkgs, config, lib, ... }: - -{ - programs.emacs = { - enable = true; - package = pkgs.emacs; - }; - - home.activation = { - cloneDoomEmacs = '' - if [ ! -d "$HOME/.emacs.d" ]; then - ${pkgs.git}/bin/git clone https://github.com/doomemacs/doomemacs $HOME/.emacs.d - fi - ''; - }; - - home.file.".doom.d" = { - source = ./doom-emacs/.doom.d; - recursive = true; - onChange = "${config.home.homeDirectory}/.emacs.d/bin/doom sync"; - force = true; - }; -} diff --git a/home-manager/packages/git.nix b/home-manager/packages/git.nix deleted file mode 100644 index 707417f..0000000 --- a/home-manager/packages/git.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: - -{ - programs.git = { - enable = true; - userName = "luxzi"; - userEmail = "lesson085@gmail.com"; - aliases = { - pf = "push --force"; - kl = "log --show-signature"; - }; - signing = { - key = "C90237A70F2FDD53"; - signByDefault = true; - }; - extraConfig = { - init.defaultBranch = "main"; - core.symlinks = true; - commit.gpgsign = true; - }; - }; -} diff --git a/home-manager/packages/kitty.nix b/home-manager/packages/kitty.nix deleted file mode 100644 index b071f86..0000000 --- a/home-manager/packages/kitty.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs, ... }: - -{ - programs.kitty = { - enable = true; - font = { - name = "FiraCode Nerd Font"; - package = pkgs.nerd-fonts.fira-code; - size = 14; - }; - settings = { - window_padding_width = 4; - background_opacity = "0.65"; - background_blur = 1; - }; - }; -} diff --git a/home-manager/packages/packages.nix b/home-manager/packages/packages.nix deleted file mode 100644 index eefd3b9..0000000 --- a/home-manager/packages/packages.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs, ... }: - -{ - imports = - [ - ./zsh.nix - ./git.nix - ./emacs.nix - ./kitty.nix - ]; - - home.packages = with pkgs; [ - hyfetch - nix-output-monitor - firefox - tree - vesktop - fzf - tor-browser - nix-search-cli - mpv - element-desktop - mission-center - nvtop - alacritty - nerd-fonts.fira-code - ]; - - nixpkgs.config.allowUnfree = true; -} diff --git a/home-manager/packages/zsh.nix b/home-manager/packages/zsh.nix deleted file mode 100644 index 956dd25..0000000 --- a/home-manager/packages/zsh.nix +++ /dev/null @@ -1,99 +0,0 @@ -{ ... }: - -{ - programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - autocd = true; - shellAliases = { - hm-switch = "home-manager switch --flake $HOME/.dotfiles"; - nx-switch = "sudo nixos-rebuild switch --flake $HOME/.dotfiles"; - nx-boot = "sudo nixos-rebuild boot --flake $HOME/.dotfiles"; - nx-clean = "sudo nix-collect-garbage --delete-old && nix-collect-garbage --delete-old"; - hm-clean = "home-manager remove-generations"; - gl-switch = "sudo nixos-rebuild switch --flake $HOME/.dotfiles && home-manager switch --flake $HOME/.dotfiles"; - gl-clean = "sudo nix-collect-garbage --delete-old && nix-collect-garbage --delete-old && home-manager remove-generations"; - snv = "sudo -E nvim"; - sen = "sudo -E"; - emacs-config = "emacs --chdir $HOME/.dotfiles/home-manager/packages/doom-emacs/.doom.d &"; - }; - - zplug = { - enable = true; - plugins = [ - { name = "Aloxaf/fzf-tab"; } - ]; - }; - - history = { - size = 5000; - save = 5000; - ignoreAllDups = true; - ignoreDups = true; - ignoreSpace = true; - share = true; - }; - - initExtra = '' - bindkey -v - bindkey '^k' history-search-backward - bindkey '^j' history-search-forward - setopt appendHistory - zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' - zstyle ':completion:*' menu no - zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' - eval "$(fzf --zsh)" - ''; - }; - - programs.starship = { - enable = true; - settings = { - format = "$username$hostname$directory$git_branch$git_state$git_status$nix_shell$cmd_duration$line_break$python$character"; - - directory = { - style = "blue"; - }; - - character = { - success_symbol = "[❯](white)"; - error_symbol = "[❯](red)"; - vimcmd_symbol = "[❮](green)"; - }; - - git_branch = { - format = "[$branch]($style)"; - style = "green"; - }; - - git_status = { - format = "[[($conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)"; - style = "cyan"; - conflicted = "!"; - untracked = "​u"; - modified = "​*"; - staged = "​+"; - renamed = "r"; - deleted = "d"; - stashed = "≡"; - }; - - git_state = { - format = "\([$state( $progress_current/$progress_total)]($style)\) "; - style = "bright-black"; - }; - - cmd_duration = { - format = "[$duration]($style) "; - style = "yellow"; - }; - - python = { - format = "[$virtualenv]($style) "; - style = "bright-black"; - }; - }; - }; -} diff --git a/home-manager/profiles/desktop.nix b/home-manager/profiles/desktop.nix new file mode 100644 index 0000000..00cfd63 --- /dev/null +++ b/home-manager/profiles/desktop.nix @@ -0,0 +1,22 @@ +{pkgs, ...}: { + imports = [ + ./main.nix + ]; + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + lily = { + hyprland.enable = true; + ghostty.enable = true; + neovim.enable = true; + rofi.enable = true; + vscode.enable = true; + zed.enable = true; + waybar.enable = true; + chromium.enable = true; + }; + home.packages = with pkgs; [ + vesktop + ]; +} diff --git a/home-manager/profiles/main.nix b/home-manager/profiles/main.nix new file mode 100644 index 0000000..b252192 --- /dev/null +++ b/home-manager/profiles/main.nix @@ -0,0 +1,10 @@ +{pkgs, ...}: { + home.stateVersion = "24.11"; + programs.home-manager.enable = true; + nixpkgs.config.allowUnfree = true; + + lily = { + zsh.enable = true; + git.enable = true; + }; +} diff --git a/machines/nix/configuration.nix b/machines/nix/configuration.nix new file mode 100644 index 0000000..05600e5 --- /dev/null +++ b/machines/nix/configuration.nix @@ -0,0 +1,79 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{...}: { + inputs, + outputs, + lib, + config, + pkgs, + flake-self, + ... +}: { + # You can import other NixOS modules here + imports = [ + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # inputs.home-manager.nixosModules.home-manager + # inputs.nix-gaming.nixosModules.platformOptimizations + + # Import your generated (nixos-generate-config) hardware configuration + ./hardware-configuration.nix + # ../common.nix + # ./plymouth.nix + ]; + lily = { + users.lily.enable = true; + laptop.enable = true; + common.enable = true; + containers = { + enable = true; + podman = true; + # docker = false; + }; + nvidia.enable = true; + desktop = { + enable = true; + hyprland.enable = true; + plasma.enable = true; + }; + }; + networking.hostName = "nix"; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + timeout = 0; + }; + consoleLogLevel = 0; + initrd.verbose = false; + kernelPackages = pkgs.linuxPackages_lqx; + kernelParams = [ + "quiet" + "splash" + ]; + }; + + programs = { + steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + platformOptimizations.enable = true; + localNetworkGameTransfers.openFirewall = true; + gamescopeSession.enable = true; + extraCompatPackages = let gamePkgs = inputs.nix-gaming.packages.${pkgs.hostPlatform.system}; in [pkgs.proton-ge-bin gamePkgs.northstar-proton]; + }; + }; + + home-manager = { + users = { + lily = flake-self.homeConfigurations.lily; + }; + }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + # system.stateVersion = "24.11"; +} diff --git a/machines/nix/hardware-configuration.nix b/machines/nix/hardware-configuration.nix new file mode 100644 index 0000000..6be9341 --- /dev/null +++ b/machines/nix/hardware-configuration.nix @@ -0,0 +1,45 @@ +# 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" "usbhid" "sd_mod" "rtsx_pci_sdmmc"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/95c3ec11-8329-4b54-a690-97c31250a110"; + fsType = "btrfs"; + options = ["subvol=@"]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/9666-823F"; + fsType = "vfat"; + options = ["fmask=0077" "dmask=0077"]; + }; + + swapDevices = [ + {device = "/dev/disk/by-uuid/5fd02c5b-4ce0-46be-8771-9c1b0d280d8d";} + ]; + + # 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.wlp92s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/nix/plymouth.nix b/machines/nix/plymouth.nix new file mode 100644 index 0000000..3dd9c93 --- /dev/null +++ b/machines/nix/plymouth.nix @@ -0,0 +1,31 @@ +{pkgs, ...}: { + boot = { + plymouth = { + enable = true; + theme = "bgrt"; + #themePackages = with pkgs; [ + # By default we would install all themes + #(adi1090x-plymouth-themes.override { + # selected_themes = [ "bgrt" ]; + #}) + #]; + }; + + # Enable "Silent Boot" + consoleLogLevel = 0; + initrd.verbose = false; + kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "loglevel=3" + "rd.systemd.show_status=false" + "rd.udev.log_level=3" + "udev.log_priority=3" + ]; + # Hide the OS choice for bootloaders. + # It's still possible to open the bootloader list by pressing any key + # It will just not appear on screen unless a key is pressed + loader.timeout = 0; + }; +} diff --git a/modules/common/common.nix b/modules/common/common.nix new file mode 100644 index 0000000..f8dd76f --- /dev/null +++ b/modules/common/common.nix @@ -0,0 +1,47 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.lily.common; +in { + options.lily.common.enable = lib.mkEnableOption "activate common"; + config = lib.mkIf cfg.enable { + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + services.openssh.enable = true; + programs.zsh.enable = true; + environment.systemPackages = with pkgs; [ + git + neovim + toybox + util-linux + tmux + ghostty + + # encryption and filesystem + cryptsetup + age + + # network tools + wget + curl + # FS-tools + unzip + gnutar + xz + bzip2 + p7zip + + netcat-gnu + dnsutils + fd + file + tree + ]; + environment.shells = with pkgs; [zsh]; + }; +} diff --git a/modules/common/default.nix b/modules/common/default.nix new file mode 100644 index 0000000..4181c63 --- /dev/null +++ b/modules/common/default.nix @@ -0,0 +1,17 @@ +{lib, ...}: let + # recursively construct attr-set of a directory + getDir = dir: + lib.mapAttrs (file: type: + if type == "directory" + then getDir "${dir}/${file}" + else type) ( + builtins.readDir dir + ); + files = dir: lib.collect lib.isString (lib.mapAttrsRecursive (path: type: lib.concatStringsSep "/" path) (getDir dir)); + validFiles = dir: + map (file: ./. + "/${file}") ( + lib.filter (file: lib.hasSuffix ".nix" file && file != "default.nix") (files dir) + ); +in { + imports = validFiles ./.; +} diff --git a/modules/common/desktop.nix b/modules/common/desktop.nix new file mode 100644 index 0000000..8d83f6d --- /dev/null +++ b/modules/common/desktop.nix @@ -0,0 +1,82 @@ +{ + pkgs, + lib, + config, + flake-self, + ... +}: let + cfg = config.lily.desktop; +in { + options.lily.desktop = { + enable = lib.mkEnableOption "activate desktop"; + plasma.enable = lib.mkEnableOption "activate plasma desktop environment"; + hyprland.enable = lib.mkEnableOption "activate hyprland desktop"; + }; + + config = lib.mkIf cfg.enable { + lily = { + plasma.enable = cfg.plasma.enable; + hyprland.enable = cfg.hyprland.enable; + }; + programs = { + dconf.enable = true; + kdeconnect.enable = true; + }; + environment.systemPackages = with pkgs; [ + vulkan-tools + jq + libqalculate + envsubst + glib + headsetcontrol + ]; + networking = { + networkmanager.enable = true; + }; + + fonts = { + enableDefaultPackages = true; + packages = with pkgs; [ + jetbrains-mono + noto-fonts-color-emoji + garamond-libre + helvetica-neue-lt-std + # nerd-fonts.jetbrains-mono + ]; + fontDir.enable = true; + fontconfig = { + defaultFonts = { + monospace = ["JetBrainsMono Bold"]; + serif = ["Garamond Libre"]; + sansSerif = ["Helvetica Neue LT Std"]; + emoji = ["Noto Color Emoji"]; + }; + }; + }; + + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + audio.enable = true; + wireplumber.enable = true; + pulse.enable = true; + jack.enable = true; + }; + + # services.printing.enable = true; + # services.flatpak.enable = true; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + services.udev.packages = [pkgs.headsetcontrol]; + # environment.sessionVariables = { + # MOZ_DISABLE_RDD_SANDBOX = "1"; + # }; + }; +} diff --git a/modules/common/locale.nix b/modules/common/locale.nix new file mode 100644 index 0000000..fbe8f00 --- /dev/null +++ b/modules/common/locale.nix @@ -0,0 +1,18 @@ +{...}: { + # Select internationalisation properties. + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; + time.timeZone = "America/Detroit"; +} diff --git a/modules/common/nixcommon.nix b/modules/common/nixcommon.nix new file mode 100644 index 0000000..9156239 --- /dev/null +++ b/modules/common/nixcommon.nix @@ -0,0 +1,49 @@ +{ + inputs, + outputs, + config, + pkgs, + ... +}: { + nixpkgs.config.allowUnfree = true; + + home-manager = { + extraSpecialArgs = {inherit inputs outputs;}; + useGlobalPkgs = true; + useUserPackages = true; + }; + + nix = { + nixPath = ["nixpkgs=${inputs.nixpkgs}"]; + package = pkgs.nixVersions.stable; + optimise.automatic = true; + gc = { + persistent = true; + automatic = true; + }; + extraOptions = '' + # If set to true, Nix will fall back to building from source if a binary substitute fails. + fallback = true + # the timeout (in seconds) for establishing connections in the binary cache substituter. + connect-timeout = 10 + # these log lines are only shown on a failed build + log-lines = 25 + ''; + settings = { + auto-optimise-store = true; + + trusted-users = ["root" "@wheel"]; + experimental-features = [ + "nix-command" + "flakes" + ]; + }; + }; + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.11"; +} diff --git a/modules/containers/default.nix b/modules/containers/default.nix new file mode 100644 index 0000000..5786d90 --- /dev/null +++ b/modules/containers/default.nix @@ -0,0 +1,48 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.lily.containers; +in { + options.lily.containers = { + enable = lib.mkEnableOption "activate containers"; + docker = lib.mkEnableOption "activate docker"; + podman = lib.mkEnableOption "activate podman"; + }; + + config = lib.mkMerge [ + # (lib.mkIf (cfg.enable && cfg.docker && cfg.podman) + # (builtins.throw "You can't enable both docker and podman at the same time")) + { + assertions = [ + { + assertion = !(cfg.docker && cfg.podman); + message = "You cannot enable docker and podman at the same time"; + } + ]; + } + (lib.mkIf (cfg.enable && cfg.docker) { + # Enable docker support: + virtualisation.containers.enable = true; + virtualisation.docker.enable = true; + }) + (lib.mkIf (cfg.enable && cfg.podman) { + # Enable podman support: + virtualisation.containers.enable = true; + virtualisation.podman = { + enable = true; + dockerCompat = true; + dockerSocket.enable = true; + defaultNetwork.settings = { + dns_enabled = true; + }; + }; + environment.systemPackages = with pkgs; [ + podman + podman-compose + ]; + }) + ]; +} diff --git a/modules/fileshare/default.nix b/modules/fileshare/default.nix new file mode 100644 index 0000000..4181c63 --- /dev/null +++ b/modules/fileshare/default.nix @@ -0,0 +1,17 @@ +{lib, ...}: let + # recursively construct attr-set of a directory + getDir = dir: + lib.mapAttrs (file: type: + if type == "directory" + then getDir "${dir}/${file}" + else type) ( + builtins.readDir dir + ); + files = dir: lib.collect lib.isString (lib.mapAttrsRecursive (path: type: lib.concatStringsSep "/" path) (getDir dir)); + validFiles = dir: + map (file: ./. + "/${file}") ( + lib.filter (file: lib.hasSuffix ".nix" file && file != "default.nix") (files dir) + ); +in { + imports = validFiles ./.; +} diff --git a/modules/fileshare/samba.nix b/modules/fileshare/samba.nix new file mode 100644 index 0000000..6e21f88 --- /dev/null +++ b/modules/fileshare/samba.nix @@ -0,0 +1,55 @@ +{ + config, + lib, + ... +}: let + cfg = config.lily.fileshare; +in { + options.lily.fileshare.enable = lib.mkEnableOption "activate local filesharing"; + + config = lib.mkIf cfg.enable { + services.samba = { + enable = true; + securityType = "user"; #Keep user, but use guest account. + openFirewall = true; + settings = { + global = { + workgroup = "WORKGROUP"; #Ensure this matches your network's workgroup. + "server string" = "smbnix"; + "netbios name" = "smbnix"; + "security" = "user"; #Keep this as user, but guest will be used for access. + "hosts allow" = "192.168.1. 127.0.0.1 localhost"; #Adjust to your LAN. + "hosts deny" = "0.0.0.0/0"; + "guest account" = "nobody"; #Important for guest access. + "map to guest" = "bad user"; #Maps unknown users to guest. + }; + "public" = { + "path" = "/ext/share"; + "browseable" = "yes"; + "read only" = "no"; + "guest ok" = "yes"; #Allows guest access. + "create mask" = "0644"; + "directory mask" = "0755"; + }; + }; + }; + + services.samba-wsdd = { + enable = true; + openFirewall = true; + }; + services.avahi = { + enable = true; + nssmdns = true; + nssmdns4 = true; + openFirewall = true; + reflector = true; + publish = { + domain = true; + enable = true; + userServices = true; + addresses = true; + }; + }; + }; +} diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix new file mode 100644 index 0000000..4181c63 --- /dev/null +++ b/modules/hardware/default.nix @@ -0,0 +1,17 @@ +{lib, ...}: let + # recursively construct attr-set of a directory + getDir = dir: + lib.mapAttrs (file: type: + if type == "directory" + then getDir "${dir}/${file}" + else type) ( + builtins.readDir dir + ); + files = dir: lib.collect lib.isString (lib.mapAttrsRecursive (path: type: lib.concatStringsSep "/" path) (getDir dir)); + validFiles = dir: + map (file: ./. + "/${file}") ( + lib.filter (file: lib.hasSuffix ".nix" file && file != "default.nix") (files dir) + ); +in { + imports = validFiles ./.; +} diff --git a/modules/hardware/laptop.nix b/modules/hardware/laptop.nix new file mode 100644 index 0000000..e467522 --- /dev/null +++ b/modules/hardware/laptop.nix @@ -0,0 +1,33 @@ +{ + config, + lib, + ... +}: let + cfg = config.lily.laptop; +in { + options.lily.laptop.enable = lib.mkEnableOption "activate laptop hardware"; + + config = lib.mkIf cfg.enable { + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + Experimental = true; + Enable = "Source,Sink,Media,Socket"; + }; + }; + }; + powerManagement.enable = true; + + services = { + libinput.enable = true; + }; + systemd.sleep.extraConfig = '' + AllowSuspend=yes + AllowHibernation=yes + AllowHybridSleep=yes + AllowSuspendThenHibernate=yes + ''; + }; +} diff --git a/modules/hardware/nvidia.nix b/modules/hardware/nvidia.nix new file mode 100644 index 0000000..c57a737 --- /dev/null +++ b/modules/hardware/nvidia.nix @@ -0,0 +1,67 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.lily.nvidia; +in { + options.lily.nvidia.enable = lib.mkEnableOption "activate Nvidia GPU support"; + config = lib.mkIf cfg.enable { + services.xserver.videoDrivers = ["nvidia"]; + environment.systemPackages = with pkgs; [ + libva-utils + nvidia-vaapi-driver + nvtopPackages.nvidia + pciutils + vdpauinfo + cudaPackages.cudatoolkit + cudaPackages.cudnn + cudaPackages.cutensor + ]; + # environment.sessionVariables = lib.mkIf config.lily.wayland.enable { + # GBM_BACKEND = "nvidia-drm"; + # __GLX_VENDOR_LIBRARY_NAME = "nvidia"; + # __GL_GSYNC_ALLOWED = "1"; + # }; + hardware = { + graphics = { + enable = true; + enable32Bit = true; + extraPackages = with pkgs; [ + vaapiVdpau + libvdpau-va-gl + nvidia-vaapi-driver + ocl-icd + ]; + extraPackages32 = with pkgs; [vaapiVdpau]; + }; + nvidia = { + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = true; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + }; + }; +} diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix new file mode 100644 index 0000000..7538b6b --- /dev/null +++ b/modules/hyprland/default.nix @@ -0,0 +1,141 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: let + cfg = config.lily.hyprland; +in { + options.lily.hyprland = { + enable = lib.mkEnableOption "activate hyprland"; + }; + config = lib.mkIf cfg.enable { + lily = { + wayland.enable = true; + }; + + services.displayManager.sddm = lib.mkDefault { + enable = true; + wayland.enable = true; + package = pkgs.kdePackages.sddm; + theme = "breeze"; + wayland.compositor = "kwin"; + extraPackages = with pkgs.kdePackages; [ + breeze-icons + kirigami + libplasma + plasma5support + qtsvg + qtvirtualkeyboard + ]; + }; + + programs.hyprland = { + enable = true; + withUWSM = true; + systemd.setPath.enable = true; + }; + programs.waybar.enable = true; + services.blueman.enable = true; + + qt.enable = true; + qt.platformTheme = "kde"; + + environment.systemPackages = with pkgs; [ + # KDE APPLICATIONS + kdePackages.dolphin + kdePackages.systemsettings + + kdePackages.qtwayland + + kdePackages.kwallet # provides helper service + kdePackages.kwallet-pam # provides helper service + kdePackages.kwalletmanager # provides KCMs and stuff + + # FRAMEWORKS AND BASES + kdePackages.plasma-desktop + kdePackages.plasma-workspace + kdePackages.frameworkintegration # For qt plugins + kdePackages.plasma-integration # kde platform theme + kdePackages.sonnet + kdePackages.libplasma + kdePackages.qtsvg + kdePackages.ksvg + kdePackages.knewstuff + kdePackages.kdeplasma-addons + kdePackages.qtsvg + kdePackages.qtdeclarative + kdePackages.kcoreaddons + kdePackages.kguiaddons + kdePackages.kirigami-addons + kdePackages.plasma-integration.qt5 + kdePackages.qtlocation + + # artwork, makes appliations which require org.kde.destkop work + kdePackages.breeze + kdePackages.breeze-icons + kdePackages.breeze-gtk + kdePackages.ocean-sound-theme + kdePackages.plasma-workspace-wallpapers + hicolor-icon-theme # fallback icons + kdePackages.qqc2-breeze-style + kdePackages.qqc2-desktop-style + + kdePackages.breeze.qt5 + kdePackages.plasma-integration.qt5 + plasma5Packages.kwayland-integration + ]; + environment.sessionVariables = { + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_DESKTOP = "Hyprland"; + KPACKAGE_DEP_RESOLVERS_PATH = "${pkgs.kdePackages.frameworkintegration.out}/libexec/kf6/kpackagehandlers"; + }; + services.udisks2.enable = true; + services.upower.enable = true; + services.power-profiles-daemon.enable = true; + # make open menu work + environment.etc."xdg/menus/applications.menu" = { + source = "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; + }; + # + + programs.ssh.askPassword = lib.mkDefault "${pkgs.kdePackages.ksshaskpass.out}/bin/ksshaskpass"; + programs.gnupg.agent.pinentryPackage = lib.mkForce pkgs.pinentry-qt; + security.pam.services = { + login.kwallet = { + enable = true; + package = lib.mkDefault pkgs.kdePackages.kwallet-pam; + }; + }; + + programs.dconf.enable = true; + + programs.kdeconnect.package = lib.mkForce pkgs.kdePackages.kdeconnect-kde; + systemd = { + user.services.polkit-gnome-authentication-agent-1 = { + description = "polkit-gnome-authentication-agent-1"; + wantedBy = ["graphical-session.target"]; + wants = ["graphical-session.target"]; + after = ["graphical-session.target"]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + user.services.powerdevil = { + description = "powerdevil"; + wantedBy = ["graphical-session.target"]; + wants = ["graphical-session.target"]; + after = ["graphical-session.target"]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.kdePackages.powerdevil}/libexec/org_kde_powerdevil"; + }; + }; + }; + }; +} diff --git a/modules/plasma/default.nix b/modules/plasma/default.nix new file mode 100644 index 0000000..463113f --- /dev/null +++ b/modules/plasma/default.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + ... +}: let + cfg = config.lily.plasma; +in { + options.lily.plasma.enable = lib.mkEnableOption "activate plasma"; + config = lib.mkIf cfg.enable { + services = { + displayManager.sddm = { + enable = true; + wayland.enable = true; + }; + desktopManager.plasma6.enable = true; + }; + }; +} diff --git a/modules/runners/default.nix b/modules/runners/default.nix new file mode 100644 index 0000000..da876fe --- /dev/null +++ b/modules/runners/default.nix @@ -0,0 +1,32 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.lily.runners; +in { + options.lily.runners.enable = lib.mkEnableOption "activate plasma"; + config = lib.mkIf cfg.enable { + # Example + # age.secrets.lily.file = ./secrets/lily.age; + # services.gitea-actions-runner = { + # package = pkgs.forgejo-runner; + # instances = { + # lilyvex = { + # enable = true; + # name = "caz-runner"; + # # token = runner-key; + # tokenFile = config.age.secrets.lily.path; + # url = "https://git.lilyvex.dev/"; + # labels = [ + # "node-22:docker://node:22-bookworm" + # "nixos-latest:docker://nixos/nix" + # "ubuntu-latest:docker://node:16-bullseye" + # ]; + # #settings = { ... }; + # }; + # }; + # }; + }; +} diff --git a/modules/runners/secrets/lily.age b/modules/runners/secrets/lily.age new file mode 100644 index 0000000..99a1a64 --- /dev/null +++ b/modules/runners/secrets/lily.age @@ -0,0 +1,7 @@ +age-encryption.org/v1 +-> ssh-ed25519 gwCq6Q YfhZEEqe8nFJInm13FuPk3lAS5MpTHeTbPYE2czQJmk +YApzb5JSzg+hGULtJGOzH04XWuzjTtf4jB9rPnweBzU +-> ssh-ed25519 TvHG8g o8lSKhyOUvW8lz303Z6b5/TasTiN4ENcS0Bg1ZAugFA +e5tvFv819718uInabUIRJYOC45f/MYQkI4jep+DA+6o +--- Hw3Q1yUIXUmajkeK0sBRjLQcR4GjFh97hTu9jTIopIM +.��-�ԓN1�3$�0�\ ��2�p���|/�y��7S�X5bLdI�t��������r �F�2`�X�s�����#� \ No newline at end of file diff --git a/modules/runners/secrets/potato.age b/modules/runners/secrets/potato.age new file mode 100644 index 0000000..31c066e Binary files /dev/null and b/modules/runners/secrets/potato.age differ diff --git a/modules/runners/secrets/secrets.nix b/modules/runners/secrets/secrets.nix new file mode 100644 index 0000000..5bd7b7f --- /dev/null +++ b/modules/runners/secrets/secrets.nix @@ -0,0 +1,19 @@ +let + lily = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHj4f4GlA+DP491i9ssmm+Ys/TLikz6ALk1kkglhcywY lily@GreenMachine"; + users = [lily]; + system = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID/rgN3hR4K2Mu/Oy3tgaGfDfCss3CrNJn2jTTQJQKKn root@nixos"; + systems = [system]; +in { + # age.secrets.potato.file = ./potato.age; + # age.secrets.lily.file = ./lily.age; + "potato.age".publicKeys = [ + lily + + system + ]; + "lily.age".publicKeys = [ + lily + + system + ]; +} diff --git a/modules/users/default.nix b/modules/users/default.nix new file mode 100644 index 0000000..4181c63 --- /dev/null +++ b/modules/users/default.nix @@ -0,0 +1,17 @@ +{lib, ...}: let + # recursively construct attr-set of a directory + getDir = dir: + lib.mapAttrs (file: type: + if type == "directory" + then getDir "${dir}/${file}" + else type) ( + builtins.readDir dir + ); + files = dir: lib.collect lib.isString (lib.mapAttrsRecursive (path: type: lib.concatStringsSep "/" path) (getDir dir)); + validFiles = dir: + map (file: ./. + "/${file}") ( + lib.filter (file: lib.hasSuffix ".nix" file && file != "default.nix") (files dir) + ); +in { + imports = validFiles ./.; +} diff --git a/modules/users/lily.nix b/modules/users/lily.nix new file mode 100644 index 0000000..986e761 --- /dev/null +++ b/modules/users/lily.nix @@ -0,0 +1,21 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.lily.users.lily; + # interpolated_secrets = import ../../secrets/interpolated_secrets.nix; +in { + options.lily.users.lily.enable = lib.mkEnableOption "activate user lily"; + config = lib.mkIf cfg.enable { + users.users.lily = { + home = "/home/lily"; + isNormalUser = true; + # hashedPasswordFile = lib.mkIf config.lily.sops config.sops.secrets."users/lily/hashedPassword".path; + extraGroups = ["wheel" "openrazer" "docker"] ++ lib.optionals config.networking.networkmanager.enable ["networkmanager"]; + shell = pkgs.zsh; + }; + # sops.secrets."users/lily/hashedPassword" = lib.mkIf config.lily.sops { neededForUsers = true; }; + }; +} diff --git a/modules/wayland/default.nix b/modules/wayland/default.nix new file mode 100644 index 0000000..c896cc9 --- /dev/null +++ b/modules/wayland/default.nix @@ -0,0 +1,37 @@ +{ + lib, + pkgs, + config, + ... +}: let + cfg = config.lily.wayland; +in { + options.lily.wayland.enable = lib.mkEnableOption "activate wayland"; + config = lib.mkIf cfg.enable { + programs.xwayland.enable = true; + environment.systemPackages = with pkgs; + [ + wl-clipboard + xwayland + xwaylandvideobridge + wayland-utils + wev + ] + ++ lib.optionals (config.lily.plasma.enable) [kdePackages.plasma-wayland-protocols]; + environment.sessionVariables = { + NIXOS_OZONE_WL = "1"; + MOZ_ENABLE_WAYLAND = "1"; + QT_QUICK_CONTROLS_STYLE = "org.kde.desktop"; + SDL_VIDEODRIVER = "wayland"; + CLUTTER_BACKEND = "wayland"; + QT_QPA_PLATFORM = "wayland;xcb"; + XDG_SESSION_TYPE = "wayland"; + GDK_BACKEND = "wayland,x11"; + }; + services.dbus.enable = true; + security = { + polkit.enable = true; + rtkit.enable = true; + }; + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix deleted file mode 100644 index 0984d3f..0000000 --- a/nixos/configuration.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ config, lib, pkgs, self, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware/hardware.nix - ./environments/plasma-wayland.nix - # ./environments/gnome.nix - ./users/luxzi.nix - ./services/services.nix - ./programs/programs.nix - ./misc/misc.nix - ]; - - nixpkgs.config.allowUnfree = true; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; - - # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, - # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how - # to actually do that. - # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . - system.stateVersion = "24.05"; # Did you read the comment? -} - diff --git a/nixos/environments/gnome.nix b/nixos/environments/gnome.nix deleted file mode 100644 index ce7d35f..0000000 --- a/nixos/environments/gnome.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - services.xserver.enable = true; - services.xserver.videoDrivers = ["nvidia"]; - services.xserver.displayManager.gdm.enable = true; - services.xserver.displayManager.gdm.wayland = true; - services.xserver.desktopManager.gnome.enable = true; -} diff --git a/nixos/environments/plasma-wayland.nix b/nixos/environments/plasma-wayland.nix deleted file mode 100644 index fb77cf1..0000000 --- a/nixos/environments/plasma-wayland.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, ... }: - -{ - services.xserver.videoDrivers = ["nvidia"]; - - services.displayManager.sddm.enable = true; - services.displayManager.sddm.wayland.enable = true; - services.desktopManager.plasma6.enable = true; - - environment.plasma6.excludePackages = with pkgs; [ - plasma-browser-integration - konsole - ]; -} diff --git a/nixos/hardware/fstab.nix b/nixos/hardware/fstab.nix deleted file mode 100644 index b8cbc26..0000000 --- a/nixos/hardware/fstab.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ ... }: - -{ - fileSystems."/" = - { device = "/dev/disk/by-uuid/afce32c1-67df-4324-aebb-a113b71317b9"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/12CE-A600"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; -} diff --git a/nixos/hardware/hardware.nix b/nixos/hardware/hardware.nix deleted file mode 100644 index c7cd0a6..0000000 --- a/nixos/hardware/hardware.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ ... }: - -{ - imports = - [ - ./modules.nix - ./fstab.nix - ./audio.nix - ./network.nix - ./intel.nix - ./nvidia.nix - ]; -} diff --git a/nixos/hardware/intel.nix b/nixos/hardware/intel.nix deleted file mode 100644 index 88bf59e..0000000 --- a/nixos/hardware/intel.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ lib, config, ... }: - -{ - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/nixos/hardware/modules.nix b/nixos/hardware/modules.nix deleted file mode 100644 index 1593b53..0000000 --- a/nixos/hardware/modules.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ modulesPath, ... }: - -{ - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; -} diff --git a/nixos/hardware/network.nix b/nixos/hardware/network.nix deleted file mode 100644 index 45bc069..0000000 --- a/nixos/hardware/network.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ lib, ... }: - -{ - networking.useDHCP = lib.mkDefault true; -} diff --git a/nixos/hardware/nvidia.nix b/nixos/hardware/nvidia.nix deleted file mode 100644 index eb1abd6..0000000 --- a/nixos/hardware/nvidia.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, ... }: - -{ - hardware.graphics.enable = true; - hardware.nvidia = { - modesetting.enable = true; - powerManagement.enable = false; - powerManagement.finegrained = false; - open = false; - nvidiaSettings = false; - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; -} diff --git a/nixos/misc/locale.nix b/nixos/misc/locale.nix deleted file mode 100644 index 01de88c..0000000 --- a/nixos/misc/locale.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - i18n.defaultLocale = "en_US.UTF-8"; -} diff --git a/nixos/misc/misc.nix b/nixos/misc/misc.nix deleted file mode 100644 index 0ff1eca..0000000 --- a/nixos/misc/misc.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: - -{ - imports = - [ - ./time.nix - ./locale.nix - ./nixconfig.nix - ]; -} diff --git a/nixos/misc/nixconfig.nix b/nixos/misc/nixconfig.nix deleted file mode 100644 index 88d2b4a..0000000 --- a/nixos/misc/nixconfig.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: - -{ - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - nixpkgs.config.allowUnfree = true; -} diff --git a/nixos/misc/time.nix b/nixos/misc/time.nix deleted file mode 100644 index edf3feb..0000000 --- a/nixos/misc/time.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - time.timeZone = "America/New_York"; -} diff --git a/nixos/programs/dconf.nix b/nixos/programs/dconf.nix deleted file mode 100644 index 11c2c3b..0000000 --- a/nixos/programs/dconf.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - programs.dconf.enable = true; -} diff --git a/nixos/programs/gpg.nix b/nixos/programs/gpg.nix deleted file mode 100644 index 0ade0fc..0000000 --- a/nixos/programs/gpg.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: - -{ - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; -} diff --git a/nixos/programs/nix-ld.nix b/nixos/programs/nix-ld.nix deleted file mode 100644 index d178e51..0000000 --- a/nixos/programs/nix-ld.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, ... }: - -{ - programs.nix-ld = { - enable = true; - libraries = with pkgs; []; - }; -} diff --git a/nixos/programs/programs.nix b/nixos/programs/programs.nix deleted file mode 100644 index 6b2b27c..0000000 --- a/nixos/programs/programs.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ pkgs, ... }: - -{ - imports = - [ - ./nix-ld.nix - ./dconf.nix - ./gpg.nix - ./steam.nix - ]; - - environment.systemPackages = with pkgs; [ - wget - curl - git - neovim - nerd-fonts.fira-code - cmake - ninja - libgcc - gnumake - topgrade - unzip - patchelf - wl-clipboard - jdk17 - jre8 - python3 - clang-tools - clang - libtool - libvterm - pkg-config - openssl - ]; -} diff --git a/nixos/programs/steam.nix b/nixos/programs/steam.nix deleted file mode 100644 index 3e50e04..0000000 --- a/nixos/programs/steam.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - programs.steam.enable = true; -} diff --git a/nixos/services/audio.nix b/nixos/services/audio.nix deleted file mode 100644 index 268a81c..0000000 --- a/nixos/services/audio.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - services.pulseaudio.enable = false; -} diff --git a/nixos/services/boot.nix b/nixos/services/boot.nix deleted file mode 100644 index 8e3bb56..0000000 --- a/nixos/services/boot.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - boot.loader.systemd-boot.enable = true; - boot.loader.systemd-boot.configurationLimit = 10; - boot.loader.systemd-boot.editor = false; - boot.loader.efi.efiSysMountPoint = "/boot"; - boot.loader.efi.canTouchEfiVariables = true; -} diff --git a/nixos/services/cups.nix b/nixos/services/cups.nix deleted file mode 100644 index 4610bde..0000000 --- a/nixos/services/cups.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - services.printing.enable = true; -} diff --git a/nixos/services/firewall.nix b/nixos/services/firewall.nix deleted file mode 100644 index 54168e7..0000000 --- a/nixos/services/firewall.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - networking.firewall.enable = false; - networking.firewall.allowedTCPPorts = []; - networking.firewall.allowedUDPPorts = []; -} diff --git a/nixos/services/libinput.nix b/nixos/services/libinput.nix deleted file mode 100644 index 4640b6d..0000000 --- a/nixos/services/libinput.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - services.libinput.enable = true; -} diff --git a/nixos/services/networkmanager.nix b/nixos/services/networkmanager.nix deleted file mode 100644 index 55ce0e4..0000000 --- a/nixos/services/networkmanager.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: - -{ - networking.hostName = "nixos"; - networking.networkmanager.enable = true; -} diff --git a/nixos/services/pipewire.nix b/nixos/services/pipewire.nix deleted file mode 100644 index dcba83f..0000000 --- a/nixos/services/pipewire.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: - -{ - services.pipewire = { - enable = true; - audio.enable = true; - pulse.enable = true; - alsa.enable = true; - alsa.support32Bit = true; - }; -} diff --git a/nixos/services/services.nix b/nixos/services/services.nix deleted file mode 100644 index 406d113..0000000 --- a/nixos/services/services.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ ... }: - -{ - imports = - [ - ./boot.nix - ./pipewire.nix - ./cups.nix - ./firewall.nix - ./libinput.nix - ./networkmanager.nix - ]; - - services.flatpak.enable = true; -} diff --git a/nixos/users/luxzi.nix b/nixos/users/luxzi.nix deleted file mode 100644 index 587a5d3..0000000 --- a/nixos/users/luxzi.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ self, pkgs, ... }: - -{ - users.users.luxzi = { - isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - shell = pkgs.zsh; - packages = [ - self.inputs.home-manager.packages.${pkgs.system}.home-manager - ]; - }; - - environment.shells = with pkgs; [ zsh ]; - programs.zsh.enable = true; -} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..3876dad --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,37 @@ +{inputs, ...}: { + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs final.pkgs; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: { + prismlauncher = prev.prismlauncher.overrideAttrs (oldAttrs: { + buildInputs = (oldAttrs.buildInputs or []) ++ [final.jdk23]; + jdks = [ + final.jdk23 + ]; + # configurePhase = '' + # export JAVA_HOME=${pkgs.jdk22} + # ''; + # installPhase = '' + # mkdir -p $out/bin + # cp -r $oldAttrs.out/* $out/ + # # Create a wrapper script to ensure JAVA_HOME is set + # echo '#!/bin/sh' > $out/bin/prismlauncher + # echo "export JAVA_HOME=${pkgs.jdk22}" >> $out/bin/prismlauncher + # echo "exec $out/bin/PrismLauncher \"\$@\"" >> $out/bin/prismlauncher + # chmod +x $out/bin/prismlauncher + # ''; + }); + }; + + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..3d9e23c --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,5 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' +pkgs: { + # example = pkgs.callPackage ./example { }; +}