From 9eae3d1e122799d0a4a4e0f0e907c82ca2ff8469 Mon Sep 17 00:00:00 2001 From: ulve Date: Tue, 7 Jul 2026 17:32:45 +0200 Subject: [PATCH] Several hosts first try --- flake.nix | 20 ++++++- hosts/macnix/default.nix | 57 +++++++++++++++++++ hosts/macnix/hardware-configuration.nix | 32 +++++++++++ hosts/macnix/home.nix | 4 ++ configuration.nix => hosts/nixos/default.nix | 0 .../nixos/hardware-configuration.nix | 0 hosts/nixos/home.nix | 35 ++++++++++++ home.nix => modules/home-common.nix | 28 +-------- niri.nix => modules/niri.nix | 12 ++-- 9 files changed, 154 insertions(+), 34 deletions(-) create mode 100644 hosts/macnix/default.nix create mode 100644 hosts/macnix/hardware-configuration.nix create mode 100644 hosts/macnix/home.nix rename configuration.nix => hosts/nixos/default.nix (100%) rename hardware-configuration.nix => hosts/nixos/hardware-configuration.nix (100%) create mode 100644 hosts/nixos/home.nix rename home.nix => modules/home-common.nix (89%) rename niri.nix => modules/niri.nix (89%) diff --git a/flake.nix b/flake.nix index 5077ddf..d803688 100644 --- a/flake.nix +++ b/flake.nix @@ -15,18 +15,34 @@ nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - ./configuration.nix + ./hosts/nixos home-manager.nixosModules.home-manager { home-manager = { useGlobalPkgs = true; useUserPackages = true; - users.ulve = import ./home.nix; + users.ulve = import ./hosts/nixos/home.nix; backupFileExtension = "backup"; extraSpecialArgs = { inherit herdr; }; }; } ]; }; + + nixosConfigurations.macnix = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + ./hosts/macnix + home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.ulve = import ./hosts/macnix/home.nix; + backupFileExtension = "backup"; + }; + } + ]; + }; }; } diff --git a/hosts/macnix/default.nix b/hosts/macnix/default.nix new file mode 100644 index 0000000..100ee11 --- /dev/null +++ b/hosts/macnix/default.nix @@ -0,0 +1,57 @@ +{ config, pkgs, ... }: + +{ + imports = [ ./hardware-configuration.nix ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "macnix"; + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Stockholm"; + + i18n.defaultLocale = "en_US.UTF-8"; + console.keyMap = "sv-latin1"; + + services.openssh = { + enable = true; + settings = { + X11Forwarding = false; + PermitRootLogin = "no"; + PasswordAuthentication = false; + }; + openFirewall = true; + }; + + users.users."ulve" = { + isNormalUser = true; + shell = pkgs.zsh; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICpiU4gStAtrJOBSkQA2YJh98fpWPpxWtWgwAGzVa/wc johansson.olov@gmail.com" + ]; + description = "ulve"; + extraGroups = [ "networkmanager" "wheel" ]; + }; + + programs.zsh.enable = true; + security.polkit.enable = true; + + environment.systemPackages = with pkgs; [ + wget + curl + git + ]; + + nixpkgs.config.allowUnfree = true; + + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 14d"; + }; + nix.settings.auto-optimise-store = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + system.stateVersion = "26.05"; +} diff --git a/hosts/macnix/hardware-configuration.nix b/hosts/macnix/hardware-configuration.nix new file mode 100644 index 0000000..64f3889 --- /dev/null +++ b/hosts/macnix/hardware-configuration.nix @@ -0,0 +1,32 @@ +# 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 = [ ]; + + boot.initrd.availableKernelModules = [ "ehci_pci" "xhci_pci" "usbhid" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/db8f8871-6d7d-4e15-b65d-87f44e5e8dd5"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/C375-5622"; + fsType = "vfat"; + options = [ "umask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/5192523e-a21c-4223-9ee3-a5150213b479"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; + hardware.parallels.enable = true; + nixpkgs.config.allowUnfreePackages = [ "prl-tools" ]; +} diff --git a/hosts/macnix/home.nix b/hosts/macnix/home.nix new file mode 100644 index 0000000..da30395 --- /dev/null +++ b/hosts/macnix/home.nix @@ -0,0 +1,4 @@ +{config, pkgs, ...}: +{ + imports = [ ../../modules/home-common.nix ]; +} diff --git a/configuration.nix b/hosts/nixos/default.nix similarity index 100% rename from configuration.nix rename to hosts/nixos/default.nix diff --git a/hardware-configuration.nix b/hosts/nixos/hardware-configuration.nix similarity index 100% rename from hardware-configuration.nix rename to hosts/nixos/hardware-configuration.nix diff --git a/hosts/nixos/home.nix b/hosts/nixos/home.nix new file mode 100644 index 0000000..0445558 --- /dev/null +++ b/hosts/nixos/home.nix @@ -0,0 +1,35 @@ +{config, pkgs, herdr, ...}: +{ + imports = [ ../../modules/home-common.nix ../../modules/niri.nix ]; + + niri.useNoctalia = true; + + home.sessionVariables = { + NIXOS_OZONE_WL = "1"; + }; + + # ── Config files ───────────────────────────────────────────────────────────── + xdg.dataFile."applications/switch-wallpaper.desktop".source = ../../config/applications/switch-wallpaper.desktop; + xdg.dataFile."applications/signal.desktop".source = ../../config/applications/signal.desktop; + xdg.dataFile."applications/vesktop.desktop".source = ../../config/applications/vesktop.desktop; + xdg.dataFile."applications/steam.desktop".source = ../../config/applications/steam.desktop; + + # ── Packages ───────────────────────────────────────────────────────────────── + home.packages = with pkgs; [ + herdr.packages.${pkgs.system}.default # wallpaper manager + brave # browser + teams-for-linux # teams + + # terminal + foot # terminal + + # file managers + thunar # gui file manager + + # messaging + telegram-desktop + signal-desktop + vesktop + karere + ]; +} diff --git a/home.nix b/modules/home-common.nix similarity index 89% rename from home.nix rename to modules/home-common.nix index 69df2c8..c10abb9 100644 --- a/home.nix +++ b/modules/home-common.nix @@ -1,10 +1,5 @@ -{config, pkgs, herdr, ...}: +{config, pkgs, ...}: { - imports = [ ./niri.nix ]; - - niri.useNoctalia = true; - - # ── Identity ──────────────────────────────────────────────────────────────── home.username = "ulve"; home.homeDirectory = "/home/ulve"; home.stateVersion = "26.05"; @@ -195,7 +190,6 @@ home.sessionVariables = { _ZO_FZF_OPTS = "--preview 'eza --tree --level=2 --color=always {2..}' --preview-window=right:40%"; NIX_BUILD_SHELL = "bash"; - NIXOS_OZONE_WL = "1"; }; # ── Git ───────────────────────────────────────────────────────────────────── @@ -257,29 +251,20 @@ source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos-dotfiles/config/nvim"; }; - xdg.dataFile."applications/switch-wallpaper.desktop".source = ./config/applications/switch-wallpaper.desktop; - xdg.dataFile."applications/signal.desktop".source = ./config/applications/signal.desktop; - xdg.dataFile."applications/vesktop.desktop".source = ./config/applications/vesktop.desktop; - xdg.dataFile."applications/steam.desktop".source = ./config/applications/steam.desktop; - # ── Packages ───────────────────────────────────────────────────────────────── home.packages = with pkgs; [ # general - herdr.packages.${pkgs.system}.default # wallpaper manager claude-code # ai coding assistant azure-cli # az cli git-credential-manager # git credential helper (azure devops PAT) pass # password store (used by GCM gpg backend) - brave # browser fastfetch # vanity jq # json processor powershell # yes - teams-for-linux # teams nh # nix helper unzip # compression # terminal - foot # terminal tmux # terminal multiplexer btop # resource monitor fd # fast find alternative @@ -288,10 +273,10 @@ dust # intuitive disk usage lsof # list open files asciinema # terminal recording + kew # terminal music player # file managers yazi # terminal file manager - thunar # gui file manager # editors neovim # editor @@ -299,9 +284,6 @@ # compilers / runtimes gcc # c compiler (needed by treesitter) - # music - kew - # nvim: lsp servers tree-sitter # parser generator (nvim) nil # language server for nix @@ -315,11 +297,5 @@ shfmt # formatter: bash/sh lua54Packages.luacheck # linter: lua shellcheck # linter: bash/sh - - # messaging - telegram-desktop - signal-desktop - vesktop - karere ]; } diff --git a/niri.nix b/modules/niri.nix similarity index 89% rename from niri.nix rename to modules/niri.nix index 89c4985..e2f6ab4 100644 --- a/niri.nix +++ b/modules/niri.nix @@ -13,7 +13,7 @@ xdg.configFile."niri" = { source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos-dotfiles/config/niri"; }; - xdg.configFile."foot".source = ./config/foot; + xdg.configFile."foot".source = ../config/foot; systemd.user.services.xwayland-satellite = { Unit = { @@ -52,19 +52,19 @@ # ── Non-noctalia ───────────────────────────────────────────────────────────── (lib.mkIf (!useNoctalia) { - xdg.configFile."waybar".source = ./config/waybar; - xdg.configFile."fuzzel/fuzzel.ini".source = ./config/fuzzel/fuzzel.ini; + xdg.configFile."waybar".source = ../config/waybar; + xdg.configFile."fuzzel/fuzzel.ini".source = ../config/fuzzel/fuzzel.ini; home.file.".local/bin/wallpaper.sh" = { - source = ./config/niri/wallpaper.sh; + source = ../config/niri/wallpaper.sh; executable = true; }; home.file.".local/bin/waybar-network.sh" = { - source = ./config/waybar/network.sh; + source = ../config/waybar/network.sh; executable = true; }; home.file.".local/bin/waybar-weather.sh" = { - source = ./config/waybar/weather.sh; + source = ../config/waybar/weather.sh; executable = true; };