diff --git a/flake.nix b/flake.nix index b9ec5f8..2f0e254 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,7 @@ ./modules ./hosts/common.nix ./hosts/Yura-PC + ./users/cazzzer # https://nix-community.github.io/home-manager/index.xhtml#sec-flakes-nixos-module home-manager.nixosModules.home-manager { @@ -52,7 +53,9 @@ modules = [ ./modules ./hosts/common.nix + ./hosts/hw-vm.nix ./hosts/vm + ./users/cazzzer ]; }; router = nixpkgs.lib.nixosSystem { @@ -62,6 +65,7 @@ ./modules ./hosts/common.nix ./hosts/router + ./users/cazzzer ]; }; }; @@ -72,11 +76,25 @@ modules = [ ./modules ./hosts/common.nix - ./hosts/vm/proxmox.nix + ./hosts/hw-proxmox.nix ./hosts/vm + ./users/cazzzer ]; format = "proxmox"; }; }; + vm-proxmox = let + image = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./modules + ./hosts/common.nix + ./hosts/hw-proxmox.nix + ./hosts/vm + ./users/cazzzer + ]; + }; + in + image.config.system.build.VMA; }; } diff --git a/home/default.nix b/home/default.nix index 15cd179..7e0772d 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,15 +1,12 @@ { config, lib, pkgs, ... }: let - defaultFont = { - family = "Noto Sans"; - pointSize = 14; - }; + username = "cazzzer"; in { # Home Manager needs a bit of information about you and the paths it should # manage. - home.username = "cazzzer"; - home.homeDirectory = "/home/cazzzer"; + home.username = username; + home.homeDirectory = "/home/${username}"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; @@ -126,8 +123,15 @@ in programs.plasma = { enable = true; overrideConfig = true; + # TODO: figure out how to enable tela-circle icon theme if installed in systemPackages + # workspace.iconTheme = if builtins.elem pkgs.tela-circle-icon-theme config.environment.systemPackages then "Tela-circle" else null; workspace.iconTheme = "Tela-circle"; - fonts = { + fonts = let + defaultFont = { + family = "Noto Sans"; + pointSize = 14; + }; + in { general = defaultFont; fixedWidth = defaultFont // { family = "Hack"; }; small = defaultFont // { pointSize = defaultFont.pointSize - 2; }; diff --git a/hosts/Yura-PC/default.nix b/hosts/Yura-PC/default.nix index d903f8f..9e9d8be 100644 --- a/hosts/Yura-PC/default.nix +++ b/hosts/Yura-PC/default.nix @@ -88,7 +88,7 @@ services.openssh.enable = true; services.flatpak.enable = true; # services.geoclue2.enable = true; - location.provider = "geoclue2"; + # location.provider = "geoclue2"; # services.gnome.gnome-keyring.enable = true; security.pam.services.sddm.enableGnomeKeyring = true; # security.pam.services.sddm.gnupg.enable = true; @@ -97,42 +97,6 @@ # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.groups = { - cazzzer = { - gid = 1000; - }; - }; - users.users.cazzzer = { - isNormalUser = true; - description = "Yura"; - uid = 1000; - group = "cazzzer"; - extraGroups = [ "networkmanager" "wheel" "docker" "wireshark" "geoclue" ]; - packages = with pkgs; [ - # Python - python3 - poetry - - # Haskell - haskellPackages.ghc - haskellPackages.stack - - # Node - nodejs_22 - pnpm - bun - - # Nix - nixd - nil - - # Gleam - gleam - beamMinimal26Packages.erlang - ]; - }; - hardware.bluetooth.enable = true; hardware.bluetooth.powerOnBoot = false; # Install firefox. @@ -168,9 +132,6 @@ # }; # }; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - # List packages installed in system profile. To search, run: # $ nix search wget @@ -219,6 +180,7 @@ ripgrep starship tealdeer + transcrypt ] ++ [ efibootmgr ffmpeg diff --git a/hosts/hw-proxmox.nix b/hosts/hw-proxmox.nix new file mode 100644 index 0000000..1a8b70a --- /dev/null +++ b/hosts/hw-proxmox.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ + "${modulesPath}/virtualisation/proxmox-image.nix" + ]; + + # boot.kernelParams = [ "console=tty0" ]; + proxmox.qemuConf.bios = "ovmf"; + proxmox.qemuExtraConf = { + machine = "q35"; + # efidisk0 = "local-lvm:vm-9999-disk-1"; + cpu = "host"; + }; + proxmox.cloudInit.enable = false; +} diff --git a/hosts/hw-vm.nix b/hosts/hw-vm.nix new file mode 100644 index 0000000..e33622f --- /dev/null +++ b/hosts/hw-vm.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, modulesPath, ... }: { + imports = [ + "${modulesPath}/profiles/qemu-guest.nix" + ]; + + boot.initrd.availableKernelModules = lib.mkDefault [ "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + + fileSystems."/" = lib.mkDefault { + device = "/dev/disk/by-label/nixos"; + autoResize = true; + fsType = "ext4"; + }; + fileSystems."/boot" = lib.mkDefault { + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; + }; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp6s18.useDHCP = lib.mkDefault true; + + # nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/router/default.nix b/hosts/router/default.nix index 9381c9d..ffcc5b7 100644 --- a/hosts/router/default.nix +++ b/hosts/router/default.nix @@ -53,24 +53,6 @@ in security.sudo.wheelNeedsPassword = false; - users.groups = { - cazzzer = { - gid = 1000; - }; - }; - users.users.cazzzer = { - password = ""; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPWgEzbEjbbu96MVQzkiuCrw+UGYAXN4sRe2zM6FVopq cazzzer@Yura-PC" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIApFeLVi3BOquL0Rt+gQK2CutNHaBDQ0m4PcGWf9Bc43 cazzzer@Yura-TPX13" - ]; - isNormalUser = true; - description = "Yura"; - uid = 1000; - group = "cazzzer"; - extraGroups = [ "wheel" "wireshark" ]; - }; - programs.firefox.enable = true; programs.fish.enable = true; programs.git.enable = true; diff --git a/hosts/vm/default.nix b/hosts/vm/default.nix index 57d59f4..26d642f 100644 --- a/hosts/vm/default.nix +++ b/hosts/vm/default.nix @@ -7,7 +7,7 @@ { imports = [ # Include the results of the hardware scan. -# ./hardware-configuration-vm.nix + # ./hardware-configuration.nix ]; mods.kb-input.enable = false; @@ -47,8 +47,8 @@ services.flatpak.enable = true; # VM services - services.cloud-init.enable = true; -# services.cloud-init.network.enable = false; + # services.cloud-init.enable = false; + # services.cloud-init.network.enable = false; services.qemuGuest.enable = true; services.spice-vdagentd.enable = true; services.openssh.enable = true; @@ -57,24 +57,6 @@ security.sudo.wheelNeedsPassword = false; - users.groups = { - cazzzer = { - gid = 1000; - }; - }; - users.users.cazzzer = { - password = ""; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPWgEzbEjbbu96MVQzkiuCrw+UGYAXN4sRe2zM6FVopq cazzzer@Yura-PC" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIApFeLVi3BOquL0Rt+gQK2CutNHaBDQ0m4PcGWf9Bc43 cazzzer@Yura-TPX13" - ]; - isNormalUser = true; - description = "Yura"; - uid = 1000; - group = "cazzzer"; - extraGroups = [ "wheel" "docker" "wireshark" ]; - }; - # Install firefox. programs.firefox.enable = true; programs.fish.enable = true; diff --git a/hosts/vm/hardware-configuration.nix b/hosts/vm/hardware-configuration.nix deleted file mode 100644 index 6a51b41..0000000 --- a/hosts/vm/hardware-configuration.nix +++ /dev/null @@ -1,37 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/profiles/qemu-guest.nix") - ]; - - boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/da85e220-e2b0-443a-9a0c-a9516b8e5030"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/3F96-8974"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - swapDevices = [ ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp6s18.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; -} diff --git a/hosts/vm/proxmox.nix b/hosts/vm/proxmox.nix deleted file mode 100644 index fbdabea..0000000 --- a/hosts/vm/proxmox.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: - -{ -# boot.kernelParams = [ "console=tty0" ]; - proxmox.qemuConf.bios = "ovmf"; - proxmox.qemuExtraConf = { - machine = "q35"; -# efidisk0 = "local-lvm:vm-9999-disk-1"; - cpu = "host"; - }; -} diff --git a/users/cazzzer/default.nix b/users/cazzzer/default.nix new file mode 100644 index 0000000..5daf2de --- /dev/null +++ b/users/cazzzer/default.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: { + users.groups.cazzzer.gid = 1000; + users.users.cazzzer = { + uid = 1000; + isNormalUser = true; + description = "Yura"; + group = "cazzzer"; + extraGroups = [ "wheel" ] + ++ lib.optionals config.networking.networkmanager.enable [ "networkmanager" ] + ++ lib.optionals config.virtualisation.docker.enable [ "docker" ] + ++ lib.optionals config.programs.wireshark.enable [ "wireshark" ] + ; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE02AhJIZtrtZ+5sZhna39LUUCEojQzmz2BDWguT9ZHG yuri@tati.sh" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHczlipzGWv8c6oYwt2/9ykes5ElfneywDXBTOYbfSfn Pixel7Pro" + ]; + # TODO: think of a better way to do this + packages = with pkgs; lib.optionals (config.networking.hostName == "Yura-PC") [ + # Python + python3 + poetry + + # Haskell + haskellPackages.ghc + haskellPackages.stack + + # Node + nodejs_22 + pnpm + bun + + # Nix + nil + nixd + nixfmt-rfc-style + + # Gleam + gleam + beamMinimal26Packages.erlang + ]; + }; +}