Compare commits

..

29 Commits

Author SHA1 Message Date
773b4309e3 remove module args again 2025-01-01 20:05:19 -05:00
2dc1cf664e try try try again 2025-01-01 20:04:34 -05:00
f6accc8faf adjust import inherits 2025-01-01 20:00:27 -05:00
4ee3d68148 remove args again 2025-01-01 19:52:17 -05:00
88bc80b663 more attempts at custom package 2025-01-01 19:51:36 -05:00
d2e13171a1 move options out of config 2025-01-01 19:39:15 -05:00
235ac07b77 move imports out of config 2025-01-01 19:38:29 -05:00
e533abc120 comment out module args 2025-01-01 19:36:56 -05:00
eed3a30d33 remove redundanct import 2025-01-01 19:35:17 -05:00
77a5b731b5 move module args 2025-01-01 19:34:34 -05:00
4ca8a524fe move options 2025-01-01 19:34:02 -05:00
8e41455ed4 remove _ again 2025-01-01 19:33:03 -05:00
832f3f348a try again 2025-01-01 19:32:33 -05:00
f1d705392e remove _ 2025-01-01 19:31:10 -05:00
6c9ba6ce29 adjust mod args again 2025-01-01 19:30:34 -05:00
06a2630a1c comment out moduleArgs 2025-01-01 19:13:50 -05:00
d287793cf0 more adjustments 2025-01-01 19:09:30 -05:00
b4eac9aadd adjust modulargs position again 2025-01-01 18:59:10 -05:00
fa0ef879d6 adjust custompkg definition 2025-01-01 18:56:03 -05:00
cf7389fc48 move option outside config 2025-01-01 18:48:08 -05:00
efeca3eca6 adjust moduleArgs again 2025-01-01 18:47:08 -05:00
bc9206355f adjust config scope 2025-01-01 18:45:25 -05:00
1f20d9d1d6 adjust moduleArgs again 2025-01-01 18:43:17 -05:00
96540b0a26 adjust moduleArgs 2025-01-01 18:39:47 -05:00
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 46 additions and 29 deletions

View File

@@ -1,31 +1,33 @@
{ config, pkgs ? import <nixpkgs>, lib, ... }:
#let
# installFiles = pkgs.runCommand "install-files" {
# #inherit (pkgs) coreutils;
# } ''
# installFiles = pkgs.runCommand "installFiles" {} ''
# mkdir -p $out
# cp -rv ${./initrd-include}/* $out/
# chmod +x -R $out/bin/
# '';
#in
## above is the olde installFiles Declaration.
{
options.myPackages.installFiles = lib.mkOption {
type = lib.types.package;
};
imports = [
../quickly.nix
## installer.nix is a system service to run a script on boot
#(../installer/installer.nix { inherit customPkgs; inherit config; inherit pkgs; inherit lib; })
../installer/installer.nix
];
#_module.args = { inherit installFiles; }; ##uncomment to pass installFiles to modules
# _module.args = {
# installFiles = config.customPkgs.installFiles;
# };
options.customPkgs.installFiles = lib.mkOption {
type = lib.types.package;
};
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 +40,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 +54,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

@@ -5,8 +5,8 @@
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;
@@ -14,16 +14,25 @@
StandardOutput = "tty";
StandardError = "tty";
};
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.customPkgs.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
#'';
};
};
}