forked from DGNum/infrastructure
feat(meta): Remove default values for nixpkgs version
They are considered harmful, and it simplifies the code.
This commit is contained in:
parent
1821104e8e
commit
eb5b8740a8
4 changed files with 25 additions and 34 deletions
18
hive.nix
18
hive.nix
|
@ -23,17 +23,19 @@ let
|
|||
nixpkgs' = import ./meta/nixpkgs.nix;
|
||||
# All supported nixpkgs versions × systems, instanciated
|
||||
nixpkgs = nix-lib.mapSingleFuse (
|
||||
s: nix-lib.mapSingleFuse (mkSystemNixpkgs s) nixpkgs'.versions.supported
|
||||
) nixpkgs'.systems.supported;
|
||||
s: nix-lib.mapSingleFuse (mkSystemNixpkgs s) nixpkgs'.versions
|
||||
) nixpkgs'.systems;
|
||||
|
||||
# Get the configured nixos version for the node,
|
||||
# defaulting to the one defined in meta/nixpkgs
|
||||
version = node: nodes'.${node}.nixpkgs.version or nixpkgs'.versions.default;
|
||||
systemType =
|
||||
version = node: nodes'.${node}.nixpkgs.version;
|
||||
system =
|
||||
node:
|
||||
nodes'.${node}.nixpkgs.system
|
||||
or (warn "${node}: Not specifying the `deployment.systemType` is deprecated!" "nixos");
|
||||
|
||||
nodePkgs = node: nixpkgs.${system node}.${version node};
|
||||
|
||||
# Builds a patched version of nixpkgs, only as the source
|
||||
mkNixpkgs' =
|
||||
v:
|
||||
|
@ -73,11 +75,11 @@ let
|
|||
# Function to create arguments based on the node
|
||||
#
|
||||
mkArgs = node: rec {
|
||||
lib = nixpkgs.${systemType node}.${version node}.lib // {
|
||||
lib = nodePkgs.lib // {
|
||||
extra = nix-lib;
|
||||
};
|
||||
|
||||
sourcePkgs = nixpkgs.${systemType node}.${version node};
|
||||
nodePkgs = nodePkgs node;
|
||||
meta = (import ./meta) lib;
|
||||
|
||||
nodeMeta = meta.nodes.${node};
|
||||
|
@ -86,7 +88,7 @@ in
|
|||
|
||||
{
|
||||
meta = {
|
||||
nodeNixpkgs = nix-lib.mapSingleFuse (n: nixpkgs.${systemType n}.${version n}) nodes;
|
||||
nodeNixpkgs = nix-lib.mapSingleFuse nodePkgs nodes;
|
||||
|
||||
specialArgs = {
|
||||
inherit nixpkgs sources;
|
||||
|
@ -99,7 +101,7 @@ in
|
|||
|
||||
registry = {
|
||||
nixos = {
|
||||
evalConfig = args: import "${args.specialArgs.sourcePkgs.path}/nixos/lib/eval-config.nix" args;
|
||||
evalConfig = args: import "${args.specialArgs.nodePkgs.path}/nixos/lib/eval-config.nix" args;
|
||||
defaults =
|
||||
{ name, nodeMeta, ... }:
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ TODO.
|
|||
|
||||
# Nixpkgs
|
||||
|
||||
Machines can use different versions of NixOS, the supported and default ones are specified here.
|
||||
Machines can use different versions of NixOS, the supported ones are specified here.
|
||||
|
||||
## How to add a new version
|
||||
|
||||
|
@ -55,7 +55,7 @@ The nodes are declared statically, several options can be configured:
|
|||
|
||||
- `deployment`, the colmena deployment option
|
||||
- `stateVersion`, the state version of the node
|
||||
- `nixpkgs`, the version of NixOS to use
|
||||
- `nixpkgs`, the version and sytem of NixOS to use
|
||||
- `admins`, the list of administrators specific to this node, they will be given root access
|
||||
- `adminGroups`, a list of groups whose members will be added to `admins`
|
||||
- `site`, the physical location of the node
|
||||
|
|
|
@ -1,25 +1,15 @@
|
|||
{
|
||||
versions = {
|
||||
# Default version of nixpkgs to use
|
||||
default = "24.05";
|
||||
|
||||
versions = [
|
||||
# Supported nixpkgs versions
|
||||
supported = [
|
||||
"unstable"
|
||||
"23.11"
|
||||
"24.05"
|
||||
"24.11"
|
||||
];
|
||||
};
|
||||
|
||||
systems = {
|
||||
# Default system for our deployments
|
||||
default = "nixos";
|
||||
|
||||
systems = [
|
||||
# Supported system types
|
||||
supported = [
|
||||
"zyxel-nwa50ax"
|
||||
"nixos"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -141,16 +141,15 @@ in
|
|||
|
||||
nixpkgs = {
|
||||
version = mkOption {
|
||||
type = enum nixpkgs.versions.supported;
|
||||
inherit (nixpkgs.versions) default;
|
||||
type = enum nixpkgs.versions;
|
||||
description = ''
|
||||
Version of nixpkgs to use.
|
||||
'';
|
||||
example = "unstable";
|
||||
};
|
||||
|
||||
system = mkOption {
|
||||
type = enum nixpkgs.systems.supported;
|
||||
inherit (nixpkgs.systems) default;
|
||||
type = enum nixpkgs.systems;
|
||||
description = ''
|
||||
Type of system for this node, will impact how it is evaluated and deployed.
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue