From 358573b80d3cb6a5a8774d6ea3da392022088b51 Mon Sep 17 00:00:00 2001 From: caem Date: Sun, 19 Jan 2025 03:05:43 +0100 Subject: [PATCH] gn --- install.sh | 27 +++++++++++-------------- modules/home/caem/default.nix | 1 + modules/home/caem/desktop/gnome.nix | 7 +++++++ modules/nixos/core/impermanence.nix | 3 +++ modules/nixos/core/security.nix | 2 ++ modules/nixos/desktop/gnome/default.nix | 9 +++++++++ 6 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 modules/home/caem/desktop/gnome.nix diff --git a/install.sh b/install.sh index c92a9ea..c8f72b7 100755 --- a/install.sh +++ b/install.sh @@ -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 } diff --git a/modules/home/caem/default.nix b/modules/home/caem/default.nix index b461d20..0ea8b8e 100644 --- a/modules/home/caem/default.nix +++ b/modules/home/caem/default.nix @@ -11,6 +11,7 @@ stateVersion = "24.11"; }; + home.file."${config.xdg.configHome}/user-dirs.dirs".force = lib.mkForce true; xdg = { enable = true; userDirs = { diff --git a/modules/home/caem/desktop/gnome.nix b/modules/home/caem/desktop/gnome.nix new file mode 100644 index 0000000..ce1ba9a --- /dev/null +++ b/modules/home/caem/desktop/gnome.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + home.persistence."/nix/persist/home/caem".directories = [ + + ]; +} diff --git a/modules/nixos/core/impermanence.nix b/modules/nixos/core/impermanence.nix index 90b3caf..d0d892d 100644 --- a/modules/nixos/core/impermanence.nix +++ b/modules/nixos/core/impermanence.nix @@ -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 diff --git a/modules/nixos/core/security.nix b/modules/nixos/core/security.nix index f1de38c..4509a3c 100644 --- a/modules/nixos/core/security.nix +++ b/modules/nixos/core/security.nix @@ -29,4 +29,6 @@ users.root.hashedPassword = "!"; mutableUsers = false; }; + + sops.age.keyFile = "/nix/config/secrets/keys.txt"; } diff --git a/modules/nixos/desktop/gnome/default.nix b/modules/nixos/desktop/gnome/default.nix index 05b6595..91a9107 100644 --- a/modules/nixos/desktop/gnome/default.nix +++ b/modules/nixos/desktop/gnome/default.nix @@ -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 ]; }