diff --git a/flake.lock b/flake.lock index 38da35d..c5c495d 100644 --- a/flake.lock +++ b/flake.lock @@ -25,11 +25,11 @@ ] }, "locked": { - "lastModified": 1753056897, - "narHash": "sha256-AVVMBFcuOXqIgmShvRv9TED3fkiZhQ0ZvlhsPoFfkNE=", + "lastModified": 1754613544, + "narHash": "sha256-ueR1mGX4I4DWfDRRxxMphbKDNisDeMPMusN72VV1+cc=", "owner": "nix-community", "repo": "home-manager", - "rev": "13a83d1b6545b7f0e8f7689bad62e7a3b1d63771", + "rev": "cc2fa2331aebf9661d22bb507d362b39852ac73f", "type": "github" }, "original": { @@ -40,11 +40,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1752950548, - "narHash": "sha256-NS6BLD0lxOrnCiEOcvQCDVPXafX1/ek1dfJHX1nUIzc=", + "lastModified": 1754498491, + "narHash": "sha256-erbiH2agUTD0Z30xcVSFcDHzkRvkRXOQ3lb887bcVrs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c87b95e25065c028d31a94f06a62927d18763fdf", + "rev": "c2ae88e026f9525daf89587f3cbee584b92b6134", "type": "github" }, "original": { @@ -54,18 +54,18 @@ "type": "github" } }, - "nixpkgs-stable": { + "nixpkgs-unstable": { "locked": { - "lastModified": 1753115646, - "narHash": "sha256-yLuz5cz5Z+sn8DRAfNkrd2Z1cV6DaYO9JMrEz4KZo/c=", + "lastModified": 1754498491, + "narHash": "sha256-erbiH2agUTD0Z30xcVSFcDHzkRvkRXOQ3lb887bcVrs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "92c2e04a475523e723c67ef872d8037379073681", + "rev": "c2ae88e026f9525daf89587f3cbee584b92b6134", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-25.05", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -75,7 +75,7 @@ "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable" + "nixpkgs-unstable": "nixpkgs-unstable" } }, "systems": { diff --git a/flake.nix b/flake.nix index fe19fca..a0a272c 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,8 @@ description = "NixOS configuration for all hosts"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-25.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; #"github:NixOS/nixpkgs/nixos-25.05"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; home-manager = { url = "github:nix-community/home-manager"; @@ -11,15 +11,32 @@ }; }; - outputs = { self, nixpkgs, flake-utils, home-manager, ... }: + outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, home-manager, ... }: let system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; config.allowUnfree = true; }; + pkgs-unstable = import nixpkgs-unstable { + inherit system; + config.allowUnfree = true; + }; sharedModules = [ ./hosts/common.nix + { + nixpkgs.config.allowUnfree = true; + } + home-manager.nixosModules.home-manager + ({ config, ...}: { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { + inherit (config.networking) hostName; + }; # end extraSpecialArgs + home-manager.users.alisceon = import ./home/alisceon.nix; + home-manager.backupFileExtension = "backup"; + }) # end home manager ]; in { @@ -27,41 +44,24 @@ electra = nixpkgs.lib.nixosSystem { inherit system; modules = sharedModules ++ [ - { - nixpkgs.config.allowUnfree = true; - } ./hosts/electra/configuration.nix - home-manager.nixosModules.home-manager - ({ config, ...}: { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - inherit (config.networking) hostName; - }; # end extraSpecialArgs - home-manager.users.alisceon = import ./home/alisceon.nix; - home-manager.backupFileExtension = "backup"; - }) # end home manager ]; # end modules }; # end electra tower = nixpkgs.lib.nixosSystem { inherit system; modules = sharedModules ++ [ + ./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; } - ./hosts/tower/configuration.nix - home-manager.nixosModules.home-manager - ({ config, ...}: { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - inherit (config.networking) hostName; - }; #end extraSpecialArgs - home-manager.users.alisceon = import ./home/alisceon.nix; - home-manager.backupFileExtension = "backup"; - }) # end home manager ]; # end modules - }; # end tower + }; # end tesla-nixos }; # end nixos conf }; # end "in" } # end file diff --git a/home/alisceon.nix b/home/alisceon.nix index e22e94a..cd2b2cb 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 @@ -16,7 +16,7 @@ ls = "exa"; ll = "exa -lah"; grep = "rg"; - cat = "bat"; + cat = "bat -p"; tsla-fan = "ipmitool -H 10.30.0.3 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01 0x0"; # NixOS commands @@ -38,8 +38,38 @@ # Tower commands weboot = "nix shell nixpkgs#efibootmgr -c sudo efibootmgr -n 0000 && reboot"; + + # Misc commands + nix-shell = "nix shell"; }; }; # 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"; + nixost = "sudo nixos-rebuild build-vm --flake .#${hostName}"; + + # Development commands + devt = "devenv test"; + + devtas = "devenv tasks list"; + devtar = "devenv tasks run"; + devs = "devenv shell"; + devu = "devenv up -d"; + devi = "nix flake init -t templates#"; + + 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"; + }; + }; git = { enable = true; userName = "alisceon"; @@ -91,6 +121,9 @@ hostname = "alma03.lab.the.malice.zone"; user = "root"; }; + "tsla-nixos" = { + hostname = "tesla-nixos.lab.the.malice.zone"; + }; }; }; # end ssh direnv = { @@ -104,6 +137,9 @@ # overide broken config xdg.configFile."obsidian/obsidian.json".source = lib.mkForce ./conf/obsidian.json; + # nixpkgs config + xdg.configFile."nixpkgs/config.nix".source = ./conf/config.nix; + home.packages = with pkgs; [ signal-desktop discord diff --git a/home/conf/config.nix b/home/conf/config.nix new file mode 100644 index 0000000..d84a323 --- /dev/null +++ b/home/conf/config.nix @@ -0,0 +1 @@ +{ allowUnfree = true; } \ No newline at end of file diff --git a/home/conf/config.nu b/home/conf/config.nu new file mode 100644 index 0000000..ddcc2fa --- /dev/null +++ b/home/conf/config.nu @@ -0,0 +1,34 @@ +let fish_completer = {|spans| + fish --command $"complete '--do-complete=($spans | str replace --all "'" "\\'" | str join ' ')'" + | from tsv --flexible --noheaders --no-infer + | rename value description + | update value {|row| + let value = $row.value + let need_quote = ['\' ',' '[' ']' '(' ')' ' ' '\t' "'" '"' "`"] | any {$in in $value} + if ($need_quote and ($value | path exists)) { + let expanded_path = if ($value starts-with ~) {$value | path expand --no-symlink} else {$value} + $'"($expanded_path | str replace --all "\"" "\\\"")"' + } else {$value} + } +} +$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: $fish_completer + } + } +} +$env.PATH = ($env.PATH | +split row (char esep) | +prepend /home/myuser/.apps | +append /usr/bin/env +) diff --git a/hosts/common.nix b/hosts/common.nix index a6b5e47..6a48d54 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -27,13 +27,25 @@ automatic = true; persistent = true; dates = "daily"; - options = "--delete-older-than 3d"; + 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 @@ -91,13 +103,20 @@ git wget curl - btop - ripgrep - bat - fd - eza + 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 + # Chat discord signal-desktop @@ -125,7 +144,9 @@ krita edk2-uefi-shell obsidian + gparted ]; # end systemPackages + gnome.excludePackages = with pkgs; [ evolution geary @@ -139,7 +160,12 @@ gnome-initial-setup gnome-clocks ]; # end gnome.excludePackages - shells = with pkgs; [ fish ]; + shells = with pkgs; [ + bash + nushell + fish + powershell + ]; }; # end environment virtualisation.podman = { @@ -151,7 +177,6 @@ users.users.alisceon = { isNormalUser = true; extraGroups = [ "wheel" "networkmanager" "podman" ]; - shell = pkgs.fish; + shell = pkgs.nushell; }; # end users - } #end file diff --git a/hosts/electra/configuration.nix b/hosts/electra/configuration.nix index d18d5e3..45f9d95 100644 --- a/hosts/electra/configuration.nix +++ b/hosts/electra/configuration.nix @@ -18,7 +18,6 @@ enable = true; theme = "rings"; themePackages = with pkgs; [ - # By default we would install all themes (adi1090x-plymouth-themes.override { selected_themes = [ "rings" ]; }) @@ -35,18 +34,27 @@ ]; loader.timeout = 0; #resumeDevice = "/dev/disk/by-uuid/c49249b9-0d68-44af-97e0-e399c8409408"; - }; + }; # end boot systemd.services = { fprintd = { wantedBy = [ "multi-user.target" ]; serviceConfig.Type = "simple"; }; - }; + }; # end systemd.services services = { fprintd = { enable = true; tod.enable = true; tod.driver = pkgs.libfprint-2-tod1-goodix; - }; - }; -} + }; # end fprintd + tuned = { + enable = true; + }; # end tuned + }; # end services + hardware = { + bluetooth = { + enable = true; + powerOnBoot = true; + }; # end bluetooth + }; # end hardware +} # end file diff --git a/hosts/tesla-nixos/configuration.nix b/hosts/tesla-nixos/configuration.nix new file mode 100644 index 0000000..1392126 --- /dev/null +++ b/hosts/tesla-nixos/configuration.nix @@ -0,0 +1,132 @@ +{ 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 = { + openssh.enable = true; + }; # end services + + services.fwupd.enable = true; + programs = { + dconf.enable = true; + fish.enable = 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 diff --git a/hosts/tesla-nixos/hardware-configuration.nix b/hosts/tesla-nixos/hardware-configuration.nix new file mode 100644 index 0000000..017a78a --- /dev/null +++ b/hosts/tesla-nixos/hardware-configuration.nix @@ -0,0 +1,37 @@ +# 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" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/8befd164-4151-4116-83ec-727e44e87ea8"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6841-1339"; + 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.ens18.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +}