Compare commits
2 Commits
11970e287c
...
691d671420
| Author | SHA1 | Date | |
|---|---|---|---|
| 691d671420 | |||
| fef845117e |
@@ -10,9 +10,10 @@ let
|
|||||||
group ? null,
|
group ? null,
|
||||||
modules ? [],
|
modules ? [],
|
||||||
}: let
|
}: let
|
||||||
localNixpkgs = nixpkgs.lib.attrByPath [ "nixpkgs-${name}" ] nixpkgs inputs;
|
localNixpkgs = import ./nixpkgs.nix inputs;
|
||||||
in localNixpkgs.lib.nixosSystem {
|
in nixpkgs.lib.nixosSystem {
|
||||||
system = system;
|
system = system;
|
||||||
|
pkgs = localNixpkgs.${system};
|
||||||
modules = modules ++ [
|
modules = modules ++ [
|
||||||
self.nixosModules.nixfilesInputs
|
self.nixosModules.nixfilesInputs
|
||||||
self.nixosModules.clerie
|
self.nixosModules.clerie
|
||||||
@@ -22,12 +23,6 @@ let
|
|||||||
# Set hostname
|
# Set hostname
|
||||||
networking.hostName = lib.mkDefault name;
|
networking.hostName = lib.mkDefault name;
|
||||||
|
|
||||||
# Apply overlays
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
self.overlays.nixfilesInputs
|
|
||||||
self.overlays.clerie
|
|
||||||
];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Make the contents of the flake availiable to modules.
|
Make the contents of the flake availiable to modules.
|
||||||
Useful for having the monitoring server scraping the
|
Useful for having the monitoring server scraping the
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
root = pkgs.clerie-keys;
|
root = pkgs.clerie-keys;
|
||||||
};
|
};
|
||||||
locations."= /ssh/known_hosts" = {
|
locations."= /ssh/known_hosts" = {
|
||||||
alias = pkgs.writeText "known_hosts" (import ../../lib/ssh-known-hosts.nix);
|
alias = pkgs.clerie-ssh-known-hosts + "/known_hosts";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
types { }
|
types { }
|
||||||
default_type "text/plain; charset=utf-8";
|
default_type "text/plain; charset=utf-8";
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
|
{
|
||||||
|
writeTextFile,
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
stripR = str: if (builtins.substring ((builtins.stringLength str) - 1) (builtins.stringLength str) str) == "\n" then stripR (builtins.substring 0 ((builtins.stringLength str) - 1) str) else str;
|
stripR = str: if (builtins.substring ((builtins.stringLength str) - 1) (builtins.stringLength str) str) == "\n" then stripR (builtins.substring 0 ((builtins.stringLength str) - 1) str) else str;
|
||||||
hostsWithSshPubkey = builtins.filter (hostname: (builtins.substring 0 1 hostname) != "_" && builtins.pathExists (../hosts + "/${hostname}/ssh.pub")) (builtins.attrNames (builtins.readDir ../hosts));
|
hostsWithSshPubkey = builtins.filter (hostname: (builtins.substring 0 1 hostname) != "_" && builtins.pathExists (../../hosts + "/${hostname}/ssh.pub")) (builtins.attrNames (builtins.readDir ../../hosts));
|
||||||
sshkeyList = map (hostname: {
|
sshkeyList = map (hostname: {
|
||||||
name = hostname;
|
name = hostname;
|
||||||
sshPubkey = stripR (builtins.readFile (../hosts + "/${hostname}/ssh.pub"));
|
sshPubkey = stripR (builtins.readFile (../../hosts + "/${hostname}/ssh.pub"));
|
||||||
}) hostsWithSshPubkey;
|
}) hostsWithSshPubkey;
|
||||||
knownHosts = builtins.concatStringsSep "" (builtins.map ({name, sshPubkey}: ''
|
knownHosts = builtins.concatStringsSep "" (builtins.map ({name, sshPubkey}: ''
|
||||||
${name} ${sshPubkey}
|
${name} ${sshPubkey}
|
||||||
${name}.net.clerie.de ${sshPubkey}
|
${name}.net.clerie.de ${sshPubkey}
|
||||||
'') sshkeyList);
|
'') sshkeyList);
|
||||||
in
|
in writeTextFile {
|
||||||
knownHosts
|
name = "clerie-ssh-known-hosts";
|
||||||
|
destination = "/known_hosts";
|
||||||
|
allowSubstitutes = true;
|
||||||
|
preferLocalBuild = false;
|
||||||
|
text = knownHosts;
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ final: prev: {
|
|||||||
clerie-backup = final.callPackage ./clerie-backup {};
|
clerie-backup = final.callPackage ./clerie-backup {};
|
||||||
clerie-cleanup-branches = final.callPackage ./clerie-update-nixfiles/clerie-cleanup-branches.nix {};
|
clerie-cleanup-branches = final.callPackage ./clerie-update-nixfiles/clerie-cleanup-branches.nix {};
|
||||||
clerie-keys = final.callPackage ./clerie-keys {};
|
clerie-keys = final.callPackage ./clerie-keys {};
|
||||||
|
clerie-ssh-known-hosts = final.callPackage ./clerie-ssh-known-hosts {};
|
||||||
clerie-system-remote-install = final.callPackage ./clerie-system-remote-install {};
|
clerie-system-remote-install = final.callPackage ./clerie-system-remote-install {};
|
||||||
clerie-system-upgrade = final.callPackage ./clerie-system-upgrade/clerie-system-upgrade.nix {};
|
clerie-system-upgrade = final.callPackage ./clerie-system-upgrade/clerie-system-upgrade.nix {};
|
||||||
clerie-merge-nixfiles-update = final.callPackage ./clerie-update-nixfiles/clerie-merge-nixfiles-update.nix {};
|
clerie-merge-nixfiles-update = final.callPackage ./clerie-update-nixfiles/clerie-merge-nixfiles-update.nix {};
|
||||||
|
|||||||
Reference in New Issue
Block a user