From 1c543e97f017de3bb56f33e52a1ef4d4bf179245 Mon Sep 17 00:00:00 2001 From: tx0 Date: Fri, 14 Mar 2025 16:40:36 +0000 Subject: [PATCH] some changes --- flake.nix | 26 +--- home/default.nix | 27 ++-- home/users/tx0/default.nix | 16 ++ home/{ => users/tx0}/profile.nix | 0 .../tx0}/programs/graphical/anyrun.nix | 0 .../tx0}/programs/graphical/foot.nix | 0 .../programs/graphical/hyprland/binds.nix | 0 .../programs/graphical/hyprland/default.nix | 0 .../programs/graphical/waybar/default.nix | 0 .../waybar/scripts/music/default.nix | 0 .../graphical/waybar/scripts/music/main.py | 0 .../graphical/waybar/scripts/music/setup.py | 0 .../tx0}/programs/graphical/xdg.nix | 0 home/users/tx0/programs/graphical/zed.nix | 13 ++ .../{ => users/tx0}/programs/terminal/bat.nix | 0 .../tx0}/programs/terminal/fish.nix | 0 .../{ => users/tx0}/programs/terminal/fzf.nix | 0 .../{ => users/tx0}/programs/terminal/git.nix | 0 home/{ => users/tx0}/programs/terminal/nh.nix | 0 .../{ => users/tx0}/programs/terminal/nvf.nix | 0 .../tx0}/programs/terminal/tmux.nix | 0 .../tx0}/programs/terminal/yazi.nix | 0 .../tx0}/programs/terminal/zoxide.nix | 0 home/{ => users/tx0}/services/mako.nix | 0 home/{ => users/tx0}/services/udiskie.nix | 0 .../tx0}/system/packages/default.nix | 0 .../derivations/bunnyfetch/bunnyfetch.sh | 0 .../derivations/bunnyfetch/default.nix | 0 .../derivations/ubports-installer/default.nix | 0 .../ubports-installer/ubports-mascot.png | Bin home/{ => users/tx0}/system/symlinks.nix | 0 home/{ => users/tx0}/theming/dconf.nix | 0 home/{ => users/tx0}/theming/gtk.nix | 0 home/{ => users/tx0}/theming/qt.nix | 0 home/{ => users/tx0}/theming/stylix.nix | 0 home/{ => users/tx0}/theming/x11.nix | 0 home/{ => users/tx0}/universe.nix | 2 +- wallpaper.png => home/users/tx0/wallpaper.png | Bin {hosts/common => host}/default.nix | 0 host/programs/graphical/anmezia-vpn.nix | 9 ++ host/programs/graphical/hyprland.nix | 15 ++ .../programs/terminal/fish.nix | 0 host/services/command-not-found.nix | 12 ++ {hosts/common => host}/services/libinput.nix | 0 host/services/libvirtd.nix | 9 ++ host/services/openssh.nix | 17 +++ {hosts/common => host}/services/packages.nix | 0 {hosts/common => host}/services/pipewire.nix | 0 host/services/podman.nix | 12 ++ {hosts/common => host}/services/resolved.nix | 0 host/services/udev.nix | 13 ++ {hosts/common => host}/services/udisks2.nix | 0 host/services/vpn.nix | 44 ++++++ {hosts/common => host}/system/boot.nix | 2 +- {hosts/earth => host}/system/hardware.nix | 2 - host/system/locale.nix | 4 + {hosts/earth => host}/system/networking.nix | 4 +- {hosts/common => host}/system/nix.nix | 0 host/system/nixpkgs.nix | 18 +++ host/system/users.nix | 78 ++++++++++ .../common/programs/graphical/anmezia-vpn.nix | 3 - hosts/common/programs/graphical/hyprland.nix | 11 -- hosts/common/services/command-not-found.nix | 7 - hosts/common/services/openssh.nix | 9 -- hosts/common/services/udev.nix | 5 - hosts/common/system/locale.nix | 4 - hosts/common/system/nixpkgs.nix | 13 -- hosts/common/system/udev.nix | 5 - hosts/common/system/users.nix | 44 ------ hosts/earth/secrets/default.nix | 16 -- hosts/earth/services/libvirtd.nix | 3 - hosts/earth/services/podman.nix | 6 - hosts/earth/services/yggdrasil.nix | 14 -- hosts/earth/system/yggdrasil.nix | 2 - hosts/earth/vpn.nix | 20 --- .../earth/awg0-earth.conf | 0 machines/earth/earth.nix | 46 ++++++ {hosts/earth => modules}/default.nix | 0 modules/universe.nix | 143 ++++++++++++++++++ 79 files changed, 474 insertions(+), 200 deletions(-) create mode 100644 home/users/tx0/default.nix rename home/{ => users/tx0}/profile.nix (100%) rename home/{ => users/tx0}/programs/graphical/anyrun.nix (100%) rename home/{ => users/tx0}/programs/graphical/foot.nix (100%) rename home/{ => users/tx0}/programs/graphical/hyprland/binds.nix (100%) rename home/{ => users/tx0}/programs/graphical/hyprland/default.nix (100%) rename home/{ => users/tx0}/programs/graphical/waybar/default.nix (100%) rename home/{ => users/tx0}/programs/graphical/waybar/scripts/music/default.nix (100%) rename home/{ => users/tx0}/programs/graphical/waybar/scripts/music/main.py (100%) rename home/{ => users/tx0}/programs/graphical/waybar/scripts/music/setup.py (100%) rename home/{ => users/tx0}/programs/graphical/xdg.nix (100%) create mode 100644 home/users/tx0/programs/graphical/zed.nix rename home/{ => users/tx0}/programs/terminal/bat.nix (100%) rename home/{ => users/tx0}/programs/terminal/fish.nix (100%) rename home/{ => users/tx0}/programs/terminal/fzf.nix (100%) rename home/{ => users/tx0}/programs/terminal/git.nix (100%) rename home/{ => users/tx0}/programs/terminal/nh.nix (100%) rename home/{ => users/tx0}/programs/terminal/nvf.nix (100%) rename home/{ => users/tx0}/programs/terminal/tmux.nix (100%) rename home/{ => users/tx0}/programs/terminal/yazi.nix (100%) rename home/{ => users/tx0}/programs/terminal/zoxide.nix (100%) rename home/{ => users/tx0}/services/mako.nix (100%) rename home/{ => users/tx0}/services/udiskie.nix (100%) rename home/{ => users/tx0}/system/packages/default.nix (100%) rename home/{ => users/tx0}/system/packages/derivations/bunnyfetch/bunnyfetch.sh (100%) rename home/{ => users/tx0}/system/packages/derivations/bunnyfetch/default.nix (100%) rename home/{ => users/tx0}/system/packages/derivations/ubports-installer/default.nix (100%) rename home/{ => users/tx0}/system/packages/derivations/ubports-installer/ubports-mascot.png (100%) rename home/{ => users/tx0}/system/symlinks.nix (100%) rename home/{ => users/tx0}/theming/dconf.nix (100%) rename home/{ => users/tx0}/theming/gtk.nix (100%) rename home/{ => users/tx0}/theming/qt.nix (100%) rename home/{ => users/tx0}/theming/stylix.nix (100%) rename home/{ => users/tx0}/theming/x11.nix (100%) rename home/{ => users/tx0}/universe.nix (90%) rename wallpaper.png => home/users/tx0/wallpaper.png (100%) rename {hosts/common => host}/default.nix (100%) create mode 100644 host/programs/graphical/anmezia-vpn.nix create mode 100644 host/programs/graphical/hyprland.nix rename {hosts/common => host}/programs/terminal/fish.nix (100%) create mode 100644 host/services/command-not-found.nix rename {hosts/common => host}/services/libinput.nix (100%) create mode 100644 host/services/libvirtd.nix create mode 100644 host/services/openssh.nix rename {hosts/common => host}/services/packages.nix (100%) rename {hosts/common => host}/services/pipewire.nix (100%) create mode 100644 host/services/podman.nix rename {hosts/common => host}/services/resolved.nix (100%) create mode 100644 host/services/udev.nix rename {hosts/common => host}/services/udisks2.nix (100%) create mode 100644 host/services/vpn.nix rename {hosts/common => host}/system/boot.nix (87%) rename {hosts/earth => host}/system/hardware.nix (96%) create mode 100644 host/system/locale.nix rename {hosts/earth => host}/system/networking.nix (56%) rename {hosts/common => host}/system/nix.nix (100%) create mode 100644 host/system/nixpkgs.nix create mode 100644 host/system/users.nix delete mode 100644 hosts/common/programs/graphical/anmezia-vpn.nix delete mode 100644 hosts/common/programs/graphical/hyprland.nix delete mode 100644 hosts/common/services/command-not-found.nix delete mode 100644 hosts/common/services/openssh.nix delete mode 100644 hosts/common/services/udev.nix delete mode 100644 hosts/common/system/locale.nix delete mode 100644 hosts/common/system/nixpkgs.nix delete mode 100644 hosts/common/system/udev.nix delete mode 100644 hosts/common/system/users.nix delete mode 100644 hosts/earth/secrets/default.nix delete mode 100644 hosts/earth/services/libvirtd.nix delete mode 100644 hosts/earth/services/podman.nix delete mode 100644 hosts/earth/services/yggdrasil.nix delete mode 100644 hosts/earth/system/yggdrasil.nix delete mode 100644 hosts/earth/vpn.nix rename hosts/earth/secrets/awg0.conf => machines/earth/awg0-earth.conf (100%) create mode 100644 machines/earth/earth.nix rename {hosts/earth => modules}/default.nix (100%) create mode 100644 modules/universe.nix diff --git a/flake.nix b/flake.nix index ef01178..6e49767 100644 --- a/flake.nix +++ b/flake.nix @@ -9,35 +9,25 @@ \$$$$$$ |$$ | $$ |$$ | \$ / \$$$$$$$\ $$ | $$$$$$$ |\$$$$$$$\ \______/ \__| \__|\__| \_/ \_______|\__| \_______/ \_______| - A nixos/hm flake + A nixos/hm flake ''; - outputs = {self, ...} @ inputs: let - system = "x86_64-linux"; - in + outputs = {self, ...} @ inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} { flake = let + machineConf = import ./machines/earth/earth.nix {inherit self;}; + system = machineConf.universe.system.arch; u = import ./ulib {inherit inputs system;}; in { nixosConfigurations."earth" = inputs.nixpkgs.lib.nixosSystem { specialArgs = {inherit system inputs u;}; modules = [ - ./hosts/common - ./hosts/earth - # universe + machineConf + ./modules + ./home + ./host inputs.home-manager.nixosModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "hm-old"; - users.tx0 = import ./home; - extraSpecialArgs = {inherit system inputs u;}; - }; - - nixpkgs.overlays = [(import ./overlays/spotx.nix)]; - } ]; }; }; diff --git a/home/default.nix b/home/default.nix index f3fe312..58c806e 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,16 +1,15 @@ -{u, ...}: { - imports = u.umport { - path = ./.; - - include = [ - ./system/packages/default.nix - ./programs/graphical/waybar/default.nix - ]; - - exclude = [ - ./default.nix - ./system/packages - ./programs/graphical/waybar - ]; +{ + config, + system, + inputs, + u, + ... +}: { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "hm-old"; + users.${config.universe.system.username} = import ./users/${config.universe.system.username}; + extraSpecialArgs = {inherit system inputs u;}; }; } diff --git a/home/users/tx0/default.nix b/home/users/tx0/default.nix new file mode 100644 index 0000000..f3fe312 --- /dev/null +++ b/home/users/tx0/default.nix @@ -0,0 +1,16 @@ +{u, ...}: { + imports = u.umport { + path = ./.; + + include = [ + ./system/packages/default.nix + ./programs/graphical/waybar/default.nix + ]; + + exclude = [ + ./default.nix + ./system/packages + ./programs/graphical/waybar + ]; + }; +} diff --git a/home/profile.nix b/home/users/tx0/profile.nix similarity index 100% rename from home/profile.nix rename to home/users/tx0/profile.nix diff --git a/home/programs/graphical/anyrun.nix b/home/users/tx0/programs/graphical/anyrun.nix similarity index 100% rename from home/programs/graphical/anyrun.nix rename to home/users/tx0/programs/graphical/anyrun.nix diff --git a/home/programs/graphical/foot.nix b/home/users/tx0/programs/graphical/foot.nix similarity index 100% rename from home/programs/graphical/foot.nix rename to home/users/tx0/programs/graphical/foot.nix diff --git a/home/programs/graphical/hyprland/binds.nix b/home/users/tx0/programs/graphical/hyprland/binds.nix similarity index 100% rename from home/programs/graphical/hyprland/binds.nix rename to home/users/tx0/programs/graphical/hyprland/binds.nix diff --git a/home/programs/graphical/hyprland/default.nix b/home/users/tx0/programs/graphical/hyprland/default.nix similarity index 100% rename from home/programs/graphical/hyprland/default.nix rename to home/users/tx0/programs/graphical/hyprland/default.nix diff --git a/home/programs/graphical/waybar/default.nix b/home/users/tx0/programs/graphical/waybar/default.nix similarity index 100% rename from home/programs/graphical/waybar/default.nix rename to home/users/tx0/programs/graphical/waybar/default.nix diff --git a/home/programs/graphical/waybar/scripts/music/default.nix b/home/users/tx0/programs/graphical/waybar/scripts/music/default.nix similarity index 100% rename from home/programs/graphical/waybar/scripts/music/default.nix rename to home/users/tx0/programs/graphical/waybar/scripts/music/default.nix diff --git a/home/programs/graphical/waybar/scripts/music/main.py b/home/users/tx0/programs/graphical/waybar/scripts/music/main.py similarity index 100% rename from home/programs/graphical/waybar/scripts/music/main.py rename to home/users/tx0/programs/graphical/waybar/scripts/music/main.py diff --git a/home/programs/graphical/waybar/scripts/music/setup.py b/home/users/tx0/programs/graphical/waybar/scripts/music/setup.py similarity index 100% rename from home/programs/graphical/waybar/scripts/music/setup.py rename to home/users/tx0/programs/graphical/waybar/scripts/music/setup.py diff --git a/home/programs/graphical/xdg.nix b/home/users/tx0/programs/graphical/xdg.nix similarity index 100% rename from home/programs/graphical/xdg.nix rename to home/users/tx0/programs/graphical/xdg.nix diff --git a/home/users/tx0/programs/graphical/zed.nix b/home/users/tx0/programs/graphical/zed.nix new file mode 100644 index 0000000..6b58705 --- /dev/null +++ b/home/users/tx0/programs/graphical/zed.nix @@ -0,0 +1,13 @@ +{config, pkgs,...}: { + programs.zed-editor = { + enable = true; + extensions = [ + "nix" + "pylsp" + ]; + userSettings = { + "buffer_font_size" = config.stylix.fonts.sizes.terminal * 4.0 / 3.0; + }; + extraPackages = with pkgs; [nil nixd]; + }; +} diff --git a/home/programs/terminal/bat.nix b/home/users/tx0/programs/terminal/bat.nix similarity index 100% rename from home/programs/terminal/bat.nix rename to home/users/tx0/programs/terminal/bat.nix diff --git a/home/programs/terminal/fish.nix b/home/users/tx0/programs/terminal/fish.nix similarity index 100% rename from home/programs/terminal/fish.nix rename to home/users/tx0/programs/terminal/fish.nix diff --git a/home/programs/terminal/fzf.nix b/home/users/tx0/programs/terminal/fzf.nix similarity index 100% rename from home/programs/terminal/fzf.nix rename to home/users/tx0/programs/terminal/fzf.nix diff --git a/home/programs/terminal/git.nix b/home/users/tx0/programs/terminal/git.nix similarity index 100% rename from home/programs/terminal/git.nix rename to home/users/tx0/programs/terminal/git.nix diff --git a/home/programs/terminal/nh.nix b/home/users/tx0/programs/terminal/nh.nix similarity index 100% rename from home/programs/terminal/nh.nix rename to home/users/tx0/programs/terminal/nh.nix diff --git a/home/programs/terminal/nvf.nix b/home/users/tx0/programs/terminal/nvf.nix similarity index 100% rename from home/programs/terminal/nvf.nix rename to home/users/tx0/programs/terminal/nvf.nix diff --git a/home/programs/terminal/tmux.nix b/home/users/tx0/programs/terminal/tmux.nix similarity index 100% rename from home/programs/terminal/tmux.nix rename to home/users/tx0/programs/terminal/tmux.nix diff --git a/home/programs/terminal/yazi.nix b/home/users/tx0/programs/terminal/yazi.nix similarity index 100% rename from home/programs/terminal/yazi.nix rename to home/users/tx0/programs/terminal/yazi.nix diff --git a/home/programs/terminal/zoxide.nix b/home/users/tx0/programs/terminal/zoxide.nix similarity index 100% rename from home/programs/terminal/zoxide.nix rename to home/users/tx0/programs/terminal/zoxide.nix diff --git a/home/services/mako.nix b/home/users/tx0/services/mako.nix similarity index 100% rename from home/services/mako.nix rename to home/users/tx0/services/mako.nix diff --git a/home/services/udiskie.nix b/home/users/tx0/services/udiskie.nix similarity index 100% rename from home/services/udiskie.nix rename to home/users/tx0/services/udiskie.nix diff --git a/home/system/packages/default.nix b/home/users/tx0/system/packages/default.nix similarity index 100% rename from home/system/packages/default.nix rename to home/users/tx0/system/packages/default.nix diff --git a/home/system/packages/derivations/bunnyfetch/bunnyfetch.sh b/home/users/tx0/system/packages/derivations/bunnyfetch/bunnyfetch.sh similarity index 100% rename from home/system/packages/derivations/bunnyfetch/bunnyfetch.sh rename to home/users/tx0/system/packages/derivations/bunnyfetch/bunnyfetch.sh diff --git a/home/system/packages/derivations/bunnyfetch/default.nix b/home/users/tx0/system/packages/derivations/bunnyfetch/default.nix similarity index 100% rename from home/system/packages/derivations/bunnyfetch/default.nix rename to home/users/tx0/system/packages/derivations/bunnyfetch/default.nix diff --git a/home/system/packages/derivations/ubports-installer/default.nix b/home/users/tx0/system/packages/derivations/ubports-installer/default.nix similarity index 100% rename from home/system/packages/derivations/ubports-installer/default.nix rename to home/users/tx0/system/packages/derivations/ubports-installer/default.nix diff --git a/home/system/packages/derivations/ubports-installer/ubports-mascot.png b/home/users/tx0/system/packages/derivations/ubports-installer/ubports-mascot.png similarity index 100% rename from home/system/packages/derivations/ubports-installer/ubports-mascot.png rename to home/users/tx0/system/packages/derivations/ubports-installer/ubports-mascot.png diff --git a/home/system/symlinks.nix b/home/users/tx0/system/symlinks.nix similarity index 100% rename from home/system/symlinks.nix rename to home/users/tx0/system/symlinks.nix diff --git a/home/theming/dconf.nix b/home/users/tx0/theming/dconf.nix similarity index 100% rename from home/theming/dconf.nix rename to home/users/tx0/theming/dconf.nix diff --git a/home/theming/gtk.nix b/home/users/tx0/theming/gtk.nix similarity index 100% rename from home/theming/gtk.nix rename to home/users/tx0/theming/gtk.nix diff --git a/home/theming/qt.nix b/home/users/tx0/theming/qt.nix similarity index 100% rename from home/theming/qt.nix rename to home/users/tx0/theming/qt.nix diff --git a/home/theming/stylix.nix b/home/users/tx0/theming/stylix.nix similarity index 100% rename from home/theming/stylix.nix rename to home/users/tx0/theming/stylix.nix diff --git a/home/theming/x11.nix b/home/users/tx0/theming/x11.nix similarity index 100% rename from home/theming/x11.nix rename to home/users/tx0/theming/x11.nix diff --git a/home/universe.nix b/home/users/tx0/universe.nix similarity index 90% rename from home/universe.nix rename to home/users/tx0/universe.nix index 8108fc9..da35245 100644 --- a/home/universe.nix +++ b/home/users/tx0/universe.nix @@ -7,7 +7,7 @@ theme.stylix = { base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml"; # base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; - wallpapers = ../wallpaper.png; + wallpapers = ./wallpaper.png; useLutgen = true; }; }; diff --git a/wallpaper.png b/home/users/tx0/wallpaper.png similarity index 100% rename from wallpaper.png rename to home/users/tx0/wallpaper.png diff --git a/hosts/common/default.nix b/host/default.nix similarity index 100% rename from hosts/common/default.nix rename to host/default.nix diff --git a/host/programs/graphical/anmezia-vpn.nix b/host/programs/graphical/anmezia-vpn.nix new file mode 100644 index 0000000..80d084d --- /dev/null +++ b/host/programs/graphical/anmezia-vpn.nix @@ -0,0 +1,9 @@ +{ + lib, + config, + ... +}: { + config = lib.mkIf config.universe.programs.amnezia-vpn.enable { + programs.amnezia-vpn.enable = true; + }; +} diff --git a/host/programs/graphical/hyprland.nix b/host/programs/graphical/hyprland.nix new file mode 100644 index 0000000..530cb6c --- /dev/null +++ b/host/programs/graphical/hyprland.nix @@ -0,0 +1,15 @@ +{ + inputs, + system, + lib, + config, + ... +}: { + config = lib.mkIf config.universe.de.hyprland.enable { + programs.hyprland = { + enable = true; + package = inputs.hyprland.packages.${system}.hyprland; + portalPackage = inputs.hyprland.packages.${system}.xdg-desktop-portal-hyprland; + }; + }; +} diff --git a/hosts/common/programs/terminal/fish.nix b/host/programs/terminal/fish.nix similarity index 100% rename from hosts/common/programs/terminal/fish.nix rename to host/programs/terminal/fish.nix diff --git a/host/services/command-not-found.nix b/host/services/command-not-found.nix new file mode 100644 index 0000000..898094b --- /dev/null +++ b/host/services/command-not-found.nix @@ -0,0 +1,12 @@ +{ + inputs, + system, + config, + lib, + ... +}: { + config = lib.mkIf config.universe.services.command-not-found.enable { + programs.command-not-found.enable = true; + programs.command-not-found.dbPath = inputs.programsdb.packages.${system}.programs-sqlite; + }; +} diff --git a/hosts/common/services/libinput.nix b/host/services/libinput.nix similarity index 100% rename from hosts/common/services/libinput.nix rename to host/services/libinput.nix diff --git a/host/services/libvirtd.nix b/host/services/libvirtd.nix new file mode 100644 index 0000000..90e779a --- /dev/null +++ b/host/services/libvirtd.nix @@ -0,0 +1,9 @@ +{ + lib, + config, + ... +}: { + config = lib.mkIf config.universe.services.libvirtd.enable { + virtualisation.libvirtd.enable = true; + }; +} diff --git a/host/services/openssh.nix b/host/services/openssh.nix new file mode 100644 index 0000000..3ba3613 --- /dev/null +++ b/host/services/openssh.nix @@ -0,0 +1,17 @@ +{ + lib, + config, + ... +}: let + cfg = config.universe.services.openssh; +in { + config = lib.mkIf cfg.enable { + services.openssh = { + enable = true; + ports = cfg.ports; + settings = { + PasswordAuthentication = false; + }; + }; + }; +} diff --git a/hosts/common/services/packages.nix b/host/services/packages.nix similarity index 100% rename from hosts/common/services/packages.nix rename to host/services/packages.nix diff --git a/hosts/common/services/pipewire.nix b/host/services/pipewire.nix similarity index 100% rename from hosts/common/services/pipewire.nix rename to host/services/pipewire.nix diff --git a/host/services/podman.nix b/host/services/podman.nix new file mode 100644 index 0000000..2403cbc --- /dev/null +++ b/host/services/podman.nix @@ -0,0 +1,12 @@ +{ + lib, + config, + ... +}: { + config = lib.mkIf config.universe.services.podman.enable { + virtualisation.podman = { + enable = true; + dockerCompat = true; + }; + }; +} diff --git a/hosts/common/services/resolved.nix b/host/services/resolved.nix similarity index 100% rename from hosts/common/services/resolved.nix rename to host/services/resolved.nix diff --git a/host/services/udev.nix b/host/services/udev.nix new file mode 100644 index 0000000..9baaa2d --- /dev/null +++ b/host/services/udev.nix @@ -0,0 +1,13 @@ +{ + config, + pkgs, + ... +}: { + services.udev.packages = + [] + ++ ( + if config.universe.programs.android-tools.enable + then [pkgs.android-udev-rules] + else [] + ); +} diff --git a/hosts/common/services/udisks2.nix b/host/services/udisks2.nix similarity index 100% rename from hosts/common/services/udisks2.nix rename to host/services/udisks2.nix diff --git a/host/services/vpn.nix b/host/services/vpn.nix new file mode 100644 index 0000000..1e9b6ab --- /dev/null +++ b/host/services/vpn.nix @@ -0,0 +1,44 @@ +{ + lib, + config, + inputs, + pkgs, + ... +}: let + cfg = config.universe.services.amneziawg; +in { + imports = [ + inputs.sops-nix.nixosModules.sops + ]; + config = lib.mkIf cfg.enable { + sops = { + age.keyFile = "/home/tx0/.age-key.txt"; + + secrets."${cfg.IfName}.conf" = { + format = "binary"; + sopsFile = cfg.secret-config; + path = "/run/secrets.d/{IfName}.conf"; + restartUnits = ["awg-${cfg.IfName}.service"]; + }; + }; + + systemd.services."awg-${cfg.IfName}" = { + enable = true; + description = "AmneziaWG Interface awg0"; + after = ["network.target"]; + wantedBy = ["multi-user.target"]; + + unitConfig = { + ConditionPathExists = "/run/secrets.d/${cfg.IfName}.conf"; + }; + + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStart = "${pkgs.amneziawg-tools}/bin/awg-quick up /run/secrets.d/${cfg.IfName}.conf"; + ExecStop = "${pkgs.amneziawg-tools}/bin/awg-quick down /run/secrets.d/${cfg.IfName}.conf"; + Restart = "on-failure"; + }; + }; + }; +} diff --git a/hosts/common/system/boot.nix b/host/system/boot.nix similarity index 87% rename from hosts/common/system/boot.nix rename to host/system/boot.nix index de01a5e..c55c8b2 100644 --- a/hosts/common/system/boot.nix +++ b/host/system/boot.nix @@ -6,7 +6,7 @@ }: { boot = { kernelPackages = pkgs.linuxPackages_zen; - kernelModules = ["i2c-dev" "ddcci_backlight"]; + kernelModules = ["i2c-dev"]; extraModulePackages = with config.boot.kernelPackages; [ amneziawg ]; diff --git a/hosts/earth/system/hardware.nix b/host/system/hardware.nix similarity index 96% rename from hosts/earth/system/hardware.nix rename to host/system/hardware.nix index 46ca777..ef327be 100644 --- a/hosts/earth/system/hardware.nix +++ b/host/system/hardware.nix @@ -2,7 +2,6 @@ config, lib, modulesPath, - system, ... }: { imports = [ @@ -56,7 +55,6 @@ }; services.xserver.videoDrivers = ["displaylink" "modesetting" "amdgpu"]; - virtualisation.vmware.host.enable = true; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/host/system/locale.nix b/host/system/locale.nix new file mode 100644 index 0000000..c3856ba --- /dev/null +++ b/host/system/locale.nix @@ -0,0 +1,4 @@ +{config, ...}: { + time.timeZone = config.universe.locale.timeZone; + i18n.defaultLocale = config.universe.locale.lang; +} diff --git a/hosts/earth/system/networking.nix b/host/system/networking.nix similarity index 56% rename from hosts/earth/system/networking.nix rename to host/system/networking.nix index 3e0c2e7..0c1f331 100644 --- a/hosts/earth/system/networking.nix +++ b/host/system/networking.nix @@ -1,6 +1,6 @@ -{ +{config, ...}: { networking = { - hostName = "earth"; + hostName = config.universe.system.hostname; networkmanager.enable = true; dhcpcd.enable = true; }; diff --git a/hosts/common/system/nix.nix b/host/system/nix.nix similarity index 100% rename from hosts/common/system/nix.nix rename to host/system/nix.nix diff --git a/host/system/nixpkgs.nix b/host/system/nixpkgs.nix new file mode 100644 index 0000000..7bca31c --- /dev/null +++ b/host/system/nixpkgs.nix @@ -0,0 +1,18 @@ +{ + config, + system, + ... +}: { + system.stateVersion = "24.11"; + nixpkgs = { + config = { + allowUnfree = config.universe.nixpkgs.allowUnfree; + allowBroken = true; + allowAliases = true; + allowInsecure = true; + allowUnfreePredicate = _: config.universe.nixpkgs.allowUnfree; + }; + hostPlatform = system; + overlays = config.universe.nixpkgs.overlays; + }; +} diff --git a/host/system/users.nix b/host/system/users.nix new file mode 100644 index 0000000..854102d --- /dev/null +++ b/host/system/users.nix @@ -0,0 +1,78 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.universe; +in { + users = { + defaultUserShell = pkgs.fish; + users.${cfg.system.username} = { + isNormalUser = true; + extraGroups = + [ + "wheel" + "input" + "networkmanager" + "video" + "audio" + ] + ++ ( + if cfg.services.podman.enable + then ["podman"] + else [] + ) + ++ ( + if cfg.services.libvirtd.enable + then ["kvm"] + else [] + ) + ++ ( + if cfg.programs.android-tools.enable + then ["adbusers"] + else [] + ); + uid = 1000; + subGidRanges = + [] + ++ ( + if cfg.services.podman.enable + then [ + { + count = 65536; + startGid = 100000; + } + ] + else [] + ); + subUidRanges = + [] + ++ ( + if cfg.services.podman.enable + then [ + { + count = 65536; + startUid = 100000; + } + ] + else [] + ); + useDefaultShell = true; + openssh.authorizedKeys = { + keys = cfg.services.openssh.authorizedKeys; + }; + shell = pkgs.fish; + }; + groups = + {} + // lib.genAttrs ( + [] + ++ ( + if cfg.programs.android-tools.enable + then ["adbusers"] + else [] + ) + ) (name: {}); + }; +} diff --git a/hosts/common/programs/graphical/anmezia-vpn.nix b/hosts/common/programs/graphical/anmezia-vpn.nix deleted file mode 100644 index 33465a6..0000000 --- a/hosts/common/programs/graphical/anmezia-vpn.nix +++ /dev/null @@ -1,3 +0,0 @@ -{...}: { - programs.amnezia-vpn.enable = true; -} diff --git a/hosts/common/programs/graphical/hyprland.nix b/hosts/common/programs/graphical/hyprland.nix deleted file mode 100644 index 9955908..0000000 --- a/hosts/common/programs/graphical/hyprland.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - inputs, - system, - ... -}: { - programs.hyprland = { - enable = true; - package = inputs.hyprland.packages.${system}.hyprland; - portalPackage = inputs.hyprland.packages.${system}.xdg-desktop-portal-hyprland; - }; -} diff --git a/hosts/common/services/command-not-found.nix b/hosts/common/services/command-not-found.nix deleted file mode 100644 index 629c755..0000000 --- a/hosts/common/services/command-not-found.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - inputs, - system, - ... -}: { - programs.command-not-found.dbPath = inputs.programsdb.packages.${system}.programs-sqlite; -} diff --git a/hosts/common/services/openssh.nix b/hosts/common/services/openssh.nix deleted file mode 100644 index cc59beb..0000000 --- a/hosts/common/services/openssh.nix +++ /dev/null @@ -1,9 +0,0 @@ -{...}: { - services.openssh = { - enable = true; - ports = [22 48001]; - settings = { - PasswordAuthentication = false; - }; - }; -} diff --git a/hosts/common/services/udev.nix b/hosts/common/services/udev.nix deleted file mode 100644 index 30e59f3..0000000 --- a/hosts/common/services/udev.nix +++ /dev/null @@ -1,5 +0,0 @@ -{pkgs, ...}: { - services.udev.packages = [ - pkgs.android-udev-rules - ]; -} diff --git a/hosts/common/system/locale.nix b/hosts/common/system/locale.nix deleted file mode 100644 index 8056076..0000000 --- a/hosts/common/system/locale.nix +++ /dev/null @@ -1,4 +0,0 @@ -{...}: { - time.timeZone = "Asia/Yekaterinburg"; - i18n.defaultLocale = "en_US.UTF-8"; -} diff --git a/hosts/common/system/nixpkgs.nix b/hosts/common/system/nixpkgs.nix deleted file mode 100644 index ca00db1..0000000 --- a/hosts/common/system/nixpkgs.nix +++ /dev/null @@ -1,13 +0,0 @@ -{system, ...}: { - system.stateVersion = "24.11"; - nixpkgs = { - config = { - allowUnfree = true; - allowBroken = true; - allowAliases = true; - allowInsecure = true; - allowUnfreePredicate = _: true; - }; - hostPlatform = system; - }; -} diff --git a/hosts/common/system/udev.nix b/hosts/common/system/udev.nix deleted file mode 100644 index 6840b4b..0000000 --- a/hosts/common/system/udev.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - services.udev.extraRules = '' - KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660" - ''; -} diff --git a/hosts/common/system/users.nix b/hosts/common/system/users.nix deleted file mode 100644 index 78f3123..0000000 --- a/hosts/common/system/users.nix +++ /dev/null @@ -1,44 +0,0 @@ -{pkgs, ...}: { - users = { - defaultUserShell = pkgs.fish; - users."tx0" = { - isNormalUser = true; - extraGroups = [ - "wheel" - "input" - "networkmanager" - "video" - "audio" - "podman" - "adbusers" - "kvm" - "i2c" - ]; - uid = 1000; - subGidRanges = [ - { - count = 65536; - startGid = 100000; - } - ]; - subUidRanges = [ - { - count = 65536; - startUid = 100000; - } - ]; - useDefaultShell = true; - openssh.authorizedKeys = { - keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCz8WZ+c24RYjBMVNZGMR+IjSQb7WtrMi2ZcfAf6BwNLaKJTlWABN20FSscbGy8oCdfheAKvdTrx+hMRNCmEdTmNZlDXZ0kDBFh1h3I2geC3XNWjXuYSSmZpfW71Tex5ZHpruD9lstL9rBVY7c1ZKJfmtgM5m+x44FZwjxdFffQbj9LtLmy6zWQ7iX7/zzcdPJvJxoQbBwmAeVqZErpR/IoSG2uXTS4tIqGStfg6kBoV/AZBwYCxE0f3jFzajTMm+n6kjnKOiztfaw+NVB4+QLlSvB5i3iJ7afjhv/KfH4/t0gmVCfqo+O9pPOUqLokQvHvAu33M6PP5Roc4mK+pGEYXabUdv757uo8RdDg6x3bu5kgJS+V06ZycnDtHYNda+8/qEh+nryu0TqqJtqALwO2k7VcTgDoMrU3UvXRSA3wIO+Gp8qbPVjJv1/jSKoVurmFe3Wwy0LVEA++zF4F571aOPzwY49q6AF+JuPCUWPy44K7oG6MfFPZSk7TtSelH18= timoxa@pc" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAka1w1Ld4KLiZfztI6Qqe5irM6g8G0ENGmqds+LWiGE" - ]; - }; - shell = pkgs.fish; - }; - groups = { - adbusers = {}; - i2c = {}; - }; - }; -} diff --git a/hosts/earth/secrets/default.nix b/hosts/earth/secrets/default.nix deleted file mode 100644 index 34220a4..0000000 --- a/hosts/earth/secrets/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{inputs, ...}: { - imports = [ - inputs.sops-nix.nixosModules.sops - ]; - sops = { - # defaultSopsFile = ./secrets.yaml; - age.keyFile = "/home/tx0/.age-key.txt"; - - secrets."awg0.conf" = { - format = "binary"; - sopsFile = ./awg0.conf; - path = "/run/secrets.d/awg0.conf"; - restartUnits = ["awg0.service"]; - }; - }; -} diff --git a/hosts/earth/services/libvirtd.nix b/hosts/earth/services/libvirtd.nix deleted file mode 100644 index f485cd0..0000000 --- a/hosts/earth/services/libvirtd.nix +++ /dev/null @@ -1,3 +0,0 @@ -{...}: { - virtualisation.libvirtd.enable = true; -} diff --git a/hosts/earth/services/podman.nix b/hosts/earth/services/podman.nix deleted file mode 100644 index e31c3ac..0000000 --- a/hosts/earth/services/podman.nix +++ /dev/null @@ -1,6 +0,0 @@ -{...}: { - virtualisation.podman = { - enable = true; - dockerCompat = true; - }; -} diff --git a/hosts/earth/services/yggdrasil.nix b/hosts/earth/services/yggdrasil.nix deleted file mode 100644 index 82fa1f8..0000000 --- a/hosts/earth/services/yggdrasil.nix +++ /dev/null @@ -1,14 +0,0 @@ -{...}: { - services.yggdrasil = { - enable = false; - settings = { - Peers = [ - "tls://ygg1.tx0.su:65534" - "tls://ygg2.tx0.su:65534" - "tls://ygg3.tx0.su:65534" - ]; - - IfName = "ygg"; - }; - }; -} diff --git a/hosts/earth/system/yggdrasil.nix b/hosts/earth/system/yggdrasil.nix deleted file mode 100644 index ea8f50d..0000000 --- a/hosts/earth/system/yggdrasil.nix +++ /dev/null @@ -1,2 +0,0 @@ -{...}: { -} diff --git a/hosts/earth/vpn.nix b/hosts/earth/vpn.nix deleted file mode 100644 index 0332893..0000000 --- a/hosts/earth/vpn.nix +++ /dev/null @@ -1,20 +0,0 @@ -{pkgs, ...}: { - systemd.services.awg0 = { - enable = true; - description = "AmneziaWG Interface awg0"; - after = ["network.target"]; - wantedBy = ["multi-user.target"]; - - unitConfig = { - ConditionPathExists = "/run/secrets.d/awg0.conf"; - }; - - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - ExecStart = "${pkgs.amneziawg-tools}/bin/awg-quick up /run/secrets.d/awg0.conf"; - ExecStop = "${pkgs.amneziawg-tools}/bin/awg-quick down /run/secrets.d/awg0.conf"; - Restart = "on-failure"; - }; - }; -} diff --git a/hosts/earth/secrets/awg0.conf b/machines/earth/awg0-earth.conf similarity index 100% rename from hosts/earth/secrets/awg0.conf rename to machines/earth/awg0-earth.conf diff --git a/machines/earth/earth.nix b/machines/earth/earth.nix new file mode 100644 index 0000000..77c7155 --- /dev/null +++ b/machines/earth/earth.nix @@ -0,0 +1,46 @@ +{self, ...}: { + universe = { + programs = { + android-tools.enable = true; + }; + + system = { + tmpUseTmpfs = true; + emulatedSystems = ["aarch64-linux"]; + arch = "x86_64-linux"; + hostname = "earth"; + username = "tx0"; + }; + + nixpkgs = { + allowUnfree = true; + overlays = [(import "${self}/overlays/spotx.nix")]; + }; + + locale = { + lang = "en_US.UTF-8"; + timeZone = "Asia/Yekateringburg"; + }; + + services = { + command-not-found.enable = true; + libvirtd.enable = false; + podman.enable = true; + + openssh = { + enable = true; + ports = [22 48001]; + authorizedKeys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCz8WZ+c24RYjBMVNZGMR+IjSQb7WtrMi2ZcfAf6BwNLaKJTlWABN20FSscbGy8oCdfheAKvdTrx+hMRNCmEdTmNZlDXZ0kDBFh1h3I2geC3XNWjXuYSSmZpfW71Tex5ZHpruD9lstL9rBVY7c1ZKJfmtgM5m+x44FZwjxdFffQbj9LtLmy6zWQ7iX7/zzcdPJvJxoQbBwmAeVqZErpR/IoSG2uXTS4tIqGStfg6kBoV/AZBwYCxE0f3jFzajTMm+n6kjnKOiztfaw+NVB4+QLlSvB5i3iJ7afjhv/KfH4/t0gmVCfqo+O9pPOUqLokQvHvAu33M6PP5Roc4mK+pGEYXabUdv757uo8RdDg6x3bu5kgJS+V06ZycnDtHYNda+8/qEh+nryu0TqqJtqALwO2k7VcTgDoMrU3UvXRSA3wIO+Gp8qbPVjJv1/jSKoVurmFe3Wwy0LVEA++zF4F571aOPzwY49q6AF+JuPCUWPy44K7oG6MfFPZSk7TtSelH18= timoxa@pc" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAka1w1Ld4KLiZfztI6Qqe5irM6g8G0ENGmqds+LWiGE" + ]; + }; + + amneziawg = { + enable = true; + secret-config = ./awg0-earth.conf; + IfName = "awg0"; + }; + }; + }; +} diff --git a/hosts/earth/default.nix b/modules/default.nix similarity index 100% rename from hosts/earth/default.nix rename to modules/default.nix diff --git a/modules/universe.nix b/modules/universe.nix new file mode 100644 index 0000000..bb404dc --- /dev/null +++ b/modules/universe.nix @@ -0,0 +1,143 @@ +{ + lib, + boot, + ... +}: +with lib; let + nixpkgsOverlayType = lib.mkOptionType { + name = "nixpkgs-overlay"; + description = "nixpkgs overlay"; + check = lib.isFunction; + merge = lib.mergeOneOption; + }; +in { + options.universe = { + programs = { + amnezia-vpn.enable = mkEnableOption "Enable AmneziaVPN app"; + android-tools.enable = mkEnableOption "Enable android tools (adb, fastboot, ...)"; + }; + + system = { + tmpUseTmpfs = mkEnableOption "Use tmpfs for /tmp"; + emulatedSystems = mkOption { + description = "Systems to emulate"; + type = with types; listOf enum builtins.attrNames boot.binfmt.magics; + default = []; + }; + arch = mkOption { + description = "System architecture"; + type = with types; uniq str; + }; + hostname = mkOption { + description = "System hostname"; + type = with types; uniq str; + }; + username = mkOption { + description = "Username"; + type = with types; uniq str; + }; + }; + + nixpkgs = { + allowUnfree = mkEnableOption "Enable non-free software"; + overlays = mkOption { + description = "List of nixpkgs overlays"; + type = with types; listOf nixpkgsOverlayType; + default = []; + }; + }; + + locale = { + timeZone = mkOption { + description = "System time zone"; + type = with types; uniq str; + default = "Asia/Yekaterinburg"; + }; + lang = mkOption { + description = "System locale"; + type = with types; uniq str; + default = "en_US.UTF-8"; + }; + }; + + services = { + command-not-found.enable = mkEnableOption "Enable command-not-found"; + libvirtd.enable = mkEnableOption "Enable libvirtd"; + podman.enable = mkEnableOption "Enable libvirtd"; + openssh = { + enable = mkEnableOption "Enable openssh server"; + ports = mkOption { + description = "Listen ports"; + type = with types; uniq (listOf port); + default = [22]; + }; + authorizedKeys = mkOption { + description = "Authorized public ssh keys"; + type = with types; uniq (listOf str); + default = []; + }; + }; + amneziawg = { + enable = mkEnableOption "Enable amneziawg vpn service"; + secret-config = mkOption { + description = "Configuration SOPS secret"; + type = with types; nullOr path; + default = null; + }; + IfName = mkOption { + description = "Interface name"; + type = with types; uniq str; + }; + }; + }; + + de = { + hyprland = { + enable = mkEnableOption "Enable Hyprland"; + }; + waybar = { + enable = mkEnableOption "Enable waybar"; + settings = { + radiuses = { + outer = mkOption { + type = types.int; + default = 100; + }; + inner = mkOption { + type = types.int; + default = 40; + }; + bar = mkOption { + type = types.int; + default = 25; + }; + }; + gapps = { + outer = mkOption { + type = types.int; + default = 6; + }; + inner = mkOption { + type = types.int; + default = 8; + }; + chips = mkOption { + type = types.int; + default = 4; + }; + }; + sizes = { + icons = mkOption { + type = types.int; + default = 20; + }; + text = mkOption { + type = types.int; + default = 15; + }; + }; + }; + }; + }; + }; +}