diff --git a/bud/default.nix b/bud/default.nix index 018f1b0..fc4eded 100644 --- a/bud/default.nix +++ b/bud/default.nix @@ -3,15 +3,13 @@ lib, budUtils, ... -}: -{ - bud.cmds = - with pkgs; { - get = { - writer = budUtils.writeBashWithPaths [nixUnstable git coreutils]; - synopsis = "get [DEST]"; - help = "Copy the desired template to DEST"; - script = ./get.bash; - }; +}: { + bud.cmds = with pkgs; { + get = { + writer = budUtils.writeBashWithPaths [nixUnstable git coreutils]; + synopsis = "get [DEST]"; + help = "Copy the desired template to DEST"; + script = ./get.bash; }; + }; } diff --git a/default.nix b/default.nix index 02ef261..395edca 100644 --- a/default.nix +++ b/default.nix @@ -3,15 +3,14 @@ let default = (import ./lib/compat).defaultNix; ciSystems = ["aarch64-linux" "i686-linux" "x86_64-linux"]; filterSystems = lib.filterAttrs (system: _: lib.elem system ciSystems); - recurseIntoAttrsRecursive = - lib.mapAttrs (_: v: - if lib.isAttrs v - then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v) - else v); + recurseIntoAttrsRecursive = lib.mapAttrs (_: v: + if lib.isAttrs v + then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v) + else v); systemOutputs = lib.filterAttrs (name: set: lib.isAttrs set && lib.any (system: set ? ${system} && name != "legacyPackages") ciSystems) default.outputs; ciDrvs = lib.mapAttrs (_: system: filterSystems system) systemOutputs; in - (recurseIntoAttrsRecursive ciDrvs) // { shell = import ./shell.nix; } + (recurseIntoAttrsRecursive ciDrvs) // {shell = import ./shell.nix;} diff --git a/flake.lock b/flake.lock index 149b7bc..8f6439e 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ ] }, "locked": { - "lastModified": 1645729578, - "narHash": "sha256-SQEbg+hHG2Q1zU/Oqjj5LK2X/lmjJoBprm4eYORk0UU=", + "lastModified": 1646360966, + "narHash": "sha256-fJ/WHSU45bMJRDqz9yA3B2lwXtW5DKooU+Pzn13GyZI=", "owner": "kamadorueda", "repo": "alejandra", - "rev": "08627c847e250b3eb654c6febeffaa0626fa8473", + "rev": "511c3f6a88b6964e1496fb6f441f4ae5e58bd3ea", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f0e8192..1673de4 100644 --- a/flake.nix +++ b/flake.nix @@ -34,106 +34,102 @@ inputs.nixpkgs.follows = "nixos"; }; }; - outputs = + outputs = { + self, + digga, + nixos, + home, + nixos-hardware, + nixosPersistence, + nixpkgsWayland, + rnixLsp, + alejandra, + ... + } @ inputs: + digga.lib.mkFlake { - self, - digga, - nixos, - home, - nixos-hardware, - nixosPersistence, - nixpkgsWayland, - rnixLsp, - alejandra, - ... - } - @ inputs: - digga.lib.mkFlake - { - inherit self inputs; - channelsConfig = { allowUnfree = true; }; - channels = { - nixos = { - imports = [(digga.lib.importOverlays ./overlays)]; - overlays = [ - nixpkgsWayland.overlay - ( - _: prev: { - #helix = helix.packages.${prev.system}.helix; - #helix-src = prev.helix.src; - #rnix-lsp = rnixLsp.packages.${prev.system}.rnix-lsp; - } - ) - ( - _: prev: { - alejandra = alejandra.defaultPackage.${prev.system}; - remarshal = - prev.remarshal.overrideAttrs - ( - old: { - postPatch = - '' - substituteInPlace pyproject.toml \ - --replace "poetry.masonry.api" "poetry.core.masonry.api" \ - --replace 'PyYAML = "^5.3"' 'PyYAML = "*"' \ - --replace 'tomlkit = "^0.7"' 'tomlkit = "*"' - ''; - } - ); - } - ) - ./pkgs/default.nix - ]; - }; - }; - lib = import ./lib { lib = digga.lib // nixos.lib; }; - sharedOverlays = [ - ( - _: prev: { - __dontExport = true; - lib = prev.lib.extend (_: _: { our = self.lib; }); - } - ) - ]; + inherit self inputs; + channelsConfig = {allowUnfree = true;}; + channels = { nixos = { - hostDefaults = { - system = "x86_64-linux"; - channelName = "nixos"; - imports = [(digga.lib.importExportableModules ./modules)]; - modules = [ - { lib.our = self.lib; } - digga.nixosModules.bootstrapIso - digga.nixosModules.nixConfig - home.nixosModules.home-manager - nixosPersistence.nixosModules.impermanence - ]; - }; - imports = [(digga.lib.importHosts ./hosts)]; - hosts = {}; - importables = rec { - profiles = - (digga.lib.rakeLeaves ./profiles) - // { - users = digga.lib.rakeLeaves ./users; - nixos-hardware = nixos-hardware.nixosModules; - }; - suites = - with profiles; { - base = [cachix core users.root]; - work = [users.patriot develop]; - }; - }; + imports = [(digga.lib.importOverlays ./overlays)]; + overlays = [ + nixpkgsWayland.overlay + ( + _: prev: { + #helix = helix.packages.${prev.system}.helix; + #helix-src = prev.helix.src; + #rnix-lsp = rnixLsp.packages.${prev.system}.rnix-lsp; + } + ) + ( + _: prev: { + alejandra = alejandra.defaultPackage.${prev.system}; + remarshal = + prev.remarshal.overrideAttrs + ( + old: { + postPatch = '' + substituteInPlace pyproject.toml \ + --replace "poetry.masonry.api" "poetry.core.masonry.api" \ + --replace 'PyYAML = "^5.3"' 'PyYAML = "*"' \ + --replace 'tomlkit = "^0.7"' 'tomlkit = "*"' + ''; + } + ); + } + ) + ./pkgs/default.nix + ]; }; - home = { - imports = [(digga.lib.importExportableModules ./users/modules)]; - modules = []; - importables = rec { - profiles = digga.lib.rakeLeaves ./users/profiles; - suites = with profiles; rec { base = [direnv git starship]; }; - }; - }; - devshell = ./shell; - homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; - deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations {}; }; + lib = import ./lib {lib = digga.lib // nixos.lib;}; + sharedOverlays = [ + ( + _: prev: { + __dontExport = true; + lib = prev.lib.extend (_: _: {our = self.lib;}); + } + ) + ]; + nixos = { + hostDefaults = { + system = "x86_64-linux"; + channelName = "nixos"; + imports = [(digga.lib.importExportableModules ./modules)]; + modules = [ + {lib.our = self.lib;} + digga.nixosModules.bootstrapIso + digga.nixosModules.nixConfig + home.nixosModules.home-manager + nixosPersistence.nixosModules.impermanence + ]; + }; + imports = [(digga.lib.importHosts ./hosts)]; + hosts = {}; + importables = rec { + profiles = + (digga.lib.rakeLeaves ./profiles) + // { + users = digga.lib.rakeLeaves ./users; + nixos-hardware = nixos-hardware.nixosModules; + }; + suites = with profiles; { + base = [cachix core users.root]; + work = [users.patriot develop]; + }; + }; + }; + home = { + imports = [(digga.lib.importExportableModules ./users/modules)]; + modules = []; + importables = rec { + profiles = digga.lib.rakeLeaves ./users/profiles; + suites = with profiles; rec {base = [direnv git starship];}; + }; + }; + devshell = ./shell; + homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; + deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations {}; + }; } diff --git a/hosts/NixOS.nix b/hosts/NixOS.nix index c1d573b..3c611ff 100644 --- a/hosts/NixOS.nix +++ b/hosts/NixOS.nix @@ -1,12 +1,8 @@ -{ - suites, - ... -}: -{ +{suites, ...}: { ### root password is empty by default ### imports = suites.base; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; networking.networkmanager.enable = true; - fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; + fileSystems."/" = {device = "/dev/disk/by-label/nixos";}; } diff --git a/hosts/bootstrap.nix b/hosts/bootstrap.nix index 5b301cc..17d2f20 100644 --- a/hosts/bootstrap.nix +++ b/hosts/bootstrap.nix @@ -1,8 +1,4 @@ -{ - profiles, - ... -}: -{ +{profiles, ...}: { # build with: `bud build bootstrap bootstrapIso` # reachable on the local link via ssh root@fe80::47%eno1 # where 'eno1' is replaced by your own machine's network @@ -16,5 +12,5 @@ ]; boot.loader.systemd-boot.enable = true; # will be overridden by the bootstrapIso instrumentation - fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; + fileSystems."/" = {device = "/dev/disk/by-label/nixos";}; } diff --git a/hosts/lungmen.nix b/hosts/lungmen.nix index 8e96e1e..0c23558 100644 --- a/hosts/lungmen.nix +++ b/hosts/lungmen.nix @@ -6,8 +6,7 @@ suites, profiles, ... -}: -let +}: let btrfsPartPath = "/dev/disk/by-label/NIXOS"; btrfsOptions = ["compress-force=zstd" "noatime"]; btrfsDiff = @@ -76,7 +75,7 @@ in { btrfs subvolume snapshot /mnt/root-blank /mnt/root umount /mnt ''; - kernel.sysctl = { "fs.inotify.max_user_watches" = 524288; }; + kernel.sysctl = {"fs.inotify.max_user_watches" = 524288;}; }; security.pam.loginLimits = [ { @@ -132,10 +131,9 @@ in { mitigations.disable = true; allowSimultaneousMultithreading = false; # Deleting root subvolume makes sudo show lecture every boot - sudo.extraConfig = - '' - Defaults lecture = never - ''; + sudo.extraConfig = '' + Defaults lecture = never + ''; rtkit.enable = true; }; sound.enable = false; @@ -152,8 +150,7 @@ in { driSupport32Bit = true; enable = true; extraPackages = with pkgs; [amdvlk libvdpau-va-gl vaapiVdpau libva vulkan-loader pipewire]; - extraPackages32 = - with pkgs.pkgsi686Linux; + extraPackages32 = with pkgs.pkgsi686Linux; [libvdpau-va-gl vaapiVdpau libva vulkan-loader pipewire] ++ [pkgs.driversi686Linux.amdvlk]; }; pulseaudio = { @@ -186,13 +183,19 @@ in { }; networking.interfaces.enp6s0.useDHCP = true; services = { + code-server = { + enable = false; + auth = "none"; + user = "patriot"; + group = "users"; + }; ipfs = { enable = false; enableGC = true; autoMount = true; }; flatpak.enable = false; - xserver = { videoDrivers = ["amdgpu"]; }; + xserver = {videoDrivers = ["amdgpu"];}; postgresql = { enable = false; enableTCPIP = true; @@ -203,7 +206,7 @@ in { local all all trust host all all 0.0.0.0/0 md5 ''; - settings = { listen_addresses = "*"; }; + settings = {listen_addresses = "*";}; initialScript = pkgs.writeText "backend-initScript" @@ -215,7 +218,7 @@ in { }; }; virtualisation = { - podman.enable = false; + podman.enable = true; libvirtd.enable = false; }; system.stateVersion = "20.09"; diff --git a/lib/compat/default.nix b/lib/compat/default.nix index 7bad31d..f082eae 100644 --- a/lib/compat/default.nix +++ b/lib/compat/default.nix @@ -9,7 +9,7 @@ let sha256 = "0zd3x46fswh5n6faq4x2kkpy6p3c6j593xbdlbsl40ppkclwc80x"; } ) - { src = ../../.; } + {src = ../../.;} ); in flake diff --git a/lib/compat/nixos/default.nix b/lib/compat/nixos/default.nix index b5d7786..f5aeeef 100644 --- a/lib/compat/nixos/default.nix +++ b/lib/compat/nixos/default.nix @@ -1,5 +1,4 @@ -{ ... }: -let +{...}: let inherit (default.inputs.nixos) lib; host = configs.${hostname} or configs.NixOS; configs = default.nixosConfigurations; diff --git a/lib/default.nix b/lib/default.nix index da6c5a1..cff2c83 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,8 +1,8 @@ -{ lib }: +{lib}: lib.makeExtensible ( self: { pkgBinNoDep = pkgs: name: "${pkgs.${name}}/bin/${name}"; - html = import ./html.nix { format = true; }; + html = import ./html.nix {format = true;}; } ) diff --git a/lib/html.nix b/lib/html.nix index b59b9e2..93284c8 100644 --- a/lib/html.nix +++ b/lib/html.nix @@ -1,5 +1,4 @@ -{ format ? false }: -let +{format ? false}: let inherit (builtins) isAttrs isList map; fmt = if format @@ -10,24 +9,23 @@ let evalAttrs = attrs: concatStrings (mapAttrsToList (name: value: " ${name}=\"${value}\"") attrs); genAttrs = f: names: builtins.listToAttrs (map - (n: { - name = n; - value = (f n); - }) - names); + (n: { + name = n; + value = f n; + }) + names); evalChildren = children: if isList children then concatStrings children else children; - tag = - name: maybeAttrs: - if isAttrs maybeAttrs - then (children: "<${name}${evalAttrs maybeAttrs}>${fmt}${evalChildren children}${fmt}") - else tag name {} maybeAttrs; - tags = (genAttrs tag ["html" "head" "body" "div" "p" "a"]); + tag = name: maybeAttrs: + if isAttrs maybeAttrs + then (children: "<${name}${evalAttrs maybeAttrs}>${fmt}${evalChildren children}${fmt}") + else tag name {} maybeAttrs; + tags = genAttrs tag ["html" "head" "body" "div" "p" "a"]; in tags // { inherit tag; - link = url: tags.a { href = url; }; + link = url: tags.a {href = url;}; } diff --git a/locale/default.nix b/locale/default.nix index 0e9acb7..ba9dea8 100644 --- a/locale/default.nix +++ b/locale/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { console.keyMap = "trq"; i18n = { defaultLocale = "en_US.UTF-8"; diff --git a/modules/hm-system-defaults.nix b/modules/hm-system-defaults.nix index 36b8d60..4884728 100644 --- a/modules/hm-system-defaults.nix +++ b/modules/hm-system-defaults.nix @@ -1,11 +1,7 @@ -{ - config, - ... -}: -{ +{config, ...}: { home-manager.sharedModules = [ { - home.sessionVariables = { inherit (config.environment.sessionVariables) NIX_PATH; }; + home.sessionVariables = {inherit (config.environment.sessionVariables) NIX_PATH;}; xdg.configFile."nix/registry.json".text = config.environment.etc."nix/registry.json".text; } ]; diff --git a/modules/nix-path.nix b/modules/nix-path.nix index 411bfba..8668a5d 100644 --- a/modules/nix-path.nix +++ b/modules/nix-path.nix @@ -2,7 +2,6 @@ channel, inputs, ... -}: -{ +}: { nix.nixPath = ["nixpkgs=${channel.input}" "nixos-config=${../lib/compat/nixos}" "home-manager=${inputs.home}"]; } diff --git a/modules/security/mitigations.nix b/modules/security/mitigations.nix index 071ce98..8df9050 100644 --- a/modules/security/mitigations.nix +++ b/modules/security/mitigations.nix @@ -6,9 +6,8 @@ with lib; let inherit (builtins) readFile fetchurl; cfg = config.security.mitigations; - cmdline = - '' - ibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off''; + cmdline = '' + ibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off''; in { options = { security.mitigations.disable = @@ -16,13 +15,12 @@ in { { type = types.bool; default = false; - description = - '' - Whether to disable spectre and meltdown mitigations in the kernel. Do - not use this in mission critical deployments, or on any machine you do - not have physical access to. - ''; + description = '' + Whether to disable spectre and meltdown mitigations in the kernel. Do + not use this in mission critical deployments, or on any machine you do + not have physical access to. + ''; }; }; - config = mkIf cfg.disable { boot.kernelParams = splitString " " cmdline; }; + config = mkIf cfg.disable {boot.kernelParams = splitString " " cmdline;}; } diff --git a/overlays/chromium-wayland.nix b/overlays/chromium-wayland.nix index 11c0249..43dcfcb 100644 --- a/overlays/chromium-wayland.nix +++ b/overlays/chromium-wayland.nix @@ -1,19 +1,18 @@ _: prev: let - cliArgs = - let - flags = [ - "--flag-switches-begin" - "--enable-features=WebUIDarkMode,UseOzonePlatform,WebRTCPipeWireCapturer,IgnoreGPUBlocklist,Vulkan" - "--flag-switches-end" - "--ozone-platform=wayland" - "--enable-webrtc-pipewire-capturer" - "--ignore-gpu-blocklist" - "--enable-gpu-rasterization" - "--enable-zero-copy" - "--disable-gpu-driver-bug-workarounds" - "--force-dark-mode" - "--process-per-site" - ]; - in - prev.lib.concatStringsSep " " flags; -in { chromium = prev.chromium.override { commandLineArgs = cliArgs; }; } + cliArgs = let + flags = [ + "--flag-switches-begin" + "--enable-features=WebUIDarkMode,UseOzonePlatform,WebRTCPipeWireCapturer,IgnoreGPUBlocklist,Vulkan" + "--flag-switches-end" + "--ozone-platform=wayland" + "--enable-webrtc-pipewire-capturer" + "--ignore-gpu-blocklist" + "--enable-gpu-rasterization" + "--enable-zero-copy" + "--disable-gpu-driver-bug-workarounds" + "--force-dark-mode" + "--process-per-site" + ]; + in + prev.lib.concatStringsSep " " flags; +in {chromium = prev.chromium.override {commandLineArgs = cliArgs;};} diff --git a/overlays/discord-canary-system.nix b/overlays/discord-canary-system.nix index 13677f4..190c8fc 100644 --- a/overlays/discord-canary-system.nix +++ b/overlays/discord-canary-system.nix @@ -2,211 +2,206 @@ final: prev: rec { discord-canary-system = prev.callPackage mkDiscord - ( - rec { - pname = "discord-canary"; - version = "0.0.131"; - binaryName = "DiscordCanary"; - desktopName = "Discord Canary"; - src = - prev.fetchurl - { - url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz"; - sha256 = "sha256-ZYPdE02Jq79LmvXu7KIJFugJX++Nnj0Og/mBuaP/+SA="; - }; - isWayland = true; - enableVulkan = false; - extraOptions = [ - "--ignore-gpu-blocklist" - "--enable-gpu-rasterization" - "--enable-zero-copy" - "--disable-gpu-driver-bug-workarounds" - ]; - } - ); - mkDiscord = - { - pname, - version, - src, - binaryName, - desktopName, - isWayland ? false, - enableVulkan ? false, - extraOptions ? [], - autoPatchelfHook, - makeDesktopItem, - lib, - stdenv, - wrapGAppsHook, - alsaLib, - at-spi2-atk, - at-spi2-core, - atk, - cairo, - cups, - dbus, - electron, - expat, - fontconfig, - freetype, - gdk-pixbuf, - glib, - gtk3, - libcxx, - libdrm, - libnotify, - libpulseaudio, - libuuid, - libX11, - libXScrnSaver, - libXcomposite, - libXcursor, - libXdamage, - libXext, - libXfixes, - libXi, - libXrandr, - libXrender, - libXtst, - libxcb, - mesa, - nspr, - nss, - pango, - systemd, - libappindicator-gtk3, - libdbusmenu, - nodePackages, - vulkan-loader, - vulkan-extension-layer, - libGL, - pipewire, - }: - stdenv.mkDerivation - rec { - inherit pname version src; - nativeBuildInputs = [ - nodePackages.asar + rec { + pname = "discord-canary"; + version = "0.0.131"; + binaryName = "DiscordCanary"; + desktopName = "Discord Canary"; + src = + prev.fetchurl + { + url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz"; + sha256 = "sha256-ZYPdE02Jq79LmvXu7KIJFugJX++Nnj0Og/mBuaP/+SA="; + }; + isWayland = true; + enableVulkan = false; + extraOptions = [ + "--ignore-gpu-blocklist" + "--enable-gpu-rasterization" + "--enable-zero-copy" + "--disable-gpu-driver-bug-workarounds" + ]; + }; + mkDiscord = { + pname, + version, + src, + binaryName, + desktopName, + isWayland ? false, + enableVulkan ? false, + extraOptions ? [], + autoPatchelfHook, + makeDesktopItem, + lib, + stdenv, + wrapGAppsHook, + alsaLib, + at-spi2-atk, + at-spi2-core, + atk, + cairo, + cups, + dbus, + electron, + expat, + fontconfig, + freetype, + gdk-pixbuf, + glib, + gtk3, + libcxx, + libdrm, + libnotify, + libpulseaudio, + libuuid, + libX11, + libXScrnSaver, + libXcomposite, + libXcursor, + libXdamage, + libXext, + libXfixes, + libXi, + libXrandr, + libXrender, + libXtst, + libxcb, + mesa, + nspr, + nss, + pango, + systemd, + libappindicator-gtk3, + libdbusmenu, + nodePackages, + vulkan-loader, + vulkan-extension-layer, + libGL, + pipewire, + }: + stdenv.mkDerivation + rec { + inherit pname version src; + nativeBuildInputs = [ + nodePackages.asar + alsaLib + autoPatchelfHook + cups + libdrm + libuuid + libXdamage + libX11 + libXScrnSaver + libXtst + libxcb + mesa.drivers + nss + wrapGAppsHook + ]; + dontWrapGApps = true; + libPath = + lib.makeLibraryPath + [ + libcxx + systemd + libpulseaudio + stdenv.cc.cc alsaLib - autoPatchelfHook + atk + at-spi2-atk + at-spi2-core + cairo cups - libdrm - libuuid - libXdamage + dbus + expat + fontconfig + freetype + gdk-pixbuf + glib + gtk3 + libnotify libX11 - libXScrnSaver + libXcomposite + libuuid + libXcursor + libXdamage + libXext + libXfixes + libXi + libXrandr + libXrender libXtst - libxcb - mesa.drivers + nspr nss - wrapGAppsHook + libxcb + pango + systemd + libXScrnSaver + libappindicator-gtk3 + libdbusmenu + vulkan-loader + vulkan-extension-layer + libGL + pipewire ]; - dontWrapGApps = true; - libPath = - lib.makeLibraryPath + flags = + ( + lib.optionals + isWayland [ - libcxx - systemd - libpulseaudio - stdenv.cc.cc - alsaLib - atk - at-spi2-atk - at-spi2-core - cairo - cups - dbus - expat - fontconfig - freetype - gdk-pixbuf - glib - gtk3 - libnotify - libX11 - libXcomposite - libuuid - libXcursor - libXdamage - libXext - libXfixes - libXi - libXrandr - libXrender - libXtst - nspr - nss - libxcb - pango - systemd - libXScrnSaver - libappindicator-gtk3 - libdbusmenu - vulkan-loader - vulkan-extension-layer - libGL - pipewire - ]; - flags = - ( - lib.optionals - isWayland - [ - "--flag-switches-begin" - "--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer${ - lib.optionalString enableVulkan ",Vulkan" - }" - "--flag-switches-end" - "--ozone-platform=wayland" - "--enable-webrtc-pipewire-capturer" - ] - ) - ++ extraOptions; - installPhase = - '' - mkdir -p $out/{bin,usr/lib/${pname},share/pixmaps} - ln -s discord.png $out/share/pixmaps/${pname}.png - ln -s "${desktopItem}/share/applications" $out/share/ + "--flag-switches-begin" + "--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer${ + lib.optionalString enableVulkan ",Vulkan" + }" + "--flag-switches-end" + "--ozone-platform=wayland" + "--enable-webrtc-pipewire-capturer" + ] + ) + ++ extraOptions; + installPhase = '' + mkdir -p $out/{bin,usr/lib/${pname},share/pixmaps} + ln -s discord.png $out/share/pixmaps/${pname}.png + ln -s "${desktopItem}/share/applications" $out/share/ - # HACKS FOR SYSTEM ELECTRON - asar e resources/app.asar resources/app - rm resources/app.asar - sed -i "s|process.resourcesPath|'$out/usr/lib/${pname}'|" resources/app/app_bootstrap/buildInfo.js - sed -i "s|exeDir,|'$out/share/pixmaps',|" resources/app/app_bootstrap/autoStart/linux.js - asar p resources/app resources/app.asar --unpack-dir '**' - rm -rf resources/app + # HACKS FOR SYSTEM ELECTRON + asar e resources/app.asar resources/app + rm resources/app.asar + sed -i "s|process.resourcesPath|'$out/usr/lib/${pname}'|" resources/app/app_bootstrap/buildInfo.js + sed -i "s|exeDir,|'$out/share/pixmaps',|" resources/app/app_bootstrap/autoStart/linux.js + asar p resources/app resources/app.asar --unpack-dir '**' + rm -rf resources/app - # Copy Relevanat data - cp -r resources/* $out/usr/lib/${pname}/ + # Copy Relevanat data + cp -r resources/* $out/usr/lib/${pname}/ - # Create starter script for discord - echo "#!${stdenv.shell}" > $out/bin/${pname} - echo "exec ${electron}/bin/electron ${lib.concatStringsSep " " flags} $out/usr/lib/${pname}/app.asar \$@" >> $out/bin/${pname} - chmod 755 $out/bin/${pname} + # Create starter script for discord + echo "#!${stdenv.shell}" > $out/bin/${pname} + echo "exec ${electron}/bin/electron ${lib.concatStringsSep " " flags} $out/usr/lib/${pname}/app.asar \$@" >> $out/bin/${pname} + chmod 755 $out/bin/${pname} - wrapProgram $out/bin/${pname} \ - "''${gappsWrapperArgs[@]}" \ - --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \ - --prefix LD_LIBRARY_PATH : ${libPath} - ''; - desktopItem = - makeDesktopItem - { - name = pname; - exec = pname; - icon = pname; - inherit desktopName; - genericName = meta.description; - categories = "Network;InstantMessaging;"; - mimeType = "x-scheme-handler/discord"; - }; - meta = - with lib; { - description = "All-in-one cross-platform voice and text chat for gamers"; - homepage = "https://discordapp.com/"; - downloadPage = "https://discordapp.com/download"; - platforms = ["x86_64-linux"]; - }; + wrapProgram $out/bin/${pname} \ + "''${gappsWrapperArgs[@]}" \ + --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \ + --prefix LD_LIBRARY_PATH : ${libPath} + ''; + desktopItem = + makeDesktopItem + { + name = pname; + exec = pname; + icon = pname; + inherit desktopName; + genericName = meta.description; + categories = "Network;InstantMessaging;"; + mimeType = "x-scheme-handler/discord"; + }; + meta = with lib; { + description = "All-in-one cross-platform voice and text chat for gamers"; + homepage = "https://discordapp.com/"; + downloadPage = "https://discordapp.com/download"; + platforms = ["x86_64-linux"]; }; + }; } diff --git a/overlays/discord-canary.nix b/overlays/discord-canary.nix index 6780bfb..287d739 100644 --- a/overlays/discord-canary.nix +++ b/overlays/discord-canary.nix @@ -12,21 +12,20 @@ final: prev: { url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz"; sha256 = "0bijwfsd9s4awqkgxd9c2cxh7y5r06vix98qjp0dkv63r6jig8ch"; }; - installPhase = - '' - mkdir -p $out/{bin,opt/${binaryName},share/pixmaps} - mv * $out/opt/${binaryName} - chmod +x $out/opt/${binaryName}/${binaryName} - patchelf --set-interpreter ${prev.stdenv.cc.bintools.dynamicLinker} \ - $out/opt/${binaryName}/${binaryName} - wrapProgram $out/opt/${binaryName}/${binaryName} \ - "''${gappsWrapperArgs[@]}" \ - --prefix XDG_DATA_DIRS : "${prev.gtk3}/share/gsettings-schemas/${prev.gtk3.name}/" \ - --prefix LD_LIBRARY_PATH : "${old.libPath}:${prev.electron_9}/lib/electron:${prev.libdrm}/lib:${prev.libGL_driver.out}/lib" - ln -s $out/opt/${binaryName}/${binaryName} $out/bin/ - ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${old.pname}.png - ln -s "${old.desktopItem}/share/applications" $out/share/ - ''; + installPhase = '' + mkdir -p $out/{bin,opt/${binaryName},share/pixmaps} + mv * $out/opt/${binaryName} + chmod +x $out/opt/${binaryName}/${binaryName} + patchelf --set-interpreter ${prev.stdenv.cc.bintools.dynamicLinker} \ + $out/opt/${binaryName}/${binaryName} + wrapProgram $out/opt/${binaryName}/${binaryName} \ + "''${gappsWrapperArgs[@]}" \ + --prefix XDG_DATA_DIRS : "${prev.gtk3}/share/gsettings-schemas/${prev.gtk3.name}/" \ + --prefix LD_LIBRARY_PATH : "${old.libPath}:${prev.electron_9}/lib/electron:${prev.libdrm}/lib:${prev.libGL_driver.out}/lib" + ln -s $out/opt/${binaryName}/${binaryName} $out/bin/ + ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${old.pname}.png + ln -s "${old.desktopItem}/share/applications" $out/share/ + ''; } ); } diff --git a/overlays/manix.nix b/overlays/manix.nix index 7afc698..19578a0 100644 --- a/overlays/manix.nix +++ b/overlays/manix.nix @@ -1 +1 @@ -final: prev: { manix = prev.manix.overrideAttrs (o: rec { inherit (prev.sources.manix) pname version src; }); } +final: prev: {manix = prev.manix.overrideAttrs (o: rec {inherit (prev.sources.manix) pname version src;});} diff --git a/overlays/phantom.nix b/overlays/phantom.nix index 2afa4f4..921069a 100644 --- a/overlays/phantom.nix +++ b/overlays/phantom.nix @@ -12,15 +12,13 @@ final: prev: { }; dontWrapQtApps = true; buildInputs = [prev.libsForQt5.qt5.qtbase]; - buildPhase = - '' - cd src/styleplugin - qmake && make - ''; - installPhase = - '' - mkdir -p $out/$qtPluginPrefix/styles - mv libphantomstyleplugin.so $out/$qtPluginPrefix/styles - ''; + buildPhase = '' + cd src/styleplugin + qmake && make + ''; + installPhase = '' + mkdir -p $out/$qtPluginPrefix/styles + mv libphantomstyleplugin.so $out/$qtPluginPrefix/styles + ''; }; } diff --git a/overlays/various-flake-fixes.nix b/overlays/various-flake-fixes.nix index d35f381..e56499e 100644 --- a/overlays/various-flake-fixes.nix +++ b/overlays/various-flake-fixes.nix @@ -2,6 +2,6 @@ final: prev: { # Since: https://github.com/NixOS/nixpkgs/pull/126137 nix-direnv = if builtins.hasAttr "enableFlakes" prev.nix-direnv.override.__functionArgs - then prev.nix-direnv.override { enableFlakes = true; } + then prev.nix-direnv.override {enableFlakes = true;} else prev.nix-direnv; } diff --git a/overlays/vscode-wayland.nix b/overlays/vscode-wayland.nix index bbc8657..6557aaa 100644 --- a/overlays/vscode-wayland.nix +++ b/overlays/vscode-wayland.nix @@ -1,52 +1,49 @@ _: prev: let pkgs = prev; lib = pkgs.lib; - vscodeWayland = - let - flags = [ - "--flag-switches-begin" - "--enable-features=UseOzonePlatform,IgnoreGPUBlocklist" - "--flag-switches-end" - "--ozone-platform=wayland" - "--ignore-gpu-blocklist" - "--enable-gpu-rasterization" - "--enable-zero-copy" - "--disable-gpu-driver-bug-workarounds" - ]; - in - pkgs.writeScriptBin - "vscode-wayland" - '' - #!${pkgs.stdenv.shell} - ${pkgs.vscodium}/bin/codium ${lib.concatStringsSep " " flags} - ''; + vscodeWayland = let + flags = [ + "--flag-switches-begin" + "--enable-features=UseOzonePlatform,IgnoreGPUBlocklist" + "--flag-switches-end" + "--ozone-platform=wayland" + "--ignore-gpu-blocklist" + "--enable-gpu-rasterization" + "--enable-zero-copy" + "--disable-gpu-driver-bug-workarounds" + ]; + in + pkgs.writeScriptBin + "vscode-wayland" + '' + #!${pkgs.stdenv.shell} + ${pkgs.vscodium}/bin/codium ${lib.concatStringsSep " " flags} + ''; in { - vscodeWayland = - let - pname = "vscode"; - desktop = - pkgs.makeDesktopItem - { - name = pname; - exec = pname; - icon = "vscode"; - desktopName = "VSCode Wayland"; - }; - in - lib.hiPrio - ( - pkgs.stdenv.mkDerivation - { - inherit pname; - version = pkgs.vscode.version; - nativeBuildInputs = [pkgs.makeWrapper]; - phases = ["installPhase"]; - installPhase = - '' - mkdir -p $out/bin - install -m755 ${vscodeWayland}/bin/${pname}-wayland $out/bin/${pname} - cp -r ${desktop}/share $out/share - ''; - } - ); + vscodeWayland = let + pname = "vscode"; + desktop = + pkgs.makeDesktopItem + { + name = pname; + exec = pname; + icon = "vscode"; + desktopName = "VSCode Wayland"; + }; + in + lib.hiPrio + ( + pkgs.stdenv.mkDerivation + { + inherit pname; + version = pkgs.vscode.version; + nativeBuildInputs = [pkgs.makeWrapper]; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + install -m755 ${vscodeWayland}/bin/${pname}-wayland $out/bin/${pname} + cp -r ${desktop}/share $out/share + ''; + } + ); } diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index c5fe280..2ce7ec4 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -2,8 +2,7 @@ { fetchgit, fetchurl, -}: -{ +}: { manix = { pname = "manix"; version = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; diff --git a/profiles/cachix/default.nix b/profiles/cachix/default.nix index 12770f3..24bcfd1 100644 --- a/profiles/cachix/default.nix +++ b/profiles/cachix/default.nix @@ -2,8 +2,7 @@ pkgs, lib, ... -}: -let +}: let folder = ./.; toImport = name: value: folder + ("/" + name); filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key && key != "default.nix"; diff --git a/profiles/core/default.nix b/profiles/core/default.nix index 7bf5bc2..007aa41 100644 --- a/profiles/core/default.nix +++ b/profiles/core/default.nix @@ -5,174 +5,167 @@ pkgs, lib, ... -}: -let +}: let inherit (lib) fileContents mkIf; pkgBin = lib.our.pkgBinNoDep pkgs; coreBin = v: "${pkgs.coreutils}/bin/${v}"; nixBin = "${config.nix.package}/bin/nix"; in { - imports = [../cachix ../../locale]; + imports = [../cachix ../../locale ../../secrets/secrets.nix]; boot = { tmpOnTmpfs = true; loader.systemd-boot.configurationLimit = 10; }; console.font = "7x14"; environment = { - systemPackages = - with pkgs; [ - binutils - coreutils - curl - direnv - dnsutils - dosfstools - fd - git - bottom - gptfdisk - iputils - jq - manix - moreutils - nix-index - nmap - ripgrep - skim - tealdeer - usbutils - utillinux - whois - bat - fzf - exa - git - lm_sensors - mkpasswd - ntfs3g - zoxide - bottom - amber - unzip - unrar - grit - hydra-check - nix-index - du-dust - mosh - ( - pkgs.runCommand - "0x0.sh" - {} - '' - mkdir -p $out/bin - cp ${ - pkgs.fetchurl - { - url = "https://raw.githubusercontent.com/Calinou/0x0/master/bin/0x0"; - sha256 = "sha256-Fad+AKBuA49qtRQfnroqjaNWeuRaCekXZG9sS9JVeaM="; - } - } $out/bin/0x0 - chmod +x $out/bin/0x0 - '' - ) - ]; - shellAliases = - let - ifSudo = string: mkIf config.security.sudo.enable string; - in { - gtw = "${pkgBin "grit"} tree wnv"; - gtwa = "${pkgBin "grit"} add -p wnv"; - gt = pkgBin "grit"; - g = pkgBin "git"; - git-optimize = "${pkgBin "git"} gc --aggressive --prune=now"; - cat = "${pkgBin "bat"} -pp --theme=base16"; - c = "cat"; - du = "${pkgs.du-dust}/bin/dust"; - df = "${coreBin "df"} -h"; - free = "${pkgs.procps}/bin/free -h"; - ls = pkgBin "exa"; - l = "${pkgBin "exa"} -lhg --git"; - la = "${pkgBin "exa"} -lhg --git -a"; - t = "${pkgBin "exa"} -lhg --git -T"; - ta = "${pkgBin "exa"} -lhg --git -a -T"; - n = nixBin; - nf = "${nixBin} flake"; - nfc = "${nixBin} flake check"; - nfu = "${nixBin} flake update"; - nfui = "${nixBin} flake lock --update-input"; - nfs = "${nixBin} flake show"; - np = "${nixBin} profile"; - nb = "${nixBin} build"; - npl = "${nixBin} profile info"; - npi = "${nixBin} profile install"; - npr = "${nixBin} profile remove"; - nsh = "${nixBin} shell"; - nsr = "${nixBin} search"; - nsrp = "${nixBin} search nixpkgs"; - ndev = "${nixBin} develop"; - nrun = "${nixBin} run"; - nrefs = "nix-store -qR"; - noscd = "cd /etc/nixos"; - nosrs = ifSudo "sudo nixos-rebuild --fast switch"; - nosrb = ifSudo "sudo nixos-rebuild --fast boot"; - nosrt = ifSudo "sudo nixos-rebuild --fast test"; - ngc = ifSudo "sudo nix-collect-garbage"; - ngcdo = ifSudo "sudo nix-collect-garbage --delete-old"; - top = "${pkgs.bottom}/bin/btm"; - myip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; - mn = - let - manix_preview = "manix '{}' | sed 's/type: /> type: /g' | bat -l Markdown --color=always --plain"; - in ''manix "" | rg '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="${manix_preview}" | xargs manix''; - # fix nixos-option - nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat"; - # sudo - s = ifSudo "sudo -E"; - si = ifSudo "sudo -i"; - se = ifSudo "sudoedit"; - # systemd - ctl = "systemctl"; - stl = ifSudo "s systemctl"; - utl = "systemctl --user"; - ut = "systemctl --user start"; - un = "systemctl --user stop"; - up = ifSudo "s systemctl start"; - dn = ifSudo "s systemctl stop"; - jtl = "journalctl"; - }; - }; - system.activationScripts.diff = - '' - ${pkgs.nixUnstable}/bin/nix store \ - --experimental-features 'nix-command' \ - diff-closures /run/current-system "$systemConfig" - ''; - nix = - let - registry = - builtins.removeAttrs - (builtins.mapAttrs (_: v: { flake = v; }) (lib.filterAttrs (_: v: v ? outputs) inputs)) - ["bud"]; - in { - package = pkgs.nixUnstable; - gc.automatic = true; - optimise.automatic = true; - extraOptions = + systemPackages = with pkgs; [ + binutils + coreutils + curl + direnv + dnsutils + dosfstools + fd + git + bottom + gptfdisk + iputils + jq + manix + moreutils + nix-index + nmap + ripgrep + skim + tealdeer + usbutils + utillinux + whois + bat + fzf + exa + git + lm_sensors + mkpasswd + ntfs3g + zoxide + bottom + amber + unzip + unrar + grit + hydra-check + nix-index + du-dust + mosh + ( + pkgs.runCommand + "0x0.sh" + {} '' - min-free = 536870912 - keep-outputs = true - keep-derivations = true - fallback = true - ''; - inherit registry; - settings = { - sandbox = true; - allowed-users = ["@wheel"]; - trusted-users = ["root" "@wheel"]; - auto-optimise-store = true; - }; + mkdir -p $out/bin + cp ${ + pkgs.fetchurl + { + url = "https://raw.githubusercontent.com/Calinou/0x0/master/bin/0x0"; + sha256 = "sha256-Fad+AKBuA49qtRQfnroqjaNWeuRaCekXZG9sS9JVeaM="; + } + } $out/bin/0x0 + chmod +x $out/bin/0x0 + '' + ) + ]; + shellAliases = let + ifSudo = string: mkIf config.security.sudo.enable string; + in { + gtw = "${pkgBin "grit"} tree wnv"; + gtwa = "${pkgBin "grit"} add -p wnv"; + gt = pkgBin "grit"; + g = pkgBin "git"; + git-optimize = "${pkgBin "git"} gc --aggressive --prune=now"; + cat = "${pkgBin "bat"} -pp --theme=base16"; + c = "cat"; + du = "${pkgs.du-dust}/bin/dust"; + df = "${coreBin "df"} -h"; + free = "${pkgs.procps}/bin/free -h"; + ls = pkgBin "exa"; + l = "${pkgBin "exa"} -lhg --git"; + la = "${pkgBin "exa"} -lhg --git -a"; + t = "${pkgBin "exa"} -lhg --git -T"; + ta = "${pkgBin "exa"} -lhg --git -a -T"; + n = nixBin; + nf = "${nixBin} flake"; + nfc = "${nixBin} flake check"; + nfu = "${nixBin} flake update"; + nfui = "${nixBin} flake lock --update-input"; + nfs = "${nixBin} flake show"; + np = "${nixBin} profile"; + nb = "${nixBin} build"; + npl = "${nixBin} profile info"; + npi = "${nixBin} profile install"; + npr = "${nixBin} profile remove"; + nsh = "${nixBin} shell"; + nsr = "${nixBin} search"; + nsrp = "${nixBin} search nixpkgs"; + ndev = "${nixBin} develop"; + nrun = "${nixBin} run"; + nrefs = "nix-store -qR"; + noscd = "cd /etc/nixos"; + nosrs = ifSudo "sudo nixos-rebuild --fast switch"; + nosrb = ifSudo "sudo nixos-rebuild --fast boot"; + nosrt = ifSudo "sudo nixos-rebuild --fast test"; + ngc = ifSudo "sudo nix-collect-garbage"; + ngcdo = ifSudo "sudo nix-collect-garbage --delete-old"; + top = "${pkgs.bottom}/bin/btm"; + myip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; + mn = let + manix_preview = "manix '{}' | sed 's/type: /> type: /g' | bat -l Markdown --color=always --plain"; + in ''manix "" | rg '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="${manix_preview}" | xargs manix''; + # fix nixos-option + nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat"; + # sudo + s = ifSudo "sudo -E"; + si = ifSudo "sudo -i"; + se = ifSudo "sudoedit"; + # systemd + ctl = "systemctl"; + stl = ifSudo "s systemctl"; + utl = "systemctl --user"; + ut = "systemctl --user start"; + un = "systemctl --user stop"; + up = ifSudo "s systemctl start"; + dn = ifSudo "s systemctl stop"; + jtl = "journalctl"; }; + }; + system.activationScripts.diff = '' + ${pkgs.nixUnstable}/bin/nix store \ + --experimental-features 'nix-command' \ + diff-closures /run/current-system "$systemConfig" + ''; + nix = let + registry = + builtins.removeAttrs + (builtins.mapAttrs (_: v: {flake = v;}) (lib.filterAttrs (_: v: v ? outputs) inputs)) + ["bud"]; + in { + package = pkgs.nixUnstable; + gc.automatic = true; + optimise.automatic = true; + extraOptions = '' + min-free = 536870912 + keep-outputs = true + keep-derivations = true + fallback = true + ''; + inherit registry; + settings = { + sandbox = true; + allowed-users = ["@wheel"]; + trusted-users = ["root" "@wheel"]; + auto-optimise-store = true; + }; + }; programs.command-not-found.enable = false; home-manager.useGlobalPkgs = true; users.mutableUsers = false; diff --git a/profiles/develop/default.nix b/profiles/develop/default.nix index 28bc9bc..b3755a7 100644 --- a/profiles/develop/default.nix +++ b/profiles/develop/default.nix @@ -1,8 +1,4 @@ -{ - pkgs, - ... -}: -{ +{pkgs, ...}: { imports = [./editor]; environment.systemPackages = with pkgs; [git tokei]; documentation.dev.enable = true; diff --git a/profiles/develop/editor/default.nix b/profiles/develop/editor/default.nix index 1a2f416..2d2dc9a 100644 --- a/profiles/develop/editor/default.nix +++ b/profiles/develop/editor/default.nix @@ -1,9 +1,5 @@ -{ - pkgs, - ... -}: -{ +{pkgs, ...}: { imports = [./helix.nix]; environment.systemPackages = with pkgs; [alejandra]; - environment.shellAliases = { nixf-all = "alejandra **/**.nix"; }; + environment.shellAliases = {nixf-all = "alejandra **/**.nix";}; } diff --git a/profiles/develop/editor/helix.nix b/profiles/develop/editor/helix.nix index 7abcf95..ce0ade7 100644 --- a/profiles/develop/editor/helix.nix +++ b/profiles/develop/editor/helix.nix @@ -1,8 +1,4 @@ -{ - pkgs, - ... -}: -let +{pkgs, ...}: let pkg = pkgs.helix; bin = "${pkg}/bin/hx"; in { @@ -11,5 +7,5 @@ in { EDITOR = bin; VISUAL = bin; }; - environment.shellAliases = { e = bin; }; + environment.shellAliases = {e = bin;}; } diff --git a/profiles/develop/editor/kakoune.nix b/profiles/develop/editor/kakoune.nix index ff6c84b..476acf0 100644 --- a/profiles/develop/editor/kakoune.nix +++ b/profiles/develop/editor/kakoune.nix @@ -1,8 +1,4 @@ -{ - pkgs, - ... -}: -let +{pkgs, ...}: let pkg = pkgs.kakoune-unwrapped; in { environment.systemPackages = [pkg]; @@ -10,5 +6,5 @@ in { EDITOR = "${pkg}/bin/kak"; VISUAL = "${pkg}/bin/kak"; }; - environment.shellAliases = { k = "${pkg}/bin/kak"; }; + environment.shellAliases = {k = "${pkg}/bin/kak";}; } diff --git a/profiles/develop/godot.nix b/profiles/develop/godot.nix index 195deeb..9566880 100644 --- a/profiles/develop/godot.nix +++ b/profiles/develop/godot.nix @@ -1,5 +1 @@ -{ - pkgs, - ... -}: -{ environment.systemPackages = with pkgs; [godot-bin godot-headless-bin godot-server-bin]; } +{pkgs, ...}: {environment.systemPackages = with pkgs; [godot-bin godot-headless-bin godot-server-bin];} diff --git a/profiles/network/default.nix b/profiles/network/default.nix index bc5de15..dbcd781 100644 --- a/profiles/network/default.nix +++ b/profiles/network/default.nix @@ -2,9 +2,8 @@ imports = [./dns]; networking.dhcpcd.enable = false; networking.useDHCP = false; - networking.dhcpcd.extraConfig = - '' - noarp - nodelay - ''; + networking.dhcpcd.extraConfig = '' + noarp + nodelay + ''; } diff --git a/profiles/network/dns/nextdns.nix b/profiles/network/dns/nextdns.nix index 1e92168..a0d5a4d 100644 --- a/profiles/network/dns/nextdns.nix +++ b/profiles/network/dns/nextdns.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { services.nextdns = { enable = true; arguments = ["-config" "75e43d"]; diff --git a/profiles/network/dns/stubby/nextdns.nix b/profiles/network/dns/stubby/nextdns.nix index cfcfc24..ff68bd4 100644 --- a/profiles/network/dns/stubby/nextdns.nix +++ b/profiles/network/dns/stubby/nextdns.nix @@ -1,18 +1,17 @@ { services.stubby = { roundRobinUpstreams = false; - upstreamServers = - let - nextDnsId = "75e43d"; - in '' - - address_data: 45.90.28.0 - tls_auth_name: "${nextDnsId}.dns1.nextdns.io" - - address_data: 2a07:a8c0::0 - tls_auth_name: "${nextDnsId}.dns1.nextdns.io" - - address_data: 45.90.30.0 - tls_auth_name: "${nextDnsId}.dns2.nextdns.io" - - address_data: 2a07:a8c1::0 - tls_auth_name: "${nextDnsId}.dns2.nextdns.io" - ''; + upstreamServers = let + nextDnsId = "75e43d"; + in '' + - address_data: 45.90.28.0 + tls_auth_name: "${nextDnsId}.dns1.nextdns.io" + - address_data: 2a07:a8c0::0 + tls_auth_name: "${nextDnsId}.dns1.nextdns.io" + - address_data: 45.90.30.0 + tls_auth_name: "${nextDnsId}.dns2.nextdns.io" + - address_data: 2a07:a8c1::0 + tls_auth_name: "${nextDnsId}.dns2.nextdns.io" + ''; }; } diff --git a/secrets/secrets.nix b/secrets/secrets.nix index ed1a48a..ec51524 100644 Binary files a/secrets/secrets.nix and b/secrets/secrets.nix differ diff --git a/shell/default.nix b/shell/default.nix index b638d4a..5d58ced 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -2,11 +2,9 @@ self, inputs, ... -}: -{ - modules = - with inputs; [ - #bud.devshellModules.bud - ]; +}: { + modules = with inputs; [ + #bud.devshellModules.bud + ]; exportedModules = [./devos.nix]; } diff --git a/shell/devos.nix b/shell/devos.nix index 7a4cc20..84a4707 100644 --- a/shell/devos.nix +++ b/shell/devos.nix @@ -2,17 +2,16 @@ pkgs, extraModulesPath, ... -}: -let +}: let hooks = import ./hooks; - pkgWithCategory = category: package: { inherit package category; }; + pkgWithCategory = category: package: {inherit package category;}; linter = pkgWithCategory "linter"; docs = pkgWithCategory "docs"; devos = pkgWithCategory "devos"; in { _file = toString ./.; imports = ["${extraModulesPath}/git/hooks.nix"]; - git = { inherit hooks; }; + git = {inherit hooks;}; # tempfix: remove when merged https://github.com/numtide/devshell/pull/123 devshell.startup.load_profiles = pkgs.lib.mkForce @@ -33,8 +32,7 @@ in { '' ); packages = with pkgs; [git-crypt]; - commands = - with pkgs; + commands = with pkgs; [ (devos nixUnstable) #(devos agenix) diff --git a/users/nixos/default.nix b/users/nixos/default.nix index c867d7d..1ec6064 100644 --- a/users/nixos/default.nix +++ b/users/nixos/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { users.users.nixos = { uid = 1000; password = "nixos"; diff --git a/users/patriot/default.nix b/users/patriot/default.nix index 00af2da..bcef036 100644 --- a/users/patriot/default.nix +++ b/users/patriot/default.nix @@ -3,8 +3,7 @@ pkgs, lib, ... -}: -let +}: let inherit (lib) mapAttrs' nameValuePair; inherit (builtins) readDir fetchGit; pkgBin = lib.our.pkgBinNoDep pkgs; @@ -20,8 +19,7 @@ in { "dialout" ]; shell = pkgs.zsh; - hashedPassword = - "$6$spzqhAyJfhHy$iHgLBlhjGn1l8PnbjJdWTn1GPvcjMqYNKUzdCe/7IrX6sHNgETSr/Nfpdmq9FCXLhrAfwHOd/q/8SvfeIeNX4/"; + hashedPassword = "$6$spzqhAyJfhHy$iHgLBlhjGn1l8PnbjJdWTn1GPvcjMqYNKUzdCe/7IrX6sHNgETSr/Nfpdmq9FCXLhrAfwHOd/q/8SvfeIeNX4/"; }; environment = { systemPackages = [pkgs.qt5.qtwayland]; @@ -88,838 +86,800 @@ in { }; }; }; - systemd.user.services.gnome-session-restart-dbus.serviceConfig = { Slice = "-.slice"; }; + systemd.user.services.gnome-session-restart-dbus.serviceConfig = {Slice = "-.slice";}; systemd = { - targets = { network-online.enable = false; }; + targets = {network-online.enable = false;}; services = { systemd-networkd-wait-online.enable = false; NetworkManager-wait-online.enable = false; }; }; - home-manager.users.patriot = - { - config, - pkgs, - suites, - ... - }: - let - personal = import ../../personal.nix; - name = personal.name; - email = personal.emails.primary; - font = "Monoid HalfTight"; - fontSize = 11; - fontComb = "${font} ${toString fontSize}"; - fontPackage = pkgs.monoid; - colorSchemeLight = { - primary = { - normal = { - background = "fbf3db"; - foreground = "53676d"; - }; - bright = { - background = "d5cdb6"; - foreground = "3a4d53"; - }; - }; + home-manager.users.patriot = { + config, + pkgs, + suites, + ... + }: let + personal = import ../../personal.nix; + name = personal.name; + email = personal.emails.primary; + font = "Monoid HalfTight"; + fontSize = 11; + fontComb = "${font} ${toString fontSize}"; + fontPackage = pkgs.monoid; + colorSchemeLight = { + primary = { normal = { - black = "ece3cc"; - gray = "5b5b5b"; - red = "d2212d"; - green = "489100"; - yellow = "ad8900"; - blue = "0072d4"; - magenta = "ca4898"; - cyan = "009c8f"; - white = "909995"; + background = "fbf3db"; + foreground = "53676d"; }; bright = { - black = "d5cdb6"; - gray = "7b7b7b"; - red = "cc1729"; - green = "428b00"; - yellow = "a78300"; - blue = "006dce"; - magenta = "c44392"; - cyan = "00978a"; - white = "3a4d53"; + background = "d5cdb6"; + foreground = "3a4d53"; }; }; - colorSchemeDark = - let - normal = { - black = "252525"; - gray = "5b5b5b"; - red = "ed4a46"; - green = "70b433"; - yellow = "dbb32d"; - blue = "368aeb"; - magenta = "eb6eb7"; - cyan = "3fc5b7"; - white = "777777"; - }; - bright = { - black = "3b3b3b"; - gray = "7b7b7b"; - red = "ff5e56"; - green = "83c746"; - yellow = "efc541"; - blue = "4f9cfe"; - magenta = "ff81ca"; - cyan = "56d8c9"; - white = "dedede"; - }; - in { - inherit normal bright; - primary = { - normal = { - background = "181818"; - foreground = "b9b9b9"; - }; - bright = { - background = bright.black; - foreground = bright.white; - }; - }; - }; - colorScheme = - # if builtins.pathExists ./light then colorSchemeLight else colorSchemeDark; - colorSchemeDark; - bgColor = colorScheme.primary.normal.background; - fgColor = colorScheme.primary.bright.foreground; - acColor = colorScheme.normal.yellow; - acColor2 = colorScheme.normal.magenta; - alacrittyColors = { - primary = { - background = "0x${bgColor}"; - foreground = "0x${fgColor}"; - }; - normal = lib.mapAttrs (_: v: "0x${v}") colorScheme.normal; - bright = lib.mapAttrs (_: v: "0x${v}") colorScheme.bright; + normal = { + black = "ece3cc"; + gray = "5b5b5b"; + red = "d2212d"; + green = "489100"; + yellow = "ad8900"; + blue = "0072d4"; + magenta = "ca4898"; + cyan = "009c8f"; + white = "909995"; }; - # sway attrs reused - focusedWorkspace = { - background = "#${bgColor}"; - border = "#${acColor}"; - text = "#${acColor}"; + bright = { + black = "d5cdb6"; + gray = "7b7b7b"; + red = "cc1729"; + green = "428b00"; + yellow = "a78300"; + blue = "006dce"; + magenta = "c44392"; + cyan = "00978a"; + white = "3a4d53"; }; - activeWorkspace = { - background = "#${bgColor}"; - border = "#${colorScheme.primary.bright.background}"; - text = "#${fgColor}"; + }; + colorSchemeDark = let + normal = { + black = "252525"; + gray = "5b5b5b"; + red = "ed4a46"; + green = "70b433"; + yellow = "dbb32d"; + blue = "368aeb"; + magenta = "eb6eb7"; + cyan = "3fc5b7"; + white = "777777"; }; - inactiveWorkspace = { - background = "#${bgColor}"; - border = "#${bgColor}"; - text = "#${fgColor}"; + bright = { + black = "3b3b3b"; + gray = "7b7b7b"; + red = "ff5e56"; + green = "83c746"; + yellow = "efc541"; + blue = "4f9cfe"; + magenta = "ff81ca"; + cyan = "56d8c9"; + white = "dedede"; }; - urgentWorkspace = { - background = "#${bgColor}"; - border = "#${acColor2}"; - text = "#${acColor2}"; - }; - addIndSway = - x: { - background = x.background; - border = x.border; - childBorder = x.border; - text = x.text; - indicator = "#111111"; - # don't care - }; - fonts = [fontComb]; - extraEnv = - '' - export SDL_VIDEODRIVER=wayland - # needs qt5.qtwayland in systemPackages - export QT_QPA_PLATFORM=wayland - #export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" - # Fix for some Java AWT applications (e.g. Android Studio), - # use this if they aren't displayed properly: - export _JAVA_AWT_WM_NONREPARENTING=1 - #export QT_QPA_PLATFORMTHEME=qt5ct - #export QT_PLATFORM_PLUGIN=qt5ct - ''; in { - imports = suites.base; - # needs to be fixed to use nix profile??? - /* - gtk = { - enable = false; - font = { - package = pkgs.dejavu_fonts; - name = "DejaVu Sans 12"; - }; - iconTheme = { - package = pkgs.papirus-icon-theme; - name = "Papirus Dark"; - }; - theme = { - package = pkgs.numix-gtk-theme; - name = "Numix Dark"; - }; - }; - - qt = { - enable = false; - style = { - package = pkgs.adwaita-qt; - name = "adwaita-dark"; - }; - }; - */ - fonts.fontconfig.enable = true; - home = { - homeDirectory = nixosConfig.users.users.patriot.home; - packages = - with pkgs; [ - # Font stuff - fontPackage - noto-fonts-cjk - font-awesome - dejavu_fonts - (nerdfonts.override { fonts = ["Monoid"]; }) - # Programs - cargo-outdated - cargo-release - cargo-udeps - vulkan-tools - krita - gnome3.seahorse - cachix - appimage-run - pfetch - gnupg - imv - mpv - youtube-dl - ffmpeg - mupdf - transmission-qt - ( - lib.hiPrio - ( - lutris.overrideAttrs - ( - old: { - profile = - '' - ${old.profile or ""} - unset VK_ICD_FILENAMES - export VK_ICD_FILENAMES=${nixosConfig.environment.variables.VK_ICD_FILENAMES}''; - } - ) - ) - ) - xdg_utils - tagref - hydrus - papirus-icon-theme - wl-clipboard - rust-analyzer - ( - lib.hiPrio - ( - steam.override - { - extraLibraries = pkgs: [pkgs.pipewire]; - extraProfile = - '' - unset VK_ICD_FILENAMES - export VK_ICD_FILENAMES=${nixosConfig.environment.variables.VK_ICD_FILENAMES}''; - } - ) - ) - /* - (multimc.overrideAttrs (old: { - src = builtins.fetchGit { url = "https://github.com/AfoninZ/MultiMC5-Cracked.git"; ref = "develop"; rev = "9069e9c9d0b7951c310fdcc8bdc70ebc422a7634"; submodules = true; }; - })) - */ - standardnotes - ]; - }; - wayland.windowManager = { - sway = - let - mkRofiCmd = args: "${config.programs.rofi.finalPackage}/bin/rofi ${lib.concatStringsSep " " args} | ${pkgs.sway}/bin/swaymsg --"; - in { - enable = true; - extraSessionCommands = extraEnv; - wrapperFeatures.gtk = true; - extraConfig = - '' - exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway - ''; - config = { - fonts = { - names = [font]; - size = fontSize + 0.0; - }; - bars = [{ command = "${pkgBin "waybar"}"; }]; - colors = { - background = "#${bgColor}"; - focused = addIndSway focusedWorkspace; - focusedInactive = addIndSway inactiveWorkspace; - unfocused = addIndSway activeWorkspace; - urgent = addIndSway urgentWorkspace; - }; - gaps.smartBorders = "on"; - menu = mkRofiCmd ["-show" "drun"]; - modifier = "Mod4"; - terminal = pkgBin "alacritty"; - keybindings = - let - mod = config.wayland.windowManager.sway.config.modifier; - cat = pkgs.coreutils + "/bin/cat"; - grim = pkgBin "grim"; - slurp = pkgBin "slurp"; - pactl = pkgs.pulseaudio + "/bin/pactl"; - playerctl = pkgBin "playerctl"; - wf-recorder = pkgBin "wf-recorder"; - wl-copy = pkgs.wl-clipboard + "/bin/wl-copy"; - wl-paste = pkgs.wl-clipboard + "/bin/wl-paste"; - shotFile = config.home.homeDirectory + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')"; - in - lib.mkOptionDefault - { - "${mod}+q" = "kill"; - "${mod}+Shift+e" = "exit"; - "${mod}+Shift+r" = "reload"; - "${mod}+c" = mkRofiCmd ["-show" "calc"]; - # Screenshot and copy it to clipboard - "Mod1+s" = - '' - exec export SFILE="${shotFile}.png" && ${grim} "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png - ''; - # Save selected area as a picture and copy it to clipboard - "Mod1+Shift+s" = - '' - exec export SFILE="${shotFile}.png" && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png - ''; - # Record screen - "Mod1+r" = ''exec ${wf-recorder} -f "${shotFile}.mp4"''; - # Record an area - "Mod1+Shift+r" = ''exec ${wf-recorder} -g "$(${slurp})" -f "${shotFile}.mp4"''; - # Stop recording - "Mod1+c" = "exec pkill -INT wf-recorder"; - "XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume 0 +5%"; - "XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume 0 -5%"; - "XF86AudioMute" = "exec ${pactl} set-sink-mute 0 toggle"; - "XF86AudioPlay" = "exec ${playerctl} play-pause"; - "XF86AudioPrev" = "exec ${playerctl} previous"; - "XF86AudioNext" = "exec ${playerctl} next"; - "XF86AudioStop" = "exec ${playerctl} stop"; - }; - input = { - "*" = { - xkb_layout = nixosConfig.services.xserver.layout; - accel_profile = "flat"; - }; - }; - output = { "*" = { bg = config.home.homeDirectory + "/wallpaper.png" + " fill"; }; }; - }; - }; - }; - programs = { - alacritty = { - enable = true; - settings = { - shell = { - program = "${pkgs.tmux}/bin/tmux"; - args = ["attach"]; - }; - font = { - normal = { family = font; }; - size = fontSize; - }; - colors = alacrittyColors; - }; + inherit normal bright; + primary = { + normal = { + background = "181818"; + foreground = "b9b9b9"; }; - tmux = { - enable = true; - newSession = true; - secureSocket = true; - baseIndex = 1; - escapeTime = 0; - keyMode = "vi"; - shortcut = "a"; - extraConfig = - '' - set -g default-terminal "alacritty" - set -ga terminal-overrides ",alacritty:Tc" - set -g status off - ''; - }; - chromium = { - enable = true; - package = pkgs.chromium; - extensions = [ - "gcbommkclmclpchllfjekcdonpmejbdp" - # https everywhere - "cjpalhdlnbpafiamejdnhcphjbkeiagm" - # ublock - "nngceckbapebfimnlniiiahkandclblb" - # bitwarden - "ldpochfccmkkmhdbclfhpagapcfdljkj" - # decentraleyes - "annfbnbieaamhaimclajlajpijgkdblo" - # dark theme - "eimadpbcbfnmbkopoojfekhnkhdbieeh" - # dark reader - "hlepfoohegkhhmjieoechaddaejaokhf" - # github refined - "pmcmeagblkinmogikoikkdjiligflglb" - # privacy redirect - ]; - }; - qutebrowser = { - enable = false; - settings = { - content.javascript.enabled = false; - colors.webpage.darkmode.enabled = false; - tabs = { - show = "multiple"; - tabs_are_windows = true; - }; - }; - extraConfig = - let - domains = [ - "discord.com" - "github.com" - "gitlab.com" - "nixos.org" - "protonmail.com" - "bitwarden.com" - "duckduckgo.com" - "youtube.com" - "docker.com" - ]; - enableJsForDomain = - d: '' - config.set('content.javascript.enabled', True, 'https://*.${d}') - ''; - in '' - ${lib.concatStrings (map enableJsForDomain domains)} - ''; - }; - git = { - signing = { - key = "E1C119F91F4CAE53E8445CAFBB57FCE7E35984F6"; - signByDefault = true; - }; - userName = name; - userEmail = email; - }; - ssh = { - enable = true; - compression = true; - hashKnownHosts = true; - userKnownHostsFile = "~/.local/share/ssh/known-hosts"; - # Only needed for darcs hub - # extraConfig = '' - # Host hub.darcs.net - # ControlMaster no - # ForwardAgent no - # ForwardX11 no - # Ciphers +aes256-cbc - # MACs +hmac-sha1 - # ''; - }; - zsh = { - enable = true; - autocd = true; - enableVteIntegration = true; - enableAutosuggestions = true; - enableCompletion = true; - plugins = - let - fast-syntax-highlighting = - let - name = "fast-syntax-highlighting"; - in { - inherit name; - src = pkgs."zsh-${name}".out; - }; - per-directory-history = { - name = "per-directory-history"; - src = - pkgs.fetchFromGitHub - { - owner = "jimhester"; - repo = "per-directory-history"; - rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06"; - hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q="; - }; - }; - in [fast-syntax-highlighting per-directory-history]; - # xdg compliant - dotDir = ".config/zsh"; - history.path = ".local/share/zsh/history"; - envExtra = extraEnv; - loginExtra = - '' - if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then - exec sway - fi - ''; - initExtra = - '' - export TERM=alacritty - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - - function tomp4 () { - ${pkgs.ffmpeg}/bin/ffmpeg -i $1 -c:v libx264 -preset slow -crf 30 -c:a aac -b:a 128k "$1.mp4" - } - - function topng () { - ${pkgs.ffmpeg}/bin/ffmpeg -i $1 "$1.png" - } - - bindkey "$terminfo[kRIT5]" forward-word - bindkey "$terminfo[kLFT5]" backward-word - zstyle ':completion:*' menu select - - eval "$(zoxide init zsh)" - ''; - shellAliases = - nixosConfig.environment.shellAliases - // { - harmony-ssh = - '' - ${pkgs.mosh}/bin/mosh root@chat.harmonyapp.io - ''; - }; - }; - fzf.enable = true; - rofi = { - enable = true; - package = pkgs.rofi-wayland; - cycle = true; - font = fontComb; - terminal = pkgBin "alacritty"; - plugins = with pkgs; [ - rofi-calc - rofi-systemd - rofi-file-browser - rofi-power-menu - ]; - extraConfig = { - modi = "drun,calc,file-browser-extended,ssh,keys"; - }; - }; - vscode = { - enable = true; - package = pkgs.vscodium; - extensions = - let - mkExt = - n: v: p: s: { - name = n; - version = v; - publisher = p; - sha256 = s; - }; - in - ( - pkgs.vscode-utils.extensionsFromVscodeMarketplace - [ - # Rust - (mkExt "rust-analyzer" "0.2.760" "matklad" "sha256-M+eFqIFwiKkiwqFRwkX5h6mc/W+NBqkXcNUdTewwkCI=") - (mkExt "even-better-toml" "0.14.2" "tamasfe" "sha256-lE2t+KUfClD/xjpvexTJlEr7Kufo+22DUM9Ju4Tisp0=") - (mkExt "crates" "0.5.9" "serayuzgur" "sha256-YHIbnl2R7lqwJHi8qUQImClx9MWm+5Pc12vYw7e/RlA=") - # Nix - ( - mkExt "nix-env-selector" "1.0.7" "arrterian" "sha256-DnaIXJ27bcpOrIp1hm7DcrlIzGSjo4RTJ9fD72ukKlc=" - ) - # Go - (mkExt "Go" "0.25.1" "golang" "sha256-ZDUWN9lzDnR77W7xcMFQaaFl/6Lf/x1jgaBkwZPqGGw=") - # Flutter and dart - (mkExt "flutter" "3.22.0" "Dart-Code" "sha256-woygN6hOWlP2UayqwDhJh9KcZk1GzH7mDF5IueDRxs4=") - (mkExt "dart-code" "3.22.0" "Dart-Code" "sha256-1nTewVmlrxbXdRR1EPts46u24LHdnP5BblFsMaGlNYg=") - # protobuf - (mkExt "vscode-proto3" "0.5.4" "zxh404" "sha256-S89qRRlfiTsJ+fJuwdNkZywe6mei48KxIEWbGWChriE=") - (mkExt "vscode-buf" "0.3.1" "bufbuild" "sha256-KjU6WlDxYPPJjh45mCq6Kczi6odYwnLaGj4RHe3fc2w=") - # git - (mkExt "gitlens" "11.6.0" "eamodio" "sha256-JxCNE/IL/v94xWmhebsRZo1Gw+nSSpDgZ41ZGongGVI=") - ( - mkExt - "vscode-commitizen" - "0.14.1" - "KnisterPeter" - "sha256-yw8XKGL7Ul9wV+C0yL1LFJCE3+E8u/sR9s3TjkGJPZM=" - ) - # Customization - # (mkExt "dance" "0.3.2" "gregoire" "sha256-+g8EXeCkPOPvZ60JoXkGTeSXYWrXmKrcbUaEfDppdgA=") - (mkExt "material-icon-theme" "4.6.0" "PKief" "sha256-i+3lrw3mDqK2vTMDhJYTACW5JleA+lN1XAC2imgQLUo=") - ( - mkExt "github-vscode-theme" "4.1.1" "GitHub" "sha256-yLySHOx6pe7w2cyi95pQlKkn/o4VMCTkrTYHu8ASn5M=" - ) - (mkExt "koka" "0.0.1" "maelvalais" "sha256-ty8Mql19HgUWForggeZuHQpzTbmmB/eBFHqof5ZMKr0=") - (mkExt "vscode-rhai" "0.6.3" "rhaiscript" "sha256-gEdpM/TkkiZ50bG9qDU6BH04AJLRDcHLquniRs6m0mg=") - (mkExt "copilot" "1.2.1991" "GitHub" "sha256-pGb5xfjuy+g646doZEuKhQalkOte5dH+I+1op+vZY48=") - ] - ) - ++ ( - with pkgs.vscode-extensions; [ - a5huynh.vscode-ron - /* - vadimcn.vscode-lldb - */ - jnoortheen.nix-ide - ] - ); - userSettings = { - "workbench.iconTheme" = "material-icon-theme"; - "workbench.colorTheme" = "GitHub Dark"; - "rust-analyzer.cargo.loadOutDirsFromCheck" = true; - "rust-analyzer.procMacro.enable" = true; - "rust-analyzer.server.path" = "${pkgs.rust-analyzer}/bin/rust-analyzer"; - "rust-analyzer.updates.channel" = "nightly"; - "editor.fontFamily" = "'${font}'"; - "debug.console.fontFamily" = "${font}"; - "debug.console.fontSize" = toString fontSize; - "terminal.integrated.fontSize" = toString fontSize; - "go.useLanguageServer" = true; - "rust-analyzer.checkOnSave.command" = "clippy"; - "nix.enableLanguageServer" = true; - "nix.serverPath" = pkgBin "rnix-lsp"; - "editor.bracketPairColorization.enabled" = true; - }; - }; - }; - services = { - gpg-agent = - let - defaultCacheTtl = 3600 * 6; - maxCacheTtl = 3600 * 24; - in { - inherit defaultCacheTtl maxCacheTtl; - enable = true; - enableSshSupport = true; - sshKeys = ["8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965"]; - defaultCacheTtlSsh = defaultCacheTtl; - maxCacheTtlSsh = maxCacheTtl; - grabKeyboardAndMouse = false; - pinentryFlavor = "qt"; - }; - gammastep = { - enable = true; - latitude = 36.9; - longitude = 30.7; - }; - }; - xdg = { - enable = true; - configFile = { - "helix/themes/mytheme.toml".text = - '' - "attribute" = { fg = "#${colorScheme.bright.yellow}]" } - "comment" = { fg = "#${colorScheme.normal.gray}", modifiers = ['italic'] } - "constant" = { fg = "#${colorScheme.normal.blue}" } - "constant.builtin" = { fg = "#${colorScheme.bright.blue}" } - "constructor" = { fg = "#${colorScheme.bright.blue}" } - "escape" = { fg = "#${colorScheme.bright.yellow}" } - "function" = { fg = "#${colorScheme.bright.blue}" } - "function.builtin" = { fg = "#${colorScheme.bright.blue}" } - "function.macro" = { fg = "#${colorScheme.bright.magenta}" } - "keyword" = { fg = "#${colorScheme.normal.magenta}", modifiers = ['italic'] } - "keyword.directive" = { fg = "#${colorScheme.normal.magenta}" } - "label" = { fg = "#${colorScheme.bright.magenta}" } - "namespace" = { fg = "#${colorScheme.bright.blue}" } - "number" = { fg = "#${colorScheme.normal.cyan}" } - "operator" = { fg = "#${colorScheme.bright.magenta}", modifiers = ['italic'] } - "property" = { fg = "#${colorScheme.normal.red}" } - "special" = { fg = "#${colorScheme.bright.blue}" } - "string" = { fg = "#${colorScheme.normal.green}" } - "type" = { fg = "#${colorScheme.normal.cyan}", modifiers = ['bold'] } - "type.builtin" = { fg = "#${colorScheme.normal.cyan}", modifiers = ['bold'] } - "variable" = { fg = "#${colorScheme.bright.blue}", modifiers = ['italic'] } - "variable.builtin" = { fg = "#${colorScheme.bright.blue}", modifiers = ['italic'] } - "variable.parameter" = { fg = "#${colorScheme.bright.red}", modifiers = ['italic'] } - "ui.menu.selected" = { fg = "#${bgColor}", bg = "#${acColor}" } - "ui.background" = { fg = "#${fgColor}", bg = "#${bgColor}" } - "ui.help" = { bg = "#${colorScheme.normal.black}" } - "ui.linenr" = { fg = "#${colorScheme.primary.bright.background}", modifiers = ['bold'] } - "ui.linenr.selected" = { fg = "#${fgColor}", modifiers = ['bold'] } - "ui.popup" = { bg = "#${colorScheme.normal.black}" } - "ui.statusline" = { fg = "#${fgColor}", bg = "#${bgColor}" } - "ui.statusline.inactive" = { fg = "#${fgColor}", bg = "#${bgColor}" } - "ui.selection" = { bg = "#${colorScheme.primary.bright.background}" } - "ui.text" = { fg = "#${fgColor}", bg = "#${bgColor}" } - "ui.text.focus" = { fg = "#${fgColor}", bg = "#${bgColor}", modifiers = ['bold'] } - "ui.window" = { bg = "#${bgColor}" } - "ui.cursor.primary" = { fg = "#${fgColor}", modifiers = ["reversed"] } - - "info" = { fg = "#${colorScheme.normal.blue}", modifiers = ['bold'] } - "hint" = { fg = "#${colorScheme.bright.green}", modifiers = ['bold'] } - "warning" = { fg = "#${colorScheme.normal.yellow}", modifiers = ['bold'] } - "error" = { fg = "#${colorScheme.bright.red}", modifiers = ['bold'] } - ''; - "helix/config.toml".text = - '' - theme = "mytheme" - [editor] - line-number = "relative" - [lsp] - display-messages = true - ''; - "helix/languages.toml".text = - '' - [[language]] - name = "nix" - language-server = { command = "${pkgBin "rnix-lsp"}" } - ''; - "waybar/config".text = - let - swayEnabled = config.wayland.windowManager.sway.enable; - in - builtins.toJSON - { - layer = "top"; - position = "top"; - modules-left = - if swayEnabled - then ["sway/workspaces"] - else []; - modules-center = - if swayEnabled - then ["sway/window"] - else []; - modules-right = ["pulseaudio" "cpu" "memory" "temperature" "clock" "tray"]; - tray = { spacing = 8; }; - cpu = { format = "/cpu {usage}/"; }; - memory = { format = "/mem {}/"; }; - temperature = { - hwmon-path = "/sys/class/hwmon/hwmon1/temp2_input"; - format = "/tmp {temperatureC}C/"; - }; - pulseaudio = { - format = "/vol {volume}/ {format_source}"; - format-bluetooth = "/volb {volume}/ {format_source}"; - format-bluetooth-muted = "/volb/ {format_source}"; - format-muted = "/vol/ {format_source}"; - format-source = "/mic {volume}/"; - format-source-muted = "/mic/"; - }; - }; - "waybar/style.css".text = - let - makeBorder = color: "border-bottom: 3px solid #${color};"; - makeInfo = - color: '' - color: #${color}; - ${makeBorder color} - ''; - clockColor = colorScheme.bright.magenta; - cpuColor = colorScheme.bright.green; - memColor = colorScheme.bright.blue; - pulseColor = { - normal = colorScheme.bright.cyan; - muted = colorScheme.bright.gray; - }; - tmpColor = { - normal = colorScheme.bright.yellow; - critical = colorScheme.bright.red; - }; - in '' - * { - border: none; - border-radius: 0; - /* `otf-font-awesome` is required to be installed for icons */ - font-family: ${font}; - font-size: ${toString fontSize}px; - min-height: 0; - } - - window#waybar { - background-color: #${bgColor}; - /* border-bottom: 0px solid rgba(100, 114, 125, 0.5); */ - color: #${fgColor}; - transition-property: background-color; - transition-duration: .5s; - } - - #workspaces button { - padding: 0 5px; - background-color: transparent; - color: #${fgColor}; - border-bottom: 3px solid transparent; - } - - /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ - #workspaces button:hover { - background: rgba(0, 0, 0, 0.2); - box-shadow: inherit; - border-bottom: 3px solid #ffffff; - } - - #workspaces button.focused { - border-bottom: 3px solid #${acColor}; - } - - #workspaces button.urgent { - background-color: #${acColor}; - color: #${bgColor}; - } - - #mode { - background-color: #64727D; - border-bottom: 3px solid #ffffff; - } - - #clock, - #battery, - #cpu, - #memory, - #temperature, - #backlight, - #network, - #pulseaudio, - #custom-media, - #tray, - #mode, - #idle_inhibitor, - #mpd { - padding: 0 10px; - margin: 0 4px; - background-color: transparent; - ${makeInfo fgColor} - } - - label:focus { - color: #000000; - } - - #clock { - ${makeInfo clockColor} - } - - #cpu { - ${makeInfo cpuColor} - } - - #memory { - ${makeInfo memColor} - } - - #pulseaudio { - ${makeInfo pulseColor.normal} - } - - #pulseaudio.muted { - ${makeInfo pulseColor.muted} - } - - #temperature { - ${makeInfo tmpColor.normal} - } - - #temperature.critical { - ${makeInfo tmpColor.critical} - } - ''; + bright = { + background = bright.black; + foreground = bright.white; }; }; }; + colorScheme = + # if builtins.pathExists ./light then colorSchemeLight else colorSchemeDark; + colorSchemeDark; + bgColor = colorScheme.primary.normal.background; + fgColor = colorScheme.primary.bright.foreground; + acColor = colorScheme.normal.yellow; + acColor2 = colorScheme.normal.magenta; + alacrittyColors = { + primary = { + background = "0x${bgColor}"; + foreground = "0x${fgColor}"; + }; + normal = lib.mapAttrs (_: v: "0x${v}") colorScheme.normal; + bright = lib.mapAttrs (_: v: "0x${v}") colorScheme.bright; + }; + # sway attrs reused + focusedWorkspace = { + background = "#${bgColor}"; + border = "#${acColor}"; + text = "#${acColor}"; + }; + activeWorkspace = { + background = "#${bgColor}"; + border = "#${colorScheme.primary.bright.background}"; + text = "#${fgColor}"; + }; + inactiveWorkspace = { + background = "#${bgColor}"; + border = "#${bgColor}"; + text = "#${fgColor}"; + }; + urgentWorkspace = { + background = "#${bgColor}"; + border = "#${acColor2}"; + text = "#${acColor2}"; + }; + addIndSway = x: { + background = x.background; + border = x.border; + childBorder = x.border; + text = x.text; + indicator = "#111111"; + # don't care + }; + fonts = [fontComb]; + extraEnv = '' + export SDL_VIDEODRIVER=wayland + # needs qt5.qtwayland in systemPackages + export QT_QPA_PLATFORM=wayland + #export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 + #export QT_QPA_PLATFORMTHEME=qt5ct + #export QT_PLATFORM_PLUGIN=qt5ct + ''; + in { + imports = suites.base; + # needs to be fixed to use nix profile??? + /* + gtk = { + enable = false; + font = { + package = pkgs.dejavu_fonts; + name = "DejaVu Sans 12"; + }; + iconTheme = { + package = pkgs.papirus-icon-theme; + name = "Papirus Dark"; + }; + theme = { + package = pkgs.numix-gtk-theme; + name = "Numix Dark"; + }; + }; + + qt = { + enable = false; + style = { + package = pkgs.adwaita-qt; + name = "adwaita-dark"; + }; + }; + */ + fonts.fontconfig.enable = true; + home = { + homeDirectory = nixosConfig.users.users.patriot.home; + packages = with pkgs; [ + # Font stuff + fontPackage + noto-fonts-cjk + font-awesome + dejavu_fonts + (nerdfonts.override {fonts = ["Monoid"];}) + # Programs + cargo-outdated + cargo-release + cargo-udeps + vulkan-tools + krita + gnome3.seahorse + cachix + appimage-run + pfetch + gnupg + imv + mpv + youtube-dl + ffmpeg + mupdf + transmission-qt + ( + lib.hiPrio + ( + lutris.overrideAttrs + ( + old: { + profile = '' + ${old.profile or ""} + unset VK_ICD_FILENAMES + export VK_ICD_FILENAMES=${nixosConfig.environment.variables.VK_ICD_FILENAMES}''; + } + ) + ) + ) + xdg_utils + tagref + hydrus + papirus-icon-theme + wl-clipboard + rust-analyzer + ( + lib.hiPrio + ( + steam.override + { + extraLibraries = pkgs: [pkgs.pipewire]; + extraProfile = '' + unset VK_ICD_FILENAMES + export VK_ICD_FILENAMES=${nixosConfig.environment.variables.VK_ICD_FILENAMES}''; + } + ) + ) + /* + (multimc.overrideAttrs (old: { + src = builtins.fetchGit { url = "https://github.com/AfoninZ/MultiMC5-Cracked.git"; ref = "develop"; rev = "9069e9c9d0b7951c310fdcc8bdc70ebc422a7634"; submodules = true; }; + })) + */ + standardnotes + ]; + }; + wayland.windowManager = { + sway = let + mkRofiCmd = args: "${config.programs.rofi.finalPackage}/bin/rofi ${lib.concatStringsSep " " args} | ${pkgs.sway}/bin/swaymsg --"; + in { + enable = true; + extraSessionCommands = extraEnv; + wrapperFeatures.gtk = true; + extraConfig = '' + exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + output HEADLESS-1 { + mode 1920x1080 + bg ~/wallpaper.png fill + } + ''; + config = { + fonts = { + names = [font]; + size = fontSize + 0.0; + }; + bars = [{command = "${pkgBin "waybar"}";}]; + colors = { + background = "#${bgColor}"; + focused = addIndSway focusedWorkspace; + focusedInactive = addIndSway inactiveWorkspace; + unfocused = addIndSway activeWorkspace; + urgent = addIndSway urgentWorkspace; + }; + gaps.smartBorders = "on"; + menu = mkRofiCmd ["-show" "drun"]; + modifier = "Mod4"; + terminal = pkgBin "alacritty"; + keybindings = let + mod = config.wayland.windowManager.sway.config.modifier; + cat = pkgs.coreutils + "/bin/cat"; + grim = pkgBin "grim"; + slurp = pkgBin "slurp"; + pactl = pkgs.pulseaudio + "/bin/pactl"; + playerctl = pkgBin "playerctl"; + wf-recorder = pkgBin "wf-recorder"; + wl-copy = pkgs.wl-clipboard + "/bin/wl-copy"; + wl-paste = pkgs.wl-clipboard + "/bin/wl-paste"; + shotFile = config.home.homeDirectory + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')"; + in + lib.mkOptionDefault + { + "${mod}+q" = "kill"; + "${mod}+Shift+e" = "exit"; + "${mod}+Shift+r" = "reload"; + "${mod}+c" = mkRofiCmd ["-show" "calc"]; + # Screenshot and copy it to clipboard + "Mod1+s" = '' + exec export SFILE="${shotFile}.png" && ${grim} "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png + ''; + # Save selected area as a picture and copy it to clipboard + "Mod1+Shift+s" = '' + exec export SFILE="${shotFile}.png" && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png + ''; + # Record screen + "Mod1+r" = ''exec ${wf-recorder} -f "${shotFile}.mp4"''; + # Record an area + "Mod1+Shift+r" = ''exec ${wf-recorder} -g "$(${slurp})" -f "${shotFile}.mp4"''; + # Stop recording + "Mod1+c" = "exec pkill -INT wf-recorder"; + "XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume 0 +5%"; + "XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume 0 -5%"; + "XF86AudioMute" = "exec ${pactl} set-sink-mute 0 toggle"; + "XF86AudioPlay" = "exec ${playerctl} play-pause"; + "XF86AudioPrev" = "exec ${playerctl} previous"; + "XF86AudioNext" = "exec ${playerctl} next"; + "XF86AudioStop" = "exec ${playerctl} stop"; + }; + input = { + "*" = { + xkb_layout = nixosConfig.services.xserver.layout; + accel_profile = "flat"; + }; + }; + output = {"*" = {bg = config.home.homeDirectory + "/wallpaper.png" + " fill";};}; + }; + }; + }; + programs = { + alacritty = { + enable = true; + settings = { + shell = { + program = "${pkgs.tmux}/bin/tmux"; + args = ["attach"]; + }; + font = { + normal = {family = font;}; + size = fontSize; + }; + colors = alacrittyColors; + }; + }; + tmux = { + enable = true; + newSession = true; + secureSocket = true; + baseIndex = 1; + escapeTime = 0; + keyMode = "vi"; + shortcut = "a"; + extraConfig = '' + set -g default-terminal "alacritty" + set -ga terminal-overrides ",alacritty:Tc" + set -g status off + ''; + }; + chromium = { + enable = true; + package = pkgs.chromium; + extensions = [ + "gcbommkclmclpchllfjekcdonpmejbdp" + # https everywhere + "cjpalhdlnbpafiamejdnhcphjbkeiagm" + # ublock + "nngceckbapebfimnlniiiahkandclblb" + # bitwarden + "ldpochfccmkkmhdbclfhpagapcfdljkj" + # decentraleyes + "annfbnbieaamhaimclajlajpijgkdblo" + # dark theme + "eimadpbcbfnmbkopoojfekhnkhdbieeh" + # dark reader + "hlepfoohegkhhmjieoechaddaejaokhf" + # github refined + "pmcmeagblkinmogikoikkdjiligflglb" + # privacy redirect + ]; + }; + qutebrowser = { + enable = false; + settings = { + content.javascript.enabled = false; + colors.webpage.darkmode.enabled = false; + tabs = { + show = "multiple"; + tabs_are_windows = true; + }; + }; + extraConfig = let + domains = [ + "discord.com" + "github.com" + "gitlab.com" + "nixos.org" + "protonmail.com" + "bitwarden.com" + "duckduckgo.com" + "youtube.com" + "docker.com" + ]; + enableJsForDomain = d: '' + config.set('content.javascript.enabled', True, 'https://*.${d}') + ''; + in '' + ${lib.concatStrings (map enableJsForDomain domains)} + ''; + }; + git = { + signing = { + key = "E1C119F91F4CAE53E8445CAFBB57FCE7E35984F6"; + signByDefault = true; + }; + userName = name; + userEmail = email; + }; + ssh = { + enable = true; + compression = true; + hashKnownHosts = true; + userKnownHostsFile = "~/.local/share/ssh/known-hosts"; + # Only needed for darcs hub + # extraConfig = '' + # Host hub.darcs.net + # ControlMaster no + # ForwardAgent no + # ForwardX11 no + # Ciphers +aes256-cbc + # MACs +hmac-sha1 + # ''; + }; + zsh = { + enable = true; + autocd = true; + enableVteIntegration = true; + enableAutosuggestions = true; + enableCompletion = true; + plugins = let + fast-syntax-highlighting = let + name = "fast-syntax-highlighting"; + in { + inherit name; + src = pkgs."zsh-${name}".out; + }; + per-directory-history = { + name = "per-directory-history"; + src = + pkgs.fetchFromGitHub + { + owner = "jimhester"; + repo = "per-directory-history"; + rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06"; + hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q="; + }; + }; + in [fast-syntax-highlighting per-directory-history]; + # xdg compliant + dotDir = ".config/zsh"; + history.path = ".local/share/zsh/history"; + envExtra = extraEnv; + loginExtra = '' + if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then + exec sway + fi + ''; + initExtra = '' + export TERM=alacritty + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + + function tomp4 () { + ${pkgs.ffmpeg}/bin/ffmpeg -i $1 -c:v libx264 -preset slow -crf 30 -c:a aac -b:a 128k "$1.mp4" + } + + function topng () { + ${pkgs.ffmpeg}/bin/ffmpeg -i $1 "$1.png" + } + + bindkey "$terminfo[kRIT5]" forward-word + bindkey "$terminfo[kLFT5]" backward-word + zstyle ':completion:*' menu select + + eval "$(zoxide init zsh)" + ''; + shellAliases = + nixosConfig.environment.shellAliases + // { + harmony-ssh = '' + ${pkgs.mosh}/bin/mosh root@chat.harmonyapp.io + ''; + }; + }; + fzf.enable = true; + rofi = { + enable = true; + package = pkgs.rofi-wayland; + cycle = true; + font = fontComb; + terminal = pkgBin "alacritty"; + plugins = with pkgs; [ + rofi-calc + rofi-systemd + rofi-file-browser + rofi-power-menu + ]; + extraConfig = { + modi = "drun,calc,file-browser-extended,ssh,keys"; + }; + }; + vscode = { + enable = true; + package = pkgs.vscode; + extensions = let + mkExt = n: v: p: s: { + name = n; + version = v; + publisher = p; + sha256 = s; + }; + in + ( + pkgs.vscode-utils.extensionsFromVscodeMarketplace + [ + # Rust + (mkExt "rust-analyzer" "0.3.968" "matklad" "sha256-wuNdmUYburGjgri8gFJl1FSryJbz1aXjJy4NQ+/Wbk4=") + (mkExt "even-better-toml" "0.14.2" "tamasfe" "sha256-lE2t+KUfClD/xjpvexTJlEr7Kufo+22DUM9Ju4Tisp0=") + (mkExt "crates" "0.5.10" "serayuzgur" "sha256-bY/dphiEPPgTg1zMjvxx4b0Ska2XggRucnZxtbppcLU=") + # Nix + ( + mkExt "nix-env-selector" "1.0.7" "arrterian" "sha256-DnaIXJ27bcpOrIp1hm7DcrlIzGSjo4RTJ9fD72ukKlc=" + ) + # Go + (mkExt "Go" "0.32.0" "golang" "sha256-OsKeZrG157l1HUCDvymJ3ovLxlEEJf7RBe2hXOutdyg=") + # Flutter and dart + (mkExt "flutter" "3.37.20220301" "Dart-Code" "sha256-PS24pbqKNZ/myNcTqgjosG0Pq58yMoATKDgy3k23JlE=") + (mkExt "dart-code" "3.37.20220303" "Dart-Code" "sha256-hS+V4kLe+eGIqj/1mZdgbhxWWxqSr2ZUsc2V0HI6tN8=") + # protobuf + (mkExt "vscode-proto3" "0.5.5" "zxh404" "sha256-Em+w3FyJLXrpVAe9N7zsHRoMcpvl+psmG1new7nA8iE=") + (mkExt "vscode-buf" "0.4.0" "bufbuild" "sha256-VM6LYYak1rB4AdpVYfKpOfizGaFI/R+iUsf6UT50vdw=") + # git + (mkExt "gitlens" "12.0.2" "eamodio" "sha256-et2uam4hOQkxxT+r0fwZhpWGjHk45NAOriFA/43ngpo=") + # Customization + (mkExt "material-icon-theme" "4.14.1" "PKief" "sha256-OHXi0EfeyKMeFiMU5yg0aDoWds4ED0lb+l6T12XZ3LQ=") + (mkExt "horizon-theme-vscode" "1.0.0" "alexandernanberg" "sha256-M7SmOYPkAVi5jQLynZqTjmFo9UcQ6W4dU4euP6ua9Z8=") + ] + ) + ++ ( + with pkgs.vscode-extensions; [ + a5huynh.vscode-ron + /* + vadimcn.vscode-lldb + */ + jnoortheen.nix-ide + ] + ); + userSettings = { + "workbench.iconTheme" = "material-icon-theme"; + "workbench.colorTheme" = "Horizon Bold"; + "rust-analyzer.cargo.loadOutDirsFromCheck" = true; + "rust-analyzer.procMacro.enable" = true; + "rust-analyzer.server.path" = "${pkgs.rust-analyzer}/bin/rust-analyzer"; + "rust-analyzer.updates.channel" = "nightly"; + "editor.fontFamily" = "'${font}'"; + "debug.console.fontFamily" = "${font}"; + "debug.console.fontSize" = toString fontSize; + "terminal.integrated.fontSize" = toString fontSize; + "go.useLanguageServer" = true; + "rust-analyzer.checkOnSave.command" = "clippy"; + "nix.enableLanguageServer" = true; + "nix.serverPath" = pkgBin "rnix-lsp"; + "editor.bracketPairColorization.enabled" = true; + "editor.semanticHighlighting.enabled" = true; + }; + }; + }; + services = { + gpg-agent = let + defaultCacheTtl = 3600 * 6; + maxCacheTtl = 3600 * 24; + in { + inherit defaultCacheTtl maxCacheTtl; + enable = true; + enableSshSupport = true; + sshKeys = ["8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965"]; + defaultCacheTtlSsh = defaultCacheTtl; + maxCacheTtlSsh = maxCacheTtl; + grabKeyboardAndMouse = false; + pinentryFlavor = "qt"; + }; + gammastep = { + enable = true; + latitude = 36.9; + longitude = 30.7; + }; + }; + xdg = { + enable = true; + configFile = { + "helix/themes/mytheme.toml".text = '' + "attribute" = { fg = "#${colorScheme.bright.yellow}]" } + "comment" = { fg = "#${colorScheme.normal.gray}", modifiers = ['italic'] } + "constant" = { fg = "#${colorScheme.normal.blue}" } + "constant.builtin" = { fg = "#${colorScheme.bright.blue}" } + "constructor" = { fg = "#${colorScheme.bright.blue}" } + "escape" = { fg = "#${colorScheme.bright.yellow}" } + "function" = { fg = "#${colorScheme.bright.blue}" } + "function.builtin" = { fg = "#${colorScheme.bright.blue}" } + "function.macro" = { fg = "#${colorScheme.bright.magenta}" } + "keyword" = { fg = "#${colorScheme.normal.magenta}", modifiers = ['italic'] } + "keyword.directive" = { fg = "#${colorScheme.normal.magenta}" } + "label" = { fg = "#${colorScheme.bright.magenta}" } + "namespace" = { fg = "#${colorScheme.bright.blue}" } + "number" = { fg = "#${colorScheme.normal.cyan}" } + "operator" = { fg = "#${colorScheme.bright.magenta}", modifiers = ['italic'] } + "property" = { fg = "#${colorScheme.normal.red}" } + "special" = { fg = "#${colorScheme.bright.blue}" } + "string" = { fg = "#${colorScheme.normal.green}" } + "type" = { fg = "#${colorScheme.normal.cyan}", modifiers = ['bold'] } + "type.builtin" = { fg = "#${colorScheme.normal.cyan}", modifiers = ['bold'] } + "variable" = { fg = "#${colorScheme.bright.blue}", modifiers = ['italic'] } + "variable.builtin" = { fg = "#${colorScheme.bright.blue}", modifiers = ['italic'] } + "variable.parameter" = { fg = "#${colorScheme.bright.red}", modifiers = ['italic'] } + "ui.menu.selected" = { fg = "#${bgColor}", bg = "#${acColor}" } + "ui.background" = { fg = "#${fgColor}", bg = "#${bgColor}" } + "ui.help" = { bg = "#${colorScheme.normal.black}" } + "ui.linenr" = { fg = "#${colorScheme.primary.bright.background}", modifiers = ['bold'] } + "ui.linenr.selected" = { fg = "#${fgColor}", modifiers = ['bold'] } + "ui.popup" = { bg = "#${colorScheme.normal.black}" } + "ui.statusline" = { fg = "#${fgColor}", bg = "#${bgColor}" } + "ui.statusline.inactive" = { fg = "#${fgColor}", bg = "#${bgColor}" } + "ui.selection" = { bg = "#${colorScheme.primary.bright.background}" } + "ui.text" = { fg = "#${fgColor}", bg = "#${bgColor}" } + "ui.text.focus" = { fg = "#${fgColor}", bg = "#${bgColor}", modifiers = ['bold'] } + "ui.window" = { bg = "#${bgColor}" } + "ui.cursor.primary" = { fg = "#${fgColor}", modifiers = ["reversed"] } + + "info" = { fg = "#${colorScheme.normal.blue}", modifiers = ['bold'] } + "hint" = { fg = "#${colorScheme.bright.green}", modifiers = ['bold'] } + "warning" = { fg = "#${colorScheme.normal.yellow}", modifiers = ['bold'] } + "error" = { fg = "#${colorScheme.bright.red}", modifiers = ['bold'] } + ''; + "helix/config.toml".text = '' + theme = "mytheme" + [editor] + line-number = "relative" + [lsp] + display-messages = true + ''; + "helix/languages.toml".text = '' + [[language]] + name = "nix" + language-server = { command = "${pkgBin "rnix-lsp"}" } + ''; + "waybar/config".text = let + swayEnabled = config.wayland.windowManager.sway.enable; + in + builtins.toJSON + { + layer = "top"; + position = "top"; + modules-left = + if swayEnabled + then ["sway/workspaces"] + else []; + modules-center = + if swayEnabled + then ["sway/window"] + else []; + modules-right = ["pulseaudio" "cpu" "memory" "temperature" "clock" "tray"]; + tray = {spacing = 8;}; + cpu = {format = "/cpu {usage}/";}; + memory = {format = "/mem {}/";}; + temperature = { + hwmon-path = "/sys/class/hwmon/hwmon1/temp2_input"; + format = "/tmp {temperatureC}C/"; + }; + pulseaudio = { + format = "/vol {volume}/ {format_source}"; + format-bluetooth = "/volb {volume}/ {format_source}"; + format-bluetooth-muted = "/volb/ {format_source}"; + format-muted = "/vol/ {format_source}"; + format-source = "/mic {volume}/"; + format-source-muted = "/mic/"; + }; + }; + "waybar/style.css".text = let + makeBorder = color: "border-bottom: 3px solid #${color};"; + makeInfo = color: '' + color: #${color}; + ${makeBorder color} + ''; + clockColor = colorScheme.bright.magenta; + cpuColor = colorScheme.bright.green; + memColor = colorScheme.bright.blue; + pulseColor = { + normal = colorScheme.bright.cyan; + muted = colorScheme.bright.gray; + }; + tmpColor = { + normal = colorScheme.bright.yellow; + critical = colorScheme.bright.red; + }; + in '' + * { + border: none; + border-radius: 0; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: ${font}; + font-size: ${toString fontSize}px; + min-height: 0; + } + + window#waybar { + background-color: #${bgColor}; + /* border-bottom: 0px solid rgba(100, 114, 125, 0.5); */ + color: #${fgColor}; + transition-property: background-color; + transition-duration: .5s; + } + + #workspaces button { + padding: 0 5px; + background-color: transparent; + color: #${fgColor}; + border-bottom: 3px solid transparent; + } + + /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ + #workspaces button:hover { + background: rgba(0, 0, 0, 0.2); + box-shadow: inherit; + border-bottom: 3px solid #ffffff; + } + + #workspaces button.focused { + border-bottom: 3px solid #${acColor}; + } + + #workspaces button.urgent { + background-color: #${acColor}; + color: #${bgColor}; + } + + #mode { + background-color: #64727D; + border-bottom: 3px solid #ffffff; + } + + #clock, + #battery, + #cpu, + #memory, + #temperature, + #backlight, + #network, + #pulseaudio, + #custom-media, + #tray, + #mode, + #idle_inhibitor, + #mpd { + padding: 0 10px; + margin: 0 4px; + background-color: transparent; + ${makeInfo fgColor} + } + + label:focus { + color: #000000; + } + + #clock { + ${makeInfo clockColor} + } + + #cpu { + ${makeInfo cpuColor} + } + + #memory { + ${makeInfo memColor} + } + + #pulseaudio { + ${makeInfo pulseColor.normal} + } + + #pulseaudio.muted { + ${makeInfo pulseColor.muted} + } + + #temperature { + ${makeInfo tmpColor.normal} + } + + #temperature.critical { + ${makeInfo tmpColor.critical} + } + ''; + }; + }; + }; } diff --git a/users/profiles/git/default.nix b/users/profiles/git/default.nix index f730572..2c3c3c0 100644 --- a/users/profiles/git/default.nix +++ b/users/profiles/git/default.nix @@ -1,7 +1,7 @@ { programs.git = { enable = true; - extraConfig = { pull.rebase = true; }; + extraConfig = {pull.rebase = true;}; lfs.enable = true; aliases = { a = "add -p"; @@ -31,8 +31,7 @@ rs1ft = "soft HEAD~1"; rh1rd = "hard HEAD~1"; # logging - l = - "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; + l = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; plog = "log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'"; tlog = "log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative"; rank = "shortlog -sn --no-merges"; diff --git a/users/profiles/hikari/default.nix b/users/profiles/hikari/default.nix index e99f84a..2872bdf 100644 --- a/users/profiles/hikari/default.nix +++ b/users/profiles/hikari/default.nix @@ -3,207 +3,204 @@ config, pkgs, ... -}: -{ +}: { home.packages = with pkgs; [hikari xwayland]; xdg = { enable = true; configFile = { - "hikari/hikari.conf".text = - '' - ui { - border = 1 - gap = 0 - step = 120 - font = "${fontComb}" + "hikari/hikari.conf".text = '' + ui { + border = 1 + gap = 0 + step = 120 + font = "${fontComb}" - colorscheme { - background = 0x282C34 - foreground = 0x000000 - selected = 0xF5E094 - grouped = 0xFDAF53 - first = 0xB8E673 - conflict = 0xED6B32 - insert = 0xE3C3FA - active = 0xFFFFFF - inactive = 0x465457 - } + colorscheme { + background = 0x282C34 + foreground = 0x000000 + selected = 0xF5E094 + grouped = 0xFDAF53 + first = 0xB8E673 + conflict = 0xED6B32 + insert = 0xE3C3FA + active = 0xFFFFFF + inactive = 0x465457 } + } - outputs { + outputs { + "*" { + background = "${config.home.homeDirectory}/wallpaper.png" + } + } + + inputs { + keyboards { "*" { - background = "${config.home.homeDirectory}/wallpaper.png" - } - } - - inputs { - keyboards { - "*" { - xkb = { - layout = "tr" - } - } - } - pointers { - "*" { - accel-profile = "flat" + xkb = { + layout = "tr" } } } - - layouts { - # main stack - s = { - scale = { - min = 0.5 - max = 0.75 - } - left = single - right = stack - } - - # main queue - q = { - scale = 0.75 - top = single - bottom = queue - } - - f = full - h = stack - v = queue - g = grid - } - - actions { - terminal = "${pkgs.alacritty}/bin/alacritty" - run = "${pkgs.wofi}/bin/wofi --show drun" - } - - bindings { - keyboard { - "L+0" = workspace-switch-to-sheet-0 - "L+1" = workspace-switch-to-sheet-1 - "L+2" = workspace-switch-to-sheet-2 - "L+3" = workspace-switch-to-sheet-3 - "L+4" = workspace-switch-to-sheet-4 - "L+5" = workspace-switch-to-sheet-5 - "L+6" = workspace-switch-to-sheet-6 - "L+7" = workspace-switch-to-sheet-7 - "L+8" = workspace-switch-to-sheet-8 - "L+9" = workspace-switch-to-sheet-9 - "L+numbersign" = workspace-switch-to-sheet-alternate - "L+Period" = workspace-switch-to-sheet-current - "L+j" = workspace-switch-to-sheet-next - "L+k" = workspace-switch-to-sheet-prev - "L+Comma" = workspace-switch-to-sheet-next-inhabited - "LS+Comma" = workspace-switch-to-sheet-prev-inhabited - "LSC+g" = workspace-show-group - "LSC+i" = workspace-show-invisible - "LSC+Period" = workspace-show-all - "LC+n" = workspace-cycle-next - "LC+p" = workspace-cycle-prev - - "LC+i" = sheet-show-invisible - "LC+Period" = sheet-show-all - "LC+g" = sheet-show-group - - "LA+r" = layout-reset - "LA+Return" = layout-restack-append - "LAS+Return" = layout-restack-prepend - "L+Home" = layout-cycle-view-first - "L+End" = layout-cycle-view-last - "L+n" = layout-cycle-view-next - "L+p" = layout-cycle-view-prev - "L+x" = layout-exchange-view-next - "LS+x" = layout-exchange-view-prev - "LA+x" = layout-exchange-view-main - - "LS+0" = view-pin-to-sheet-0 - "LS+1" = view-pin-to-sheet-1 - "LS+2" = view-pin-to-sheet-2 - "LS+3" = view-pin-to-sheet-3 - "LS+4" = view-pin-to-sheet-4 - "LS+5" = view-pin-to-sheet-5 - "LS+6" = view-pin-to-sheet-6 - "LS+7" = view-pin-to-sheet-7 - "LS+8" = view-pin-to-sheet-8 - "LS+9" = view-pin-to-sheet-9 - "LS+numbersign" = view-pin-to-sheet-alternate - "LS+Period" = view-pin-to-sheet-current - "LS+j" = view-pin-to-sheet-next - "LS+k" = view-pin-to-sheet-prev - - "L+q" = view-quit - "L+Tab" = view-cycle-next - "LS+Tab" = view-cycle-prev - - "L+Up" = view-move-up - "L+Down" = view-move-down - "L+Left" = view-move-left - "L+Right" = view-move-right - "LA+Up" = view-decrease-size-up - "LAS+Up" = view-increase-size-up - "LA+Down" = view-increase-size-down - "LAS+Down" = view-decrease-size-down - "LA+Left" = view-decrease-size-left - "LAS+Left" = view-increase-size-left - "LA+Right" = view-increase-size-right - "LAS+Right" = view-decrease-size-right - "LS+Up" = view-snap-up - "LS+Down" = view-snap-down - "LS+Left" = view-snap-left - "LS+Right" = view-snap-right - "L+r" = view-reset-geometry - - "L+minus" = view-toggle-maximize-vertical - "L+less" = view-toggle-maximize-horizontal - "L+f" = view-toggle-maximize-full - "L5+plus" = view-toggle-floating - "L+i" = view-toggle-invisible - "L5+p" = view-toggle-public - - "L+l" = mode-enter-layout - "L+s" = mode-enter-sheet-assign - "L+g" = mode-enter-group-assign - "L+m" = mode-enter-mark-assign - "L+acute" = mode-enter-mark-select - "LS+acute" = mode-enter-mark-switch-select - "LCA+g" = mode-enter-input-grab - - "LS+Backspace" = lock - "LCA+q" = quit - "LCA+r" = reload - - "L+Return" = action-terminal - "L+d" = action-run - - "A+F1" = vt-switch-to-1 - "A+F2" = vt-switch-to-2 - "A+F3" = vt-switch-to-3 - "A+F4" = vt-switch-to-4 - "A+F5" = vt-switch-to-5 - "A+F6" = vt-switch-to-6 - "A+F7" = vt-switch-to-7 - "A+F8" = vt-switch-to-8 - "A+F9" = vt-switch-to-9 - } - - mouse { - "L+left" = mode-enter-move - "L+right" = mode-enter-resize + pointers { + "*" { + accel-profile = "flat" } } - ''; - "hikari/autostart".source = - "${ - pkgs.writeScriptBin - "hikari-autostart" - '' - #!${pkgs.stdenv.shell} - ${pkgs.waybar}/bin/waybar & - '' - }/bin/hikari-autostart"; + } + + layouts { + # main stack + s = { + scale = { + min = 0.5 + max = 0.75 + } + left = single + right = stack + } + + # main queue + q = { + scale = 0.75 + top = single + bottom = queue + } + + f = full + h = stack + v = queue + g = grid + } + + actions { + terminal = "${pkgs.alacritty}/bin/alacritty" + run = "${pkgs.wofi}/bin/wofi --show drun" + } + + bindings { + keyboard { + "L+0" = workspace-switch-to-sheet-0 + "L+1" = workspace-switch-to-sheet-1 + "L+2" = workspace-switch-to-sheet-2 + "L+3" = workspace-switch-to-sheet-3 + "L+4" = workspace-switch-to-sheet-4 + "L+5" = workspace-switch-to-sheet-5 + "L+6" = workspace-switch-to-sheet-6 + "L+7" = workspace-switch-to-sheet-7 + "L+8" = workspace-switch-to-sheet-8 + "L+9" = workspace-switch-to-sheet-9 + "L+numbersign" = workspace-switch-to-sheet-alternate + "L+Period" = workspace-switch-to-sheet-current + "L+j" = workspace-switch-to-sheet-next + "L+k" = workspace-switch-to-sheet-prev + "L+Comma" = workspace-switch-to-sheet-next-inhabited + "LS+Comma" = workspace-switch-to-sheet-prev-inhabited + "LSC+g" = workspace-show-group + "LSC+i" = workspace-show-invisible + "LSC+Period" = workspace-show-all + "LC+n" = workspace-cycle-next + "LC+p" = workspace-cycle-prev + + "LC+i" = sheet-show-invisible + "LC+Period" = sheet-show-all + "LC+g" = sheet-show-group + + "LA+r" = layout-reset + "LA+Return" = layout-restack-append + "LAS+Return" = layout-restack-prepend + "L+Home" = layout-cycle-view-first + "L+End" = layout-cycle-view-last + "L+n" = layout-cycle-view-next + "L+p" = layout-cycle-view-prev + "L+x" = layout-exchange-view-next + "LS+x" = layout-exchange-view-prev + "LA+x" = layout-exchange-view-main + + "LS+0" = view-pin-to-sheet-0 + "LS+1" = view-pin-to-sheet-1 + "LS+2" = view-pin-to-sheet-2 + "LS+3" = view-pin-to-sheet-3 + "LS+4" = view-pin-to-sheet-4 + "LS+5" = view-pin-to-sheet-5 + "LS+6" = view-pin-to-sheet-6 + "LS+7" = view-pin-to-sheet-7 + "LS+8" = view-pin-to-sheet-8 + "LS+9" = view-pin-to-sheet-9 + "LS+numbersign" = view-pin-to-sheet-alternate + "LS+Period" = view-pin-to-sheet-current + "LS+j" = view-pin-to-sheet-next + "LS+k" = view-pin-to-sheet-prev + + "L+q" = view-quit + "L+Tab" = view-cycle-next + "LS+Tab" = view-cycle-prev + + "L+Up" = view-move-up + "L+Down" = view-move-down + "L+Left" = view-move-left + "L+Right" = view-move-right + "LA+Up" = view-decrease-size-up + "LAS+Up" = view-increase-size-up + "LA+Down" = view-increase-size-down + "LAS+Down" = view-decrease-size-down + "LA+Left" = view-decrease-size-left + "LAS+Left" = view-increase-size-left + "LA+Right" = view-increase-size-right + "LAS+Right" = view-decrease-size-right + "LS+Up" = view-snap-up + "LS+Down" = view-snap-down + "LS+Left" = view-snap-left + "LS+Right" = view-snap-right + "L+r" = view-reset-geometry + + "L+minus" = view-toggle-maximize-vertical + "L+less" = view-toggle-maximize-horizontal + "L+f" = view-toggle-maximize-full + "L5+plus" = view-toggle-floating + "L+i" = view-toggle-invisible + "L5+p" = view-toggle-public + + "L+l" = mode-enter-layout + "L+s" = mode-enter-sheet-assign + "L+g" = mode-enter-group-assign + "L+m" = mode-enter-mark-assign + "L+acute" = mode-enter-mark-select + "LS+acute" = mode-enter-mark-switch-select + "LCA+g" = mode-enter-input-grab + + "LS+Backspace" = lock + "LCA+q" = quit + "LCA+r" = reload + + "L+Return" = action-terminal + "L+d" = action-run + + "A+F1" = vt-switch-to-1 + "A+F2" = vt-switch-to-2 + "A+F3" = vt-switch-to-3 + "A+F4" = vt-switch-to-4 + "A+F5" = vt-switch-to-5 + "A+F6" = vt-switch-to-6 + "A+F7" = vt-switch-to-7 + "A+F8" = vt-switch-to-8 + "A+F9" = vt-switch-to-9 + } + + mouse { + "L+left" = mode-enter-move + "L+right" = mode-enter-resize + } + } + ''; + "hikari/autostart".source = "${ + pkgs.writeScriptBin + "hikari-autostart" + '' + #!${pkgs.stdenv.shell} + ${pkgs.waybar}/bin/waybar & + '' + }/bin/hikari-autostart"; }; }; } diff --git a/users/profiles/starship/default.nix b/users/profiles/starship/default.nix index 62d00d5..8e8080a 100644 --- a/users/profiles/starship/default.nix +++ b/users/profiles/starship/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { programs.starship = { enable = true; settings = { diff --git a/users/profiles/wtf/default.nix b/users/profiles/wtf/default.nix index 59c149a..27ca9d6 100644 --- a/users/profiles/wtf/default.nix +++ b/users/profiles/wtf/default.nix @@ -1,5 +1 @@ -{ - pkgs, - ... -}: -{ home.packages = [pkgs.wtf]; } +{pkgs, ...}: {home.packages = [pkgs.wtf];} diff --git a/users/root/default.nix b/users/root/default.nix index 5bf59e1..110d9b9 100644 --- a/users/root/default.nix +++ b/users/root/default.nix @@ -1,5 +1,3 @@ -{ ... }: -{ - users.users.root.initialHashedPassword = - "$6$XLWo1sPpgp63Zm$XHBbULH9q1gb/.yalPPU/I7EgTcW80bM.moCjIe/qGyOwE47VcXNVbTHloBZdIWQq0MfIG0IxInAu59.oJyos/"; +{...}: { + users.users.root.initialHashedPassword = "$6$XLWo1sPpgp63Zm$XHBbULH9q1gb/.yalPPU/I7EgTcW80bM.moCjIe/qGyOwE47VcXNVbTHloBZdIWQq0MfIG0IxInAu59.oJyos/"; }