Compare commits
5 Commits
b77600c855
...
317356ed79
| Author | SHA1 | Date | |
|---|---|---|---|
| 317356ed79 | |||
| ca3131c7ef | |||
| 912a6b7242 | |||
| 96d409b636 | |||
| 09817ded71 |
@ -1,31 +1,25 @@
|
|||||||
{ 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.myPackages.installFiles = lib.mkOption {
|
options.customPkgs.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
|
||||||
];
|
];
|
||||||
#_module.args = { inherit installFiles; }; ##uncomment to pass installFiles to modules
|
##uncomment to pass installFiles to modules
|
||||||
config = {
|
config = {
|
||||||
myPackages.installFiles = pkgs.runCommand "install-files" {
|
customPkgs.installFiles = pkgs.runCommand "installFiles" {} ''
|
||||||
#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 = {
|
||||||
@ -38,8 +32,10 @@
|
|||||||
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
|
||||||
@ -50,8 +46,9 @@
|
|||||||
pkgs.util-linux
|
pkgs.util-linux
|
||||||
pkgs.nettools
|
pkgs.nettools
|
||||||
pkgs.nixos-facter
|
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";
|
system.stateVersion = "24.11";
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
#!/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 '$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?"
|
echo "System should be installed?"
|
||||||
@ -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?
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@ -1,12 +1,12 @@
|
|||||||
{ pkgs, config, lib, ... }:
|
{ pkgs, config, lib, installFiles, ... }:
|
||||||
{
|
{
|
||||||
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.util-linux pkgs.parted pkgs.nixos-install-tools pkgs.nixos-anywhere pkgs.disko ];
|
path = [ pkgs.coreutils ];
|
||||||
preStart = "/run/current-system/sw/bin/sleep 60";
|
preStart = "/run/current-system/sw/bin/sleep 4";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
@ -16,14 +16,23 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
# Your installation commands here
|
mkdir /home/nixos/installer
|
||||||
if [ ! -f /etc/installation-completed ]; then
|
cp -R ${config.myPackages.installFiles}/ /home/nixos/installer
|
||||||
# Run your installation steps
|
ln -s /home/nixos/installer/bin/installer.sh /home/nixos/installer.sh
|
||||||
"${config.myPackages.installFiles}/bin/install.sh"
|
echo "Installer files are available in /home/nixos/installer"
|
||||||
# Mark as completed
|
echo "The installer.sh script is available in directly in /home/nixos/installer.sh"
|
||||||
touch /etc/installation-completed
|
|
||||||
fi
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
## 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
|
||||||
|
#'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user