diff options
| author | Dylan <boss@tehbox.org> | 2026-10-17 21:53:43 +1300 |
|---|---|---|
| committer | Dylan <boss@tehbox.org> | 2026-10-17 21:53:43 +1300 |
| commit | 280e1bbe5e733128a451260685cc8ecd10a042a3 (patch) | |
| tree | 78bab82353bbfa00f9a781015e246c274a5c983b /modules | |
| parent | bcfc69e424802276cc52fb6e00fb4a42e9c37816 (diff) | |
| download | nixos-configuration-280e1bbe5e733128a451260685cc8ecd10a042a3.tar.gz nixos-configuration-280e1bbe5e733128a451260685cc8ecd10a042a3.zip | |
feat: Dendritic pattern
This re-write was done with the help of claude, and still needs a
decent amount of changes before it properly follows the dendritic
pattern
Diffstat (limited to 'modules')
54 files changed, 3542 insertions, 297 deletions
diff --git a/modules/cgit.nix b/modules/cgit.nix deleted file mode 100644 index af4ecf2..0000000 --- a/modules/cgit.nix +++ /dev/null @@ -1,157 +0,0 @@ -{ pkgs, lib, config, ... }: -let - cfg = config.teh-nix.services.cgit; - cgitrc = pkgs.writeText "cgitrc" '' -css=/static/cgit.css -logo=/static/cgit.png -favicon=/static/favicon.ico -repository-sort=age - -root-title=${cfg.title} -root-desc=${cfg.description} - -enable-blame=1 -enable-commit-graph=1 -enable-log-filecount=1 -enable-log-linecount=1 -enable-index-links=1 - -snapshots=tar.gz zip -enable-http-clone=1 -clone-prefix=https://${cfg.domain} - -readme=:README -readme=:readme -readme=:readme.txt -readme=:README.txt -readme=:readme.md -readme=:README.md - -${cfg.extraConfig} - -about-filter=${cfg.package}/lib/cgit/filters/about-formatting.sh -source-filter=${cfg.package}/lib/cgit/filters/syntax-highlighting.py - -enable-git-config=1 -scan-path=${cfg.directory} -''; -in -{ - options.teh-nix.services.cgit = with lib;{ - enable = mkEnableOption "Enable cgit"; - user = mkOption { - type = types.str; - default = "cgit"; - description = "Username for the user that will run cgit"; - }; - authorizedKeys = lib.mkOption { - type = types.listOf types.str; - default = [ ]; - description = "List of ssh keys for the cgit user (cgit user should own all repos)"; - }; - authorizedUsers = lib.mkOption { - type = types.listOf types.str; - default = [ ]; - description = "List of users that should have access to the cgit directory"; - }; - directory = mkOption { - type = types.str; - default = "/srv/cgit/repos"; - description = "Directory for cgit (cgit user's home directory"; - }; - description = mkOption { - type = types.str; - default = "Cgit instance hosted with nixos"; - description = "Description of the cgit website"; - }; - title = mkOption { - type = types.str; - default = "Cgit + Nix"; - description = "Title of the cgit website"; - }; - domain = mkOption { - type = types.str; - default = "git.example.com"; - description = "Domain to host it on"; - }; - useACMEHost = mkOption { - type = types.str; - default = ""; - description = "SSL cert to use if already aquired using security.acme.certs"; - }; - enableACME = mkEnableOption "Enable ACME with nginx"; - onlySSL = mkOption { - type = types.bool; - default = false; - description = "Only allow ssl connections"; - }; - forceSSL = mkOption { - type = types.bool; - default = true; - description = "Force ssl connections"; - }; - package = mkPackageOption pkgs "cgit" { }; - extraConfig = mkOption { - type = types.str; - default = ""; - description = "Extra config to be appended to cgitrc"; - }; - }; - - config = lib.mkIf cfg.enable { - environment.systemPackages = [ pkgs.git cfg.package ]; - users = { - groups.${cfg.user} = { - members = cfg.authorizedUsers; - }; - users.${cfg.user} = { - createHome = true; - homeMode = "770"; - home = cfg.directory; - isSystemUser = true; - shell = "${pkgs.git}/bin/git-shell"; - openssh.authorizedKeys.keys = cfg.authorizedKeys; - group = cfg.user; - }; - }; - - - services.fcgiwrap.instances.cgit = { - socket = { - user = cfg.user; - group = "nginx"; - type = "unix"; - mode = "0660"; - }; - process = { - user = cfg.user; - group = cfg.user; - }; - }; - - services.nginx.enable = true; - services.nginx.virtualHosts.${cfg.domain} = { - locations."~* ^/static/(.+.(ico|css|png))$" = { - extraConfig = '' -alias ${cfg.package}/cgit/$1; -''; - }; - locations."/" = { - extraConfig = '' -include ${pkgs.nginx}/conf/fastcgi_params; -fastcgi_param CGIT_CONFIG ${cgitrc}; -fastcgi_param SCRIPT_FILENAME ${cfg.package}/cgit/cgit.cgi; -fastcgi_split_path_info ^(/?)(.+)$; -fastcgi_param PATH_INFO $fastcgi_path_info; -fastcgi_param QUERY_STRING $args; -fastcgi_param HTTP_HOST $server_name; -fastcgi_pass unix:${config.services.fcgiwrap.instances.cgit.socket.address}; - ''; - }; - enableACME = cfg.enableACME; - forceSSL = cfg.forceSSL; - } // lib.optionalAttrs (cfg.useACMEHost != "") { - useACMEHost = "${cfg.useACMEHost}"; - }; - }; -} diff --git a/modules/computers/nixnode.nix b/modules/computers/nixnode.nix new file mode 100644 index 0000000..3cf6999 --- /dev/null +++ b/modules/computers/nixnode.nix @@ -0,0 +1,347 @@ +{ inputs, config, ... }: +let + nixos = config.flake.modules.nixos; +in +{ + flake.nixosConfigurations.nixnode = inputs.nixpkgs.lib.nixosSystem { + modules = [ nixos.nixnode ]; + }; + + flake.modules.nixos.nixnode = + # Edit this configuration file to define what should be installed on + # your system. Help is available in the configuration.nix(5) man page, on + # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + + { config, lib, pkgs, ... }: + + { + imports = + [ + nixos.teh-nix + nixos.linode + inputs.STK.nixosModules.default + inputs.sops.nixosModules.sops + inputs.nixos-mailserver.nixosModules.default + inputs.neodrive-website.nixosModules.default + ]; + + teh-nix.nix.enable = true; + + # Use the GRUB 2 boot loader. + boot.loader.grub.enable = true; + # boot.loader.grub.efiSupport = true; + # boot.loader.grub.efiInstallAsRemovable = true; + # boot.loader.efi.efiSysMountPoint = "/boot/efi"; + # Define on which hard drive you want to install Grub. + # boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only + + networking.hostName = "nixnode"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + time.timeZone = "NZ"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + # i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfcpfig = true; # use xkb.options in tty. + # }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + security.sudo.wheelNeedsPassword = false; + + sops.defaultSopsFile = ../../secrets/general.yaml; + sops.defaultSopsFormat = "yaml"; + + sops.age.keyFile = "/home/boss/.config/sops/age/keys.txt"; + + sops.secrets = { + #"wg/nixy/pub" = { }; + "wg/nixnode/priv" = { }; + "acme/linode" = { + owner = "acme"; + mode = "440"; + }; + "mail/boss" = { }; + "nginx/dashboard-htpasswd" = { + owner = "nginx"; + mode = "400"; + }; + }; + + networking.firewall = { + enable = true; + allowedTCPPorts = [ 80 443 ]; + allowedUDPPorts = [ 51820 ]; + }; + + security.acme.acceptTerms = true; + # security.acme.useRoot = true; + security.acme.defaults.email = "boss@tehbox.org"; + # security.acme.certs = { + # "tehbox.org" = + # { + # webroot = "/var/lib/acme/acme-challenge/"; + # email = "boss@tehbox.org"; + # extraDomainNames = (map (sub: sub + ".tehbox.org" ) [ "www" "git" ]); + # #dnsProvider = "linode"; + # # dnsResolver = "92.123.94.2"; + # # dnsPropagationCheck = false; + # #environmentFile = environmentFile; + # }; + # }; + users.groups.acme.members = [ "nginx" ]; + + # Wireguard + networking = { + nat = { + enable = true; + externalInterface = "eth0"; + internalInterfaces = [ "wg0" ]; + }; + + wireguard.interfaces.wg0 = { + ips = [ "10.100.0.1/24" ]; + listenPort = 51820; + + postSetup = '' +${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE +''; + postShutdown = '' +${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE +''; + + privateKeyFile = config.sops.secrets."wg/nixnode/priv".path; + + peers = [ + { + name = "nixy"; + publicKey = "FMkFU9k+YeCvj48+WDVglySgoncbITqkS//o2e+TClY="; + allowedIPs = [ "10.100.0.2/32" ]; + } + ]; + }; + }; + + services.nginx = { + enable = true; + # Log the vhost at the start of each line ("vcombined") so goaccess + # can split traffic by subdomain + commonHttpConfig = '' +log_format vcombined '$host:$server_port $remote_addr - $remote_user [$time_local] ' + '"$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent"'; +access_log /var/log/nginx/access.log vcombined; +''; + # virtualHosts.${config.mailserver.fqdn}.enableACME = true; + virtualHosts = { + "tehbox.org" = { + root = "${inputs.self.packages.x86_64-linux.teh-website}/srv/www"; + serverAliases = [ "www.tehbox.org" ]; + enableACME = true; + forceSSL = true; + }; + "files.tehbox.org" = { + root = "/srv/files"; + enableACME = true; + forceSSL = true; + }; + # "stk.lug.ac" = { + # root = "${inputs.self.packages.x86_64-linux.stk-installers}/srv/www"; + # enableACME = true; + # forceSSL = true; + # locations."/".extraConfig = "autoindex on;\n"; + # }; + "dashboard.tehbox.org" = { + root = "/var/lib/goaccess/html"; + basicAuthFile = config.sops.secrets."nginx/dashboard-htpasswd".path; + enableACME = true; + forceSSL = true; + }; + "_" = { + globalRedirect = "tehbox.org"; + }; + }; + }; + + # Web traffic dashboard, rebuilt from the nginx access log every 10 minutes. + # --persist/--restore keep the totals in /var/lib/goaccess/db across log rotations. + systemd.services.goaccess-report = { + description = "Build goaccess report for dashboard.tehbox.org"; + serviceConfig = { + Type = "oneshot"; + User = "nginx"; + Group = "nginx"; + StateDirectory = [ "goaccess" "goaccess/db" "goaccess/html" ]; + }; + script = '' +${pkgs.goaccess}/bin/goaccess /var/log/nginx/access.log \ + --log-format=VCOMBINED \ + --num-tests=0 \ + --no-query-string \ + --persist --restore --db-path=/var/lib/goaccess/db \ + --html-report-title="tehbox.org traffic" \ + -o /var/lib/goaccess/html/index.html +''; + }; + systemd.timers.goaccess-report = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "*:0/10"; + Persistent = true; + }; + }; + + teh-nix.services.cgit = { + enable = true; + authorizedKeys = config.users.users.boss.openssh.authorizedKeys.keys; + authorizedUsers = [ "boss" ]; + domain = "git.tehbox.org"; + enableACME = true; + # useACMEHost = "tehbox.org"; + forceSSL = true; + # onlySSL = true; + }; + + services.neodrive-website = { + enable = true; + domain = "neodrive.tehbox.org"; + }; + + services.znc = { + enable = true; + mutable = true; + useLegacyConfig = false; + openFirewall = true; + config = { + SSLCertFile = "/var/lib/acme/tehbox.org/key.pem"; + LoadModule = [ "webadmin" ]; + User.boss = { + Admin = true; + Pass.password = { + Method = "sha256"; + Hash = "401e8fed9a3ab1f93047b7465fd7cc6b0ca5aaed6b1c0482f0f4331ebdca8647"; + Salt = "*F_-,pqOdiJi;p)JoMnm"; + }; + }; + User.komodo = { + Admin = false; + Pass.password = { + Method = "sha256"; + Hash = "2c624debe3e2672383346230b6acad82192e40df05666481f792a9dd97d935cc"; + Salt = "q9At0+KZvmofZil(3us1"; + }; + }; + }; + }; + + services.openssh = { + enable = true; + settings.PermitRootLogin = "no"; + settings.PasswordAuthentication = false; + }; + + services.superTuxKarts = { + enable = true; + port = 2759; + package = pkgs.superTuxKart; + serverOptions = { + server-name = "LUG STK server"; + server-mode = 3; + server-difficulty = 3; + server-max-players = 16; + track-voting = false; + voting-timeout = 15; + private-server-password = "lug@uoa"; + motd = "Server for LUG@UoA\nChampionship coming soon!"; + live-spectate = true; + server-configurable = true; + }; + }; + + mailserver = { + enable = true; + stateVersion = 3; + fqdn = "tehbox.org"; + domains = [ "tehbox.org" ]; + + x509.useACMEHost = config.mailserver.fqdn; + + loginAccounts = { + "boss@tehbox.org" = { + hashedPasswordFile = config.sops.secrets."mail/boss".path; + aliases = ["postmaster@tehbox.org"]; + }; + }; + + # certificateScheme = "acme"; + }; + + users.users.boss = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager"]; # Enable ‘sudo’ for the user. + home = "/home/boss"; + openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJOukEKExoF6vr3vciQN8pBdd4FtZtRzqIGFJrUvllOY boss@nixy" ]; + }; + users.groups.files.members = [ "boss" "nginx" ]; + users.groups.nginx.members = [ "nginx" "znc" ]; + + environment.systemPackages = with pkgs; [ + vim + emacs + inetutils + mtr + sysstat + git + goaccess + inputs.self.packages.x86_64-linux.teh-website + # inputs.self.packages.x86_64-linux.stk-installers + ]; + + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + networking.usePredictableInterfaceNames = false; + networking.useDHCP = false; + networking.interfaces.eth0.useDHCP = 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 option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # 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. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "25.05"; # Did you read the comment? + + }; +} diff --git a/modules/computers/nixy.nix b/modules/computers/nixy.nix new file mode 100644 index 0000000..95820f5 --- /dev/null +++ b/modules/computers/nixy.nix @@ -0,0 +1,343 @@ +{ inputs, config, ... }: +let + nixos = config.flake.modules.nixos; + hm = config.flake.modules.homeManager; +in +{ + flake.nixosConfigurations.nixy = inputs.nixpkgs.lib.nixosSystem { + modules = [ nixos.nixy ]; + }; + + flake.modules.nixos.nixy = + # Edit this configuration file to define what should be installed on + # your system. Help is available in the configuration.nix(5) man page + # and in the NixOS manual (accessible by running ‘nixos-help’). + + { config, pkgs, ... }: + { + imports = + [ + nixos.teh-nix + nixos.my-pkgs + nixos.tuf + inputs.sops.nixosModules.sops + #inputs.spicetify-nix.nixosModules.default + inputs.home-manager.nixosModules.home-manager + inputs.stylix.nixosModules.stylix + ]; + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.boss = hm.boss; + + teh-nix.nix.enable = true; + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + # stdenv.cc.cc + glib + glibc + nspr + nss + dbus + atk + cups + cairo + gtk3 + alsa-lib + expat + fontconfig + freetype + libgbm + libnotify + libsecret + libxkbcommon + mesa + pango + libX11 + libXcomposite + libXcursor + libXdamage + libXext + libXfixes + libXi + libXrandr + libXrender + libXtst + libxcb + ]; + + # Use the systemd-boot EFI boot loader. + boot = { + loader.grub.enable = true; + loader.grub.device = "nodev"; + loader.grub.efiSupport = true; + loader.grub.enableCryptodisk = true; + # loader.grub.useOSProber = true; + loader.efi.canTouchEfiVariables = true; + kernel.sysctl."kernel.sysrq" = 502; + plymouth.enable = true; + }; + + + networking.hostName = "nixy"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + sops.defaultSopsFile = ../../secrets/general.yaml; + sops.defaultSopsFormat = "yaml"; + + sops.age.keyFile = "/home/boss/.config/sops/age/keys.txt"; + + sops.secrets = { + #"wg/nixnode/pub" = { }; + "wg/nixy/priv" = { + restartUnits = [ "nm-file-secret-agent.service" ]; + group = "networkmanager"; + mode = "440"; + }; + }; + + networking.firewall = { + allowedUDPPorts = [ 51820 ]; + allowedTCPPorts = [ 8081 ]; + }; + networking.networkmanager.ensureProfiles = { + profiles = { + wg-nixnode = { + connection = { + id = "wg-nixnode"; + autoconnect = "false"; + interface-name = "wg0"; + type = "wireguard"; + }; + ipv4 = { + address1 = "10.100.0.2/32"; + may-fail = "false"; + method = "manual"; + }; + ipv6 = { + method = "disabled"; + }; + wireguard = { + listen-port = "51820"; + private-key-flags = 1; + #private-key = "dummy"; + }; + proxy = { }; + "wireguard-peer./6bWy02DhOSjaeXk+ol5ATgEYDDJvL+mTO9SCNvfIUQ=" = { + allowed-ips = "0.0.0.0/0;"; + endpoint = "172.105.172.191:51820"; + persistent-keepalive = "25"; + }; + }; + }; + secrets.entries = [ + { + matchId = "wg-nixnode"; + matchType = "wireguard"; + matchSetting = "wireguard"; + key = "private-key"; + file = config.sops.secrets."wg/nixy/priv".path; + } + ]; + }; + + systemd.services."nm-file-secret-agent" = { + serviceConfig.User = "boss"; + }; + + + # Set your time zone. + time.timeZone = "NZ"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + #keyMap = "us"; + #useXkbConfig = true; # use xkbOptions in tty. + }; + + teh-nix.xorg = { + enable = true; + }; + + programs.hyprland = { + enable = false; + #package = inputs.hyprland.packages.${pkgs.system}.hyprland; + #portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland; + }; + + security.pam.services.swaylock = {}; + + # Enable CUPS to print documents. + services.printing.enable = true; + services.printing.drivers = with pkgs;[ + hplip + ]; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + # Enable sound. + #sound.enable = true; + services.pipewire = { + enable = true; + alsa.enable = false; + alsa.support32Bit = false; + pulse.enable = true; + }; + + services.upower.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + security.rtkit.enable = true; + services.libinput = { + enable = true; + mouse = { + accelProfile = "flat"; + }; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.boss = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" "input" "uinput" ]; + }; + + fonts.packages = with pkgs; [ + #(nerdfonts.override { fonts = [ "Cousine" ]; }) + nerd-fonts.cousine + ]; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; + [ + vim + firefox + pfetch + fastfetch + pinentry-gtk2 + git + nm-file-secret-agent + deploy-rs + ]; + documentation.dev.enable = true; + + hardware.graphics.enable32Bit = true; + programs.steam = { + enable = true; + package = pkgs.steam.override { + extraEnv = { + __NV_PRIME_RENDER_OFFLOAD=1; + __NV_PRIME_RENDER_OFFLOAD_PROVIDER="NVIDIA-G0"; + __GLX_VENDOR_LIBRARY_NAME="nvidia"; + __VK_LAYER_NV_optimus="NVIDIA_only"; + }; + }; + + extraCompatPackages = with pkgs; [ + proton-ge-bin + ]; + }; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + programs.gnupg = { + agent = { + enable = true; + pinentryPackage = pkgs.pinentry-gtk2; + }; + # enableSSHSupport = true; + }; + + hardware.bluetooth.enable = true; # enables support for Bluetooth + hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot + services.blueman.enable = true; + + systemd.tmpfiles.rules = [ + "f /var/lib/systemd/linger/boss" # enables lingering + ]; + + # programs.dconf.enable = true; + + + services.ratbagd.enable = true; + + # xdg.portal.enable = true; + # services.flatpak.enable = true; + + stylix = { + enable = true; + + base16Scheme = "${pkgs.base16-schemes}/share/themes/material-palenight.yaml"; + + image = ../../wallpaper.png; + targets.grub.useWallpaper = true; + + opacity = { + terminal = 0.8; + }; + + polarity = "dark"; + + fonts = { + monospace = { + package = pkgs.nerd-fonts.cousine; + name = "Cousine Nerd Font Mono"; + }; + + serif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Serif"; + }; + + sansSerif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Sans"; + }; + + emoji = { + package = pkgs.noto-fonts-color-emoji; + name = "Noto Color Emoji"; + }; + + sizes = { + terminal = 10; + applications = 10; + desktop = 10; + popups = 10; + }; + }; + + cursor = { + package = pkgs.nordzy-cursor-theme; + name = "Nordzy-cursors"; + size = 20; + }; + }; + + # 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 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.05"; # Did you read the comment? + + }; +} diff --git a/modules/default.nix b/modules/default.nix deleted file mode 100644 index c523ae9..0000000 --- a/modules/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ lib, ... }: -{ - imports = lib.filter - (n: (lib.strings.hasSuffix ".nix" n) && !(lib.strings.hasSuffix "default.nix" n)) - (lib.filesystem.listFilesRecursive ./.); -} diff --git a/modules/deploy.nix b/modules/deploy.nix new file mode 100644 index 0000000..7cda026 --- /dev/null +++ b/modules/deploy.nix @@ -0,0 +1,30 @@ +{ inputs, config, ... }: +let + system = "x86_64-linux"; + pkgs = import inputs.nixpkgs { inherit system; }; + deployPkgs = import inputs.nixpkgs { + inherit system; + overlays = [ + inputs.deploy-rs.overlays.default # or deploy-rs.overlays.default + (self: super: { deploy-rs = { inherit (pkgs) deploy-rs; lib = super.deploy-rs.lib; }; }) + ]; + }; + deployCfg = config.flake.deploy; +in +{ + flake.deploy.nodes.nixnode = { + hostname = "tehbox.org"; + profiles.system = { + user = "root"; + sshUser = "boss"; + interactiveSudo = true; + path = deployPkgs.deploy-rs.lib.activate.nixos config.flake.nixosConfigurations.nixnode; + }; + }; + + perSystem = + { system, ... }: + { + checks = inputs.deploy-rs.lib.${system}.deployChecks deployCfg; + }; +} diff --git a/modules/flake-parts.nix b/modules/flake-parts.nix new file mode 100644 index 0000000..d7a467b --- /dev/null +++ b/modules/flake-parts.nix @@ -0,0 +1,8 @@ +{ inputs, ... }: +{ + imports = [ + inputs.flake-parts.flakeModules.modules + ]; + + systems = [ "x86_64-linux" ]; +} diff --git a/modules/hardware-setups/linode.nix b/modules/hardware-setups/linode.nix new file mode 100644 index 0000000..506c262 --- /dev/null +++ b/modules/hardware-setups/linode.nix @@ -0,0 +1,44 @@ +{ ... }: +{ + flake.modules.nixos.linode = + { config, lib, pkgs, modulesPath, ... }: + + { + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.loader.grub.extraConfig = '' + serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1; + terminal_input serial; + terminal_output serial + ''; + boot.loader.grub.forceInstall = true; + boot.loader.grub.device = "nodev"; + boot.loader.timeout = 10; + + fileSystems."/" = + { device = "/dev/sda"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/sdb"; } + ]; + + # 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.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + }; +} diff --git a/modules/hardware-setups/tuf.nix b/modules/hardware-setups/tuf.nix new file mode 100644 index 0000000..c36a0df --- /dev/null +++ b/modules/hardware-setups/tuf.nix @@ -0,0 +1,57 @@ +{ ... }: +{ + flake.modules.nixos.tuf = + # 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 = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" "cryptd"]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + boot.initrd.luks.devices.cryptroot = { + device = "/dev/disk/by-uuid/18e2ffad-9ffb-4c3a-a82f-dd8098171427"; + preLVM = true; + }; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/db909240-4006-4ca8-a03a-3e3fc60cba17"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/9ef8fad1-08cb-4c7a-9db1-3a37097544b0"; + fsType = "ext4"; + neededForBoot = true; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6FC0-9F1C"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/e1e972c8-3bb9-4131-a77f-fdea9f086a4d"; } + ]; + + # 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.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0f3u1.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.enableAllFirmware = true; + }; +} diff --git a/modules/home-manager/YATwm/config b/modules/home-manager/YATwm/config new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/modules/home-manager/YATwm/config diff --git a/modules/home-manager/YATwm/default.nix b/modules/home-manager/YATwm/default.nix new file mode 100644 index 0000000..587e929 --- /dev/null +++ b/modules/home-manager/YATwm/default.nix @@ -0,0 +1,117 @@ +{ inputs, config, ... }: +let + hm = config.flake.modules.homeManager; +in +{ + flake.modules.homeManager.YATwm = + { + pkgs, + lib, + ... + } : { + imports = [ + hm.polybar + hm.rofi + hm.kitty + inputs.YATwm.homeManagerModules.default + ]; + home.packages = with pkgs; [ + i3lock + xss-lock + networkmanagerapplet + flameshot + picom + nitrogen + pamixer + kitty + alacritty + ]; + + xsession.windowManager.YATwm = { + enable = true; + package = inputs.YATwm.packages.x86_64-linux.YATwm; + useEmacsBinds = true; + quitKey = "C-s-g"; + swapMods = false; + keybinds = let + left = "h"; + right = "l"; + up = "k"; + down = "j"; + wsBind = key: ws: { + "s-${key}" = "changeWS ${ws}"; + "s-S-${key}" = "wToWS ${ws}"; + }; + wsBinds = workspaces: lib.attrsets.concatMapAttrs (key: ws: wsBind key ws) workspaces; + in { + # Important + "s-E" = "exit"; + "s-R" = "reload"; + + # Directions + "s-${left}" = "focChange left"; + "s-${right}" = "focChange right"; + "s-${up}" = "focChange up"; + "s-${down}" = "focChange down"; + + # Tiling + "s-t" = "toggle"; + "s-f" = "fullscreen"; + + # Application shortcuts + "s-d" = "bashSpawn rofi -i -show drun -disable-history"; + "s-D" = "bashSpawn prime-run rofi -i -show drun -disable-history"; + "s-g" = "bashSpawn ~/bin/rofi-passmenu"; + "s-RET" = "bashSpawn kitty"; + # "s-r k" = "spawn kitty"; + "s-c" = "spawn firefox"; + "s-S--" = "bashSpawn emacsclient -c"; + "s-S" = "spawn flameshot gui"; + "s-x" = "spawn loginctl lock-session"; + "s-X" = "bashSpawn loginctl lock-session && systemctl suspend"; + "s-Q" = "kill"; + + # Sound + "s-[" = "spawn playerctl -p firefox play-pause"; + "s-]" = "spawn playerctl -p spotify play-pause"; + + # Special workspaces + "s-p s" = "changeWS 11"; + "s-S-p s" = "wToWS 11"; + } // + wsBinds { + "1" = "1"; + "2" = "2"; + "3" = "3"; + "4" = "4"; + "5" = "5"; + "6" = "6"; + "7" = "7"; + "8" = "8"; + "9" = "9"; + "0" = "10"; + }; + workspaces = [ + {name = "1: A";} + {name = "2: B";} + {name = "3: C";} + {name = "4: D";} + {name = "5: E";} + {name = "6: F"; monitorPriorities = [2 1];} + {name = "7: G"; monitorPriorities = [2 1];} + {name = "8: H"; monitorPriorities = [2 1];} + {name = "9: I"; monitorPriorities = [2 1];} + {name = "10: J"; monitorPriorities = [2 1];} + {name = "S"; monitorPriorities = [1];} + ]; + startup = [ + {command = "~/.config/polybar/launch.sh"; once = false;} + {command = "picom --legacy-backends -fD 3"; once = false;} + {command = "xss-lock --transfer-sleep-lock -- i3lock -eti ~/Documents/lockscreen.png --nofork"; bash = false;} + {command = "nitrogen --restore";} + {command = "nm-applet"; once = false; bash = false;} + ]; + #extraConfig = "bindmode normal\n" + (builtins.readFile ./config); + }; + }; +} diff --git a/modules/home-manager/claude-code-manifest-2.1.282.json b/modules/home-manager/claude-code-manifest-2.1.282.json new file mode 100644 index 0000000..78dbc55 --- /dev/null +++ b/modules/home-manager/claude-code-manifest-2.1.282.json @@ -0,0 +1,84 @@ +{ + "version": "2.1.282", + "manifestSignatureEnforcement": "flag", + "commit": "88e628ac87357ab077f78e21f78aee6156f01ab3", + "modsCommit": "d78be9481b889e11186ec4578b4f5e9301396e25", + "buildDate": "2026-09-24T04:11:54Z", + "platforms": { + "darwin-arm64": { + "binary": "claude", + "checksum": "fcfd837103965c64de34a6b9b94370d77a347ea71819715a27d5f0ef01775ea4", + "size": 222245312 + }, + "darwin-x64": { + "binary": "claude", + "checksum": "5c34b00b5c0f3862b76011015c334e91904c4593afea7a5451e00746ad7934c1", + "size": 230651344 + }, + "linux-arm64": { + "binary": "claude", + "checksum": "6764ffc39e9fed425a493ff61ea28506d1ba83996ce81a48d1177dbb393419c9", + "size": 238084088 + }, + "linux-x64": { + "binary": "claude", + "checksum": "3afe8535c0cc33f0e24f7b25dab7a1727b8b592196f8496a8bc302ba2161eed3", + "size": 238767288 + }, + "linux-arm64-musl": { + "binary": "claude", + "checksum": "5c3b3c9904f84b59d01c4e7f5c9305a4fc1981b18b26745688c9c1dab9cb25ae", + "size": 230438720 + }, + "linux-x64-musl": { + "binary": "claude", + "checksum": "e01fc77a210c54acf69205db13d8d50d11fa6ac62b81b6c6201de8440c293b0d", + "size": 232525912 + }, + "win32-x64": { + "binary": "claude.exe", + "checksum": "fc0e3af017705624b9e1bce913f72761864ff994804514da1f5e41380fca4484", + "size": 242171040 + }, + "win32-arm64": { + "binary": "claude.exe", + "checksum": "a7f3db85706ca2ca123ea9088e565f10a657a15a0f5d7b9b34283609d857de25", + "size": 229716640 + } + }, + "sdkCompat": { + "testedWrapperVersions": [ + "0.3.243", + "0.3.245", + "0.3.246", + "0.3.247", + "0.3.248", + "0.3.250", + "0.3.251", + "0.3.252", + "0.3.257", + "0.3.258", + "0.3.259", + "0.3.260", + "0.3.261", + "0.3.263", + "0.3.265", + "0.3.266", + "0.3.267", + "0.3.268", + "0.3.269", + "0.3.270", + "0.3.271", + "0.3.272", + "0.3.273", + "0.3.274", + "0.3.275", + "0.3.276", + "0.3.277", + "0.3.278", + "0.3.280", + "0.3.281" + ], + "harnessSchema": 1 + } +} diff --git a/modules/home-manager/emacs/default.nix b/modules/home-manager/emacs/default.nix new file mode 100644 index 0000000..c63e481 --- /dev/null +++ b/modules/home-manager/emacs/default.nix @@ -0,0 +1,39 @@ +{ ... }: +{ + flake.modules.homeManager.emacs = + { pkgs, config, ... } : + let + tex = (pkgs.texlive.combine { + inherit (pkgs.texlive) scheme-medium + dvisvgm dvipng # for preview and export as html + # svg transparent + etoolbox + subfiles + enumitem + wrapfig amsmath ulem hyperref capt-of; + }); + myEmacs = (pkgs.emacsPackagesFor pkgs.emacs30).emacsWithPackages (epkgs: with epkgs; [ + # vterm + # ghostel + treesit-grammars.with-all-grammars + ]); + in + { + services.emacs = { + enable = true; + package = myEmacs; + }; + + home.packages = with pkgs; [ + mu + emacsPackages.mu4e + isync + ispell + poppler-utils + tex + ghostscript + haskell-language-server + myEmacs + ]; + }; +} diff --git a/modules/home-manager/home.nix b/modules/home-manager/home.nix new file mode 100644 index 0000000..3f4eb02 --- /dev/null +++ b/modules/home-manager/home.nix @@ -0,0 +1,217 @@ +{ inputs, config, ... }: +let + hm = config.flake.modules.homeManager; +in +{ + flake.modules.homeManager.boss = + { pkgs, lib, ... }: + let + claude-code-latest = pkgs.claude-code.override { + manifest = lib.importJSON ./claude-code-manifest-2.1.282.json; + }; + in + { + + imports = [ + hm.bash + hm.emacs + #hm.hyprland + hm.i3 + # hm.YATwm + hm.kitty + inputs.spicetify-nix.homeManagerModules.default + inputs.nixcord.homeModules.nixcord + inputs.zen-browser.homeModules.twilight-official + #inputs.stylix.homeManagerModules.stylix + ]; + + home = { + stateVersion = "24.05"; + username = "boss"; + homeDirectory = "/home/boss"; + }; + + # The home.packages option allows you to install Nix packages into your + # environment. + # nixpkgs.config.allowUnfree = true; + home.packages = with pkgs; [ + feh + pass + # spotify + playerctl + libqalculate + libreoffice + hunspell + hunspellDicts.en_AU + logisim-evolution + thunderbird + xdotool + discord + # (discord.override { + # withOpenASAR = true; + # withVencord = true; + # }) + # vesktop + mumble + gimp + bottom + xfce.thunar + mpv + man-pages + man-pages-posix + # (inputs.plover-flake.packages.${system}.plover.with-plugins (ps: with ps;[ + # plover-dict-commands + # plover-console-ui + # plover-controller + # ])) + pavucontrol + unzip zip + appimage-run + # lunar-client + libnotify + xclip + (python3.withPackages (ps: with ps; [ + python-lsp-server + numpy + matplotlib + jupyter + jupytext + pandas + pydot + scikit-learn + nbdev + pillow + ])) + graphviz + alacritty + # nyxt + wireguard-tools + brightnessctl + # inputs.nil.packages.${system}.default + nil + #inputs.polymc.packages.${system}.default + jre8 + #inputs.zen-browser.packages."${system}".default + piper + qbittorrent + # sbcl + superTuxKart + typst + sops + ffmpeg + ghc + # hytale-launcher + # inputs.hytale-launcher.packages.${pkgs.system}.default + #adom + flatpak + deadlock-mod-manager + nh + claude-code-latest + inputs.claude-desktop.packages.${system}.claude-desktop + # openttd + ]; + + nix = { + #package = pkgs.nix; + settings.experimental-features = [ "nix-command" "flakes" ]; + }; + + home.sessionVariables = { + EDITOR = "emacsclient -c"; + MAKEFLAGS = " -j16 "; + MOZ_ENABLE_WAYLAND = 1; + }; + + + programs.home-manager.enable = true; + + programs.direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + + services.gpg-agent.enable = true; + services.gpg-agent.pinentry.package = pkgs.pinentry-gtk2; + + services.dunst = { + enable = true; + settings = { + global = { + follow = "keyboard"; + frame_width = 0; + }; + }; + }; + + programs.obs-studio = { + enable = true; + + # optional Nvidia hardware acceleration + # package = ( + # pkgs.obs-studio.override { + # cudaSupport = true; + # } + # ); + + plugins = with pkgs.obs-studio-plugins; [ + obs-pipewire-audio-capture + input-overlay + ]; + }; + + # services.easyeffects.enable = true; + + services.pass-secret-service.enable = true; + # Start with the X session rather than at boot, so it inherits DISPLAY/XAUTHORITY + # and gpg can show the GTK pinentry. Otherwise apps get logged out. + systemd.user.services.pass-secret-service = { + Unit.After = [ "graphical-session.target" ]; + Unit.PartOf = lib.mkForce [ "graphical-session.target" ]; + Install.WantedBy = lib.mkForce [ "graphical-session.target" ]; + }; + + + programs.firefox = { + enable = true; + }; + programs.zen-browser = { + enable = true; + setAsDefaultBrowser = true; + }; + + # programs.nixcord = { + # enable = true; + # }; + + + stylix.targets.spicetify.enable = true; + stylix.targets.firefox.profileNames = [ "default"]; + stylix.targets.zen-browser.profileNames = [ "default" ]; + # stylix.targets.nixcord.enable = true; + + programs.spicetify = + let + spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system}; + in + { + enable = true; + spotifyLaunchFlags = "--disable-gpu --disable-software-rasterizer"; + enabledExtensions = with spicePkgs.extensions; [ + fullAppDisplay + powerBar + # addToQueueTop + loopyLoop + ]; + enabledCustomApps = with spicePkgs.apps; [ + newReleases + lyricsPlus + betterLibrary + ]; + # theme = spicePkgs.themes.nightlight; + }; + + + xsession.windowManager.command = lib.mkForce "$@"; + }; +} diff --git a/modules/home-manager/hyprland/default.nix b/modules/home-manager/hyprland/default.nix new file mode 100644 index 0000000..e5f041e --- /dev/null +++ b/modules/home-manager/hyprland/default.nix @@ -0,0 +1,157 @@ +{ inputs, config, ... }: +let + hm = config.flake.modules.homeManager; +in +{ + flake.modules.homeManager.hyprland = + { + pkgs, + lib, + ... + }: + { + imports = [ + hm.rofi + hm.kitty + hm.waybar + hm.hyprpaper + ]; + + home.file.".config/hypr/hyprlock.conf".source = ./hyprlock.conf; + + wayland.windowManager.hyprland= { + enable = true; + xwayland.enable = true; + systemd.variables = ["--all"]; + #package = inputs.hyprland.packages.${pkgs.system}.hyprland; + #portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland; + settings = { + "$mod" = "SUPER"; + exec-once = [ + "waybar" + "xss-lock --transfer-sleep-lock -- hyprlock" + "nm-applet" + "hyprpaper" + ]; + bind = + [ + "$mod, C, exec, firefox" + ", Print, exec, grimblast copy area" + "$mod, D, exec, rofi -i -show drun -disable-history" + "$mod Shift, E, exit" + "$mod, Return, exec, kitty" + "$mod, T, togglesplit" + "$mod Control, left, workspace, m-1" + "$mod Control, h, workspace, m-1" + "$mod Control, right, workspace, m+1" + "$mod Control, l, workspace, m+1" + "$mod, x, exec, hyprlock" + "$mod Shift, x, exec, hyprlock" + "$mod Shift, x, exec, systemctl suspend" + "$mod Shift, MINUS, exec, emacsclient -c" + "ALT, Tab, focusmonitor, +1" + "$mod, G, exec, bash /home/boss/bin/rofi-passmenu" + ", XF86AudioRaiseVolume, exec, pamixer -i 5" + ", XF86AudioLowerVolume, exec, pamixer -d 5" + "$mod Shift, Q, killactive" + "$mod, F, fullscreen" + "$mod Shift, space, togglefloating" + "$mod, mouse:272, movewindow" + ", XF86AudioPlay, exec, playerctl play-pause" + "$mod, bracketleft, exec, playerctl -p firefox play-pause" + "$mod, bracketright, exec, playerctl -p spotify play-pause" + "$mod Shift, S, exec spectacle -r" + ] + ++ ( + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + builtins.concatLists (builtins.genList ( + x: let + key = let + c = (x + 1) / 10; + in toString (x + 1 - (c * 10)); + in [ + "$mod, ${key}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${key}, movetoworkspace, ${toString (x + 1)}" + (lib.mkIf (x < 5) + "$mod Control, ${key}, workspace, ${toString (x + 6)}" + ) + "$mod Control, ${key}, workspace, ${toString (x + 1)}" + ] + ) + 10) + ) + ++ ( + builtins.map ( + x: "$mod, ${ builtins.elemAt x 0}, movefocus, ${builtins.elemAt x 1}\nbind=$mod Shift, ${builtins.elemAt x 0}, movewindow, ${builtins.elemAt x 1}" + ) + [ + ["h" "l"] + ["left" "l"] + ["j" "d"] + ["down" "d"] + ["k" "u"] + ["up" "u"] + ["l" "r"] + ["right" "r"] + ] + ); + monitor = + [ + "eDP-1, highrr, 0x0, 1" + "HDMI-A-1, highrr, 1920x0, 1" + ]; + workspace = + (builtins.genList + (x : "${toString (x + 1)},monitor:eDP-1") + 5 + ) + ++ (builtins.genList + (x : "${toString (x + 6)},monitor:HDMI-A-1") + 5 + ); + + + input = { + touchpad.natural_scroll = true; + #touchpad.scroll_factor = 0.5; + accel_profile = "flat"; + follow_mouse = true; + kb_options = "caps:super"; + #sensitivity = 0.00; + }; + decoration = { + rounding = 10; + drop_shadow = false; + }; + animation = [ + "workspaces,1,5,easeOutQuint,slide" + ]; + bezier = [ + "easeInOutCubic,0.65,0,0.35,1" + "easeOutQuint,0.22,1,0.36,1" + ]; + general = { + #"col.inactive_border" = "rgb(2f2e43)"; + #"col.active_border" = "rgb(ab47bc)"; + border_size = 2; + gaps_in = 6; + gaps_out = 12; + }; + windowrulev2 = [ + "opacity 0.8 override 0.8 override, title:Spotify$" + ]; + }; + }; + + home.packages = with pkgs; [ + ydotool + xss-lock + pamixer + grimblast + playerctl + libsForQt5.spectacle + inputs.hyprlock.packages.${system}.hyprlock + ]; + }; +} diff --git a/modules/home-manager/hyprland/default.nix~ b/modules/home-manager/hyprland/default.nix~ new file mode 100644 index 0000000..569d7ff --- /dev/null +++ b/modules/home-manager/hyprland/default.nix~ @@ -0,0 +1,95 @@ +{ + pkgs, + ... +}: +{ + imports = [ + ../rofi + ../kitty + ../waybar + ]; + + wayland.windowManager.hyprland= { + enable = true; + xwayland.enable = true; + settings = { + "$mod" = "SUPER"; + exec-once = [ + "waybar" + "xss-lock --transfer-sleep-lock -- swaylock" + ]; + bind = + [ + "$mod, C, exec, firefox" + #", Print, exec, grimblast copy area" + "$mod, D, exec, rofi -i -show drun -disable-history" + "$mod Shift, E, exit" + "$mod, Return, exec, kitty" + "$mod, T, togglesplit" + "$mod Control, left, workspace, m-1" + "$mod Control, h, workspace, m-1" + "$mod Control, right, workspace, m+1" + "$mod Control, l, workspace, m+1" + "$mod, x, exec, swaylock" + "$mod Shift, x, exec, swaylock" + "$mod Shift, x, exec, systemctl suspend" + "$mod Shift, MINUS, exec, emacsclient -c" + ] + ++ ( + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + builtins.concatLists (builtins.genList ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in [ + "$mod, ${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + ] + ) + 10) + ) + ++ ( + builtins.map ( + x: "$mod, ${ builtins.elemAt x 0}, movefocus, ${builtins.elemAt x 1}\nbind=$mod Shift, ${builtins.elemAt x 0}, movewindow, ${builtins.elemAt x 1}" + ) + [ + ["h" "l"] + ["left" "l"] + ["j" "d"] + ["down" "d"] + ["k" "u"] + ["up" "u"] + ["l" "r"] + ["right" "r"] + ] + ); + monitor = + [ + "eDP-1, 1920x1080, 0x0, 1" + "HDMI-A-1, 1920x1080, 1920x0, 1" + ]; + input = { + touchpad.natural_scroll = true; + #touchpad.scroll_factor = 0.5; + accel_profile = "flat"; + follow_mouse = true; + #sensitivity = 0.00; + }; + decoration.rounding = 10; + animation = [ + "workspaces,1,5,easeOutQuint,slide" + ]; + bezier = [ + "easeInOutCubic,0.65,0,0.35,1" + "easeOutQuint,0.22,1,0.36,1" + ]; + }; + }; + + home.packages = with pkgs; [ + swaylock + ]; +} diff --git a/modules/home-manager/hyprland/hyprlock.conf b/modules/home-manager/hyprland/hyprlock.conf new file mode 100644 index 0000000..dc2bc93 --- /dev/null +++ b/modules/home-manager/hyprland/hyprlock.conf @@ -0,0 +1,41 @@ +background { + path = /home/boss/Wallpapers/lockscreen.png + blur_passes = 0 +} +input-field { + size = 200, 50 + outline_thickness = 3 + dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = false + dots_rounding = -1 # -1 default circle, -2 follow input-field rounding + outer_color = rgb(151515) + inner_color = rgb(200, 200, 200) + font_color = rgb(10, 10, 10) + fade_on_empty = true + fade_timeout = 1000 # Milliseconds before fade_on_empty is triggered. + placeholder_text = <i>Input Password...</i> # Text rendered in the input box when it's empty. + hide_input = false + rounding = -1 # -1 means complete rounding (circle/oval) + check_color = rgb(204, 136, 34) + fail_color = rgb(204, 34, 34) # if authentication failed, changes outer_color and fail message color + fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i> # can be set to empty + fail_transition = 300 # transition time in ms between normal outer_color and fail_color + capslock_color = -1 + numlock_color = -1 + bothlock_color = -1 # when both locks are active. -1 means don't change outer color (same for above) + invert_numlock = false # change color if numlock is off + swap_font_color = false # see below + + position = 0, -20 + halign = center + valign = center +} +label { + text = $TIME + text_align = center + color = rgb(50, 50, 50) + position = 0, 200 + halign = center + valign = center +}
\ No newline at end of file diff --git a/modules/home-manager/hyprpaper/default.nix b/modules/home-manager/hyprpaper/default.nix new file mode 100644 index 0000000..4596331 --- /dev/null +++ b/modules/home-manager/hyprpaper/default.nix @@ -0,0 +1,14 @@ +{ ... }: +{ + flake.modules.homeManager.hyprpaper = + { + pkgs, + ... + }: + { + #home.file.".config/hypr/hyprpaper.conf".source = ./hyprpaper.conf; + home.packages = with pkgs; [ + hyprpaper + ]; + }; +} diff --git a/modules/home-manager/hyprpaper/hyprpaper.conf b/modules/home-manager/hyprpaper/hyprpaper.conf new file mode 100644 index 0000000..02bec8b --- /dev/null +++ b/modules/home-manager/hyprpaper/hyprpaper.conf @@ -0,0 +1,3 @@ +preload = ~/Wallpapers/val.png + +wallpaper = ,~/Wallpapers/val.png
\ No newline at end of file diff --git a/modules/home-manager/i3/config b/modules/home-manager/i3/config new file mode 100644 index 0000000..fc0afae --- /dev/null +++ b/modules/home-manager/i3/config @@ -0,0 +1,333 @@ +# i3 config file (v4) +# +# Please see https://i3wm.org/docs/userguide.html for a complete reference! +# +# This config file uses keycodes (bindsym) and was written for the QWERTY +# layout. +# +# To get a config file with the same key positions, but for your current +# layout, use the i3-config-wizard +# + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font pango:Ubuntu 10 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +#font pango:DejaVu Sans Mono 8 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -eti ~/Documents/lockscreen.png --nofork + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec_always --no-startup-id nm-applet + +# Use pactl to adjust volume in PulseAudio. +#set $refresh_i3status killall -SIGUSR1 i3status +#bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% +#bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% +#bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle +#bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle + +bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer -i 5 +bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 5 + +# use these keys for focus, movement, and resize directions when reaching for +# the arrows is not convenient + +set $up k +set $down j +set $left h +set $right l + +##STARTUP +exec_always --no-startup-id "feh --bg-scale ~/Wallpapers/val.png" +#exec_always --no-startup-id nitrogen --restore +#exec_always --no-startup-id "picom --backend glx -fD 3 --vsync" +exec_always --no-startup-id "~/.config/polybar/launch.sh" +# Bind caps to super +#exec_always --no-startup-id "setxkbmap -option caps:super" +# Bind caps to control +# exec --no-startup-id "setxkbmap -option ctrl:nocaps" +# exec --no-startup-id "systemctl --user start dunst" +exec_always --no-startup-id xinput set-prop "ELAN1203:00 04F3:307A Touchpad" "libinput Tapping Enabled" 1 +exec_always --no-startup-id xinput set-prop "ELAN1203:00 04F3:307A Touchpad" "libinput Natural Scrolling Enabled" 1 +exec --no-startup-id flameshot +exec --no-startup-id rog-control-center +# Using systemd instead +#exec --no-startup-id "emacs --daemon" +exec --no-startup-id "emacsclient -c --eval '(start-scratch)'" +for_window [title="scratch-emacs"] , move scratchpad + +set $mod Mod4 + + +#GAPS + +for_window[class="-*"] border pixel 0 + +gaps inner 6 + + +#My keybinds +bindsym $mod+Control+$right workspace next +bindsym $mod+Control+Right workspace next + +#Special workspaces +bindsym $mod+p exec --no-startup-id "workspaces.sh" +bindsym $mod+Shift+p exec --no-startup-id "workspaces.sh move" + +bindsym $mod+Control+$left workspace prev +bindsym $mod+Control+Left workspace prev + +#set $i3lock-cmd i3lock -eti ~/Documents/lockscreen.png + +bindsym $mod+Shift+s exec --no-startup-id flameshot gui + +bindsym $mod+x exec --no-startup-id "loginctl lock-session" +bindsym $mod+Shift+x exec --no-startup-id "loginctl lock-session; systemctl suspend" +# bindsym $mod+Shift+c exec --no-startup-id "~/.i3_commands/open-qb.sh" +bindsym $mod+c exec --no-startup-id "zen-twilight" +bindsym $mod+Shift+c exec --no-startup-id "nyxt" +bindsym $mod+Shift+minus exec --no-startup-id "emacsclient -c" + +bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl s +5 +bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl s 5- + +bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause +bindsym XF86AudioNext exec --no-startup-id playerctl next +bindsym XF86AudioPrev exec --no-startup-id playerctl previous +bindxym XF86AudioStop exec --no-startup-id playerctl stop + +bindsym $mod+bracketleft exec --no-startup-id playerctl -p firefox play-pause +bindsym $mod+bracketright exec --no-startup-id playerctl -p spotify play-pause + +#Emoji picker +#bindsym $mod+comma exec --no-startup-id "emojis.sh" + +#Monitor config +bindsym $mod+m exec --no-startup-id "monitor-config.sh" + +# use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# start a terminal +bindsym $mod+Return exec --no-startup-id kitty + +# Start emacs with vterm +bindsym $mod+Shift+Return exec --no-startup-id "emacsclient -c --eval '(multi-vterm)'" + +# kill focused window +bindsym $mod+Shift+q kill + +# start dmenu (a program launcher) +bindsym $mod+d exec --no-startup-id rofi -i -show drun -disable-history +bindsym $mod+Shift+d exec --no-startup-id "prime-run rofi -i -show drun -disable-history" +#bindsym $mod+Shift+c exec --no-startup-id "rofi -i -lines 0 -dmenu -p 'Search:' | xargs -I{} ~/.i3_commands/browser-open.sh '{}'" +#bindsym $mod+d exec dmenu_run -i -nb '#303239' -nf '#f3f4f5' -sb '#bf00f6' -sf '#f3f4f5' + +# Password menu +bindsym $mod+g exec --no-startup-id "rofi-passmenu" + +# i3 command runner +bindsym $mod+Shift+semicolon exec --no-startup-id "i3-msg $(echo | rofi -l 0 -dmenu -p 'i3 command')" + +# There also is the (new) i3-dmenu-desktop which only displays applications +# shipping a .desktop file. It is a wrapper around dmenu, so you need that +# installed. +# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop + +# change focus +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right + +bindsym Mod1+Tab focus output left + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+$left move left +bindsym $mod+Shift+$down move down +bindsym $mod+Shift+$up move up +bindsym $mod+Shift+$right move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +# bindsym $mod+g split h + +# split in vertical orientation +# bindsym $mod+v split v + +# split toggle +bindsym $mod+t split toggle + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# move the currently focused window to the scratchpad +# bindsym $mod+Shift+minus move scratchpad + +# Show the next scratchpad window or hide the focused scratchpad window. +# If there are multiple scratchpad windows, this command cycles through them. +for_window [title="scratch-emacs"] , floating_minimum_size 1600 x 900 +bindsym $mod+minus scratchpad show + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1: " +set $ws2 "2: " +set $ws3 "3: " +set $ws4 "4: " +set $ws5 "5: " +set $ws6 "6: " +set $ws7 "7: " +set $ws8 "8: " +set $ws9 "9: " +set $ws10 "10: " + +# make workspaces go on correct monitors +workspace $ws1 output eDP eDP-1 eDP-1-1 +workspace $ws2 output eDP eDP-1 eDP-1-1 +workspace $ws3 output eDP eDP-1 eDP-1-1 +workspace $ws4 output eDP eDP-1 eDP-1-1 +workspace $ws5 output eDP eDP-1 eDP-1-1 +workspace $ws6 output HDMI-A-0 HDMI-1 HDMI-1-1 eDP eDP-1 eDP-1-1 +workspace $ws7 output HDMI-A-0 HDMI-1 HDMI-1-1 eDP eDP-1 eDP-1-1 +workspace $ws8 output HDMI-A-0 HDMI-1 HDMI-1-1 eDP eDP-1 eDP-1-1 +workspace $ws9 output HDMI-A-0 HDMI-1 HDMI-1-1 eDP eDP-1 eDP-1-1 +workspace $ws10 output HDMI-A-0 HDMI-1 HDMI-1-1 eDP eDP-1 eDP-1-1 + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + + +bindsym $mod+Control+1 workspace number $ws6; workspace number $ws1 +bindsym $mod+Control+2 workspace number $ws7; workspace number $ws2 +bindsym $mod+Control+3 workspace number $ws8; workspace number $ws3 +bindsym $mod+Control+4 workspace number $ws9; workspace number $ws4 +bindsym $mod+Control+5 workspace number $ws10; workspace number $ws5 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# reload the configuration file +# bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "exit.sh" +#bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym $left resize shrink width 10 px or 10 ppt + bindsym $down resize grow height 10 px or 10 ppt + bindsym $up resize shrink height 10 px or 10 ppt + bindsym $right resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +set $bg-color #303239 +set $inactive-bg-color #303239 +set $text-color #f3f4f5 +set $inactive-text-color #676E7D +set $urgent-bg-color #bf00f6 + +set $focused-border #ffcb6b + +# window colors +# border background text indicator +client.focused $bg-color $focused-border $text-color $bg-color +client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-color $inactive-bg-color +client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color $inactive-bg-color +client.urgent $urgent-bg-color $urgent-bg-color $text-color $urgent-bg-color + + +hide_edge_borders none + +# bar +bar { + i3bar_command none + tray_output primary + font pango: Sauce Code Pro Nerd Font, Powerline 10 + height 19 + #status_command i3status + status_command "i3status-rs" + colors { + background $bg-color + # border background text + focused_workspace $bg-color $bg-color $text-color + inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color + urgent_workspace $urgent-bg-color $urgent-bg-color $text-color + } +} diff --git a/modules/home-manager/i3/default.nix b/modules/home-manager/i3/default.nix new file mode 100644 index 0000000..982aea1 --- /dev/null +++ b/modules/home-manager/i3/default.nix @@ -0,0 +1,49 @@ +{ inputs, config, ... }: +let + hm = config.flake.modules.homeManager; +in +{ + flake.modules.homeManager.i3 = + # let + # nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.11"; + # pkgs = import nixpkgs { config = {}; overlays = []; }; + # in + # { + # i3-commands = pkgs.callPackage ./i3-commands.nix { }; + # } + + + { + config, + pkgs, + ... + } : { + imports = [ + hm.polybar + hm.rofi + hm.kitty + hm.picom + ]; + xsession.enable = true; + xsession.windowManager.i3 = { + enable = true; + package = pkgs.i3; + }; + xdg.configFile."i3/config".enable = false; + home.file.".config/i3/config" = { + source = ./config; + onChange = "${pkgs.i3}/bin/i3-msg restart"; + }; + home.packages = with pkgs; [ + i3lock + xss-lock + networkmanagerapplet + flameshot + picom + nitrogen + pamixer + inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.i3-commands + inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.rofi-passmenu + ]; + }; +} diff --git a/modules/home-manager/i3/i3-commands.nix b/modules/home-manager/i3/i3-commands.nix new file mode 100644 index 0000000..d3df9a4 --- /dev/null +++ b/modules/home-manager/i3/i3-commands.nix @@ -0,0 +1,28 @@ +{ + perSystem = + { pkgs, ... }: + { + packages.i3-commands = pkgs.callPackage ( + { + stdenv, + lib + }: + stdenv.mkDerivation { + pname = "i3-commands"; + version = "0.0.1"; + + srcs = lib.cleanSourceWith { + src = ./scripts; + filter = path: type: baseNameOf path != "rofi-passmenu"; + }; + + installPhase = '' + runHook preInstall + mkdir -p $out/bin + install -D -m 755 ./* $out/bin + runHook postInstall + ''; + } + ) { }; + }; +} diff --git a/modules/home-manager/i3/rofi-passmenu.nix b/modules/home-manager/i3/rofi-passmenu.nix new file mode 100644 index 0000000..006fcb3 --- /dev/null +++ b/modules/home-manager/i3/rofi-passmenu.nix @@ -0,0 +1,80 @@ +{ + perSystem = + { pkgs, ... }: + { + packages.rofi-passmenu = pkgs.callPackage ( + { + pkgs + }: + + pkgs.writeShellApplication { + name = "rofi-passmenu"; + + runtimeInputs = with pkgs; [ + pass + rofi + xclip + xdotool + gnugrep + gawk + coreutils + libnotify + ]; + + text = '' + #!/usr/bin/env bash + + store_dir="''${PASSWORD_STORE_DIR:-$HOME/.password-store}" + + get_passwords() { + echo "[+] Add New Password" + if [ -d "$store_dir" ]; then + find "$store_dir" -name "*.gpg" | sort | while IFS= read -r file; do + pass="''${file#"$store_dir"/}" + echo "''${pass%.gpg}" + done + fi + } + + selected=$(get_passwords | rofi -dmenu -i -p "pass") + [[ -z "$selected" ]] && exit 0 + + if [[ "$selected" == "[+] Add New Password" ]]; then + new_path=$(rofi -dmenu -p "Enter path/name for new password:") + [[ -z "$new_path" ]] && exit 0 + + choice=$(echo -e "Generate\nManual" | rofi -dmenu -p "Password method:") + if [[ "$choice" == "Generate" ]]; then + pass generate "$new_path" 20 + notify-send "Pass" "Generated password for $new_path" + elif [[ "$choice" == "Manual" ]]; then + new_pass=$(rofi -dmenu -p "Enter password:" -password) + [[ -n "$new_pass" ]] && echo "$new_pass" | pass insert -m "$new_path" + fi + exit 0 + fi + + action=$(echo -e "1. Type Password\n2. Type Username\n3. Copy Password\n4. Copy Username\n5. Show Password" | rofi -dmenu -i -p "$selected") + + case "$action" in + "1. Type Password") + pass show "$selected" | head -n 1 | tr -d '\n' | xdotool type --clearmodifiers -fi - + ;; + "2. Type Username") + pass show "$selected" | grep -i "^username:" | sed 's/^[^:]*:[[:space:]]*//' | tr -d '\n' | xdotool type --clearmodifiers -fi - + ;; + "3. Copy Password") + pass show -c "$selected" + ;; + "4. Copy Username") + pass show "$selected" | grep -i "^username:" | sed 's/^[^:]*:[[:space:]]*//' | xclip -selection clipboard + ;; + "5. Show Password") + pass show "$selected" | head -n 1 | rofi -dmenu -p "Password for $selected" + ;; + esac + ''; + } + ) { }; + }; +} diff --git a/modules/home-manager/i3/scripts/exit.sh b/modules/home-manager/i3/scripts/exit.sh new file mode 100755 index 0000000..6e1f492 --- /dev/null +++ b/modules/home-manager/i3/scripts/exit.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +choice=$(echo -e "Sleep\nLock\nLock and sleep\nExit i3" | rofi -dmenu -i -p "What do you want to do") +case $choice in + "Sleep") + systemctl suspend + ;; + "Lock") + i3lock -eti /usr/share/backgrounds/lockscreen.png + ;; + "Lock and sleep") + i3lock -eti /usr/share/backgrounds/lockscreen.png + systemctl suspend + ;; + "Exit i3") + i3-msg exit + ;; + *) + notify-send "Canceling" + ;; +esac diff --git a/modules/home-manager/i3/scripts/image_upload.sh b/modules/home-manager/i3/scripts/image_upload.sh new file mode 100755 index 0000000..ea327ad --- /dev/null +++ b/modules/home-manager/i3/scripts/image_upload.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +image_name=$(rofi -dmenu -l 0 -p "Image name") +xclip -selection clipboard -t image/png -o > ~/Documents/tehbox-files/$image_name +eval $(ssh-agent) +rsync ~/Documents/tehbox-files/$image_name boss@tehbox.org:/srv/files +notify-send "uploaded https://files.tehbox.org/$image_name" +echo -n "https://files.tehbox.org/$image_name" | xclip -i -selection clipboard diff --git a/modules/home-manager/i3/scripts/monitor-config.sh b/modules/home-manager/i3/scripts/monitor-config.sh new file mode 100755 index 0000000..8f17660 --- /dev/null +++ b/modules/home-manager/i3/scripts/monitor-config.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +choice=$(echo -e "One monitor\nTwo monitors" | rofi -dmenu -i -p "What monitor setup to use") + +monitor1=$(xrandr | grep -E "eDP(-1(-1)?)?" | awk '{print $1 }') +monitor2=$(xrandr | grep -E "HDMI(-A-0)?(-1(-1)?)?" | awk '{print $1 }') + +case $choice in + "One monitor") + xrandr --output $monitor1 --primary --mode 1920x1080 --rate 144 --pos 0x0 --rotate normal --output $monitor2 --off + sleep 1 + i3-msg restart + ;; + "Two monitors") + xrandr --output $monitor1 --primary --mode 1920x1080 --rate 144 --pos 0x0 --rotate normal --output $monitor2 --mode 1920x1080 --rate 144 --pos 1920x0 --rotate normal + sleep 1 + i3-msg restart + ;; + *) + notify-send "Invalid response, canceling" + ;; +esac + diff --git a/modules/home-manager/i3/scripts/rofi-passmenu b/modules/home-manager/i3/scripts/rofi-passmenu new file mode 100755 index 0000000..798961b --- /dev/null +++ b/modules/home-manager/i3/scripts/rofi-passmenu @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=1 + +if [[ -n $WAYLAND_DISPLAY ]]; then + rofi=rofi-wl + xdotool="ydotool type --file -" +elif [[ -n $DISPLAY ]]; then + rofi=rofi + xdotool="xdotool type --clearmodifiers --file -" +else + echo "Error: No Wayland or X11 display detected" >&2 + exit 1 +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | "$rofi" -dmenu "$@") + +[[ -n $password ]] || exit + +pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool diff --git a/modules/home-manager/i3/scripts/workspaces.sh b/modules/home-manager/i3/scripts/workspaces.sh new file mode 100755 index 0000000..3ad68ef --- /dev/null +++ b/modules/home-manager/i3/scripts/workspaces.sh @@ -0,0 +1,7 @@ +choice=$(cat ~/.i3_commands/workspaces.txt | rofi -dmenu -i -p "Which workspace to switch to") +if [[ $1 == "move" ]] +then + i3-msg move container to workspace \"$choice\" +else + i3-msg workspace \"$choice\" +fi diff --git a/modules/home-manager/i3/scripts/workspaces.txt b/modules/home-manager/i3/scripts/workspaces.txt new file mode 100644 index 0000000..84b3bf0 --- /dev/null +++ b/modules/home-manager/i3/scripts/workspaces.txt @@ -0,0 +1,11 @@ +1: +2: +3: +4: +5: +6: +7: +8: +9: +10: +S: diff --git a/modules/home-manager/kitty/default.nix b/modules/home-manager/kitty/default.nix new file mode 100644 index 0000000..8b1721f --- /dev/null +++ b/modules/home-manager/kitty/default.nix @@ -0,0 +1,28 @@ +{ ... }: +{ + flake.modules.homeManager.kitty = + { + pkgs, + config, + ... + }: + { + programs.kitty = { + enable = true; + keybindings = { + "control+shift+c" = "copy_to_clipboard"; + "control+shift+v" = "paste_from_clipboard"; + }; + settings = { + #font_family = "Cousine Nerd Font"; + #font_size = "10.0"; + #background_opacity = "0.8"; + term = "xterm-256color"; + enable_audio_bell = "no"; + mouse_hide_wait = 2; + window_padding_width = 4; + }; + #extraConfig = (builtins.readFile ./palenight.conf); + }; + }; +} diff --git a/modules/home-manager/kitty/palenight.conf b/modules/home-manager/kitty/palenight.conf new file mode 100644 index 0000000..6a58ece --- /dev/null +++ b/modules/home-manager/kitty/palenight.conf @@ -0,0 +1,40 @@ +# Palenight Colorscheme for Kitty +# Based on https://github.com/sindresorhus/hyper-snazzy + +foreground #959dcb +background #292d3e +selection_foreground #eceef0 +selection_background #607c8b +url_color #82aaff + +# black +color0 #434759 +color8 #434758 + +# red +color1 #f07178 +color9 #ff8b92 + +# green +color2 #c3e88d +color10 #ddffa7 + +# yellow +color3 #ffcb6b +color11 #ffe585 + +# blue +color4 #82aaff +color12 #9cc4ff + +# magenta +color5 #c792ea +color13 #e1acff + +# cyan +color6 #89ddff +color14 #a3f7ff + +# white +color7 #d0d0d0 +color15 #fefefe diff --git a/modules/home-manager/picom/default.nix b/modules/home-manager/picom/default.nix new file mode 100644 index 0000000..3fb1cf7 --- /dev/null +++ b/modules/home-manager/picom/default.nix @@ -0,0 +1,22 @@ +{ ... }: +{ + flake.modules.homeManager.picom = + { + pkgs, + config, + ... + }: + { + services.picom = { + enable = true; + fade = true; + fadeDelta = 3; + fadeExclude = [ + "window_type *= 'tooltip'" + ]; + settings = { + corner-radius = 10; + }; + }; + }; +} diff --git a/modules/home-manager/polybar/config.ini b/modules/home-manager/polybar/config.ini new file mode 100644 index 0000000..b7cf83e --- /dev/null +++ b/modules/home-manager/polybar/config.ini @@ -0,0 +1,186 @@ +;========================================================== +; +; +; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ +; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ +; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ +; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ +; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ +; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ +; +; +; To learn more about how to configure Polybar +; go to https://github.com/polybar/polybar +; +; The README contains a lot of information +; +;========================================================== +;;; +[colors] +background = #cc292d3e +background-alt = #cc292d3e +foreground = #676e96 +primary = #676e96 +secondary = #8ABEB7 +alert = #BF00F6 +disabled = #515772 +active = #eeffff +inactive = #515772 + +[section/bar-defaults] +width = 100% +height = 19pt +radius = 10 + +monitor = ${env:MONITOR:} + +bottom = true + +; dpi = 96 + +background = ${colors.background} +foreground = ${colors.foreground} + +border-size = 6px +border-color = #00000000 + +padding-left = 0 +padding-right = 1 +border-top-size = 0 + +module-margin = 1 + +separator = "|" +separator-foreground = ${colors.disabled} + +font-0 = Cousine Nerd Font;1 + +cursor-click = pointer +cursor-scroll = ns-resize + +enable-ipc = true + +; wm-restack = generic +; wm-restack = bspwm +wm-restack = generic + +override-redirect = false + +[bar/mainbar] +inherit = section/bar-defaults +modules-left = xworkspaces +modules-right = pipewire xkeyboard memory cpu battery date tray +modules-center = xwindow + +[bar/extrabar] +inherit = section/bar-defaults +modules-left = xworkspaces +modules-right = pipewire xkeyboard memory cpu battery date +modules-center = xwindow + +[module/xworkspaces] +type = internal/xworkspaces + +pin-workspaces = true + +label-active = %name% +label-active-foreground = ${colors.active} +label-active-padding = 1 + +label-occupied = %name% +label-occupied-foreground = ${colors.inactive} +label-occupied-padding = 1 + +label-urgent = %name% +label-urgent-foreground = ${colors.inactive} +label-urgent-background = ${colors.alert} +label-urgent-padding = 1 + +label-empty = +label-empty-foreground = ${colors.inactive} +label-empty-padding = 0 + +[module/pipewire] +type = internal/pulseaudio + +master-soundcard = hw:2 +master-mixer = Master +mapped = true + +format-volume-prefix = "VOL " +format-volume-prefix-foreground = ${colors.primary} +format-volume = <label-volume> + +label-volume = %percentage%% + +label-muted = muted +label-muted-foreground = ${colors.disabled} + +[module/battery] +type = internal/battery +low-at = 20 +full-at = 100 +battery = BAT1 +adapter = ACAD + +time-format = "%H:%M" + +format-charging-prefix = "BAT " +format-discharging-prefix = "BAT " +format-full-prefix = "BAT " +format-charging-prefix-foreground = ${colors.primary} +format-discharging-prefix-foreground = ${colors.primary} +format-full-prefix-foreground = ${colors.primary} +format-charging = "<label-charging>" +format-discharging = "<label-discharging>" +format-full = <label-full> + +label-charging = "%percentage%% - %time%" +label-discharging = "%percentage%% - %time%" +label-full = "FULL" + +[module/memory] +type = internal/memory +interval = 1 +format-prefix = "RAM " +format-prefix-foreground = ${colors.primary} +label = %percentage_used:2%% + +[module/cpu] +type = internal/cpu +interval = 1 +format-prefix = "CPU " +format-prefix-foreground = ${colors.primary} +label = %percentage:2%% + +[module/date] +type = internal/date +interval = 1 + +date = %H:%M:%S +date-alt = %H:%M:%S %d-%m-%Y + +label = %date% +label-foreground = ${colors.primary} + +[module/tray] +type = internal/tray +tray-spacing = 5 + +[module/xwindow] +type = internal/xwindow +format = <label> +label = %title% +label-maxlen = 60 + +[module/xkeyboard] +type = internal/xkeyboard +format = <label-indicator> +label-indicator-on-numlock = "NL" +label-indicator-off-numlock = "" + +[settings] +screenchange-reload = true +pseudo-transparency = true + +; vim:ft=dosini diff --git a/modules/home-manager/polybar/default.nix b/modules/home-manager/polybar/default.nix new file mode 100644 index 0000000..101e8a8 --- /dev/null +++ b/modules/home-manager/polybar/default.nix @@ -0,0 +1,24 @@ +{ ... }: +{ + flake.modules.homeManager.polybar = + { + config, + pkgs, + ... + } : { + home.file.".config/polybar/launch.sh" = { + source = ./launch.sh; + executable = true; + }; + home.file.".config/polybar/config.ini" = { + source = ./config.ini; + # onChange = '' + #${pkgs.procps}/bin/pkill polybar + #PATH=$PATH:${pkgs.polybarFull}/bin:${pkgs.lxrandr}/bin ~/.config/polybar/launch.sh + #''; + }; + home.packages = with pkgs; [ + polybarFull + ]; + }; +} diff --git a/modules/home-manager/polybar/launch.sh b/modules/home-manager/polybar/launch.sh new file mode 100755 index 0000000..41d5f3d --- /dev/null +++ b/modules/home-manager/polybar/launch.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Terminate already running bar instances +# If all your bars have ipc enabled, you can use +polybar-msg cmd quit +# Otherwise you can use the nuclear option: +# killall -q polybar + +# Launch bar1 and bar2 +echo "---" | tee -a /tmp/polybarstatus.log + +for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do + if [ $(xrandr | grep $m | grep primary | wc -l) -eq 1 ]; then + MONITOR=$m polybar mainbar | tee -a /tmp/mainpolybar.log & disown + else + MONITOR=$m polybar extrabar | tee -a /tmp/extrapolybar.log & disown + fi +done + +echo "Bars launched..." diff --git a/modules/home-manager/rofi/config/config.rasi b/modules/home-manager/rofi/config/config.rasi new file mode 100644 index 0000000..cfda0ba --- /dev/null +++ b/modules/home-manager/rofi/config/config.rasi @@ -0,0 +1,145 @@ +configuration { +modi: "window,run,drun,combi"; +width: 50; +lines: 10; +/* columns: 1;*/ +/* font: "mono 12";*/ +/* bw: 1;*/ +/* location: 0;*/ +/* padding: 5;*/ +/* yoffset: 0;*/ +/* xoffset: 0;*/ +/* fixed-num-lines: true;*/ +show-icons: true; +/* terminal: "rofi-sensible-terminal";*/ +/* ssh-client: "ssh";*/ +/* ssh-command: "{terminal} -e {ssh-client} {host} [-p {port}]";*/ +/* run-command: "{cmd}";*/ +/* run-list-command: "";*/ +/* run-shell-command: "{terminal} -e {cmd}";*/ +/* window-command: "wmctrl -i -R {window}";*/ +/* window-match-fields: "all";*/ +/* icon-theme: ;*/ +/* drun-match-fields: "name,generic,exec,categories";*/ +/* drun-show-actions: false;*/ +/* drun-display-format: "{name} [<span weight='light' size='small'><i>({generic})</i></span>]";*/ +/* disable-history: false;*/ +/* ignored-prefixes: "";*/ +/* sort: false;*/ +/* sorting-method: ;*/ +/* case-sensitive: false;*/ +/* cycle: true;*/ +/* sidebar-mode: false;*/ +/* eh: 1;*/ +/* auto-select: false;*/ +/* parse-hosts: false;*/ +/* parse-known-hosts: true;*/ +combi-modi: "run,drun"; +/* matching: "normal";*/ +/* tokenize: true;*/ +/* m: "-5";*/ +/* line-margin: 2;*/ +/* line-padding: 1;*/ +/* filter: ;*/ +/* separator-style: "dash";*/ +/* hide-scrollbar: false;*/ +/* fullscreen: false;*/ +/* fake-transparency: false;*/ +/* dpi: -1;*/ +/* threads: 0;*/ +/* scrollbar-width: 8;*/ +/* scroll-method: 0;*/ +/* fake-background: "screenshot";*/ +/* window-format: "{w} {c} {t}";*/ +/* click-to-exit: true;*/ +/* show-match: true;*/ +/* color-normal: ;*/ +/* color-urgent: ;*/ +/* color-active: ;*/ +/* color-window: ;*/ +max-history-size: 25; +/* combi-hide-mode-prefix: false;*/ +/* matching-negate-char: '-' /* unsupported */;*/ +/* cache-dir: ;*/ +/* pid: "/run/user/1000/rofi.pid";*/ +/* display-window: ;*/ +/* display-windowcd: ;*/ +/* display-run: ;*/ +/* display-ssh: ;*/ +/* display-drun: ;*/ +/* display-combi: ;*/ +/* display-keys: ;*/ +/* kb-primary-paste: "Control+V,Shift+Insert";*/ +/* kb-secondary-paste: "Control+v,Insert";*/ +/* kb-clear-line: "Control+w";*/ +/* kb-move-front: "Control+a";*/ +/* kb-move-end: "Control+e";*/ +/* kb-move-word-back: "Alt+b,Control+Left";*/ +/* kb-move-word-forward: "Alt+f,Control+Right";*/ +/* kb-move-char-back: "Left,Control+b";*/ +/* kb-move-char-forward: "Right,Control+f";*/ +/* kb-remove-word-back: "Control+Alt+h,Control+BackSpace";*/ +/* kb-remove-word-forward: "Control+Alt+d";*/ +/* kb-remove-char-forward: "Delete,Control+d";*/ +/* kb-remove-char-back: "BackSpace,Shift+BackSpace,Control+h";*/ +/* kb-remove-to-eol: "Control+k";*/ +/* kb-remove-to-sol: "Control+u";*/ +/* kb-accept-entry: "Control+j,Control+m,Return,KP_Enter";*/ +/* kb-accept-custom: "Control+Return";*/ +/* kb-accept-alt: "Shift+Return";*/ +/* kb-delete-entry: "Shift+Delete";*/ +/* kb-mode-next: "Shift+Right,Control+Tab";*/ +/* kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab";*/ +/* kb-row-left: "Control+Page_Up";*/ +/* kb-row-right: "Control+Page_Down";*/ + kb-row-up: "Up,Control+p,Alt+k"; + kb-row-down: "Down,Control+n,Alt+j"; +/* kb-row-tab: "Tab";*/ +/* kb-page-prev: "Page_Up";*/ +/* kb-page-next: "Page_Down";*/ +/* kb-row-first: "Home,KP_Home";*/ +/* kb-row-last: "End,KP_End";*/ +/* kb-row-select: "Control+space";*/ +/* kb-screenshot: "Alt+S";*/ +/* kb-ellipsize: "Alt+period";*/ +/* kb-toggle-case-sensitivity: "grave,dead_grave";*/ +/* kb-toggle-sort: "Alt+grave";*/ +/* kb-cancel: "Escape,Control+g,Control+bracketleft";*/ +/* kb-custom-1: "Alt+1";*/ +/* kb-custom-2: "Alt+2";*/ +/* kb-custom-3: "Alt+3";*/ +/* kb-custom-4: "Alt+4";*/ +/* kb-custom-5: "Alt+5";*/ +/* kb-custom-6: "Alt+6";*/ +/* kb-custom-7: "Alt+7";*/ +/* kb-custom-8: "Alt+8";*/ +/* kb-custom-9: "Alt+9";*/ +/* kb-custom-10: "Alt+0";*/ +/* kb-custom-11: "Alt+exclam";*/ +/* kb-custom-12: "Alt+at";*/ +/* kb-custom-13: "Alt+numbersign";*/ +/* kb-custom-14: "Alt+dollar";*/ +/* kb-custom-15: "Alt+percent";*/ +/* kb-custom-16: "Alt+dead_circumflex";*/ +/* kb-custom-17: "Alt+ampersand";*/ +/* kb-custom-18: "Alt+asterisk";*/ +/* kb-custom-19: "Alt+parenleft";*/ +/* kb-select-1: "Super+1";*/ +/* kb-select-2: "Super+2";*/ +/* kb-select-3: "Super+3";*/ +/* kb-select-4: "Super+4";*/ +/* kb-select-5: "Super+5";*/ +/* kb-select-6: "Super+6";*/ +/* kb-select-7: "Super+7";*/ +/* kb-select-8: "Super+8";*/ +/* kb-select-9: "Super+9";*/ +/* kb-select-10: "Super+0";*/ +/* ml-row-left: "ScrollLeft";*/ +/* ml-row-right: "ScrollRight";*/ +/* ml-row-up: "ScrollUp";*/ +/* ml-row-down: "ScrollDown";*/ +/* me-select-entry: "MousePrimary";*/ +/* me-accept-entry: "MouseDPrimary";*/ +/* me-accept-custom: "Control+MouseDPrimary";*/ +} +@theme "customised" diff --git a/modules/home-manager/rofi/config/customised.rasi b/modules/home-manager/rofi/config/customised.rasi new file mode 100644 index 0000000..d953062 --- /dev/null +++ b/modules/home-manager/rofi/config/customised.rasi @@ -0,0 +1,195 @@ +/** + * I based mine of this one + */ +/** + * ROFI Color theme + * User: Qball + * Copyright: Dave Davenport + */ + +* { + foreground: #a6accd; + backlight: #ccffeedd; + background-color: transparent; + dark: #1c1c1c; + + //My colors + normal-background: #292d3e; + normal-text: #eeffff; + selected-background: #ab47bc; + + // Black + black: #3d352a; + lightblack: #554444; + tlightblack: #554444cc; + // + // Red + red: #cd5c5c; + lightred: #cc5533; + // + // Green + green: #86af80; + lightgreen: #88cc22; + // + // Yellow + yellow: #e8ae5b; + lightyellow: #ffa75d; + // + // Blue + blue: #6495ed; + lightblue: #87ceeb; + // + // Magenta + magenta: #deb887; + lightmagenta: #996600; + // + // Cyan + cyan: #b0c4de; + tcyan: #ccb0c4de; + lightcyan: #b0c4de; + // + // White + white: #bbaa99; + lightwhite: #ddccbb; + // + // Bold, Italic, Underline + highlight: underline bold #ffffff; + + transparent: rgba(0,0,0,0); + font: "Cousine Nerd Font 10"; +} +#window { + location: center; + anchor: center; + padding: 10px; + border-radius: 10px; + color: @magenta; + background-color: @transparent; + spacing: 0; + children: [mainbox]; + orientation: horizontal; +} + +#mainbox { + spacing: 0; + children: [ inputbar, message, listview ]; + //border: 2px; + border-color: @normal-text; + border-radius: 15px; +} + +#message { + border-color: @normal-text; + border: 0px 2px 2px 2px; + border-radius: 10px; + padding: 5; + background-color: @tcyan; +} +#message { + font: "Cousine Nerd Font 10"; + color: @black; +} + +#inputbar { + color: @normal-text; + padding: 11px; + background-color: @normal-background; + //border: 2px 2px 2px 2px; + border-radius: 15px 15px 0px 0px; + border-color: @normal-text; + font: "Cousine Nerd Font 10"; +} +#entry,prompt,case-indicator { + text-font: inherit; + text-color:inherit; +} +#prompt { + margin: 0px 0.3em 0em 0em ; +} +#listview { + //padding: 8px; + border-radius: 0px 0px 15px 15px; + border-color: @normal-text; + //border: 0px 2px 2px 2px; + background-color: @normal-background; + dynamic: false; + // lines: 10; +} +#element { + padding: 4px 4px 4px 11px; + vertical-align: 0.5; + //border: 2px; + border-radius: 0px; + background-color: transparent; + color: @foreground; + font:inherit; +} +element-text +{ + background-color: inherit; + text-color: inherit; +} +element-icon { + size: 2ch; +} +#element selected.normal { + background-color: @selected-background; + color: @normal-text; +} +#element normal active { + foreground: @selected-background; +} +#element normal urgent { + foreground: @lightred; +} +#element alternate normal { +} +#element alternate active { + foreground: @selected-background; +} +#element alternate urgent { + foreground: @lightred; +} +#element selected active { + background-color: @selected-background; + foreground: @selected-background; +} +#element selected urgent { + background-color: @lightred; + foreground: @dark; +} +#element normal normal { + +} + +#vertb { + expand: false; + children: [ dummy0, mode-switcher, dummy1 ]; +} +#dummy0, dummy1 { + expand: true; +} + +#mode-switcher { + expand: false; + orientation: vertical; + spacing: 0px; + //border: 0px 0px 0px 0px; +} +#button { + font: "Cousine Nerd Font 10"; + padding: 6px; + //border: 2px 0px 2px 2px; + border-radius: 4px 0px 0px 4px; + background-color: @tlightblack; + border-color: @normal-text; + color: @foreground; + horizontal-align: 0.5; +} +#button selected normal { + color: @dark; + //border: 2px 0px 2px 2px; + background-color: @backlight; + border-color: @normal-text; +} + diff --git a/modules/home-manager/rofi/default.nix b/modules/home-manager/rofi/default.nix new file mode 100644 index 0000000..76cc56e --- /dev/null +++ b/modules/home-manager/rofi/default.nix @@ -0,0 +1,17 @@ +{ ... }: +{ + flake.modules.homeManager.rofi = + { + pkgs, + config, + ... + }: { + home.file.".config/rofi" = { + source = ./config; + recursive = true; + }; + home.packages = [ + pkgs.rofi + ]; + }; +} diff --git a/modules/home-manager/shells/bash.nix b/modules/home-manager/shells/bash.nix new file mode 100644 index 0000000..a396594 --- /dev/null +++ b/modules/home-manager/shells/bash.nix @@ -0,0 +1,87 @@ +{ ... }: +{ + flake.modules.homeManager.bash = + { pkgs, ... } : + { + programs.bash = { + enable = true; + enableCompletion = true; + initExtra = '' +tabs 4 +clear +PF_INFO="ascii title os kernel uptime memory shell wm" pfetch + +# Fancy prompt +export PROMPT_COMMAND=__prompt_command +__prompt_command() { + local exit="$?" + PS1="" + local reset='\[\e[0m\]' + local white='\[\e[97m\]' + local blue='\[\e[38;5;25m\]' + local bgblue='\[\e[48;5;25m\]' + local green='\[\e[38;5;34m\]' + local bggreen='\[\e[48;5;34m\]' + local gray='\[\e[38;5;238m\]' + local bggray='\[\e[48;5;238m\]' + local red='\[\e[38;5;124m\]' + local bgred='\[\e[48;5;124m\]' + + # Add user + PS1+="$white$bgblue \u$blue" + # Add SHLVL (shell depth) + if [ $SHLVL -gt 2 ]; then + PS1+="$bggreen$white $(($SHLVL - 2))$reset$green" + fi + # Add dir + PS1+="$bggray$white \w$reset$gray" + + if [ $exit != 0 ]; then + # Change end color + #PS1+="$bgred$white \w$reset$red" + # Add exit code + PS1+="$bgred$white $exit$reset$red" + else + # Change end color + #PS1+="$bggray$white \w$reset$gray" + # Add end cap + PS1+="" + fi + PS1+="$reset " +} +# Powerline prompt +#export PS1='\[\e[48;5;25;38;5;189m\] \u \[\e[48;5;238;38;5;25m\] \[\e[48;5;238;38;5;189m\]\w \[\e[0m\]\[\e[38;5;238m\]\[\e[0m\] ' + +# Multiline prompt +#export PS1="\[\e[32m\]╭──\[\e[31m\](\[\e[34m\]\u\[\e[33m\]@\[\e[34m\]\h\[\e[31m\])\[\e[32m\]-\[\e[31m\](\[\e[34m\]\w\[\e[31m\])\[\e[32m\]-\[\e[31m\](\[\e[34m\]\d\[\e[31m\]) +#\[\e[32m\]╰\[\e[0m\] " +''; + shellAliases = { + cm = "cmatrix -absu 2"; + pipes = "pipes.sh -KR -p 3 -t3 -c 1 -c 2 -c 3 -c 4 -c 5 -c 6"; + cl = "clear"; + ls = "lsd"; + la = "lsd -a"; + ll = "lsd -al"; + tree = "lsd --tree"; + pathfindsaver = "while sleep 1; do pathfind -f; done"; + qalc = "qalc -s 'varunits 0' -s 'angle 2'"; + + flake-rebuild = "nixos-rebuild switch --flake ~/nixos-configuration"; + }; + }; + + programs.zoxide = { + enable = true; + enableBashIntegration = true; + options = [ "--cmd cd" ]; + }; + + home.packages = with pkgs; [ + zoxide + pfetch + lsd + libqalculate + ]; + }; +} diff --git a/modules/home-manager/waybar/config/config.jsonc b/modules/home-manager/waybar/config/config.jsonc new file mode 100644 index 0000000..8dcf08a --- /dev/null +++ b/modules/home-manager/waybar/config/config.jsonc @@ -0,0 +1,57 @@ +{ + "layer": "bottom", + "position": "bottom", + "height": 30, + "modules-left": ["hyprland/workspaces"], + "modules-center": [], + "modules-right": ["tray", "pulseaudio", "memory", "cpu", "battery", "clock"], + "hyprland/workspaces": { + "format": "{icon} {name}", + "on-click": "activate", + "on-scroll-up": "hyprctl dispatch workspace e+1", + "on-scroll-down": "hyprctl dispatch workspace e-1", + "format-icons": { + "urgent": "", + "active": "", + "default": "" + }, + "sort-by-number": true + }, + "tray": { + "spacing": 5, + }, + "pulseaudio": { + "scroll-step": 5.0, + "on-click": "pamixer -t", + "format": " {volume}%", + "format-muted": " {volume}%", + }, + "memory": { + "format": " {percentage}%" + }, + "cpu": { + "format": " {usage}%" + }, + "battery": { + "format": "{icon} {time} {capacity}%", + "format-time": " {H}:{M}", + "format-icons": ["", "", "", "", ""] + }, + "clock": { + "format": " {:%H:%M:%S}", + "format-alt": " {:%a, %d. %b %H:%M:%S}", + "interval": 1 + }, + "network": { + "interface": "wlp2s0", + "format": "{ifname}", + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "{ipaddr}/{cidr} ", + "format-disconnected": "", + "tooltip-format": "{ifname} via {gwaddr} ", + "tooltip-format-wifi": "{essid} ({signalStrength}%) ", + "tooltip-format-ethernet": "{ifname} ", + "tooltip-format-disconnected": "Disconnected", + "max-length": 50 + } +} diff --git a/modules/home-manager/waybar/config/style.css b/modules/home-manager/waybar/config/style.css new file mode 100644 index 0000000..3a9b5b5 --- /dev/null +++ b/modules/home-manager/waybar/config/style.css @@ -0,0 +1,71 @@ +* { + font-family: "Cousine Nerd Font"; + font-size: 13px; +} +window#waybar { + background-color: alpha(#292D3E, 0); +} +.modules-right { + margin-right: 7px; +} +.modules-right > * > * { + padding-left: 10px; + padding-right: 10px; + border-radius: 10px; + margin-left: 5px; + margin-right: 5px; + margin-bottom: 12px; + color: #eeffff; + background-color: #292D3E; +} + +.modules-right > *:nth-child(1) > * { + background-color: shade(alpha(#c792ea, 1), 0.75); +} +.modules-right > *:nth-child(2) > * { + background-color: shade(alpha(#82aaff, 1), 0.75); +} +.modules-right > *:nth-child(3) > * { + background-color: shade(alpha(#c3e88d, 1), 0.75); +} +.modules-right > *:nth-child(4) > * { + background-color: shade(alpha(#89ddff, 1), 0.75); +} +.modules-right > *:nth-child(5) > * { + background-color: shade(alpha(#f78c6c, 1), 0.75); +} +.modules-right > *:nth-child(6) > * { + background-color: shade(alpha(#ffcb6b, 1), 0.75); +} + +#workspaces { + background-color: #292D3E; + border-radius: 10px; + margin-left: 12px; + margin-bottom: 12px; +} + +#workspaces button { + padding-left: 10px; + padding-right: 10px; + border: none; + color: #eeffff; +} +#workspaces button:hover { + box-shadow: none; + text-shadow: none; + background: none; + transition: none; + /*background-color: shade(alpha(#c792ea, 0.8), 0.75); + transition: background-color 0.2s;*/ + color: shade(#c792ea, 0.75); + transition: color 0.2s; +} +.modules-center > * > * { + padding-left: 10px; + padding-right: 10px; + border-radius: 10px; + margin-bottom: 12px; + color: #eeffff; + background-color: #292D3E; +} diff --git a/modules/home-manager/waybar/default.nix b/modules/home-manager/waybar/default.nix new file mode 100644 index 0000000..fb084d7 --- /dev/null +++ b/modules/home-manager/waybar/default.nix @@ -0,0 +1,20 @@ +{ ... }: +{ + flake.modules.homeManager.waybar = + { + config, + pkgs, + ... + } : { + home.file.".config/waybar/" = { + source = ./config; + onChange = "${pkgs.procps}/bin/pkill waybar && ${pkgs.hyprland}/bin/hyprctl dispatch exec waybar || ${pkgs.hyprland}/bin/hyprctl dispatch exec waybar"; + recursive = true; + }; + home.packages = with pkgs; [ + waybar + pamixer + wtype + ]; + }; +} diff --git a/modules/my-pkgs/adom.nix b/modules/my-pkgs/adom.nix new file mode 100644 index 0000000..0c2ad03 --- /dev/null +++ b/modules/my-pkgs/adom.nix @@ -0,0 +1,59 @@ +{ + perSystem = + { pkgs, ... }: + { + packages.adom = pkgs.callPackage ( + { stdenv, fetchurl, autoPatchelfHook, makeDesktopItem, makeWrapper, ncurses5, libtinfo, SDL2, SDL2_image, SDL2_mixer, SDL2_net, SDL2_ttf, luajit} : + + stdenv.mkDerivation rec { + pname = "adom"; + version = "3.3.3"; + src = fetchurl { + url = "https://sjc4.dl.dbolical.com/dl/2019/01/29/adom_noteye_linux_ubuntu_64_${version}.tar.gz?st=PcXL3PZSxDxr6H6v58PFfw==&e=1750223221"; + hash = "sha256-7c39tEPlrpWIL6QH0BIOLLrFFIlhEHPw5F3knMUh+BA="; + }; + + nativeBuildInputs = [ + autoPatchelfHook + makeWrapper + ]; + + buildInputs = [ + (ncurses5.override { unicodeSupport = false; }) + ncurses5 + SDL2 + SDL2_image + SDL2_mixer + SDL2_net + SDL2_ttf + luajit + stdenv.cc.cc.lib + ]; + + sourceRoot = "adom"; + installPhase = let desktopEntry = makeDesktopItem { + name = "adom"; + desktopName = "ADOM"; + exec = "OUT_DIR/bin/adom"; + #path = "OUT_DIR/share"; + }; in '' + runHook preInstall + install -m755 -D adom $out/bin/adom + wrapProgram $out/bin/adom \ + --chdir $out/share + install -m644 -D lib/libnoteye.so $out/lib/libnoteye.so + mkdir -p $out/share + cp -r common $out/share/ + cp -r docs $out/share/ + cp -r games $out/share/ + cp -r gfx $out/share/ + cp -r licenses $out/share/ + cp -r sound $out/share/ + mkdir -p $out/share/applications + sed -e "s|OUT_DIR|$out|g" ${desktopEntry}/share/applications/adom.desktop > $out/share/applications/adom.desktop + runHook postInstall +''; + } + ) { }; + }; +} diff --git a/modules/my-pkgs/default.nix b/modules/my-pkgs/default.nix new file mode 100644 index 0000000..fb227d0 --- /dev/null +++ b/modules/my-pkgs/default.nix @@ -0,0 +1,12 @@ +{ inputs, ... }: +{ + flake.modules.nixos.my-pkgs = + { config, pkgs, lib, ... }: + { + nixpkgs.overlays = [ + (final: prev: { + adom = inputs.self.packages.${final.stdenv.hostPlatform.system}.adom; + }) + ]; + }; +} diff --git a/modules/my-pkgs/stk-installers.nix b/modules/my-pkgs/stk-installers.nix new file mode 100644 index 0000000..0558733 --- /dev/null +++ b/modules/my-pkgs/stk-installers.nix @@ -0,0 +1,44 @@ +{ + perSystem = + { pkgs, ... }: + { + packages.stk-installers = pkgs.callPackage ( + { stdenv, fetchurl, lib, writeText, ... }: + stdenv.mkDerivation rec { + pname = "stk-installers"; + version = "0.1.0"; + + srcs = let + releaseHashes = { + #"installer-aarch64.exe" = "sha256-orLoDvW+fUDucqY4KcC0DQ4JbA2LaG3RQtaBEjtG6HU="; + #"installer-i686.exe" = "sha256-knC7XF6OeY/dQ2VnyjYm+IlJxU8g6s/S395Nr4HZ6Jk="; + # "installer-x86_64.exe" = "sha256-oSYOu3PdnaE+w+N/Um8p5JSztmwAwF/XB2ezCkSX2V4="; + # "linux-arm64.tar.gz" = "sha256-lhtLaRtEVHzcrae6OdrRVhpufnZskLIsot8foYqi5Hc="; + #"linux-armv7.tar.gz" = "sha256-jQYR2wkIu1j7c5xEfzdIa9fnQFU1wNKAVq35NZB/BzA="; + # "linux-x86.tar.gz" = "sha256-sT57jnRV7Wa4qC8p1/fOTwXfelM66fRckdfQvqMqOOs="; + "linux-x86_64.tar.gz" = "sha256-VwkLbCFj62kfIBBK6XEiBKy7ToNBBZ3uCl/1MV78QBs="; + # "mac-signed.zip" = "sha256-wmas24pjo/4w9SZS2bdJ9b66Sr655UOC+7k0sAxTswM="; + # "src.tar.gz" = "sha256-M8+IQeT/QILYC5JIAUKVu76mHRRoPobf8QDjq497J8s="; + # "win.zip" = "sha256-nffi1n6FYhJ6O7YzAw8b1O53+p5/CuEQiXRzAlr4rNw="; + }; + in + lib.attrsets.mapAttrsToList (release: hash: fetchurl { + url = "https://github.com/supertuxkart/stk-code/releases/download/1.5/SuperTuxKart-1.5-${release}"; + sha256 = hash; + }) releaseHashes + ++ [(writeText "hashes.txt" (builtins.concatStringsSep "\n" (lib.attrsets.mapAttrsToList (release: hash: "SuperTuxKart-1.5-${release} ${hash}") releaseHashes)))]; + + sourceRoot = "."; + + unpackPhase = ":"; + + installPhase = '' +mkdir -p $out/srv/www +for srcFile in $srcs; do + cp $srcFile "$out/srv/www/$(stripHash $srcFile)" +done +''; + } + ) { }; + }; +} diff --git a/modules/nix.nix b/modules/nix.nix deleted file mode 100644 index 64fc4a3..0000000 --- a/modules/nix.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ inputs, config, lib, ... }: -{ - options.teh-nix.nix = with lib; { - enable = mkEnableOption "Use the TehNix nix settings"; - }; - - config = lib.mkIf config.teh-nix.nix.enable { - nix.nixPath = [ "/etc/nix/path" ]; - nix.registry.nixpkgs.flake = inputs.nixpkgs; - environment.etc."nix/path/nixpkgs".source = inputs.nixpkgs; - - nix = { - settings = { - experimental-features = [ "nix-command" "flakes" ]; - auto-optimise-store = true; - - trusted-users = [ "boss" ]; - - substituters = [ - "https://cache.nixos.org" - ]; - - # trusted-public-keys = [ - # "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - # ]; - }; - optimise.automatic = true; - }; - - # nh's cleaner replaces nix.gc (the nh module asserts they aren't both on) - programs.nh = { - enable = true; - clean = { - enable = true; - dates = "weekly"; - # --no-direnv keeps nix-direnv's gcroots so dev shells survive - extraArgs = "--keep-since 7d --keep 5 --no-direnv"; - }; - }; - }; -} diff --git a/modules/nvidia.nix b/modules/nvidia.nix deleted file mode 100644 index d315238..0000000 --- a/modules/nvidia.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ config, pkgs, lib, inputs, ... }: -let - nvidia-offload = pkgs.writeShellScriptBin "prime-run" '' -export __NV_PRIME_RENDER_OFFLOAD=1 -export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 -export __GLX_VENDOR_LIBRARY_NAME=nvidia -export __VK_LAYER_NV_optimus=NVIDIA_only -exec "$@" -''; -in -{ - options.teh-nix.nvidia = with lib; { - enable = mkEnableOption "Enable nvidia"; - }; - - config = lib.mkIf config.teh-nix.nvidia.enable { - nixpkgs.config.allowUnfree = true; - hardware.graphics.enable = true; - hardware.nvidia.modesetting.enable = true; - # hardware.nvidia.dynamicBoost.enable = true; - hardware.nvidia.open = true; - hardware.nvidia.prime = { - # sync.enable = true; - offload.enable = true; - # offload.offloadCmdMainProgram = "prime-run"; - - nvidiaBusId = "PCI:1:0:0"; - intelBusId = "PCI:5:0:0"; - }; - hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; - - services.xserver.videoDrivers = [ "nvidia" ]; - - environment.systemPackages = [ nvidia-offload ]; - }; -} diff --git a/modules/teh-nix/cgit.nix b/modules/teh-nix/cgit.nix new file mode 100644 index 0000000..ff3aee0 --- /dev/null +++ b/modules/teh-nix/cgit.nix @@ -0,0 +1,161 @@ +{ ... }: +{ + flake.modules.nixos.teh-nix = + { pkgs, lib, config, ... }: + let + cfg = config.teh-nix.services.cgit; + cgitrc = pkgs.writeText "cgitrc" '' +css=/static/cgit.css +logo=/static/cgit.png +favicon=/static/favicon.ico +repository-sort=age + +root-title=${cfg.title} +root-desc=${cfg.description} + +enable-blame=1 +enable-commit-graph=1 +enable-log-filecount=1 +enable-log-linecount=1 +enable-index-links=1 + +snapshots=tar.gz zip +enable-http-clone=1 +clone-prefix=https://${cfg.domain} + +readme=:README +readme=:readme +readme=:readme.txt +readme=:README.txt +readme=:readme.md +readme=:README.md + +${cfg.extraConfig} + +about-filter=${cfg.package}/lib/cgit/filters/about-formatting.sh +source-filter=${cfg.package}/lib/cgit/filters/syntax-highlighting.py + +enable-git-config=1 +scan-path=${cfg.directory} +''; + in + { + options.teh-nix.services.cgit = with lib;{ + enable = mkEnableOption "Enable cgit"; + user = mkOption { + type = types.str; + default = "cgit"; + description = "Username for the user that will run cgit"; + }; + authorizedKeys = lib.mkOption { + type = types.listOf types.str; + default = [ ]; + description = "List of ssh keys for the cgit user (cgit user should own all repos)"; + }; + authorizedUsers = lib.mkOption { + type = types.listOf types.str; + default = [ ]; + description = "List of users that should have access to the cgit directory"; + }; + directory = mkOption { + type = types.str; + default = "/srv/cgit/repos"; + description = "Directory for cgit (cgit user's home directory"; + }; + description = mkOption { + type = types.str; + default = "Cgit instance hosted with nixos"; + description = "Description of the cgit website"; + }; + title = mkOption { + type = types.str; + default = "Cgit + Nix"; + description = "Title of the cgit website"; + }; + domain = mkOption { + type = types.str; + default = "git.example.com"; + description = "Domain to host it on"; + }; + useACMEHost = mkOption { + type = types.str; + default = ""; + description = "SSL cert to use if already aquired using security.acme.certs"; + }; + enableACME = mkEnableOption "Enable ACME with nginx"; + onlySSL = mkOption { + type = types.bool; + default = false; + description = "Only allow ssl connections"; + }; + forceSSL = mkOption { + type = types.bool; + default = true; + description = "Force ssl connections"; + }; + package = mkPackageOption pkgs "cgit" { }; + extraConfig = mkOption { + type = types.str; + default = ""; + description = "Extra config to be appended to cgitrc"; + }; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [ pkgs.git cfg.package ]; + users = { + groups.${cfg.user} = { + members = cfg.authorizedUsers; + }; + users.${cfg.user} = { + createHome = true; + homeMode = "770"; + home = cfg.directory; + isSystemUser = true; + shell = "${pkgs.git}/bin/git-shell"; + openssh.authorizedKeys.keys = cfg.authorizedKeys; + group = cfg.user; + }; + }; + + + services.fcgiwrap.instances.cgit = { + socket = { + user = cfg.user; + group = "nginx"; + type = "unix"; + mode = "0660"; + }; + process = { + user = cfg.user; + group = cfg.user; + }; + }; + + services.nginx.enable = true; + services.nginx.virtualHosts.${cfg.domain} = { + locations."~* ^/static/(.+.(ico|css|png))$" = { + extraConfig = '' +alias ${cfg.package}/cgit/$1; +''; + }; + locations."/" = { + extraConfig = '' +include ${pkgs.nginx}/conf/fastcgi_params; +fastcgi_param CGIT_CONFIG ${cgitrc}; +fastcgi_param SCRIPT_FILENAME ${cfg.package}/cgit/cgit.cgi; +fastcgi_split_path_info ^(/?)(.+)$; +fastcgi_param PATH_INFO $fastcgi_path_info; +fastcgi_param QUERY_STRING $args; +fastcgi_param HTTP_HOST $server_name; +fastcgi_pass unix:${config.services.fcgiwrap.instances.cgit.socket.address}; + ''; + }; + enableACME = cfg.enableACME; + forceSSL = cfg.forceSSL; + } // lib.optionalAttrs (cfg.useACMEHost != "") { + useACMEHost = "${cfg.useACMEHost}"; + }; + }; + }; +} diff --git a/modules/teh-nix/nix.nix b/modules/teh-nix/nix.nix new file mode 100644 index 0000000..d0b6cb3 --- /dev/null +++ b/modules/teh-nix/nix.nix @@ -0,0 +1,45 @@ +{ inputs, ... }: +{ + flake.modules.nixos.teh-nix = + { config, lib, ... }: + { + options.teh-nix.nix = with lib; { + enable = mkEnableOption "Use the TehNix nix settings"; + }; + + config = lib.mkIf config.teh-nix.nix.enable { + nix.nixPath = [ "/etc/nix/path" ]; + nix.registry.nixpkgs.flake = inputs.nixpkgs; + environment.etc."nix/path/nixpkgs".source = inputs.nixpkgs; + + nix = { + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + + trusted-users = [ "boss" ]; + + substituters = [ + "https://cache.nixos.org" + ]; + + # trusted-public-keys = [ + # "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + # ]; + }; + optimise.automatic = true; + }; + + # nh's cleaner replaces nix.gc (the nh module asserts they aren't both on) + programs.nh = { + enable = true; + clean = { + enable = true; + dates = "weekly"; + # --no-direnv keeps nix-direnv's gcroots so dev shells survive + extraArgs = "--keep-since 7d --keep 5 --no-direnv"; + }; + }; + }; + }; +} diff --git a/modules/teh-nix/nvidia.nix b/modules/teh-nix/nvidia.nix new file mode 100644 index 0000000..f14d20c --- /dev/null +++ b/modules/teh-nix/nvidia.nix @@ -0,0 +1,40 @@ +{ ... }: +{ + flake.modules.nixos.teh-nix = + { config, pkgs, lib, ... }: + let + nvidia-offload = pkgs.writeShellScriptBin "prime-run" '' +export __NV_PRIME_RENDER_OFFLOAD=1 +export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 +export __GLX_VENDOR_LIBRARY_NAME=nvidia +export __VK_LAYER_NV_optimus=NVIDIA_only +exec "$@" +''; + in + { + options.teh-nix.nvidia = with lib; { + enable = mkEnableOption "Enable nvidia"; + }; + + config = lib.mkIf config.teh-nix.nvidia.enable { + nixpkgs.config.allowUnfree = true; + hardware.graphics.enable = true; + hardware.nvidia.modesetting.enable = true; + # hardware.nvidia.dynamicBoost.enable = true; + hardware.nvidia.open = true; + hardware.nvidia.prime = { + # sync.enable = true; + offload.enable = true; + # offload.offloadCmdMainProgram = "prime-run"; + + nvidiaBusId = "PCI:1:0:0"; + intelBusId = "PCI:5:0:0"; + }; + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; + + services.xserver.videoDrivers = [ "nvidia" ]; + + environment.systemPackages = [ nvidia-offload ]; + }; + }; +} diff --git a/modules/teh-nix/xorg.nix b/modules/teh-nix/xorg.nix new file mode 100644 index 0000000..17febd3 --- /dev/null +++ b/modules/teh-nix/xorg.nix @@ -0,0 +1,60 @@ +{ inputs, ... }: +{ + flake.modules.nixos.teh-nix = + { config, lib, pkgs, ... }: + { + imports = [ + # inputs.YATwm.nixosModules.YATwm + ]; + + options.teh-nix.xorg = with lib; { + enable = mkEnableOption "Enable xorg"; + nvidia = mkOption { + type = types.bool; + default = true; + description = "Enable nvidia with xorg"; + }; + }; + + config = lib.mkIf config.teh-nix.xorg.enable { + + teh-nix.nvidia.enable = lib.mkIf config.teh-nix.xorg.nvidia (lib.mkDefault true); + + services.xserver = { + enable = true; + + desktopManager = { + xterm.enable = false; + #default = "none"; + }; + + deviceSection = '' + Option "DRI" "2" + Option "TearFree" "true" + ''; + + windowManager.i3 = { + enable = true; + package = pkgs.i3; + }; + + # windowManager.YATwm = { + # enable = true; + # package = inputs.YATwm.packages.x86_64-linux.YATwm; + # }; + }; + programs.i3lock.enable = true; + + services.displayManager = { + #defaultSession = "none+i3"; + sddm.enable = true; + #sddm.theme = "catppuccin-macchiato"; + # ly.enable = true; + }; + + + services.xserver.xkb.layout = "us"; + services.xserver.xkb.options = "caps:super"; + }; + }; +} diff --git a/modules/website/default.nix b/modules/website/default.nix new file mode 100644 index 0000000..8fc2477 --- /dev/null +++ b/modules/website/default.nix @@ -0,0 +1,20 @@ +{ + perSystem = + { pkgs, ... }: + { + packages.teh-website = pkgs.callPackage ( + { stdenv, ... }: + stdenv.mkDerivation { + pname = "TehWebsite"; + version = "0.0.1"; + + src = ./src; + + installPhase = '' +mkdir -p $out/srv/www +cp -r ./* $out/srv/www +''; + } + ) { }; + }; +} diff --git a/modules/website/src/index.html b/modules/website/src/index.html new file mode 100644 index 0000000..a28d898 --- /dev/null +++ b/modules/website/src/index.html @@ -0,0 +1,4 @@ +<!DOCTYPE html> +<h1>Test</h1> +<a href = "./other-page.html">Other page</a> +<p>This websit was built and uploaded and hosted on my server using nix!!!</p> diff --git a/modules/website/src/other-page.html b/modules/website/src/other-page.html new file mode 100644 index 0000000..cbd5c8b --- /dev/null +++ b/modules/website/src/other-page.html @@ -0,0 +1,4 @@ +<!DOCTYPE html> +<h1>Other page</h1> +<a href = "./index.html">Home</a> +<p>Multipage test</p> diff --git a/modules/xorg.nix b/modules/xorg.nix deleted file mode 100644 index 6fb8e64..0000000 --- a/modules/xorg.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ config, lib, pkgs, inputs, ... }: -{ - imports = [ - ./nvidia.nix - # inputs.YATwm.nixosModules.YATwm - ]; - - options.teh-nix.xorg = with lib; { - enable = mkEnableOption "Enable xorg"; - nvidia = mkOption { - type = types.bool; - default = true; - description = "Enable nvidia with xorg"; - }; - }; - - config = lib.mkIf config.teh-nix.xorg.enable { - - teh-nix.nvidia.enable = lib.mkIf config.teh-nix.xorg.nvidia (lib.mkDefault true); - - services.xserver = { - enable = true; - - desktopManager = { - xterm.enable = false; - #default = "none"; - }; - - deviceSection = '' - Option "DRI" "2" - Option "TearFree" "true" - ''; - - windowManager.i3 = { - enable = true; - package = pkgs.i3; - }; - - # windowManager.YATwm = { - # enable = true; - # package = inputs.YATwm.packages.x86_64-linux.YATwm; - # }; - }; - programs.i3lock.enable = true; - - services.displayManager = { - #defaultSession = "none+i3"; - sddm.enable = true; - #sddm.theme = "catppuccin-macchiato"; - # ly.enable = true; - }; - - - services.xserver.xkb.layout = "us"; - services.xserver.xkb.options = "caps:super"; - }; -} |
