diff --git a/flake.nix b/flake.nix index 4460357..754da83 100644 --- a/flake.nix +++ b/flake.nix @@ -21,13 +21,29 @@ in { nixosConfigurations = { - laptop = nixpkgs.lib.nixosSystem { + electra = nixpkgs.lib.nixosSystem { inherit system; modules = [ { nixpkgs.config.allowUnfree = true; } - ./hosts/laptop/configuration.nix + ./hosts/electra/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.alisceon = import ./home/users/alisceon.nix; + home-manager.backupFileExtension = "backup"; + } + ]; + }; + tower = nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + { + nixpkgs.config.allowUnfree = true; + } + ./hosts/tower/configuration.nix home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/home/users/alisceon.nix b/home/users/alisceon.nix index 56c2694..5d40d4f 100644 --- a/home/users/alisceon.nix +++ b/home/users/alisceon.nix @@ -18,8 +18,8 @@ grep = "rg"; cat = "bat"; tsla-fan = "ipmitool -H 10.30.0.3 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01 0x0"; - nixos-switch = "sudo nixos-rebuild switch --flake .#"; - nixos-test = "sudo nixos-rebuild build-vm --flake .#"; + nixos-switch = "sudo nixos-rebuild switch --flake .#${config.networking.hostName}"; + nixos-test = "sudo nixos-rebuild build-vm --flake .#${config.networking.hostName}"; pypod = "podman run --rm -it --network host -v '.:/run' -w '/run' python /run/"; }; }; diff --git a/hosts/electra/configuration.nix b/hosts/electra/configuration.nix index 93694fe..61770fa 100644 --- a/hosts/electra/configuration.nix +++ b/hosts/electra/configuration.nix @@ -3,77 +3,139 @@ { imports = [ ./hardware-configuration.nix ]; + + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + initrd = { + enable = true; + luks.devices."luks-654125f4-7b26-408d-b1b5-d31648ec8770".device = "/dev/disk/by-uuid/654125f4-7b26-408d-b1b5-d31648ec8770"; + verbose = false; + }; + + + plymouth = { + enable = true; + theme = "rings"; + themePackages = with pkgs; [ + # By default we would install all themes + (adi1090x-plymouth-themes.override { + selected_themes = [ "rings" ]; + }) + ]; + }; + consoleLogLevel = 3; + kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "udev.log_priority=3" + "rd.systemd.show_status=auto" + "mem_sleep_default=s2idle" + ]; + loader.timeout = 0; + #resumeDevice = "/dev/disk/by-uuid/c49249b9-0d68-44af-97e0-e399c8409408"; + }; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-partlabel/luks"; - - boot.resumeDevice = "/dev/vg0/swap"; - - time.timeZone = "Europe/Stockholm"; - i18n.defaultLocale = "sv_SE.UTF-8"; - - services.openssh.enable = true; - - fileSystems."/".options = [ "compress=zstd" ]; networking.hostName = "electra"; networking.networkmanager.enable = true; + time.timeZone = "Europe/Stockholm"; + i18n.defaultLocale = "en_US.UTF-8"; - services.xserver = { - enable = true; - displayManager.gdm.enable = true; + i18n.extraLocaleSettings = { + LC_ADDRESS = "sv_SE.UTF-8"; + LC_IDENTIFICATION = "sv_SE.UTF-8"; + LC_MEASUREMENT = "sv_SE.UTF-8"; + LC_MONETARY = "sv_SE.UTF-8"; + LC_NAME = "sv_SE.UTF-8"; + LC_NUMERIC = "sv_SE.UTF-8"; + LC_PAPER = "sv_SE.UTF-8"; + LC_TELEPHONE = "sv_SE.UTF-8"; + LC_TIME = "sv_SE.UTF-8"; + }; + + nix.settings.auto-optimise-store = true; + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + + console.keyMap = "sv-latin1"; + + services= { + printing.enable = true; + fwupd.enable = true; + thermald.enable = true; + pulseaudio.enable = false; + gnome.gnome-keyring.enable = true; + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + jack.enable = true; + }; + power-profiles-daemon.enable = true; + displayManager = { + gdm.enable = true; + gdm.wayland = true; + }; desktopManager.gnome.enable = true; - xkb.layout = "us"; - displayManager.gdm.wayland = true; + xserver.xkb.layout = "se"; }; - services.printing.enable = true; - sound.enable = true; - hardware.pulseaudio.enable = false; - services.pipewire = { - enable = true; - alsa.enable = true; - pulse.enable = true; - jack.enable = true; + programs = { + dconf.enable = true; + fish.enable = true; + steam = { + enable = true; + remotePlay.openFirewall = true; + }; }; - services.fwupd.enable = true; - - users.users.dummy = { - isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" "podman" ]; - shell = pkgs.fish; - hashedPassword = "!" ; # placeholder - }; - - security.sudo.wheelNeedsPassword = false; - - programs.fish.enable = true; - environment.systemPackages = with pkgs; [ + # NIX Tools + vulnix + + # CLI tools git wget curl - podman - firefox - discord - signal-desktop - vscode - obsidian - alacritty - gnome.gnome-tweaks - gnome.dconf-editor - gnomeExtensions.pop-shell - tlp - bat btop ripgrep + bat fd eza + bash + + # Chat + discord + signal-desktop + + # Browser + firefox + + # Development + vscode + devenv + direnv + + # Virtualization + podman + + # GNOME tweaks and extensions + gnome-tweaks + dconf-editor + gnomeExtensions.ddterm + gnomeExtensions.unpanel + + # Other + syncthing + steam + obsidian ]; virtualisation.podman = { @@ -82,11 +144,18 @@ defaultNetwork.settings.dns_enabled = true; }; - services.tlp.enable = true; + users.users.alisceon = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" "podman" ]; + shell = pkgs.fish; + }; - programs.dconf.enable = true; + security.sudo.wheelNeedsPassword = false; - environment.shells = with pkgs; [ fish ]; + environment.shells = with pkgs; [ + fish + bash + ]; system.stateVersion = "24.05"; } diff --git a/hosts/electra/disko.nix b/hosts/electra/disko.nix deleted file mode 100644 index 682561b..0000000 --- a/hosts/electra/disko.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - device = "/dev/nvme0n1"; - - content = { - type = "gpt"; - partitions = { - boot = { - size = "512M"; - type = "EF00"; # EFI system partition - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - - luks = { - size = "100%"; - content = { - type = "luks"; - name = "cryptroot"; - settings.allowDiscards = true; - content = { - type = "lvm_pv"; - vg = "vg0"; - }; - }; - }; - }; - }; - - swap = { - size = "32G"; # Adjust to your RAM size - content = { - type = "swap"; - resumeDevice = true; - }; - }; - - lvm_vgs.vg0 = { - lvs = { - root = { - size = "100%FREE"; - content = { - type = "filesystem"; - format = "btrfs"; - mountpoint = "/"; - }; - }; - }; - }; -} diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/electra/hardware-configuration.nix similarity index 100% rename from hosts/laptop/hardware-configuration.nix rename to hosts/electra/hardware-configuration.nix diff --git a/hosts/laptop/configuration.nix b/hosts/tower/configuration.nix similarity index 69% rename from hosts/laptop/configuration.nix rename to hosts/tower/configuration.nix index 61770fa..07b3973 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/tower/configuration.nix @@ -7,13 +7,7 @@ boot = { loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; - initrd = { - enable = true; - luks.devices."luks-654125f4-7b26-408d-b1b5-d31648ec8770".device = "/dev/disk/by-uuid/654125f4-7b26-408d-b1b5-d31648ec8770"; - verbose = false; - }; - - + initrd.enable = true; plymouth = { enable = true; theme = "rings"; @@ -39,7 +33,7 @@ nix.settings.experimental-features = [ "nix-command" "flakes" ]; - networking.hostName = "electra"; + networking.hostName = "tower"; networking.networkmanager.enable = true; time.timeZone = "Europe/Stockholm"; @@ -56,7 +50,16 @@ LC_TELEPHONE = "sv_SE.UTF-8"; LC_TIME = "sv_SE.UTF-8"; }; + + + services.displayManager = { + gdm.enable = true; + gdm.wayland = true; + }; + services.desktopManager.gnome.enable = true; + services.xserver.xkb.layout = "se"; + services.gnome.gnome-keyring.enable = true; nix.settings.auto-optimise-store = true; nix.gc = { automatic = true; @@ -66,40 +69,25 @@ console.keyMap = "sv-latin1"; - services= { - printing.enable = true; - fwupd.enable = true; - thermald.enable = true; - pulseaudio.enable = false; - gnome.gnome-keyring.enable = true; - pipewire = { - enable = true; - alsa.enable = true; - pulse.enable = true; - jack.enable = true; - }; - power-profiles-daemon.enable = true; - displayManager = { - gdm.enable = true; - gdm.wayland = true; - }; - desktopManager.gnome.enable = true; - xserver.xkb.layout = "se"; + services.printing.enable = true; + services.pulseaudio.enable = false; + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + jack.enable = true; }; - programs = { - dconf.enable = true; - fish.enable = true; - steam = { - enable = true; - remotePlay.openFirewall = true; - }; + services.fwupd.enable = true; + + + programs.fish.enable = true; + programs.steam = { + enable = true; + remotePlay.openFirewall = true; }; environment.systemPackages = with pkgs; [ - # NIX Tools - vulnix - # CLI tools git wget @@ -118,10 +106,9 @@ # Browser firefox - # Development + # Editor vscode - devenv - direnv + obsidian # Virtualization podman @@ -132,10 +119,10 @@ gnomeExtensions.ddterm gnomeExtensions.unpanel + # Other syncthing steam - obsidian ]; virtualisation.podman = { @@ -151,11 +138,9 @@ }; security.sudo.wheelNeedsPassword = false; + programs.dconf.enable = true; - environment.shells = with pkgs; [ - fish - bash - ]; + environment.shells = with pkgs; [ fish ]; system.stateVersion = "24.05"; } diff --git a/hosts/tower/hardware-configuration.nix b/hosts/tower/hardware-configuration.nix new file mode 100644 index 0000000..323fa96 --- /dev/null +++ b/hosts/tower/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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 + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0fd6a4e2-3fa3-4a9a-90fa-8679feb0196d"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E212-41FD"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + 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.enp10s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}