diff --git a/flake.lock b/flake.lock index a3e367b..c58ac6c 100644 --- a/flake.lock +++ b/flake.lock @@ -62,6 +62,26 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731746438, + "narHash": "sha256-f3SSp1axoOk0NAI7oFdRzbxG2XPBSIXC+/DaAXnvS1A=", + "owner": "nix-community", + "repo": "disko", + "rev": "cb64993826fa7a477490be6ccb38ba1fa1e18fa8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "dotfiles": { "flake": false, "locked": { @@ -253,6 +273,7 @@ "root": { "inputs": { "agenix": "agenix", + "disko": "disko", "dotfiles": "dotfiles", "home-manager": "home-manager_2", "hyprpanel": "hyprpanel", diff --git a/flake.nix b/flake.nix index 5fca0a7..f744d7a 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,11 @@ agenix.url = "github:ryantm/agenix"; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + hyprpanel.url = "github:Jas-SinghFSU/HyprPanel"; dotfiles = { @@ -63,6 +68,15 @@ agenix.nixosModules.default ]; }; + m3-helios = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + system = "x86_64-linux"; + modules = [ + ./hosts/m3-helios + inputs.disko.nixosModules.disko + agenix.nixosModules.default + ]; + }; }; homeConfigurations = { "m3tam3re@m3-kratos" = home-manager.lib.homeManagerConfiguration { diff --git a/home/features/cli/default.nix b/home/features/cli/default.nix index d3e000f..abf14d6 100644 --- a/home/features/cli/default.nix +++ b/home/features/cli/default.nix @@ -75,7 +75,7 @@ unzip wttrbar wireguard-tools - #yazi + yazi zellij-ps zip ]; diff --git a/home/m3tam3re/home-server.nix b/home/m3tam3re/home-server.nix new file mode 100644 index 0000000..6df5604 --- /dev/null +++ b/home/m3tam3re/home-server.nix @@ -0,0 +1,115 @@ +# This is a default home.nix generated by the follwing hone-manager command +# +# home-manager init ./ +{ + config, + lib, + pkgs, + ... +}: { + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = lib.mkDefault "your-name"; + home.homeDirectory = lib.mkDefault "/home/${config.home.username}"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "24.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. If you don't want to manage your shell through Home + # Manager then you have to manually source 'hm-session-vars.sh' located at + # either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/m3tam3re/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + programs.git = { + enable = true; + userName = "m3tam3re"; + userEmail = "m@m3tam3re.com"; + aliases = {st = "status";}; + extraConfig = { + core.excludesfile = "~/.gitignore_global"; + init.defaultBranch = "master"; + }; + }; + programs.zellij-ps = { + enable = true; + projectFolders = [ + "${config.home.homeDirectory}/p/c" + "${config.home.homeDirectory}/p" + "${config.home.homeDirectory}/.config" + ]; + layout = '' + layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane size="70%" command="nvim" + pane split_direction="vertical" { + pane + pane command="unimatrix" + } + pane size=1 borderless=true { + plugin location="zellij:status-bar" + } + } + ''; + }; +} diff --git a/home/m3tam3re/m3-helios.nix b/home/m3tam3re/m3-helios.nix new file mode 100644 index 0000000..1794a09 --- /dev/null +++ b/home/m3tam3re/m3-helios.nix @@ -0,0 +1,17 @@ +{ + imports = [ + ../common + ../features/cli + ./home-server.nix + ]; + + features = { + cli = { + fish.enable = true; + fzf.enable = true; + neofetch.enable = true; + secrets.enable = false; + starship.enable = true; + }; + }; +} diff --git a/hosts/common/extraServices/flatpak.nix b/hosts/common/extraServices/flatpak.nix index b7ac4c5..608088c 100644 --- a/hosts/common/extraServices/flatpak.nix +++ b/hosts/common/extraServices/flatpak.nix @@ -15,6 +15,7 @@ in { # xdg desktop intergration (required for flatpak) enable = true; extraPortals = [pkgs.xdg-desktop-portal-gtk]; + config.common.default = "*"; }; }; } diff --git a/hosts/common/extraServices/wireguard.nix b/hosts/common/extraServices/wireguard.nix deleted file mode 100644 index 8b13789..0000000 --- a/hosts/common/extraServices/wireguard.nix +++ /dev/null @@ -1 +0,0 @@ - diff --git a/hosts/m3-helios/configuration.nix b/hosts/m3-helios/configuration.nix new file mode 100644 index 0000000..d3addbc --- /dev/null +++ b/hosts/m3-helios/configuration.nix @@ -0,0 +1,111 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). +{pkgs, ...}: { + imports = [ + # Include the results of the hardware scan. + ./disko-config.nix + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.grub = { + efiSupport = true; + efiInstallAsRemovable = true; + }; + + networking.hostName = "m3-helios"; # Define your hostname. + networking.hostId = "3ebf1cd3"; + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = + true; # Easiest to use and most distros use this by default. + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkb.options in tty. + # }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + # services.xserver.displayManager.gdm.enable = true; + # services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + # services.xserver.xkb.layout = "us"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + # hardware.pulseaudio.enable = true; + # OR + + # Enable touchpad support (enabled default in most desktopManager). + # services.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [neovim git]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + services.fstrim = { + enable = true; # For SSD/thin-provisioned storage + interval = "weekly"; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "24.11"; # Did you read the comment? +} diff --git a/hosts/m3-helios/default.nix b/hosts/m3-helios/default.nix new file mode 100644 index 0000000..3e17ab6 --- /dev/null +++ b/hosts/m3-helios/default.nix @@ -0,0 +1,49 @@ +# A staring point is the basic NIXOS configuration generated by the ISO installer. +# On an existing NIXOS install you can use the following command in your flakes basedir: +# sudo nixos-generate-config --dir ./hosts/m3tam3re +# +# Please make sure to change the first couple of lines in your configuration.nix: +# { config, inputs, ouputs, lib, pkgs, ... }: +# +# { +# imports = [ # Include the results of the hardware scan. +# ./hardware-configuration.nix +# inputs.home-manager.nixosModules.home-manager +# ]; +# ... +# +# Moreover please update the packages option in your user configuration and add the home-manager options: +# users.users = { +# m3tam3re = { +# isNormalUser = true; +# initialPassword = "12345"; +# extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. +# packages = [ inputs.home-manager.packages.${pkgs.system}.default ]; +# }; +# }; +# +# home-manager = { +# useUserPackages = true; +# extraSpecialArgs = { inherit inputs outputs; }; +# users.m3tam3re = +# import ../../home/m3tam3re/${config.networking.hostName}.nix; +# }; +# +# Please also change your hostname accordingly: +#:w +# networking.hostName = "nixos"; # Define your hostname. +{ + imports = [ + ../common + ./configuration.nix + ./programs.nix + ./services + ]; + + extraServices = { + flatpak.enable = true; + ollama.enable = false; + podman.enable = true; + virtualisation.enable = false; + }; +} diff --git a/hosts/m3-helios/disko-config.nix b/hosts/m3-helios/disko-config.nix new file mode 100644 index 0000000..ed8a8b6 --- /dev/null +++ b/hosts/m3-helios/disko-config.nix @@ -0,0 +1,39 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + boot = { + size = "1M"; + type = "EF02"; # for GRUB MBR + priority = 1; + }; + esp = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["defaults" "umask=0077"]; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = ["noatime" "nodiratime" "discard"]; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/m3-helios/hardware-configuration.nix b/hosts/m3-helios/hardware-configuration.nix new file mode 100644 index 0000000..4e571c8 --- /dev/null +++ b/hosts/m3-helios/hardware-configuration.nix @@ -0,0 +1,24 @@ +# 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 = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + # 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.ens18.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/m3-helios/programs.nix b/hosts/m3-helios/programs.nix new file mode 100644 index 0000000..829e7cf --- /dev/null +++ b/hosts/m3-helios/programs.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: { + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + # Add any missing dynamic libraries for unpackaged programs + # here, NOT in environment.systemPackages + ]; + programs.fish.enable = true; + programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 4d --keep 3"; + flake = "/home/m3tam3re/p/nixos/nixos-config"; + }; +} diff --git a/hosts/m3-helios/services/adguard.nix b/hosts/m3-helios/services/adguard.nix new file mode 100644 index 0000000..2bc68f7 --- /dev/null +++ b/hosts/m3-helios/services/adguard.nix @@ -0,0 +1,15 @@ +{ + services.adguardhome = { + enable = true; + openFirewall = true; + settings = { + dns = { + port = 53; + upstream_dns = [ + "1.1.1.1" + "8.8.8.8" + ]; + }; + }; + }; +} diff --git a/hosts/m3-helios/services/containers/default.nix b/hosts/m3-helios/services/containers/default.nix new file mode 100644 index 0000000..f7e9be4 --- /dev/null +++ b/hosts/m3-helios/services/containers/default.nix @@ -0,0 +1,4 @@ +{ + imports = [ + ]; +} diff --git a/hosts/m3-helios/services/default.nix b/hosts/m3-helios/services/default.nix new file mode 100644 index 0000000..2fed452 --- /dev/null +++ b/hosts/m3-helios/services/default.nix @@ -0,0 +1,12 @@ +{ + imports = [ + ./adguard.nix + ./containers + ]; + systemd.sleep.extraConfig = '' + AllowSuspend=no + AllowHibernation=no + AllowHybridSleep=no + AllowSuspendThenHibernate=no + ''; +}