Compare commits

..

No commits in common. "317356ed79ad357a6149dcce3499ba202efbbd6a" and "b77600c855b6731515b418cb0264c87000120318" have entirely different histories.

4 changed files with 33 additions and 42 deletions

View File

@ -1,25 +1,31 @@
{ config, pkgs ? import <nixpkgs>, lib, ... }:
#let
# installFiles = pkgs.runCommand "install-files" {
# #inherit (pkgs) coreutils;
# } ''
# mkdir -p $out
# cp -rv ${./initrd-include}/* $out/
# '';
#in
## above is the olde installFiles Declaration.
{
options.customPkgs.installFiles = lib.mkOption {
options.myPackages.installFiles = lib.mkOption {
type = lib.types.package;
};
_module.args = {
installFiles = config.customPkgs.installFiles;
};
imports = [
../quickly.nix
## installer.nix is a system service to run a script on boot
../installer/installer.nix
];
##uncomment to pass installFiles to modules
#_module.args = { inherit installFiles; }; ##uncomment to pass installFiles to modules
config = {
customPkgs.installFiles = pkgs.runCommand "installFiles" {} ''
myPackages.installFiles = pkgs.runCommand "install-files" {
#inherit (pkgs) coreutils;
} ''
mkdir -p $out
cp -rv ${./initrd-include}/* $out/
chmod +x -R $out/bin/
'';
services.getty.autologinUser = "nixos";
security.sudo.wheelNeedsPassword = false;
users.users.nixos = {
@ -32,10 +38,8 @@
tree
];
};
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = [
pkgs.vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
pkgs.wget
@ -46,10 +50,9 @@
pkgs.util-linux
pkgs.nettools
pkgs.nixos-facter
config.customPkgs.installFiles
config.myPackages.installFiles
];
system.autoUpgrade.channel = "https://nixos.org/channels/nixos-24.11/";
system.autoUpgrade.channel = "https://nixos.org/channels/nixos-24.11/";
system.stateVersion = "24.11";
};
}

View File

@ -1,12 +1,9 @@
#!/run/current-system/sw/bin/bash
#storePath=$(/run/current-system/sw/bin/nix-store -q installFiles)
storePath=$(/run/current-system/sw/bin/nix-store -q installFiles)
echo "Installing system using disco and flake"
echo "Input your sudo password when prompted"
sleep 2s
sudo -s
cd ./installer
#disko-install --disk main /dev/sda --flake $storePath/etc#zabbixProxy
nix run 'github:nix-community/disko/latest#disko-install' -- --flake './etc#zabbixProxy' --disk main /dev/sda
nix run 'github:nix-community/disko/latest#disko-install' -- --flake '$storePath/etc#zabbixProxy' --disk main /dev/sda
echo "System should be installed?"

View File

@ -10,7 +10,7 @@
./hardware-configuration.nix
./diskco.nix
];
config = {
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
@ -162,5 +162,5 @@ fi
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
};
}

View File

@ -1,12 +1,12 @@
{ pkgs, config, lib, installFiles, ... }:
{ pkgs, config, lib, ... }:
{
config = {
systemd.services.custom-install = {
description = "Custom installation script";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
path = [ pkgs.coreutils ];
preStart = "/run/current-system/sw/bin/sleep 4";
path = [ pkgs.util-linux pkgs.parted pkgs.nixos-install-tools pkgs.nixos-anywhere pkgs.disko ];
preStart = "/run/current-system/sw/bin/sleep 60";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
@ -14,25 +14,16 @@
StandardOutput = "tty";
StandardError = "tty";
};
script = ''
mkdir /home/nixos/installer
cp -R ${config.myPackages.installFiles}/ /home/nixos/installer
ln -s /home/nixos/installer/bin/installer.sh /home/nixos/installer.sh
echo "Installer files are available in /home/nixos/installer"
echo "The installer.sh script is available in directly in /home/nixos/installer.sh"
'';
## Old install script
#script = ''
# # Your installation commands here
# if [ ! -f /etc/installation-completed ]; then
# # Run your installation steps
# "${config.myPackages.installFiles}/bin/install.sh"
# # Mark as completed
# touch /etc/installation-completed
# fi
#'';
script = ''
# Your installation commands here
if [ ! -f /etc/installation-completed ]; then
# Run your installation steps
"${config.myPackages.installFiles}/bin/install.sh"
# Mark as completed
touch /etc/installation-completed
fi
'';
};
};
}