@adrifer/winix 0.1.2 → 0.1.3-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,7 +35,7 @@ const inputs = defineInputs({
35
35
  });
36
36
 
37
37
  const wsl = feature("wsl", () => [
38
- nixos.imports("nixos-wsl"),
38
+ nixos.imports("inputs.nixos-wsl.nixosModules.wsl"),
39
39
  nixos({ wsl: { enable: true } }),
40
40
  nixos.program("nix-ld"),
41
41
  ]);
@@ -82,6 +82,12 @@ export default workspace({
82
82
 
83
83
  > Winix is early software. The core pipeline works end-to-end, but the public API is still evolving.
84
84
 
85
+ ### Why the name?
86
+
87
+ It started as a half-joke about wrapping Nix for **Win**dows (early prototypes targeted WSL first). The name stuck because **Win + Nix** also reads as "winning at Nix", which felt apt for a project that's trying to make the Nix ecosystem a bit less painful to onboard into.
88
+
89
+ For what it's worth: Winix today works just as well on macOS and native NixOS as it does on WSL. The Windows-flavored origin survives in the name only.
90
+
85
91
  ## Install and create a config
86
92
 
87
93
  ```bash
@@ -239,7 +245,7 @@ host("wsl", platforms.nixos({ stateVersion: "25.05" }), [
239
245
  Winix includes helpers for common Nix namespaces:
240
246
 
241
247
  ```ts
242
- nixos.imports("nixos-wsl")
248
+ nixos.imports("inputs.nixos-wsl.nixosModules.wsl")
243
249
  nixos.networking({ hostName: "server", firewall: { allowedTCPPorts: [22, 443] } })
244
250
  nixos.service("openssh", { settings: { PermitRootLogin: "no" } })
245
251
  nixos.systemd.service("backup", { script: "echo backup" })
@@ -64,12 +64,6 @@ function formatInput(name, def) {
64
64
  }
65
65
  return lines.join("\n");
66
66
  }
67
- // Known input name → NixOS module path mapping
68
- const MODULE_MAP = {
69
- "home-manager": "inputs.home-manager.nixosModules.home-manager",
70
- "nixos-wsl": "inputs.nixos-wsl.nixosModules.wsl",
71
- "nix-darwin": "inputs.nix-darwin.darwinModules.default",
72
- };
73
67
  function generateHostModule(host) {
74
68
  const lines = [
75
69
  `# Generated by Winix — do not edit`,
@@ -216,7 +210,7 @@ function formatImport(imp) {
216
210
  return `../raw-modules/${imp.path}`;
217
211
  }
218
212
  if (typeof imp === "string") {
219
- return MODULE_MAP[imp] ?? imp;
213
+ return imp;
220
214
  }
221
215
  throw new Error("imports entries must be strings or rawModule() references");
222
216
  }
@@ -393,8 +387,17 @@ function validateWorkspaceInputs(workspace, hosts) {
393
387
  if (hosts.some((host) => Object.keys(host.darwin).length > 0) && !hasInput(workspace, "nix-darwin")) {
394
388
  warnings.push("darwin host detected but workspace inputs do not include nix-darwin");
395
389
  }
390
+ if (hosts.some(hasHomeManagerImport) && !hasInput(workspace, "home-manager")) {
391
+ warnings.push("home-manager module import detected but workspace inputs do not include home-manager");
392
+ }
396
393
  return warnings;
397
394
  }
395
+ function hasHomeManagerImport(host) {
396
+ return [
397
+ ...getImports(host.nixos),
398
+ ...getImports(host.darwin),
399
+ ].some((imp) => typeof imp === "string" && imp.startsWith("inputs.home-manager."));
400
+ }
398
401
  function hasInput(workspace, nixName) {
399
402
  return Object.entries(workspace.inputs).some(([name, def]) => inputNixName(name, def) === nixName);
400
403
  }
@@ -6,7 +6,7 @@ export const platforms = {
6
6
  const useHomeManager = opts.homeManager ?? true;
7
7
  return {
8
8
  nixos: {
9
- ...(useHomeManager && { imports: ["home-manager"] }),
9
+ ...(useHomeManager && { imports: ["inputs.home-manager.nixosModules.home-manager"] }),
10
10
  nixpkgs: {
11
11
  hostPlatform: opts.system ?? "x86_64-linux",
12
12
  config: { allowUnfree: opts.allowUnfree ?? true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adrifer/winix",
3
- "version": "0.1.2",
3
+ "version": "0.1.3-preview.0",
4
4
  "description": "TypeScript-first system configuration for NixOS, nix-darwin, and Home Manager",
5
5
  "license": "MIT",
6
6
  "author": "Adrian Fernandez",