diff --git a/common.nix b/common.nix index c4fded6..3ee1e3a 100644 --- a/common.nix +++ b/common.nix @@ -32,11 +32,6 @@ ./services/omnisearch.nix ]; - #public token to avoid rate limit - #nix.extraConfig = '' - # access-tokens = github.com - #''; - ### Make build time quicker documentation.nixos.enable = false; @@ -82,6 +77,5 @@ environment.systemPackages = with pkgs; [ git localsend - onlyoffice-desktopeditors ]; } diff --git a/configuration-template.nix b/configuration-template.nix deleted file mode 100644 index 566b084..0000000 --- a/configuration-template.nix +++ /dev/null @@ -1,26 +0,0 @@ -# configuration-template.nix -#################################################################################################################################################################### -## IMPORTANT: On a fresh NixOS install, run this command first: -nix-shell -p git --run "sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos && \ -sudo nix-channel --add https://github.com/gmodena/nix-flatpak/archive/main.tar.gz nix-flatpak && \ -sudo nix-channel --update && sudo nixos-rebuild switch" -#################################################################################################################################################################### -{ config, pkgs, lib, ... }: -let - gitConfig = builtins.fetchGit { - url = "https://github.com/ediblerope/nixos-config"; - ref = "main"; - }; -in -{ -imports = [ - ./hardware-configuration.nix - "${gitConfig}/common.nix" -]; -networking.hostName = "HOSTNAME-HERE"; # Change this! - -###################################################### -## Add Nixos-default generated boot loader settings ## -###################################################### -system.stateVersion = "25.11"; -} diff --git a/flake.nix b/flake.nix index 855f4c9..d0a07c3 100644 --- a/flake.nix +++ b/flake.nix @@ -10,17 +10,17 @@ }; omnisearch = { - url = "git+https://git.bwaaa.monster/omnisearch"; - inputs.nixpkgs.follows = "nixpkgs"; + url = "git+https://git.bwaaa.monster/omnisearch"; + inputs.nixpkgs.follows = "nixpkgs"; }; - zen-browser = { - url = "github:0xc000022070/zen-browser-flake"; - inputs = { - nixpkgs.follows = "nixpkgs"; - home-manager.follows = "home-manager"; + zen-browser = { + url = "github:0xc000022070/zen-browser-flake"; + inputs = { + nixpkgs.follows = "nixpkgs"; + home-manager.follows = "home-manager"; + }; }; - }; nix-flatpak.url = "github:gmodena/nix-flatpak"; }; diff --git a/hosts/FredOS-Gaming.nix b/hosts/FredOS-Gaming.nix index 93849e1..b040538 100644 --- a/hosts/FredOS-Gaming.nix +++ b/hosts/FredOS-Gaming.nix @@ -20,7 +20,7 @@ wowup-cf adwsteamgtk proton-vpn - #inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default + onlyoffice-desktopeditors ]; services.lact.enable = true; @@ -43,23 +43,11 @@ ]; }; }; - + # Bootloader boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; boot.loader.systemd-boot.configurationLimit = 5; boot.initrd.systemd.enable = true; - - system.autoUpgrade = { - enable = true; - dates = "daily"; - persistent = true; - allowReboot = false; - channel = "https://nixos.org/channels/nixos-unstable"; - flags = [ - "--upgrade" - "--option" "tarball-ttl" "0" - ]; - }; }; } diff --git a/hosts/FredOS-Macbook.nix b/hosts/FredOS-Macbook.nix index 5415882..d875e5c 100644 --- a/hosts/FredOS-Macbook.nix +++ b/hosts/FredOS-Macbook.nix @@ -18,7 +18,7 @@ vlc geary proton-vpn - #inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default + onlyoffice-desktopeditors ]; diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..6f890b2 --- /dev/null +++ b/readme.md @@ -0,0 +1,135 @@ +# FredOS NixOS Configuration + +Multi-host NixOS configuration managed via flakes, built and deployed directly from GitHub. No local config management required — all changes are made via the GitHub web editor. + +## How it works + +All machines pull their configuration directly from this repo at build time: + +```bash +sudo nixos-rebuild switch --flake github:ediblerope/nixos-config --refresh --no-write-lock-file +``` + +This is aliased to `update` on all machines. + +## Repo structure + +``` +flake.nix # Flake inputs and host definitions +common.nix # Shared config imported by all hosts +hosts/ + FredOS-Gaming.nix # Gaming PC specific config + FredOS-Macbook.nix # Macbook specific config + FredOS-Mediaserver.nix # Mediaserver specific config + hardware/ + FredOS-Gaming.nix # Hardware config + bootloader + hostname + FredOS-Macbook.nix + FredOS-Mediaserver.nix +apps/ # Per-app config files +settings/ # System settings (GNOME, locale, audio, etc.) +services/ # System services (Jellyfin, Sonarr, nginx, etc.) +home-manager/ # Home Manager config +walls/ # Wallpapers +``` + +## Flake inputs + +| Input | Source | +|---|---| +| nixpkgs | github:NixOS/nixpkgs/nixos-unstable | +| home-manager | github:nix-community/home-manager | +| omnisearch | git+https://git.bwaaa.monster/omnisearch | +| zen-browser | github:0xc000022070/zen-browser-flake | +| nix-flatpak | github:gmodena/nix-flatpak | + +## Day-to-day usage + +| Task | Command | +|---|---| +| Update system | `update` | +| Garbage collect | `clean` | +| First-run on new machine | See below | + +--- + +## Adding a new machine + +### 1. Fresh NixOS install + +Boot the NixOS installer and complete the standard installation. Note the `system.stateVersion` the installer sets — you'll need it later. + +### 2. Enable flakes + +After the base install, add this to `/etc/nixos/configuration.nix` and run `sudo nixos-rebuild switch`: + +```nix +nix.settings.experimental-features = [ "nix-command" "flakes" ]; +``` + +### 3. Create the hardware config on GitHub + +Copy the contents of `/etc/nixos/hardware-configuration.nix` and create `hosts/hardware/FredOS-NEWHOST.nix` in this repo via the GitHub web editor. Append the following to it: + +```nix +networking.hostName = "FredOS-NEWHOST"; + +# Match whatever bootloader the installer set up: +boot.loader.systemd-boot.enable = true; # UEFI systems +boot.loader.efi.canTouchEfiVariables = true; # UEFI systems +# boot.loader.grub.enable = true; # BIOS systems +# boot.loader.grub.devices = [ "/dev/sda" ]; # BIOS systems — verify with: sudo grub-probe --target=disk / + +boot.loader.systemd-boot.configurationLimit = 5; # UEFI only +boot.initrd.systemd.enable = true; # UEFI only + +nix.settings.experimental-features = [ "nix-command" "flakes" ]; + +system.stateVersion = "25.11"; # Use the version the installer generated +``` + +### 4. Add the host to flake.nix + +In `flake.nix`, add the new host to `nixosConfigurations`: + +```nix +FredOS-NEWHOST = mkHost "FredOS-NEWHOST"; +``` + +### 5. Create a host-specific config file + +Create `hosts/FredOS-NEWHOST.nix` for any machine-specific packages or services. Wrap everything in a hostname guard: + +```nix +{ config, pkgs, lib, ... }: +{ + config = lib.mkIf (config.networking.hostName == "FredOS-NEWHOST") { + environment.systemPackages = with pkgs; [ + # host-specific packages + ]; + }; +} +``` + +Then add it to the imports list in `common.nix`: + +```nix +./hosts/FredOS-NEWHOST.nix +``` + +### 6. Switch to the flake + +Run this on the new machine (first time only — requires explicit hostname): + +```bash +sudo nixos-rebuild switch --flake github:ediblerope/nixos-config#FredOS-NEWHOST --refresh --no-write-lock-file +``` + +After this succeeds, the `update` alias works normally from that point on. + +--- + +## Notes + +- **GitHub rate limiting** — `--refresh` queries the GitHub API on every run. At 60 unauthenticated requests/hour this is fine for normal use but will hit the limit during rapid iteration. Wait ~15 minutes if you see a 403 rate limit error. +- **hardware-configuration.nix** — do not run `nixos-generate-config` and expect to copy the output directly. Always append the hostname, bootloader, stateVersion and flake settings as shown above. +- **system.autoUpgrade** — disabled on all hosts. Updates are done manually via the `update` alias. \ No newline at end of file