update installer
This commit is contained in:
parent
d8d9988453
commit
de91841c0e
18
flake.nix
18
flake.nix
@ -60,19 +60,19 @@
|
|||||||
};
|
};
|
||||||
in genAttrs hosts mkHost;
|
in genAttrs hosts mkHost;
|
||||||
|
|
||||||
legacyPackages.x86_64-linux =
|
# legacyPackages.x86_64-linux =
|
||||||
(builtins.head (builtins.attrValues self.nixosConfigurations)).pkgs;
|
# (builtins.head (builtins.attrValues self.nixosConfigurations)).pkgs;
|
||||||
|
|
||||||
# nix run github:serokell/deploy
|
# nix run github:serokell/deploy
|
||||||
# Because sudo requires local presence of my Yubikey, we have to manually activate the system
|
# Because sudo requires local presence of my Yubikey, we have to manually activate the system
|
||||||
# sudo nix-env -p /nix/var/nix/profiles/system --set /nix/var/nix/profiles/per-user/alukard/system;
|
# sudo nix-env -p /nix/var/nix/profiles/system --set /nix/var/nix/profiles/per-user/alukard/system;
|
||||||
# sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch
|
# sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch
|
||||||
deploy = {
|
# deploy = {
|
||||||
user = "alukard";
|
# user = "alukard";
|
||||||
nodes = builtins.mapAttrs (_: conf: {
|
# nodes = builtins.mapAttrs (_: conf: {
|
||||||
hostname = conf.config.networking.hostName;
|
# hostname = conf.config.networking.hostName;
|
||||||
profiles.system.path = conf.config.system.build.toplevel;
|
# profiles.system.path = conf.config.system.build.toplevel;
|
||||||
}) self.nixosConfigurations;
|
# }) self.nixosConfigurations;
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
15
install/install.sh
Executable file → Normal file
15
install/install.sh
Executable file → Normal file
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#! /usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p git
|
||||||
cd ..
|
cd ..
|
||||||
CONFIG_FOLDER=$(pwd)
|
CONFIG_FOLDER=$(pwd)
|
||||||
cd install
|
cd install
|
||||||
@ -40,13 +41,11 @@ mkswap -L swap $SWAP_PARTITION
|
|||||||
# Generate config (hardware)
|
# Generate config (hardware)
|
||||||
nixos-generate-config --root /mnt/
|
nixos-generate-config --root /mnt/
|
||||||
cp /mnt/etc/nixos/hardware-configuration.nix $CONFIG_FOLDER/hardware-configuration/$DEVICE_NAME.nix
|
cp /mnt/etc/nixos/hardware-configuration.nix $CONFIG_FOLDER/hardware-configuration/$DEVICE_NAME.nix
|
||||||
echo "import $CONFIG_FOLDER \"$DEVICE_NAME\"" > /mnt/etc/nixos/configuration.nix
|
sed -i 's#<nixpkgs/nixos/modules/installer/scan/not-detected.nix>#"${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix"#' $CONFIG_FOLDER/hardware-configuration/$DEVICE_NAME.nix
|
||||||
sed -i 's#nixos-config=/etc/nixos/#nixos-config=/mnt/etc/nixos/#' $CONFIG_FOLDER/modules/packages.nix
|
cp ./min-config.nix /mnt/etc/nixos/configuration.nix
|
||||||
read -p "Please, add swap device into nixos-config/modules/filesystems.nix before continue"
|
|
||||||
nixos-install -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/ae6bdcc53584aaf20211ce1814bea97ece08a248.tar.gz --max-jobs $MAX_JOBS --no-root-passwd
|
nixos-install -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/840c782d507d60aaa49aa9e3f6d0b0e780912742.tar.gz --max-jobs $MAX_JOBS --no-root-passwd
|
||||||
read -p "Press enter to continue"
|
|
||||||
sed -i 's#nixos-config=/mnt/etc/nixos/#nixos-config=/etc/nixos/#' $CONFIG_FOLDER/modules/packages.nix
|
|
||||||
mkdir -p /mnt/home/alukard/nixos-config
|
mkdir -p /mnt/home/alukard/nixos-config
|
||||||
cp -aT $CONFIG_FOLDER /mnt/home/alukard/nixos-config
|
cp -aT $CONFIG_FOLDER /mnt/home/alukard/nixos-config
|
||||||
echo "import /home/alukard/nixos-config \"$DEVICE_NAME\"" > /mnt/etc/nixos/configuration.nix
|
|
||||||
echo "Installation complete!"
|
echo "Installation complete!"
|
@ -10,21 +10,6 @@
|
|||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
fileSystems = {
|
|
||||||
"/" = {
|
|
||||||
options = [ "noatime" "ssd" "compress=zstd" ];
|
|
||||||
};
|
|
||||||
"/.snapshots" = {
|
|
||||||
options = [ "noatime" "ssd" "compress=zstd" ];
|
|
||||||
};
|
|
||||||
"/home" = {
|
|
||||||
options = [ "noatime" "ssd" "compress=zstd" ];
|
|
||||||
};
|
|
||||||
"/nix-store" = {
|
|
||||||
options = [ "noatime" "ssd" "compress=zstd" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "nixos";
|
hostName = "nixos";
|
||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
@ -57,7 +42,7 @@
|
|||||||
time.timeZone = "Europe/Volgograd";
|
time.timeZone = "Europe/Volgograd";
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
wget vim git
|
wget vim git gnupg
|
||||||
];
|
];
|
||||||
|
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
@ -68,6 +53,6 @@
|
|||||||
hashedPassword = "$6$kDBGyd99tto$9LjQwixa7NYB9Kaey002MD94zHob1MmNbVz9kx3yX6Q4AmVgsFMGUyNuHozXprxyuXHIbOlTcf8nd4rK8MWfI/";
|
hashedPassword = "$6$kDBGyd99tto$9LjQwixa7NYB9Kaey002MD94zHob1MmNbVz9kx3yX6Q4AmVgsFMGUyNuHozXprxyuXHIbOlTcf8nd4rK8MWfI/";
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "19.03";
|
system.stateVersion = "20.03";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
11
install/shell.nix
Normal file
11
install/shell.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
name = "nixflk";
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
git
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
|
||||||
|
'';
|
||||||
|
}
|
31
shell.nix
Normal file
31
shell.nix
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
|
let
|
||||||
|
configs = "${toString ./.}#nixosConfigurations";
|
||||||
|
build = "config.system.build";
|
||||||
|
|
||||||
|
rebuild = pkgs.writeShellScriptBin "rebuild" ''
|
||||||
|
if [[ -z $1 ]]; then
|
||||||
|
echo "Usage: $(basename $0) host {switch|boot|test}"
|
||||||
|
else
|
||||||
|
sudo -E nix shell -vv ${configs}.$1.${build}.toplevel -c switch-to-configuration $2
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
name = "nixflk";
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
git
|
||||||
|
git-crypt
|
||||||
|
nixFlakes
|
||||||
|
rebuild
|
||||||
|
gnupg
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
PATH=${
|
||||||
|
pkgs.writeShellScriptBin "nix" ''
|
||||||
|
${pkgs.nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"
|
||||||
|
''
|
||||||
|
}/bin:$PATH
|
||||||
|
'';
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user