Added Install script for hosts

This commit is contained in:
2026-06-28 00:18:08 +02:00
parent b7edb85dd8
commit bbf95a5a8c
2 changed files with 174 additions and 0 deletions
Generated
+131
View File
@@ -110,6 +110,28 @@
"type": "github" "type": "github"
} }
}, },
"disko_2": {
"inputs": {
"nixpkgs": [
"nixos-anywhere",
"nixpkgs"
]
},
"locked": {
"lastModified": 1781152676,
"narHash": "sha256-RxWs5ND31KzTG7wvMM+PMfUjyNpmIEr999lqNARaM5o=",
"owner": "nix-community",
"repo": "disko",
"rev": "ff8702b4de27f72b4c78573dfb89ec74e36abdf1",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "disko",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -725,6 +747,27 @@
"type": "github" "type": "github"
} }
}, },
"nix-vm-test": {
"inputs": {
"nixpkgs": [
"nixos-anywhere",
"nixpkgs"
]
},
"locked": {
"lastModified": 1781506385,
"narHash": "sha256-kvTBHLiqB911yf2D9VThIRfB6Ai/E2H9+mVF0wR+9AY=",
"owner": "numtide",
"repo": "nix-vm-test",
"rev": "2071ebc1f5b2a2e0211a2ca38c4e678092df76a5",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-vm-test",
"type": "github"
}
},
"nixcord": { "nixcord": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
@@ -748,6 +791,72 @@
"type": "github" "type": "github"
} }
}, },
"nixos-anywhere": {
"inputs": {
"disko": "disko_2",
"nix-vm-test": "nix-vm-test",
"nixos-images": "nixos-images",
"nixos-stable": "nixos-stable",
"nixpkgs": [
"nixpkgs"
],
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1782285665,
"narHash": "sha256-ISUNn+z9+BIDGRrNAmEfghvzFmDgKtGHGEYqIDvGeWk=",
"owner": "nix-community",
"repo": "nixos-anywhere",
"rev": "4b74194d2927a7741d023b3fd2a0d252059f75ee",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-anywhere",
"type": "github"
}
},
"nixos-images": {
"inputs": {
"nixos-stable": [
"nixos-anywhere",
"nixos-stable"
],
"nixos-unstable": [
"nixos-anywhere",
"nixpkgs"
]
},
"locked": {
"lastModified": 1781778781,
"narHash": "sha256-CYnhWtKIr0xbxQT6N0X1j0FsmCG+cDV498jyO0xevwQ=",
"owner": "nix-community",
"repo": "nixos-images",
"rev": "94cbd4c8da5f130f188af04293514926a947b380",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-images",
"type": "github"
}
},
"nixos-stable": {
"locked": {
"lastModified": 1782116945,
"narHash": "sha256-G3tw/IXmaH6IQ2upZvhuN9sG8CkuX+BLuJDpE8hz0Ds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "34268251cf5547d39063f2c5ea9a196246f7f3a6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1780749050, "lastModified": 1780749050,
@@ -905,6 +1014,7 @@
"impermanence": "impermanence", "impermanence": "impermanence",
"nix-homebrew": "nix-homebrew", "nix-homebrew": "nix-homebrew",
"nixcord": "nixcord", "nixcord": "nixcord",
"nixos-anywhere": "nixos-anywhere",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"nixvim": "nixvim", "nixvim": "nixvim",
"nur": "nur", "nur": "nur",
@@ -1014,6 +1124,27 @@
"type": "github" "type": "github"
} }
}, },
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixos-anywhere",
"nixpkgs"
]
},
"locked": {
"lastModified": 1780220602,
"narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "db947814a175b7ca6ded66e21383d938df01c227",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"xdph": { "xdph": {
"inputs": { "inputs": {
"hyprland-protocols": [ "hyprland-protocols": [
+43
View File
@@ -16,6 +16,12 @@
url = "github:nix-community/impermanence"; url = "github:nix-community/impermanence";
}; };
# declarative installer
nixos-anywhere = {
url = "github:nix-community/nixos-anywhere";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative Configs # declarative Configs
home-manager = { home-manager = {
url = "github:nix-community/home-manager/master"; url = "github:nix-community/home-manager/master";
@@ -98,6 +104,7 @@
nur, nur,
impermanence, impermanence,
disko, disko,
nixos-anywhere,
... ...
}@inputs: }@inputs:
let let
@@ -117,6 +124,33 @@
]; ];
}; };
mkInstall =
{
hostName,
target ? "192.168.2.99",
}:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
type = "app";
program = "${
pkgs.writeShellApplication {
name = "install-${hostName}";
runtimeInputs = [ nixos-anywhere.packages.x86_64-linux.nixos-anywhere ];
text = ''
EXTRA_FILES="''${1:-./extra-files}"
TARGET="''${2:-${target}}"
nixos-anywhere \
--flake .#${hostName} \
--extra-files "$EXTRA_FILES" \
--chown /persist/secrets/age-key.txt "$(id -u ${primaryUser})":100 \
root@"$TARGET"
'';
}
}/bin/install-${hostName}";
};
mkSystem = mkSystem =
{ {
hostName, hostName,
@@ -227,5 +261,14 @@
}; };
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
apps.x86_64-linux = {
install-cyper-node-1 = mkInstall {
hostName = "cyper-node-1";
};
install-cyper-node-2 = mkInstall {
hostName = "cyper-node-2";
};
};
}; };
} }