1
Fork 0
This commit is contained in:
caem 2025-01-19 03:05:43 +01:00
parent fc03bb0b93
commit 358573b80d
Signed by: caem
GPG key ID: 69A830D03203405F
6 changed files with 34 additions and 15 deletions

View file

@ -132,19 +132,22 @@ partition_disk() {
fi
}
generate_config() {
sudo nixos-generate-config --no-filesystems --root /mnt
}
install() {
sudo nixos-install --flake ".#$DOTNIX_HOSTNAME"
sudo nixos-install --flake --no-root-passwd ".#$DOTNIX_HOSTNAME"
}
copy_files_to_new_install() {
username="$(grep user ./flake.nix | sed -e 's/.*\(.*\).*/\1/')"
cp -vr . /mnt/nix/config
mkdir -p "/mnt/nix/persist/home/$username/programming"
ln -svf /nix/config "/mnt/nix/persist/home/$username/programming/dotnix"
if [ -z "$username" ]; then
>&2 echo "Cannot determine username"
exit 1
fi
sudo cp -vr . /mnt/nix/config
sudo mkdir -p "/mnt/nix/persist/home/$username/programming"
sudo ln -svf /nix/config "/mnt/nix/persist/home/$username/programming/dotnix"
sudo chown -R 1000:100 "/mnt/nix/persist/home/$username"
sudo chown -R 1000:100 "/mnt/nix/config"
}
reboot_on_consent() {
@ -162,11 +165,6 @@ ensure_shell() {
fi
}
generate_age_keys() {
mkdir -vp ~/.config/sops/age
age-keygen -o ~/.config/sops/age/keys.txt
}
main () {
ensure_shell "$@"
@ -185,9 +183,8 @@ main () {
ensure_confirmation
update_managed_values
partition_disk
generate_config
install
copy_files_to_new_install
install
reboot_on_consent
}

View file

@ -11,6 +11,7 @@
stateVersion = "24.11";
};
home.file."${config.xdg.configHome}/user-dirs.dirs".force = lib.mkForce true;
xdg = {
enable = true;
userDirs = {

View file

@ -0,0 +1,7 @@
{ ... }:
{
home.persistence."/nix/persist/home/caem".directories = [
];
}

View file

@ -1,6 +1,9 @@
{ config, lib, ... }:
{
/* Required to be able to allowOther on user persisted directories */
programs.fuse.userAllowOther = true;
boot.initrd.postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount "${config.fileSystems."/".device}" /btrfs_tmp

View file

@ -29,4 +29,6 @@
users.root.hashedPassword = "!";
mutableUsers = false;
};
sops.age.keyFile = "/nix/config/secrets/keys.txt";
}

View file

@ -24,5 +24,14 @@
gnome-text-editor
gnome-tour
gnome-bluetooth
gnome-music
gnome-maps
gnome-contacts
gnome-calendar
gnome-connections
];
environment.systemPackages = with pkgs; [
ghostty
];
}