diff --git a/.gitignore b/.gitignore index 0e0dd53..c75dfa8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,11 @@ result # direnv .direnv +# python +__pycache__/ +*.pyc +*.pyo +*.pyd + # clamav -.clamav \ No newline at end of file +.clamav diff --git a/README.md b/README.md new file mode 100644 index 0000000..09f40a3 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# NixOS Configuration Layout + +This repository is structured around explicit NixOS and Home Manager layers. + +## Directory Overview + +- `nixos/hosts//` + - Host-specific `configuration.nix` and `hardware-configuration.nix`. +- `nixos/modules/` + - Shared NixOS modules: + - `base.nix` + - `profiles/` (`workstation.nix`, `server.nix`) + - `wm/` (`sway.nix`, `gnome.nix`) + - `theme/` (`stylix.nix`) +- `home/users/` + - User base modules (`alisceon`, `root`). +- `home/profiles/` + - Shared Home Manager profile composition. +- `home/modules/` + - Home Manager feature modules grouped by `programs/`, `services/`, and `wm/`. +- `home/hosts/alisceon/` + - Host-specific Home Manager overrides for `alisceon`. +- `lib/` + - Shared helper libraries imported by modules. +- `util/` + - Local helper scripts. + +## Composition Rules + +- `flake.nix` is the single composition entrypoint for hosts. +- NixOS host modules should import only host-local hardware config and rely on shared modules from `nixos/modules`. +- Home Manager host overrides should stay small and contain only host deltas. +- Reusable behavior belongs in `nixos/modules` or `home/modules`, not in host files. + +## Local Validation + +Run these in your normal environment: + +```bash +nix flake show +nix eval .#nixosConfigurations.electra.config.system.build.toplevel.drvPath +nix eval .#nixosConfigurations.tower.config.system.build.toplevel.drvPath +nix eval .#nixosConfigurations.tesla-nixos.config.system.build.toplevel.drvPath +nix eval .#nixosConfigurations.nuc.config.system.build.toplevel.drvPath +nix flake check --no-build +``` diff --git a/flake.lock b/flake.lock index 7bfb5a6..851586a 100644 --- a/flake.lock +++ b/flake.lock @@ -273,11 +273,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1772822230, - "narHash": "sha256-yf3iYLGbGVlIthlQIk5/4/EQDZNNEmuqKZkQssMljuw=", + "lastModified": 1773068389, + "narHash": "sha256-vMrm7Pk2hjBRPnCSjhq1pH0bg350Z+pXhqZ9ICiqqCs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "71caefce12ba78d84fe618cf61644dce01cf3a96", + "rev": "44bae273f9f82d480273bab26f5c50de3724f52f", "type": "github" }, "original": { @@ -295,11 +295,11 @@ ] }, "locked": { - "lastModified": 1773134141, - "narHash": "sha256-GM6mNluLIw/Fp6rXvc4MbDCdwL1TIbhC+cp2/1cYLPc=", + "lastModified": 1773173351, + "narHash": "sha256-vbZTr0Tbu+c6WMAJTW/n3nYyJ8ngsixJ81v87j7UWAk=", "owner": "nix-community", "repo": "NUR", - "rev": "ef5cd9310115cb270eb2c896433340cbb724b92d", + "rev": "08030da6f07460f8f4ff343cda712e9dd1d0a7ec", "type": "github" }, "original": { @@ -316,11 +316,11 @@ ] }, "locked": { - "lastModified": 1773134141, - "narHash": "sha256-GM6mNluLIw/Fp6rXvc4MbDCdwL1TIbhC+cp2/1cYLPc=", + "lastModified": 1773173351, + "narHash": "sha256-vbZTr0Tbu+c6WMAJTW/n3nYyJ8ngsixJ81v87j7UWAk=", "owner": "nix-community", "repo": "NUR", - "rev": "ef5cd9310115cb270eb2c896433340cbb724b92d", + "rev": "08030da6f07460f8f4ff343cda712e9dd1d0a7ec", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index dadc18d..64db494 100644 --- a/flake.nix +++ b/flake.nix @@ -36,7 +36,11 @@ }: let system = "x86_64-linux"; - repoLocalPath = "/home/alisceon/.nixos_config"; + repoLocalPath = + let + fromEnv = builtins.getEnv "NIXOS_CONFIG_ROOT"; + in + if fromEnv != "" then fromEnv else "/home/alisceon/.nixos_config"; pkgs = import nixpkgs { inherit system; @@ -53,7 +57,7 @@ }; sharedSpecialArgs = { - inherit inputs pkgs-unstable repoLocalPath; + inherit pkgs-unstable repoLocalPath; repoRoot = self; }; @@ -113,9 +117,7 @@ ./nixos/modules/profiles/server.nix ]; - serverHomeModules = [ - ./home/profiles/server.nix - ]; + serverHomeModules = [ ]; in { nixosConfigurations = { diff --git a/home/profiles/server.nix b/home/profiles/server.nix deleted file mode 100644 index 52c14b8..0000000 --- a/home/profiles/server.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ ... }: -{ -} diff --git a/home/profiles/workstation.nix b/home/profiles/workstation.nix index 1f1b3a1..fb22096 100644 --- a/home/profiles/workstation.nix +++ b/home/profiles/workstation.nix @@ -10,7 +10,6 @@ stylix.enableReleaseChecks = false; xdg.configFile."obsidian/obsidian.json".source = lib.mkForce ../conf/obsidian.json; - xdg.configFile."nixpkgs/config.nix".source = ../conf/config.nix; xdg = { enable = true;