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

View File

@ -1,12 +1,9 @@
#!/run/current-system/sw/bin/bash #!/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 "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 #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?" echo "System should be installed?"

View File

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

View File

@ -1,12 +1,12 @@
{ pkgs, config, lib, installFiles, ... }: { pkgs, config, lib, ... }:
{ {
config = { config = {
systemd.services.custom-install = { systemd.services.custom-install = {
description = "Custom installation script"; description = "Custom installation script";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
path = [ pkgs.coreutils ]; path = [ pkgs.util-linux pkgs.parted pkgs.nixos-install-tools pkgs.nixos-anywhere pkgs.disko ];
preStart = "/run/current-system/sw/bin/sleep 4"; preStart = "/run/current-system/sw/bin/sleep 60";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
@ -14,25 +14,16 @@
StandardOutput = "tty"; StandardOutput = "tty";
StandardError = "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 = ''
#script = '' # Your installation commands here
# # Your installation commands here if [ ! -f /etc/installation-completed ]; then
# if [ ! -f /etc/installation-completed ]; then # Run your installation steps
# # Run your installation steps "${config.myPackages.installFiles}/bin/install.sh"
# "${config.myPackages.installFiles}/bin/install.sh" # Mark as completed
# # Mark as completed touch /etc/installation-completed
# touch /etc/installation-completed fi
# fi '';
#'';
}; };
}; };
} }