Compare commits

...

5 Commits

Author SHA1 Message Date
317356ed79 add symlink and message 2025-01-01 18:36:20 -05:00
ca3131c7ef add sudo 2025-01-01 18:36:07 -05:00
912a6b7242 add config block 2025-01-01 18:27:07 -05:00
96d409b636 rework 2025-01-01 18:26:59 -05:00
09817ded71 adjust custom package 2025-01-01 18:26:39 -05:00
4 changed files with 41 additions and 32 deletions

View File

@ -1,31 +1,25 @@
{ 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.myPackages.installFiles = lib.mkOption {
options.customPkgs.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
];
#_module.args = { inherit installFiles; }; ##uncomment to pass installFiles to modules
##uncomment to pass installFiles to modules
config = {
myPackages.installFiles = pkgs.runCommand "install-files" {
#inherit (pkgs) coreutils;
} ''
customPkgs.installFiles = pkgs.runCommand "installFiles" {} ''
mkdir -p $out
cp -rv ${./initrd-include}/* $out/
chmod +x -R $out/bin/
'';
services.getty.autologinUser = "nixos";
security.sudo.wheelNeedsPassword = false;
users.users.nixos = {
@ -38,8 +32,10 @@
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
@ -50,9 +46,10 @@
pkgs.util-linux
pkgs.nettools
pkgs.nixos-facter
config.myPackages.installFiles
config.customPkgs.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,9 +1,12 @@
#!/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 '$storePath/etc#zabbixProxy' --disk main /dev/sda
nix run 'github:nix-community/disko/latest#disko-install' -- --flake './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, ... }:
{ pkgs, config, lib, installFiles, ... }:
{
config = {
systemd.services.custom-install = {
description = "Custom installation script";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
path = [ pkgs.util-linux pkgs.parted pkgs.nixos-install-tools pkgs.nixos-anywhere pkgs.disko ];
preStart = "/run/current-system/sw/bin/sleep 60";
path = [ pkgs.coreutils ];
preStart = "/run/current-system/sw/bin/sleep 4";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
@ -16,14 +16,23 @@
};
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
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
#'';
};
};
}