feat: add nix-topology

This commit is contained in:
Swarsel 2024-12-28 12:34:34 +01:00
parent dcb18d99b0
commit 47b99bb39d
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
4 changed files with 1025 additions and 827 deletions

View file

@ -725,6 +725,9 @@ In =outputs = inputs@ [...]=, the =inputs@= makes it so that all inputs are auto
<<flakedroidconf>> <<flakedroidconf>>
}; };
topology =
<<topologyconf>>
}; };
} }
@ -836,6 +839,8 @@ A short overview over each input and what it does:
This is a private repository that I use for settings in modules that do not expose a =secretsFile= (or similar) option. An example is the =LastFM.ApiKey= option in [[#h:f347f3ad-5100-4c4f-8616-cfd7f8e14a72][navidrome]]: This is a private repository that I use for settings in modules that do not expose a =secretsFile= (or similar) option. An example is the =LastFM.ApiKey= option in [[#h:f347f3ad-5100-4c4f-8616-cfd7f8e14a72][navidrome]]:
=LastFM.ApiKey = builtins.readFile "${secretsDirectory}/navidrome/lastfm-secret";= =LastFM.ApiKey = builtins.readFile "${secretsDirectory}/navidrome/lastfm-secret";=
When setting this option normally, the password would normally be written world-readable not only in the nix store, but also in the configuration. Hence, I put such passwords into a private repository. This allows me to keep purity of the flake while keeping a level of security on these secrets. When setting this option normally, the password would normally be written world-readable not only in the nix store, but also in the configuration. Hence, I put such passwords into a private repository. This allows me to keep purity of the flake while keeping a level of security on these secrets.
- [[https://github.com/oddlama/nix-topology][nix-topology]]
This automatically creates a topology diagram of my configuration.
#+begin_src nix :tangle no :noweb-ref flakeinputs #+begin_src nix :tangle no :noweb-ref flakeinputs
@ -939,6 +944,8 @@ When setting this option normally, the password would normally be written world-
inputs = { }; inputs = { };
}; };
nix-topology.url = "github:oddlama/nix-topology";
#+end_src #+end_src
** let ** let
:PROPERTIES: :PROPERTIES:
@ -1000,6 +1007,7 @@ The interesting part is in the start:
inputs.impermanence.nixosModules.impermanence inputs.impermanence.nixosModules.impermanence
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm
inputs.nix-topology.nixosModules.default
./profiles/common/nixos ./profiles/common/nixos
]; ];
@ -1171,6 +1179,22 @@ Nix on Android also demands an own flake output, which is provided here.
#+end_src #+end_src
** topologyConfigurations
#+begin_src nix :tangle no :noweb-ref topologyconf
forEachSystem (pkgs: import inputs.nix-topology {
inherit pkgs;
modules = [
# Your own file to define global topology. Works in principle like a nixos module but uses different options.
# ./topology.nix
{ inherit (self) nixosConfigurations; }
];
});
#+end_src
* System * System
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:02cd20be-1ffa-4904-9d5a-da5a89ba1421 :CUSTOM_ID: h:02cd20be-1ffa-4904-9d5a-da5a89ba1421
@ -3557,6 +3581,7 @@ When adding a new entry here, do not forget to add it in the default output of t
// (zjstatus final prev) // (zjstatus final prev)
// (inputs.nur.overlays.default final prev) // (inputs.nur.overlays.default final prev)
// (inputs.emacs-overlay.overlay final prev) // (inputs.emacs-overlay.overlay final prev)
// (inputs.nix-topology.overlays.default final prev)
// (inputs.nixgl.overlay final prev); // (inputs.nixgl.overlay final prev);
} }

247
flake.lock generated
View file

@ -96,6 +96,27 @@
"type": "github" "type": "github"
} }
}, },
"devshell": {
"inputs": {
"nixpkgs": [
"nix-topology",
"nixpkgs"
]
},
"locked": {
"lastModified": 1728330715,
"narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=",
"owner": "numtide",
"repo": "devshell",
"rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"disko": { "disko": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -216,6 +237,22 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_6": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@ -294,6 +331,24 @@
} }
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
@ -308,7 +363,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": { "flake-utils_4": {
"inputs": { "inputs": {
"systems": [ "systems": [
"stylix", "stylix",
@ -329,9 +384,9 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_4": { "flake-utils_5": {
"inputs": { "inputs": {
"systems": "systems_4" "systems": "systems_5"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1731533236,
@ -408,6 +463,28 @@
} }
}, },
"gitignore_2": { "gitignore_2": {
"inputs": {
"nixpkgs": [
"nix-topology",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_3": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"pre-commit-hooks", "pre-commit-hooks",
@ -710,10 +787,31 @@
"url": "ssh://git@github.com/Swarsel/nix-secrets.git" "url": "ssh://git@github.com/Swarsel/nix-secrets.git"
} }
}, },
"nix-topology": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_3",
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1734639503,
"narHash": "sha256-Z58HeNQpfbi94Cw8VxdF1GtU1S5AoWO0hfJTxA6wu78=",
"owner": "oddlama",
"repo": "nix-topology",
"rev": "d6edd49bac68dc70e19b5e91617b9f04e8ac1c43",
"type": "github"
},
"original": {
"owner": "oddlama",
"repo": "nix-topology",
"type": "github"
}
},
"nixgl": { "nixgl": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1713543440, "lastModified": 1713543440,
@ -905,6 +1003,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_10": {
"locked": {
"lastModified": 1732812356,
"narHash": "sha256-LNcgjOLArRlx2W6XSi0yc0xwLjrK3KF9LxAMqUgFDgw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "581d7e4d23b91daf2afa0005a5d3d01d6a8884fe",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1731319897, "lastModified": 1731319897,
@ -922,6 +1036,22 @@
} }
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": {
"lastModified": 1730531603,
"narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1660551188, "lastModified": 1660551188,
"narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=",
@ -936,7 +1066,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1733581040, "lastModified": 1733581040,
"narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=", "narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=",
@ -952,7 +1082,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": { "nixpkgs_6": {
"locked": { "locked": {
"lastModified": 1720957393, "lastModified": 1720957393,
"narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=", "narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=",
@ -968,7 +1098,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_6": { "nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1733581040, "lastModified": 1733581040,
"narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=", "narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=",
@ -984,7 +1114,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_7": { "nixpkgs_8": {
"locked": { "locked": {
"lastModified": 1731763621, "lastModified": 1731763621,
"narHash": "sha256-ddcX4lQL0X05AYkrkV2LMFgGdRvgap7Ho8kgon3iWZk=", "narHash": "sha256-ddcX4lQL0X05AYkrkV2LMFgGdRvgap7Ho8kgon3iWZk=",
@ -1000,7 +1130,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_8": { "nixpkgs_9": {
"locked": { "locked": {
"lastModified": 1732238832, "lastModified": 1732238832,
"narHash": "sha256-sQxuJm8rHY20xq6Ah+GwIUkF95tWjGRd1X8xF+Pkk38=", "narHash": "sha256-sQxuJm8rHY20xq6Ah+GwIUkF95tWjGRd1X8xF+Pkk38=",
@ -1016,22 +1146,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_9": {
"locked": {
"lastModified": 1732812356,
"narHash": "sha256-LNcgjOLArRlx2W6XSi0yc0xwLjrK3KF9LxAMqUgFDgw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "581d7e4d23b91daf2afa0005a5d3d01d6a8884fe",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nmd": { "nmd": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1089,7 +1203,7 @@
"nswitch-rcm-nix": { "nswitch-rcm-nix": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_6"
}, },
"locked": { "locked": {
"lastModified": 1721304043, "lastModified": 1721304043,
@ -1108,7 +1222,7 @@
"nur": { "nur": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_3", "flake-parts": "flake-parts_3",
"nixpkgs": "nixpkgs_6", "nixpkgs": "nixpkgs_7",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
@ -1130,21 +1244,25 @@
"flake-compat": "flake-compat_4", "flake-compat": "flake-compat_4",
"gitignore": "gitignore_2", "gitignore": "gitignore_2",
"nixpkgs": [ "nixpkgs": [
"nix-topology",
"nixpkgs" "nixpkgs"
], ],
"nixpkgs-stable": "nixpkgs-stable_4" "nixpkgs-stable": [
"nix-topology",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1733665616, "lastModified": 1730797577,
"narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=", "narHash": "sha256-SrID5yVpyUfknUTGWgYkTyvdr9J1LxUym4om3SVGPkg=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a", "rev": "1864030ed24a2b8b4e4d386a5eeaf0c5369e50a9",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "pre-commit-hooks.nix",
"type": "github" "type": "github"
} }
}, },
@ -1175,6 +1293,29 @@
"type": "github" "type": "github"
} }
}, },
"pre-commit-hooks_2": {
"inputs": {
"flake-compat": "flake-compat_5",
"gitignore": "gitignore_3",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_4"
},
"locked": {
"lastModified": 1733665616,
"narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"disko": "disko", "disko": "disko",
@ -1188,17 +1329,18 @@
"nix-index-database": "nix-index-database_2", "nix-index-database": "nix-index-database_2",
"nix-on-droid": "nix-on-droid", "nix-on-droid": "nix-on-droid",
"nix-secrets": "nix-secrets", "nix-secrets": "nix-secrets",
"nix-topology": "nix-topology",
"nixgl": "nixgl", "nixgl": "nixgl",
"nixos-generators": "nixos-generators", "nixos-generators": "nixos-generators",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_4", "nixpkgs": "nixpkgs_5",
"nixpkgs-stable": "nixpkgs-stable_3", "nixpkgs-stable": "nixpkgs-stable_3",
"nswitch-rcm-nix": "nswitch-rcm-nix", "nswitch-rcm-nix": "nswitch-rcm-nix",
"nur": "nur", "nur": "nur",
"pre-commit-hooks": "pre-commit-hooks", "pre-commit-hooks": "pre-commit-hooks_2",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"stylix": "stylix", "stylix": "stylix",
"systems": "systems_3", "systems": "systems_4",
"zjstatus": "zjstatus" "zjstatus": "zjstatus"
} }
}, },
@ -1262,7 +1404,7 @@
}, },
"sops-nix": { "sops-nix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_7" "nixpkgs": "nixpkgs_8"
}, },
"locked": { "locked": {
"lastModified": 1733128155, "lastModified": 1733128155,
@ -1284,12 +1426,12 @@
"base16-fish": "base16-fish", "base16-fish": "base16-fish",
"base16-helix": "base16-helix", "base16-helix": "base16-helix",
"base16-vim": "base16-vim", "base16-vim": "base16-vim",
"flake-compat": "flake-compat_5", "flake-compat": "flake-compat_6",
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_4",
"gnome-shell": "gnome-shell", "gnome-shell": "gnome-shell",
"home-manager": "home-manager_3", "home-manager": "home-manager_3",
"nixpkgs": "nixpkgs_8", "nixpkgs": "nixpkgs_9",
"systems": "systems_2", "systems": "systems_3",
"tinted-foot": "tinted-foot", "tinted-foot": "tinted-foot",
"tinted-kitty": "tinted-kitty", "tinted-kitty": "tinted-kitty",
"tinted-tmux": "tinted-tmux" "tinted-tmux": "tinted-tmux"
@ -1339,6 +1481,21 @@
} }
}, },
"systems_3": { "systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_4": {
"locked": { "locked": {
"lastModified": 1689347949, "lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
@ -1353,7 +1510,7 @@
"type": "github" "type": "github"
} }
}, },
"systems_4": { "systems_5": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@ -1442,8 +1599,8 @@
"zjstatus": { "zjstatus": {
"inputs": { "inputs": {
"crane": "crane_2", "crane": "crane_2",
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_5",
"nixpkgs": "nixpkgs_9", "nixpkgs": "nixpkgs_10",
"rust-overlay": "rust-overlay_2" "rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {

View file

@ -115,6 +115,8 @@
inputs = { }; inputs = { };
}; };
nix-topology.url = "github:oddlama/nix-topology";
}; };
outputs = outputs =
@ -169,6 +171,7 @@
inputs.impermanence.nixosModules.impermanence inputs.impermanence.nixosModules.impermanence
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm
inputs.nix-topology.nixosModules.default
./profiles/common/nixos ./profiles/common/nixos
]; ];
@ -284,5 +287,17 @@
}; };
topology =
forEachSystem (pkgs: import inputs.nix-topology {
inherit pkgs;
modules = [
# Your own file to define global topology. Works in principle like a nixos module but uses different options.
# ./topology.nix
{ inherit (self) nixosConfigurations; }
];
});
}; };
} }

View file

@ -65,6 +65,7 @@ in
// (zjstatus final prev) // (zjstatus final prev)
// (inputs.nur.overlays.default final prev) // (inputs.nur.overlays.default final prev)
// (inputs.emacs-overlay.overlay final prev) // (inputs.emacs-overlay.overlay final prev)
// (inputs.nix-topology.overlays.default final prev)
// (inputs.nixgl.overlay final prev); // (inputs.nixgl.overlay final prev);
} }