From bd420734805375bb85cfbc51d1a0e57f0694f6a8 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 2 Jan 2024 13:41:00 +0300 Subject: [PATCH] Multi hosts, finally --- .gitignore | 2 +- ...x-icons.nix => gruvbox-plus-icon-pack.nix} | 6 +- flake.nix | 75 +++++++++---------- hosts/cube/default.nix | 33 +------- hosts/cube/hardware.nix | 4 +- hosts/cube/packages.nix | 17 ----- hosts/enka/default.nix | 48 +----------- hosts/enka/hardware.nix | 10 ++- hosts/enka/packages.nix | 44 ----------- lib/configuration.nix | 52 +++++++------ lib/default.nix | 14 ++-- lib/merge.nix | 17 +++-- lib/modules.nix | 8 -- lib/values.nix | 5 ++ modules/autofreq/default.nix | 2 +- modules/blueman/default.nix | 2 +- modules/boot/default.nix | 9 --- modules/btop/default.nix | 2 +- modules/discord/default.nix | 10 ++- modules/dunst/default.nix | 6 +- modules/endlessh/default.nix | 2 +- modules/firefox/default.nix | 2 +- modules/fonts/default.nix | 2 +- modules/fuzzel/default.nix | 6 +- modules/ghostty/default.nix | 10 ++- modules/git/default.nix | 6 +- modules/gtk/default.nix | 4 +- modules/helix/default.nix | 2 +- modules/hyprland/default.nix | 10 +-- modules/kitty/default.nix | 2 +- modules/localisation/default.nix | 2 + modules/logind/default.nix | 2 +- modules/nano/default.nix | 5 ++ modules/networkmanager/default.nix | 6 +- modules/nushell/configuration.nix.nu | 20 ++--- modules/nushell/default.nix | 9 +-- modules/nushell/environment.nix.nu | 12 +-- modules/openssh/default.nix | 6 +- modules/openttd/default.nix | 2 +- modules/packages/default.nix | 10 ++- modules/pipewire/default.nix | 2 +- modules/qt/default.nix | 2 +- modules/rust/default.nix | 4 +- modules/site/default.nix | 1 + modules/ssh/default.nix | 4 +- modules/steam/default.nix | 4 +- modules/sudo/default.nix | 2 +- modules/waybar/default.nix | 6 +- 48 files changed, 200 insertions(+), 311 deletions(-) rename derivations/{gruvbox-icons.nix => gruvbox-plus-icon-pack.nix} (89%) delete mode 100644 hosts/cube/packages.nix delete mode 100644 hosts/enka/packages.nix delete mode 100644 lib/modules.nix delete mode 100644 modules/boot/default.nix create mode 100644 modules/nano/default.nix diff --git a/.gitignore b/.gitignore index 96990b6..6141c60 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ !modules/autofreq/ !modules/bat/ !modules/blueman/ -!modules/boot/ !modules/btop/ !modules/discord/ !modules/dunst/ @@ -27,6 +26,7 @@ !modules/kitty/ !modules/localisation/ !modules/logind/ +!modules/nano/ !modules/networkmanager/ !modules/nix/ !modules/nushell/ diff --git a/derivations/gruvbox-icons.nix b/derivations/gruvbox-plus-icon-pack.nix similarity index 89% rename from derivations/gruvbox-icons.nix rename to derivations/gruvbox-plus-icon-pack.nix index 20d936d..eb2ffd5 100644 --- a/derivations/gruvbox-icons.nix +++ b/derivations/gruvbox-plus-icon-pack.nix @@ -8,8 +8,8 @@ , hicolor-icon-theme }: -stdenvNoCC.mkDerivation rec { - pname = "gruvbox-plus-icons"; +stdenvNoCC.mkDerivation { + pname = "gruvbox-plus-icon-pack"; version = "unstable-2023-12-07"; src = fetchFromGitHub { @@ -42,6 +42,6 @@ stdenvNoCC.mkDerivation rec { homepage = "https://github.com/SylEleuth/gruvbox-plus-icon-pack"; license = licenses.gpl3Only; platforms = platforms.linux; - maintainers = with maintainers; [ eureka-cpu ]; + maintainers = with maintainers; [ eureka-cpu RGBCube ]; }; } diff --git a/flake.nix b/flake.nix index 9c73a88..08f58b1 100644 --- a/flake.nix +++ b/flake.nix @@ -86,7 +86,6 @@ nixSuper, nixpkgs, homeManager, - ghosttyModule, nuScripts, fenix, zig, @@ -95,28 +94,38 @@ themes, ... } @ inputs: let - lib = nixpkgs.lib; + importConfiguration = host: let + hostDefault = import ./hosts/${host} { + # Will explode if you try to use user dependant stuff. + ulib = (import ./lib lib null) // { merge = lib.recursiveUpdate; }; + }; - configuration = host: { - system, - normalUsers, - graphicalUsers ? [], - }: let - ulib = import ./lib lib normalUsers graphicalUsers; + users = { + all = builtins.attrNames hostDefault.users.users ++ [ "root" ]; + graphical = builtins.attrNames (lib.filterAttrs (name: value: builtins.elem "graphical" (value.extraGroups or [])) hostDefault.users.users); + }; - pkgs = import nixpkgs { inherit system; }; + system = hostDefault.nixpkgs.hostPlatform; - upkgs = { - inherit nuScripts; + lib = nixpkgs.lib; + ulib = import ./lib lib users; - zig = zig.packages.${system}.master; - } // (lib.genAttrs - [ "nixSuper" "hyprland" "hyprpicker" "ghostty" "zls" ] - (name: inputs.${name}.packages.${system}.default)); + pkgs = import nixpkgs { inherit system; }; + upkgs = let + defaults = lib.genAttrs + [ "nixSuper" "hyprland" "hyprpicker" "ghostty" "zls" ] + (name: inputs.${name}.packages.${system}.default); + + other = { + inherit nuScripts; + + zig = zig.packages.${system}.master; + }; + in defaults // other; theme = themes.custom (themes.raw.gruvbox-dark-hard // { - corner-radius = 8; - border-width = 2; + cornerRadius = 8; + borderWidth = 2; margin = 6; padding = 8; @@ -131,19 +140,16 @@ font.mono.package = (pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; }); icons.name = "Gruvbox-Plus-Dark"; - icons.package = pkgs.callPackage (import ./derivations/gruvbox-icons.nix) {}; + icons.package = pkgs.callPackage (import ./derivations/gruvbox-plus-icon-pack.nix) {}; }); defaultConfiguration = { - environment.defaultPackages = []; - - home-manager.sharedModules = [ ghosttyModule.homeModules.default ]; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; networking.hostName = host; - nixpkgs.hostPlatform = system; }; + in lib.nixosSystem { inherit system; @@ -151,26 +157,17 @@ modules = [ homeManager.nixosModules.default site.nixosModules.default + defaultConfiguration - ./hosts/${host} - ]; + ] ++ (builtins.attrValues (builtins.mapAttrs (name: type: ./modules/${name}) (builtins.readDir ./modules))) + ++ (builtins.attrValues (builtins.mapAttrs (name: type: ./hosts/${host}/${name}) (builtins.readDir ./hosts/${host}))); }; - configurations = builtins.mapAttrs configuration; + hosts = (builtins.attrNames + (nixpkgs.lib.filterAttrs + (name: value: value == "directory") + (builtins.readDir ./hosts))); in { - nixosConfigurations = configurations { - enka = { - system = "x86_64-linux"; - - normalUsers = [ "nixos" "root" ]; - graphicalUsers = [ "nixos" ]; - }; - - cube = { - system = "x86_64-linux"; - - normalUsers = [ "rgb" "root" ]; - }; - }; + nixosConfigurations = nixpkgs.lib.genAttrs hosts importConfiguration; }; } diff --git a/hosts/cube/default.nix b/hosts/cube/default.nix index 2d1147a..6e77360 100644 --- a/hosts/cube/default.nix +++ b/hosts/cube/default.nix @@ -1,12 +1,14 @@ -{ lib, ulib, ... }: with ulib; merge3 +{ ulib, ... }: with ulib; merge (systemConfiguration { system.stateVersion = "23.05"; + nixpkgs.hostPlatform = "x86_64-linux"; + time.timeZone = "Europe/Amsterdam"; users.users.rgb = normalUser { - description = "NixOS"; + description = "RGB"; extraGroups = [ "wheel" ]; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDRSLWxpIMOZIQv9ggDnAwSxmux/TZvuEPgq2HFiH+oI2OE07xYQAiroBVI5HH+aIg1nwpYtArANoD8V9Hrx2XCo2py/fMi9LhJWNMlFVcRLqYrCmrZYhBqZhxXIdY+wXqkSE7kvTKsz84BrhwilfA/bqTgVw2Ro6w0RnTzUhlYx4w10DT3isN09cQJMgvuyWNRlpGpkEGhPwyXythKM2ERoHTfq/XtpiGZQeLr6yoTTd9q4rbvnGGka5IUEz3RrmeXEs13l02IY6dCUFJkRRsK8dvB9zFjQyM08IqdaoHeudZoCOsnl/AiegZ7C5FoYEKIXY86RqxS3TH3nwuxe2fXTNr9gwf2PumM1Yh2WxV4+pHQOksxW8rWgv1nXMT5AG0RrJxr+S0Nn7NBbzCImrprX3mg4vJqT24xcUjUSDYllEMa2ioXGCeff8cwVKK/Ly5fwj0AX1scjiw+b7jD6VvDLA5z+ALwCblxiRMCN0SOMk9/V2Xsg9YIRMHyQwpqu8k= u0_a216@localhost" ]; }; @@ -14,31 +16,4 @@ (homeConfiguration { home.stateVersion = "23.11"; - - programs.git.extraConfig.commit.gpgSign = lib.mkForce false; }) - -(importModules [ - ./hardware.nix - - "bat" - "btop" - "endlessh" - "git" - "helix" - "kernel" - "localisation" - "networkmanager" - "nix" - "nushell" - "openssh" - "pueue" - "packages" - "python" - "ripgrep" - "rust" - "site" - "ssh" - "sudo" - "tmp" -]) diff --git a/hosts/cube/hardware.nix b/hosts/cube/hardware.nix index 74e7bbb..4a26e14 100644 --- a/hosts/cube/hardware.nix +++ b/hosts/cube/hardware.nix @@ -1,9 +1,7 @@ { ulib, modulesPath, ... }: with ulib; systemConfiguration { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; boot.loader.grub = enabled { device = "/dev/vda"; diff --git a/hosts/cube/packages.nix b/hosts/cube/packages.nix deleted file mode 100644 index 3079742..0000000 --- a/hosts/cube/packages.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ ulib, pkgs, ... }: with ulib; - -systemPackages (with pkgs; [ - fastfetch - fd - hyperfine - moreutils - nix-index - nix-output-monitor - p7zip - pstree - strace - tree - yt-dlp - - gh -]) diff --git a/hosts/enka/default.nix b/hosts/enka/default.nix index 5756b14..e1ae058 100644 --- a/hosts/enka/default.nix +++ b/hosts/enka/default.nix @@ -1,12 +1,13 @@ -{ ulib, ... }: with ulib; merge3 +{ ulib, ... }: with ulib; merge (systemConfiguration { system.stateVersion = "23.05"; - console.keyMap = "trq"; + nixpkgs.hostPlatform = "x86_64-linux"; + time.timeZone = "Europe/Istanbul"; - users.users.nixos = normalUser { + users.users.nixos = graphicalUser { description = "NixOS"; extraGroups = [ "wheel" ]; }; @@ -19,44 +20,3 @@ (homeConfiguration { home.stateVersion = "23.05"; }) - -(importModules [ - ./hardware.nix - - "autofreq" - "bat" - "blueman" - "boot" - "btop" - "discord" - "dunst" - "firefox" - "fonts" - "fuzzel" - "ghostty" - "git" - "gtk" - "helix" - "hyprland" - "kernel" - "kitty" - "localisation" - "logind" - "networkmanager" - "nix" - "nushell" - "openttd" - "packages" - "pipewire" - "pueue" - "python" - "qt" - "ripgrep" - "rust" - "ssh" - "steam" - "sudo" - "tmp" - "w3m" - "waybar" -]) diff --git a/hosts/enka/hardware.nix b/hosts/enka/hardware.nix index 4417e40..16c19df 100644 --- a/hosts/enka/hardware.nix +++ b/hosts/enka/hardware.nix @@ -1,4 +1,12 @@ -{ +{ ulib, ... }: with ulib; + +systemConfiguration { + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; + systemd-boot.editor = false; + }; + boot.initrd.availableKernelModules = [ "ahci" "rtsx_pci_sdmmc" diff --git a/hosts/enka/packages.nix b/hosts/enka/packages.nix deleted file mode 100644 index 01891b5..0000000 --- a/hosts/enka/packages.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ ulib, pkgs, upkgs, ... }: with ulib; merge - -(systemPackages (with pkgs; [ - asciinema - fastfetch - fd - hyperfine - moreutils - nix-index - nix-output-monitor - p7zip - pstree - strace - timg - tree - usbutils - yt-dlp - - wine - - clang_16 - clang-tools_16 - gh - go - jdk - lld - maven - upkgs.zig - vlang -])) - -(graphicalPackages (with pkgs; [ - qbittorrent - thunderbird - whatsapp-for-linux - xfce.thunar - - krita - obs-studio - - libreoffice - hunspellDicts.en_US - hunspellDicts.en_GB-ize -])) diff --git a/lib/configuration.nix b/lib/configuration.nix index 4ca1cf7..88872ea 100644 --- a/lib/configuration.nix +++ b/lib/configuration.nix @@ -1,31 +1,37 @@ -normalUsers: graphicalUsers: - -rec { - inherit normalUsers graphicalUsers; - - systemConfiguration = configuration: configuration; - - systemPackages = packages: systemConfiguration { - environment.systemPackages = packages; - }; - - systemFonts = packages: systemConfiguration { - fonts.packages = packages; - }; - +lib: users: let userHomeConfiguration = users: configuration: { home-manager.users = builtins.foldl' (final: user: final // { ${user} = configuration; }) {} (if builtins.isList users then users else [ users ]); }; +in rec { + inherit users; - graphicalConfiguration = userHomeConfiguration graphicalUsers; - graphicalPackages = packages: graphicalConfiguration { - home.packages = packages; - }; + isServer = users.graphical == []; + isDesktop = !isServer; - homeConfiguration = userHomeConfiguration normalUsers; - homePackages = packages: homeConfiguration { - home.packages = packages; - }; + # For every machine. + systemConfiguration = configuration: configuration; + systemPackages = packages: systemConfiguration { environment.systemPackages = packages; }; + systemFonts = packages: systemConfiguration { fonts.packages = packages; }; + + # For every user, on every machine. + homeConfiguration = configuration: { home-manager.sharedModules = [ configuration ]; }; + homePackages = packages: homeConfiguration { home.packages = packages; }; + + # For every desktop. + desktopSystemConfiguration = configuration: if isServer then {} else configuration; + desktopSystemPackages = packages: if isServer then {} else systemPackages packages; + desktopSystemFonts = packages: if isServer then {} else systemFonts packages; + # For every graphical user on every desktop. + desktopHomeConfiguration = configuration: if isServer then {} else userHomeConfiguration users.graphical configuration; + desktopHomePackages = packages: if isServer then {} else desktopHomeConfiguration { home.packages = packages; }; + + # For every server. + serverSystemConfiguration = configuration: if isServer then configuration else {}; + serverSystemPackages = packages: if isServer then systemPackages packages else {}; + serverSystemFonts = packages: if isServer then systemFonts packages else {}; + # For every user on every server. + serverHomeConfiguration = configuration: if isServer then homeConfiguration configuration else {}; + serverHomePackages = packages: if isServer then homePackages packages else {}; } diff --git a/lib/default.nix b/lib/default.nix index 11fd1b3..b7ce1e7 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,9 +1,5 @@ -lib: normalUsers: graphicalUsers: - -(import ./configuration.nix normalUsers graphicalUsers) -// -(import ./merge.nix lib) -// -(import ./modules.nix) -// -(import ./values.nix) +lib: users: let + configuration = import ./configuration.nix lib users; + merge = import ./merge.nix lib; + values = import ./values.nix; +in configuration // merge // values diff --git a/lib/merge.nix b/lib/merge.nix index ab28500..b76485a 100644 --- a/lib/merge.nix +++ b/lib/merge.nix @@ -1,8 +1,11 @@ -lib: - -rec { - merge = lib.recursiveUpdate; - merge3 = x: y: merge (merge x y); - merge4 = x: y: merge3 (merge x y); - merge5 = x: y: merge4 (merge x y); +lib: let + mergeAll = builtins.foldl' (collected: module: { + imports = collected.imports ++ [ module ]; + }) { imports = []; }; +in { + merge = a: b: mergeAll [ a b ]; + merge3 = a: b: c: mergeAll [ a b c ]; + merge4 = a: b: c: d: mergeAll [ a b c d ]; + merge5 = a: b: c: d: e: mergeAll [ a b c d e ]; + merge6 = a: b: c: d: e: f: mergeAll [ a b c d e f ]; } diff --git a/lib/modules.nix b/lib/modules.nix deleted file mode 100644 index 14d06a8..0000000 --- a/lib/modules.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - importModules = modules: { - imports = builtins.map (module: if builtins.isPath module then - module - else - ../modules/${module}) modules; - }; -} diff --git a/lib/values.nix b/lib/values.nix index abcb898..f03336b 100644 --- a/lib/values.nix +++ b/lib/values.nix @@ -6,4 +6,9 @@ normalUser = attributes: attributes // { isNormalUser = true; }; + + graphicalUser = attributes: attributes // { + isNormalUser = true; + extraGroups = [ "graphical" ] ++ attributes.extraGroups or []; + }; } diff --git a/modules/autofreq/default.nix b/modules/autofreq/default.nix index 91a3fdc..f0ef820 100644 --- a/modules/autofreq/default.nix +++ b/modules/autofreq/default.nix @@ -1,5 +1,5 @@ { ulib, ... }: with ulib; -systemConfiguration { +desktopSystemConfiguration { services.auto-cpufreq = enabled {}; } diff --git a/modules/blueman/default.nix b/modules/blueman/default.nix index d448a49..d7b426a 100644 --- a/modules/blueman/default.nix +++ b/modules/blueman/default.nix @@ -1,6 +1,6 @@ { ulib, ... }: with ulib; -systemConfiguration { +desktopSystemConfiguration { services.blueman = enabled {}; hardware.bluetooth = enabled { diff --git a/modules/boot/default.nix b/modules/boot/default.nix deleted file mode 100644 index 36dcb55..0000000 --- a/modules/boot/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ulib, pkgs, ... }: with ulib; - -systemConfiguration { - boot.loader = { - efi.canTouchEfiVariables = true; - systemd-boot.enable = true; - systemd-boot.editor = false; - }; -} diff --git a/modules/btop/default.nix b/modules/btop/default.nix index f53d780..ac2f44c 100644 --- a/modules/btop/default.nix +++ b/modules/btop/default.nix @@ -6,6 +6,6 @@ homeConfiguration { programs.btop = enabled { settings.color_theme = "base16"; - settings.rounded_corners = theme.corner-radius != 0; + settings.rounded_corners = theme.cornerRadius != 0; }; } diff --git a/modules/discord/default.nix b/modules/discord/default.nix index 3cd3305..e6ce427 100644 --- a/modules/discord/default.nix +++ b/modules/discord/default.nix @@ -1,10 +1,14 @@ -{ ulib, pkgs, theme, ... }: with ulib; merge +{ ulib, pkgs, theme, ... }: with ulib; merge3 -(graphicalConfiguration { +(desktopSystemConfiguration { + nixpkgs.config.allowUnfree = true; +}) + +(desktopHomeConfiguration { xdg.configFile."Vencord/settings/quickCss.css".text = theme.discordCss; }) -(graphicalPackages (with pkgs; [ +(desktopSystemPackages (with pkgs; [ (discord.override { withOpenASAR = true; withVencord = true; diff --git a/modules/dunst/default.nix b/modules/dunst/default.nix index bf5d163..fae5844 100644 --- a/modules/dunst/default.nix +++ b/modules/dunst/default.nix @@ -1,6 +1,6 @@ { ulib, theme, ... }: with ulib; -graphicalConfiguration { +desktopHomeConfiguration { services.dunst = with theme.withHashtag; enabled { iconTheme = icons; @@ -9,13 +9,13 @@ graphicalConfiguration { dmenu = "fuzzel --dmenu"; - corner_radius = corner-radius; + corner_radius = cornerRadius; gap_size = margin; horizontal_padding = padding; padding = padding; frame_color = base0A; - frame_width = border-width; + frame_width = borderWidth; separator_color = "frame"; background = base00; diff --git a/modules/endlessh/default.nix b/modules/endlessh/default.nix index 31950ec..b9e25ea 100644 --- a/modules/endlessh/default.nix +++ b/modules/endlessh/default.nix @@ -1,6 +1,6 @@ { ulib, ... }: with ulib; -systemConfiguration { +serverSystemConfiguration { services.endlessh = enabled { openFirewall = true; port = 22; diff --git a/modules/firefox/default.nix b/modules/firefox/default.nix index 631cf37..3056e3c 100644 --- a/modules/firefox/default.nix +++ b/modules/firefox/default.nix @@ -1,6 +1,6 @@ { ulib, ... }: with ulib; -graphicalConfiguration { +desktopHomeConfiguration { programs.firefox = enabled {}; programs.librewolf = enabled {}; diff --git a/modules/fonts/default.nix b/modules/fonts/default.nix index 76acdac..628ece3 100644 --- a/modules/fonts/default.nix +++ b/modules/fonts/default.nix @@ -8,7 +8,7 @@ }; }) -(systemFonts (with pkgs; [ +(desktopSystemFonts (with pkgs; [ theme.font.sans.package theme.font.mono.package diff --git a/modules/fuzzel/default.nix b/modules/fuzzel/default.nix index 10bfcf3..9d61208 100644 --- a/modules/fuzzel/default.nix +++ b/modules/fuzzel/default.nix @@ -1,6 +1,6 @@ { ulib, theme, ... }: with ulib; -graphicalConfiguration { +desktopHomeConfiguration { programs.fuzzel = with theme; enabled { settings.main = { dpi-aware = false; @@ -29,8 +29,8 @@ graphicalConfiguration { }; settings.border = { - radius = corner-radius; - width = border-width; + radius = cornerRadius; + width = borderWidth; }; }; } diff --git a/modules/ghostty/default.nix b/modules/ghostty/default.nix index 92d359c..83d45af 100644 --- a/modules/ghostty/default.nix +++ b/modules/ghostty/default.nix @@ -1,6 +1,10 @@ -{ lib, ulib, pkgs, upkgs, theme, ... }: with ulib; +{ inputs, lib, ulib, pkgs, upkgs, theme, ... }: with ulib; merge -graphicalConfiguration { +(desktopSystemConfiguration { + home-manager.sharedModules = [ inputs.ghosttyModule.homeModules.default ]; +}) + +(desktopHomeConfiguration { programs.nushell.environmentVariables.TERMINAL = "ghostty"; programs.ghostty = enabled { @@ -69,4 +73,4 @@ graphicalConfiguration { ]; }; }; -} +}) diff --git a/modules/git/default.nix b/modules/git/default.nix index 7278abd..05de79d 100644 --- a/modules/git/default.nix +++ b/modules/git/default.nix @@ -1,4 +1,4 @@ -{ ulib, pkgs, ... }: with ulib; +{ lib, ulib, pkgs, ... }: with ulib; homeConfiguration { programs.nushell.shellAliases = { @@ -59,11 +59,11 @@ homeConfiguration { init.defaultBranch = "master"; push.autoSetupRemote = true; + url."ssh://git@github.com/".insteadOf = "https://github.com/"; + } // lib.mkIf ulib.isDesktop { commit.gpgSign = true; gpg.format = "ssh"; user.signingKey = "~/.ssh/id_rsa"; - - url."ssh://git@github.com/".insteadOf = "https://github.com/"; }; }; } diff --git a/modules/gtk/default.nix b/modules/gtk/default.nix index 32a6ad9..20fac3f 100644 --- a/modules/gtk/default.nix +++ b/modules/gtk/default.nix @@ -1,10 +1,10 @@ { ulib, pkgs, theme, ... }: with ulib; merge -(systemConfiguration { +(desktopSystemConfiguration { programs.dconf = enabled {}; }) -(graphicalConfiguration { +(desktopHomeConfiguration { gtk = enabled { gtk3.extraCss = theme.adwaitaGtkCss; gtk4.extraCss = theme.adwaitaGtkCss; diff --git a/modules/helix/default.nix b/modules/helix/default.nix index 7b0e2b1..d16b678 100644 --- a/modules/helix/default.nix +++ b/modules/helix/default.nix @@ -67,7 +67,7 @@ }; }) -(homePackages (with pkgs; [ +(desktopSystemPackages (with pkgs; [ # CMAKE cmake-language-server diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index 06e63fd..72b61ca 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -1,6 +1,6 @@ { ulib, pkgs, upkgs, theme, ... }: with ulib; merge3 -(systemConfiguration { +(desktopSystemConfiguration { hardware.opengl = enabled {}; xdg.portal = enabled { @@ -12,7 +12,7 @@ }; }) -(graphicalConfiguration { +(desktopHomeConfiguration { wayland.windowManager.hyprland = with theme; enabled { package = upkgs.hyprland; @@ -140,7 +140,7 @@ '' decoration { drop_shadow = false - rounding = ${toString corner-radius} + rounding = ${toString cornerRadius} blur { enabled = false @@ -154,7 +154,7 @@ gaps_in = ${toString (margin/ 2)} gaps_out = ${toString margin} - border_size = ${toString border-width} + border_size = ${toString borderWidth} col.active_border = 0xFF${base0A} col.nogroup_border_active = 0xFF${base0A} @@ -215,7 +215,7 @@ }; }) -(homePackages (with pkgs; [ +(desktopHomePackages (with pkgs; [ brightnessctl cliphist grim diff --git a/modules/kitty/default.nix b/modules/kitty/default.nix index d833d18..f27c1b5 100644 --- a/modules/kitty/default.nix +++ b/modules/kitty/default.nix @@ -1,6 +1,6 @@ { ulib, theme, ... }: with ulib; -graphicalConfiguration { +desktopHomeConfiguration { programs.kitty = with theme.withHashtag; enabled { font = with font; { inherit (mono) name package; diff --git a/modules/localisation/default.nix b/modules/localisation/default.nix index 7506ee5..413d6ac 100644 --- a/modules/localisation/default.nix +++ b/modules/localisation/default.nix @@ -1,6 +1,8 @@ { ulib, ... }: with ulib; systemConfiguration { + console.keyMap = "trq"; + i18n.defaultLocale = "en_US.UTF-8"; i18n.extraLocaleSettings = let locale = "tr_TR.UTF-8"; diff --git a/modules/logind/default.nix b/modules/logind/default.nix index 0853da6..df7d75c 100644 --- a/modules/logind/default.nix +++ b/modules/logind/default.nix @@ -1,5 +1,5 @@ { ulib, ... }: with ulib; -systemConfiguration { +desktopSystemConfiguration { services.logind.powerKey = "ignore"; } diff --git a/modules/nano/default.nix b/modules/nano/default.nix new file mode 100644 index 0000000..8b50249 --- /dev/null +++ b/modules/nano/default.nix @@ -0,0 +1,5 @@ +{ ulib, ... }: with ulib; + +systemConfiguration { + environment.defaultPackages = []; +} diff --git a/modules/networkmanager/default.nix b/modules/networkmanager/default.nix index 680adbe..a5205f8 100644 --- a/modules/networkmanager/default.nix +++ b/modules/networkmanager/default.nix @@ -1,11 +1,11 @@ { ulib, ... }: with ulib; merge -(systemConfiguration { +(desktopSystemConfiguration { networking.networkmanager = enabled {}; - users.extraGroups.networkmanager.members = ulib.normalUsers; + users.extraGroups.networkmanager.members = ulib.users.all; }) -(homeConfiguration { +(desktopHomeConfiguration { programs.nushell.shellAliases.wifi = "nmcli dev wifi show-password"; }) diff --git a/modules/nushell/configuration.nix.nu b/modules/nushell/configuration.nix.nu index 2cf0d78..ee62b32 100644 --- a/modules/nushell/configuration.nix.nu +++ b/modules/nushell/configuration.nix.nu @@ -1,4 +1,4 @@ -'' +{ lib, ulib, ... }: '' $env.config = { bracketed_paste: true buffer_editor: "" @@ -182,15 +182,17 @@ $env.config.cursor_shape = { $env.config.hooks = { command_not_found: {|| - task status - | where label == boom - | get id - | each {|id| - task kill $id | null - task remove $id | null - } + ${lib.optionals ulib.isDesktop '' + task status + | where label == boom + | get id + | each {|id| + task kill $id | null + task remove $id | null + } - task spawn --label boom { pw-play ${./boom.opus} } + task spawn --label boom { pw-play ${./boom.opus} } + ''} } display_output: "table --expand" env_change: {} diff --git a/modules/nushell/default.nix b/modules/nushell/default.nix index b09d07c..02be81f 100644 --- a/modules/nushell/default.nix +++ b/modules/nushell/default.nix @@ -1,4 +1,4 @@ -{ config, ulib, pkgs, upkgs, theme, ... }: with ulib; merge3 +{ config, ulib, pkgs, ... } @ inputs: with ulib; merge3 (systemConfiguration { users.defaultUserShell = pkgs.nushell; @@ -8,11 +8,8 @@ programs.starship = enabled {}; programs.nushell = enabled { - configFile.text = import ./configuration.nix.nu; - envFile.text = import ./environment.nix.nu { - inherit (upkgs) nuScripts; - inherit theme; - }; + configFile.text = import ./configuration.nix.nu inputs; + envFile.text = import ./environment.nix.nu inputs; environmentVariables = { inherit (config.environment.variables) NIX_LD; diff --git a/modules/nushell/environment.nix.nu b/modules/nushell/environment.nix.nu index ccc7da7..c0ad029 100644 --- a/modules/nushell/environment.nix.nu +++ b/modules/nushell/environment.nix.nu @@ -1,7 +1,9 @@ -{ nuScripts, theme }: '' -if (tty) == /dev/tty1 { - (Hyprland) -} +{ lib, ulib, upkgs, theme, ... }: '' +${lib.optionals ulib.isDesktop '' + if (tty) == /dev/tty1 { + (Hyprland) + } +''} $env.PROMPT_INDICATOR = ""; $env.PROMPT_INDICATOR_VI_INSERT = ""; @@ -34,5 +36,5 @@ def --wrapped hx [...arguments] { } } -use ${nuScripts}/modules/background_task/task.nu +use ${upkgs.nuScripts}/modules/background_task/task.nu '' diff --git a/modules/openssh/default.nix b/modules/openssh/default.nix index a94f0ef..cadab47 100644 --- a/modules/openssh/default.nix +++ b/modules/openssh/default.nix @@ -1,8 +1,8 @@ -{ config, ulib, ... }: with ulib; +{ ulib, ... }: with ulib; -systemConfiguration { +serverSystemConfiguration { services.openssh = enabled { - ports = if config.services.endlessh.enable then [ 2222 ] else [ 22 ]; + ports = [ 2222 ]; settings = { KbdInteractiveAuthentication = false; PasswordAuthentication = false; diff --git a/modules/openttd/default.nix b/modules/openttd/default.nix index 68f0c19..3629d96 100644 --- a/modules/openttd/default.nix +++ b/modules/openttd/default.nix @@ -1,5 +1,5 @@ { ulib, pkgs, ... }: with ulib; -graphicalPackages (with pkgs; [ +desktopHomePackages (with pkgs; [ openttd ]) diff --git a/modules/packages/default.nix b/modules/packages/default.nix index 01891b5..e68a72e 100644 --- a/modules/packages/default.nix +++ b/modules/packages/default.nix @@ -1,4 +1,4 @@ -{ ulib, pkgs, upkgs, ... }: with ulib; merge +{ ulib, pkgs, upkgs, ... }: with ulib; merge3 (systemPackages (with pkgs; [ asciinema @@ -15,9 +15,9 @@ tree usbutils yt-dlp +])) - wine - +(desktopSystemPackages (with pkgs; [ clang_16 clang-tools_16 gh @@ -27,9 +27,11 @@ maven upkgs.zig vlang + + wine ])) -(graphicalPackages (with pkgs; [ +(desktopHomePackages (with pkgs; [ qbittorrent thunderbird whatsapp-for-linux diff --git a/modules/pipewire/default.nix b/modules/pipewire/default.nix index 6ff84aa..01229fe 100644 --- a/modules/pipewire/default.nix +++ b/modules/pipewire/default.nix @@ -1,6 +1,6 @@ { ulib, ... }: with ulib; -systemConfiguration { +desktopSystemConfiguration { security.rtkit = enabled {}; sound = enabled {}; diff --git a/modules/qt/default.nix b/modules/qt/default.nix index 7b0a681..127c7fc 100644 --- a/modules/qt/default.nix +++ b/modules/qt/default.nix @@ -1,6 +1,6 @@ { ulib, pkgs, ... }: with ulib; -graphicalConfiguration { +desktopHomeConfiguration { qt = enabled { platformTheme = "gnome"; style.name = "adwaita-dark"; diff --git a/modules/rust/default.nix b/modules/rust/default.nix index 3939805..265ebd5 100644 --- a/modules/rust/default.nix +++ b/modules/rust/default.nix @@ -1,10 +1,10 @@ { inputs, ulib, pkgs, ... }: with ulib; merge -(systemConfiguration { +(desktopSystemConfiguration { nixpkgs.overlays = [ inputs.fenix.overlays.default ]; }) -(systemPackages (with pkgs; [ +(desktopSystemPackages (with pkgs; [ (fenix.complete.withComponents [ "cargo" "clippy" diff --git a/modules/site/default.nix b/modules/site/default.nix index 3ff1588..f457357 100644 --- a/modules/site/default.nix +++ b/modules/site/default.nix @@ -1,6 +1,7 @@ { ulib, ... }: with ulib; systemConfiguration { + # TODO: Move to cube host. services.site = { # enabled { openFirewall = true; }; diff --git a/modules/ssh/default.nix b/modules/ssh/default.nix index aff5e14..dec1ed8 100644 --- a/modules/ssh/default.nix +++ b/modules/ssh/default.nix @@ -1,8 +1,8 @@ { ulib, ... }: with ulib; -homeConfiguration { +desktopHomeConfiguration { programs.ssh = enabled { - matchBlocks."*".setEnv.TERM = "xterm-kitty"; + matchBlocks."*".setEnv.TERM = "xterm-kitty"; matchBlocks.cube = { hostname = "5.255.78.70"; diff --git a/modules/steam/default.nix b/modules/steam/default.nix index 14cddca..42ac1b2 100644 --- a/modules/steam/default.nix +++ b/modules/steam/default.nix @@ -1,12 +1,12 @@ { ulib, pkgs, ... }: with ulib; merge -(systemConfiguration { +(desktopSystemConfiguration { # Steam uses 32-bit drivers for some unholy fucking reason. hardware.opengl.driSupport32Bit = true; nixpkgs.config.allowUnfree = true; }) -(graphicalPackages (with pkgs; [ +(desktopHomePackages (with pkgs; [ steam ])) diff --git a/modules/sudo/default.nix b/modules/sudo/default.nix index 6933f79..a1abbd5 100644 --- a/modules/sudo/default.nix +++ b/modules/sudo/default.nix @@ -3,7 +3,7 @@ systemConfiguration { security.sudo = enabled { extraConfig = '' - Defaults timestamp_timeout=-1 + Defaults timestamp_timeout=${if ulib.isDesktop then "-1" else "0"} ''; execWheelOnly = true; }; diff --git a/modules/waybar/default.nix b/modules/waybar/default.nix index b53299e..3e7fde6 100644 --- a/modules/waybar/default.nix +++ b/modules/waybar/default.nix @@ -1,12 +1,12 @@ { ulib, theme, ... }: with ulib; -graphicalConfiguration { +desktopHomeConfiguration { programs.waybar = with theme.withHashtag; enabled { systemd = enabled {}; settings = [{ layer = "top"; - height = 2 * corner-radius; + height = 2 * cornerRadius; margin-right = margin; margin-left = margin; @@ -124,7 +124,7 @@ graphicalConfiguration { style = '' * { border: none; - border-radius: ${toString corner-radius}px; + border-radius: ${toString cornerRadius}px; font-family: "${font.sans.name}"; }