From cd35565370995cf02ceebec5ac4de6f14c9a0c2c Mon Sep 17 00:00:00 2001 From: alisceon Date: Tue, 12 Aug 2025 21:00:01 +0200 Subject: [PATCH] server v1 --- flake.nix | 9 ++ home/alisceon.nix | 12 +-- home/conf/config.nu | 24 +++++ hosts/tesla-nixos/configuration.nix | 153 ++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+), 7 deletions(-) create mode 100644 home/conf/config.nu create mode 100644 hosts/tesla-nixos/configuration.nix diff --git a/flake.nix b/flake.nix index ab4f545..a0a272c 100644 --- a/flake.nix +++ b/flake.nix @@ -53,6 +53,15 @@ ./hosts/tower/configuration.nix ]; # end modules }; # end tower + tesla-nixos = nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + ./hosts/tesla-nixos/configuration.nix + { + nixpkgs.config.allowUnfree = true; + } + ]; # end modules + }; # end tesla-nixos }; # end nixos conf }; # end "in" } # end file diff --git a/home/alisceon.nix b/home/alisceon.nix index 279d412..eff326d 100644 --- a/home/alisceon.nix +++ b/home/alisceon.nix @@ -6,7 +6,7 @@ programs = { fish = { - enable = true; + enable = false; # Disable greeting interactiveShellInit = '' set fish_greeting @@ -45,13 +45,14 @@ }; # end fish nushell = { enable = true; + configFile.source = ./conf/config.nu; shellAliases = { tsla-fan = "ipmitool -H 10.30.0.3 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01 0x0"; # NixOS commands nixoss = "sudo nixos-rebuild switch --flake .#${hostName}"; - nixos-main = "git checkout main && git pull && sudo nixos-rebuild switch --flake #${hostName}"; - nixossr = "sudo nixos-rebuild switch --flake .#${hostName} && reboot"; + nixos-main = "git checkout main ; git pull ; sudo nixos-rebuild switch --flake #${hostName}"; + nixossr = "sudo nixos-rebuild switch --flake .#${hostName} ; reboot"; nixost = "sudo nixos-rebuild build-vm --flake .#${hostName}"; # Development commands @@ -66,10 +67,7 @@ pypod = "podman run --rm -it --network host -v '.:/run' -w '/run' python /run/"; # Tower commands - weboot = "nix shell nixpkgs#efibootmgr -c sudo efibootmgr -n 0000 && reboot"; - - # Misc commands - nix-shell = "nix shell"; + weboot = "nix shell nixpkgs#efibootmgr -c sudo efibootmgr -n 0000 ; reboot"; }; }; git = { diff --git a/home/conf/config.nu b/home/conf/config.nu new file mode 100644 index 0000000..ad8b9f0 --- /dev/null +++ b/home/conf/config.nu @@ -0,0 +1,24 @@ +let carapace_completer = {|spans| + carapace $spans.0 nushell ...$spans | from json +} +$env.config = { + show_banner: false, + completions: { + case_sensitive: false # case-sensitive completions + quick: true # set to false to prevent auto-selecting completions + partial: true # set to false to prevent partial filling of the prompt + algorithm: "fuzzy" # prefix or fuzzy + external: { + # set to false to prevent nushell looking into $env.PATH to find more suggestions + enable: true + # set to lower can improve completion performance at the cost of omitting some options + max_results: 100 + completer: $carapace_completer # check 'carapace_completer' + } + } +} +$env.PATH = ($env.PATH | +split row (char esep) | +prepend /home/myuser/.apps | +append /usr/bin/env +) diff --git a/hosts/tesla-nixos/configuration.nix b/hosts/tesla-nixos/configuration.nix new file mode 100644 index 0000000..be8b93a --- /dev/null +++ b/hosts/tesla-nixos/configuration.nix @@ -0,0 +1,153 @@ +{ config, pkgs, ... }: + +{ + imports = + [ ./hardware-configuration.nix ]; + networking.hostName = "tesla-nixos"; + boot.initrd.enable = true; + boot.loader = { + systemd-boot = { + enable = true; + }; # end loader.systemd-boot + }; # end boot + system.stateVersion = "24.05"; + system.autoUpgrade = { + enable = true; + persistent = true; + flake = "/home/alisceon/.nixos_config"; + flags = [ + "--update-input" + "nixpkgs" + "-L" + ]; + dates = "daily"; + }; # end system.autoUpgrade + + nix = { + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + trusted-users = [ "root" "alisceon" ]; + }; # end settings + gc = { + automatic = true; + persistent = true; + dates = "daily"; + options = "--delete-older-than 7d"; + }; # end gc + registry = { + templates.to = { + type = "git"; + url = "git+ssh://git@git.malice.zone/alisceon/devenv_templates.git"; + }; # end templates.to + nixpkgs.to = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + ref = "nixos-unstable"; + }; # end nixpkgs.to + nixpkgs-stable.to = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + ref = "nixos-25.05"; + }; # end nixpkgs.to + }; #end registry + }; #end nix + + console.keyMap = "sv-latin1"; + networking.networkmanager.enable = true; + time.timeZone = "Europe/Stockholm"; + i18n.defaultLocale = "en_US.UTF-8"; + 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"; + }; + security.sudo.wheelNeedsPassword = false; + + services = { + printing.enable = true; + pulseaudio.enable = false; + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + jack.enable = true; + }; + xserver.xkb.layout = "se"; + displayManager = { + gdm.enable = true; + gdm.wayland = true; + }; + desktopManager.gnome.enable = true; + gnome = { + gnome-keyring.enable = true; + gnome-initial-setup.enable = false; + }; + }; # end services + + services.fwupd.enable = true; + programs = { + dconf.enable = true; + fish.enable = true; + steam = { + enable = true; + remotePlay.openFirewall = true; + }; + }; # end programs + + environment = { + systemPackages = with pkgs; [ + # CLI tools + git + wget + curl + btop # system monitor + ripgrep # grep replacement + bat # cat replacement + fd # find replacement + eza # ls replacement + nh # nix helper + jq # JSON processor + + # Shells + bash + nushell + fish + powershell + + devenv + direnv + + # Virtualization + podman + + ]; # end systemPackages + + shells = with pkgs; [ + bash + nushell + fish + powershell + ]; + }; # end environment + + virtualisation.podman = { + enable = true; + dockerCompat = true; + defaultNetwork.settings.dns_enabled = true; + }; # end virtualisation + + users.users.alisceon = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" "podman" ]; + shell = pkgs.nushell; + }; # end users +} # end file