Compare commits
5 Commits
7a6e9e0717
...
d68a99d67c
Author | SHA1 | Date | |
---|---|---|---|
d68a99d67c
|
|||
f97fd2d6f7
|
|||
72bfa078e7
|
|||
689efb279a
|
|||
5f919ca9b0
|
@ -109,18 +109,18 @@
|
||||
# quartus-prime-lite # Intel FPGA design software
|
||||
|
||||
# Don't want heavy IDE's on the laptop
|
||||
jetbrains.clion
|
||||
jetbrains.rust-rover
|
||||
jetbrains.pycharm-professional
|
||||
# jetbrains.clion
|
||||
# jetbrains.rust-rover
|
||||
# jetbrains.pycharm-professional
|
||||
# jetbrains.idea-ultimate
|
||||
# jetbrains.webstorm
|
||||
|
||||
# Unity Stuff
|
||||
# unityhub
|
||||
|
||||
rider
|
||||
dotnetCore
|
||||
mono
|
||||
# rider
|
||||
# dotnetCore
|
||||
# mono
|
||||
|
||||
blender
|
||||
godot_4
|
||||
|
@ -27,6 +27,6 @@
|
||||
# HM modules imported from the flake inputs
|
||||
inputs.nix-flatpak.homeManagerModules.nix-flatpak
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
inputs.impermanence.homeManagerModules.impermanence
|
||||
# inputs.impermanence.homeManagerModules.impermanence
|
||||
];
|
||||
}
|
||||
|
@ -216,10 +216,13 @@ with mylib.networking; {
|
||||
console.keyMap = "us-acentos";
|
||||
|
||||
# Define a user account. Password is set from sops-nix secrets automatically.
|
||||
users.mutableUsers = false; # Users are always overridden by stuff defined here
|
||||
users.users.${username} = {
|
||||
isNormalUser = true;
|
||||
hashedPasswordFile = config.sops.secrets.user-password.path;
|
||||
description = "Christoph";
|
||||
group = "users";
|
||||
uid = 1000;
|
||||
extraGroups = [
|
||||
"networkmanager"
|
||||
"wheel"
|
||||
@ -241,6 +244,8 @@ with mylib.networking; {
|
||||
# packages = with pkgs; [];
|
||||
};
|
||||
|
||||
users.groups."users".gid = 100;
|
||||
|
||||
# We want these packages to be available even when no user profile is active
|
||||
# Empty since we basically only need git + editor which is enabled below
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
@ -23,17 +23,17 @@ in {
|
||||
|
||||
mkDir = user: directory: mode: {
|
||||
inherit directory mode;
|
||||
user = config.users.users.${user}.name;
|
||||
group = config.users.users.${user}.group;
|
||||
# user = config.users.users.${user}.name;
|
||||
# group = config.users.users.${user}.group;
|
||||
};
|
||||
|
||||
mkFile = user: file: mode: {
|
||||
inherit file;
|
||||
parentDirectory = {
|
||||
inherit mode;
|
||||
user = config.users.users.${user}.name;
|
||||
group = config.users.users.${user}.group;
|
||||
};
|
||||
# parentDirectory = {
|
||||
# inherit mode;
|
||||
# user = config.users.users.${user}.name;
|
||||
# group = config.users.users.${user}.group;
|
||||
# };
|
||||
};
|
||||
in
|
||||
lib.mkIf impermanence.enable {
|
||||
@ -55,6 +55,8 @@ in {
|
||||
(mkRDir "/etc/secureboot" m755)
|
||||
(mkRDir "/etc/ssh" m755)
|
||||
|
||||
(mkRDir "/nix/var" m755)
|
||||
|
||||
# https://github.com/nix-community/impermanence/issues/253
|
||||
(mkRDir "/usr/systemd-placeholder" m755)
|
||||
|
||||
@ -63,9 +65,10 @@ in {
|
||||
(mkRDir "/var/lib/bluetooth" m755) # m700
|
||||
(mkRDir "/var/lib/containers" m755)
|
||||
(mkRDir "/var/lib/flatpak" m755)
|
||||
(mkRDir "/var/lib/NetworkManager" m755)
|
||||
(mkRDir "/var/lib/libvirt" m755)
|
||||
(mkRDir "/var/lib/NetworkManager" m755)
|
||||
(mkRDir "/var/lib/nixos" m755)
|
||||
(mkRDir "/var/lib/private/ollama" m755)
|
||||
(mkRDir "/var/lib/systemd" m755)
|
||||
|
||||
(mkRDir "/var/tmp" m777)
|
||||
@ -126,11 +129,34 @@ in {
|
||||
(mkUDir ".local/share/zoxide" m755)
|
||||
|
||||
(mkUDir ".local/state/astal/notifd" m755)
|
||||
(mkUDir ".local/state/nix" m755)
|
||||
(mkUDir ".local/state/nvim" m755)
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services."impermanence-fix-home-ownership" = let
|
||||
homeDir = "/home/${username}";
|
||||
homeUser = builtins.toString config.users.users.${username}.uid;
|
||||
homeGroup = builtins.toString config.users.groups.${config.users.users.${username}.group}.gid;
|
||||
in {
|
||||
description = "Fix impermanent home ownership";
|
||||
# wantedBy = ["local-fs.target"];
|
||||
# partOf = ["local-fs.target"];
|
||||
after = ["local-fs.target"]; # Execute afer home.mount
|
||||
before = ["network-online.target"]; # Execute before NFS mounts
|
||||
serviceConfig.Type = "oneshot";
|
||||
|
||||
script = ''
|
||||
if [[ -d ${homeDir} ]]; then
|
||||
chown -R ${homeUser}:${homeGroup} ${homeDir}
|
||||
echo "Set ownership for ${homeDir} to ${homeUser}:${homeGroup}"
|
||||
else
|
||||
echo "ERROR: Home ${homeDir} does not exist!"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# Because we have a LUKS encrypted drive
|
||||
# we use a systemd service to cleanup the volumes
|
||||
boot.initrd.systemd = {
|
||||
@ -140,6 +166,9 @@ in {
|
||||
backupDuration = "7"; # Days
|
||||
mountDir = "/btrfs_tmp";
|
||||
persistDir = "${mountDir}/persist";
|
||||
|
||||
homeUser = builtins.toString config.users.users.${username}.uid;
|
||||
homeGroup = builtins.toString config.users.groups.${config.users.users.${username}.group}.gid;
|
||||
in {
|
||||
description = "Clean impermanent btrfs subvolumes";
|
||||
wantedBy = ["initrd.target"];
|
||||
@ -205,6 +234,12 @@ in {
|
||||
btrfs subvolume create ${mountDir}/home
|
||||
echo "Created new subvolumes ${mountDir}/root and ${mountDir}/home"
|
||||
|
||||
chown -R ${homeUser}:${homeGroup} ${mountDir}/home/${username}
|
||||
echo "Set permissions for ${mountDir}/home/${username} to ${homeUser}:${homeGroup}"
|
||||
|
||||
chown -R ${homeUser}:${homeGroup} ${persistDir}/home/${username}
|
||||
echo "Set permissions for ${persistDir}/home/${username} to ${homeUser}:${homeGroup}"
|
||||
|
||||
umount ${mountDir}
|
||||
rmdir ${mountDir}
|
||||
'';
|
||||
|
@ -45,47 +45,42 @@
|
||||
type = "btrfs";
|
||||
extraArgs = ["-L" "NIXOS" "-f"];
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
"root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
"subvol=root"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/home" = {
|
||||
"home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [
|
||||
"subvol=home"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/nix" = {
|
||||
"nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
"subvol=nix"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/persist" = {
|
||||
"persist" = {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = [
|
||||
"subvol=persist"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/log" = {
|
||||
"log" = {
|
||||
mountpoint = "/var/log";
|
||||
mountOptions = [
|
||||
"subvol=log"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/swap" = {
|
||||
"swap" = {
|
||||
mountpoint = "/swap";
|
||||
swap.swapfile.size = "16G";
|
||||
};
|
||||
|
Reference in New Issue
Block a user