Trying out a seperate hosts flake
This commit is contained in:
parent
ee77c14b0e
commit
c3fe6c59e3
32
flake.lock
generated
32
flake.lock
generated
@ -21,6 +21,20 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"hosts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"narHash": "sha256-LbajVWkqSpZt2SW7tGqxIn391hCT02AyokxFuNyA/4w=",
|
||||||
|
"path": "../fudo-hosts",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"path": "../fudo-hosts",
|
||||||
|
"type": "path"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1628427351,
|
"lastModified": 1628427351,
|
||||||
@ -36,10 +50,26 @@
|
|||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1628427351,
|
||||||
|
"narHash": "sha256-WuZUIQ07AvRw+T9wvQ3qFf8MXmKZ+ktZz9drNgWXDbs=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "348bc5de8bca09c624f5c4975f538684da4713d2",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-21.05",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"nixpkgs": "nixpkgs"
|
"hosts": "hosts",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
19
flake.nix
19
flake.nix
@ -3,24 +3,17 @@
|
|||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-21.05";
|
nixpkgs.url = "nixpkgs/nixos-21.05";
|
||||||
|
|
||||||
|
hosts.url = "path:../fudo-hosts";
|
||||||
|
|
||||||
home-manager.url = "github:nix-community/home-manager/release-21.05";
|
home-manager.url = "github:nix-community/home-manager/release-21.05";
|
||||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { nixpkgs, home-manager, ... }:
|
outputs = { nixpkgs, hosts, home-manager, ... }:
|
||||||
let
|
let
|
||||||
hosts-path = ./config/hosts;
|
|
||||||
lib = nixpkgs.lib;
|
|
||||||
is-nix-file = filename: type: (builtins.match ".+.nix$" filename) != null;
|
|
||||||
is-regular-file = filename: type: type == "regular" || type == "link";
|
|
||||||
hostname-from-file = filename:
|
|
||||||
builtins.replaceStrings [ ".nix" ] [ "" ] filename;
|
|
||||||
hosts = map hostname-from-file (lib.attrNames (lib.filterAttrs is-nix-file
|
|
||||||
(lib.filterAttrs is-regular-file (builtins.readDir hosts-path))));
|
|
||||||
hostsOpts = lib.listToAttrs (hostname:
|
|
||||||
lib.nameValuePair hostname (import hosts-path + "/${hostname}.nix"));
|
|
||||||
|
|
||||||
pkgs = import nixpkgs { };
|
pkgs = import nixpkgs { };
|
||||||
|
lib = nixpkgs.lib;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
nixConfigurations = lib.mapAttrs (hostname: hostOpts:
|
nixConfigurations = lib.mapAttrs (hostname: hostOpts:
|
||||||
@ -34,6 +27,6 @@
|
|||||||
include-secrets = true;
|
include-secrets = true;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}) hostsOpts;
|
}) hosts.host-configs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user