From 830c1a8800f142dce3271721d09cd1f24c94aed0 Mon Sep 17 00:00:00 2001 From: Tobias Frischmann Date: Wed, 05 Aug 2026 10:35:16 +0000 Subject: [PATCH] share between pc and laptop --- shared/cli.nix | 15 +++++++++++++++ shared/desktop.nix | 20 ++++++++++++++++++++ shared/fish.nix | 23 ----------------------- hosts/homeserver/configuration.nix | 20 ++------------------ hosts/laptop/configuration.nix | 65 +++-------------------------------------------------------------- hosts/pc/configuration.nix | 81 +++------------------------------------------------------------------------------ shared/dev/apps.nix | 14 ++++++++++++++ shared/dev/mod.nix | 23 +++++++++++++++++++++++ shared/dev/rust.nix | 20 ++++++++++++++++++++ hosts/homeserver/services/mod.nix | 16 ++++++++++++++++ 10 file(s) changed, 116 insertion(s)(+), 181 deletion(s)(-) diff --git a/shared/cli.nix b/shared/cli.nix --- a/shared/cli.nix +++ b/shared/cli.nix @@ -12,5 +12,20 @@ just nvd + + starship + zoxide ]; + + programs.fish = { + enable = true; + interactiveShellInit = '' + set fish_greeting # Disable greeting + + starship init fish | source + zoxide init fish | source + + alias cd z + ''; + }; } diff --git a/shared/desktop.nix b/shared/desktop.nix new file mode 100644 --- /dev/null +++ b/shared/desktop.nix @@ -0,0 +1,20 @@ +{ + pkgs, + inputs, + ... +}: + +{ + environment.systemPackages = with pkgs; [ + inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default + + discord + + prismlauncher + aseprite + + nextcloud-client + ]; + + programs.steam.enable = true; +} diff --git a/shared/fish.nix b/shared/fish.nix deleted file mode 100644 --- a/shared/fish.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - pkgs, - ... -}: - -{ - environment.systemPackages = with pkgs; [ - starship - zoxide - ]; - - programs.fish = { - enable = true; - interactiveShellInit = '' - set fish_greeting # Disable greeting - - starship init fish | source - zoxide init fish | source - - alias cd z - ''; - }; -} diff --git a/hosts/homeserver/configuration.nix b/hosts/homeserver/configuration.nix --- a/hosts/homeserver/configuration.nix +++ b/hosts/homeserver/configuration.nix @@ -1,7 +1,3 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { config, pkgs, @@ -15,17 +11,9 @@ ./hardware-configuration.nix # Services - ./services/homeassistant.nix - ./services/taskline.nix - ./services/newt.nix - ./services/postgres.nix - ./services/nextcloud.nix - ./services/backup.nix - ./services/modrinth-statistics.nix - ./services/lightcontrol.nix + ./services/mod.nix # Common modules - ../../shared/fish.nix ../../shared/cli.nix # External Modules @@ -39,12 +27,8 @@ # Use provided UUIDs instead of blkid probing (required for btrfs subvolumes) boot.loader.grub.fsIdentifier = "provided"; - networking.hostName = "nixos"; # Define your hostname. + networking.hostName = "homeserver"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # Power saving settings services.tlp = { diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -1,7 +1,3 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { inputs, config, @@ -15,8 +11,9 @@ ./hardware-configuration.nix # Common modules - ../../shared/fish.nix ../../shared/cli.nix + ../../shared/dev/mod.nix + ../../shared/desktop.nix # External modules inputs.hydration-notifier.nixosModules.default @@ -28,12 +25,8 @@ boot.kernelPackages = pkgs.linuxPackages_latest; - networking.hostName = "nixos"; # Define your hostname. + networking.hostName = "laptop-nixos"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # Enable networking networking.networkmanager.enable = true; @@ -105,27 +98,10 @@ "dialout" ]; packages = with pkgs; [ - inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default - - zed-editor pangolin-cli - - discord - - prismlauncher - aseprite - - nixd - nixfmt ]; shell = pkgs.fish; }; - - programs.fish.interactiveShellInit = '' - alias zed zeditor - - . /home/tobinio/export-esp.sh - ''; # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -138,42 +114,7 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - espup - espflash - - rustup - gcc - - nextcloud-client ]; - - programs.steam.enable = true; - - programs.nix-ld.enable = true; - programs.nix-ld.libraries = with pkgs; [ - stdenv.cc.cc - zlib - openssl - ]; - - # 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; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions diff --git a/hosts/pc/configuration.nix b/hosts/pc/configuration.nix --- a/hosts/pc/configuration.nix +++ b/hosts/pc/configuration.nix @@ -1,7 +1,3 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { inputs, config, @@ -15,8 +11,9 @@ ./hardware-configuration.nix # Common modules - ../../shared/fish.nix ../../shared/cli.nix + ../../shared/dev/mod.nix + ../../shared/desktop.nix # External modules inputs.hydration-notifier.nixosModules.default @@ -28,20 +25,11 @@ boot.kernelPackages = pkgs.linuxPackages_latest; - networking.hostName = "nixos"; # Define your hostname. + networking.hostName = "pc-nixos"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # Enable networking networking.networkmanager.enable = true; - - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - }; # Set your time zone. time.timeZone = "Europe/Vienna"; @@ -82,18 +70,9 @@ alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; }; services.hydration-notifier.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. users.users."tobinio" = { @@ -105,27 +84,10 @@ "dialout" ]; packages = with pkgs; [ - inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default - - zed-editor pangolin-cli - - discord - - prismlauncher - aseprite - - nixd - nixfmt ]; shell = pkgs.fish; }; - - programs.fish.interactiveShellInit = '' - alias zed zeditor - - . /home/tobinio/export-esp.sh - ''; # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -138,44 +100,8 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - espup - espflash - - rustup - gcc - pika-backup - - nextcloud-client ]; - - programs.steam.enable = true; - - programs.nix-ld.enable = true; - programs.nix-ld.libraries = with pkgs; [ - stdenv.cc.cc - zlib - openssl - ]; - - # 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; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions @@ -184,5 +110,4 @@ # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "26.05"; # Did you read the comment? - } diff --git a/shared/dev/apps.nix b/shared/dev/apps.nix new file mode 100644 --- /dev/null +++ b/shared/dev/apps.nix @@ -0,0 +1,14 @@ +{ + pkgs, + ... +}: + +{ + programs.fish.interactiveShellInit = '' + alias zed zeditor + ''; + + environment.systemPackages = with pkgs; [ + zed-editor + ]; +} diff --git a/shared/dev/mod.nix b/shared/dev/mod.nix new file mode 100644 --- /dev/null +++ b/shared/dev/mod.nix @@ -0,0 +1,23 @@ +{ + pkgs, + ... +}: + +{ + imports = [ + ./apps.nix + ./rust.nix + ]; + + environment.systemPackages = with pkgs; [ + nixd + nixfmt + ]; + + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + stdenv.cc.cc + zlib + openssl + ]; +} diff --git a/shared/dev/rust.nix b/shared/dev/rust.nix new file mode 100644 --- /dev/null +++ b/shared/dev/rust.nix @@ -0,0 +1,20 @@ +{ + pkgs, + ... +}: + +{ + programs.fish.interactiveShellInit = '' + alias zed zeditor + + . /home/tobinio/export-esp.sh + ''; + + environment.systemPackages = with pkgs; [ + rustup + gcc + + espup + espflash + ]; +} diff --git a/hosts/homeserver/services/mod.nix b/hosts/homeserver/services/mod.nix new file mode 100644 --- /dev/null +++ b/hosts/homeserver/services/mod.nix @@ -0,0 +1,16 @@ +{ + ... +}: + +{ + imports = [ + ./homeassistant.nix + ./taskline.nix + ./newt.nix + ./postgres.nix + ./nextcloud.nix + ./backup.nix + ./modrinth-statistics.nix + ./lightcontrol.nix + ]; +} -- tangled.sh