Refactor modules
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
**/key.txt
|
||||||
|
**/secrets/plaintext/*
|
32
README.md
32
README.md
@@ -1,3 +1,35 @@
|
|||||||
# nix
|
# nix
|
||||||
|
|
||||||
NixOS dotfiles and configuration.
|
NixOS dotfiles and configuration.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
The below installation example is for a fresh `eirene-vm` virtual machine.
|
||||||
|
|
||||||
|
### Mount NixOS Configuration
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo -i
|
||||||
|
mkdir /host
|
||||||
|
mount -t virtiofs host /host
|
||||||
|
```
|
||||||
|
|
||||||
|
### Format Disks
|
||||||
|
|
||||||
|
```sh
|
||||||
|
nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /host/hosts/eirene/format.nix --arg device '"/dev/vda"'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install NixOS
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mkdir -p /mnt/etc/nixos
|
||||||
|
cp -r /host/* /mnt/etc/nixos
|
||||||
|
nixos-install --root /mnt --flake /mnt/etc/nixos#eirene-vm
|
||||||
|
```
|
||||||
|
|
||||||
|
### Reboot
|
||||||
|
|
||||||
|
```sh
|
||||||
|
reboot
|
||||||
|
```
|
||||||
|
14
flake.nix
14
flake.nix
@@ -19,20 +19,18 @@
|
|||||||
stylix = {
|
stylix = {
|
||||||
url = "github:danth/stylix";
|
url = "github:danth/stylix";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sops-nix = {
|
||||||
|
url = "github:Mic92/sops-nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... } @ inputs: {
|
outputs = { self, nixpkgs, ... } @ inputs: {
|
||||||
nixosConfigurations.eirene-vm = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.eirene-vm = nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [ ./hosts/eirene/vm ];
|
||||||
./common
|
|
||||||
./hosts/eirene
|
|
||||||
./hosts/eirene/vm
|
|
||||||
inputs.disko.nixosModules.default
|
|
||||||
inputs.impermanence.nixosModules.impermanence
|
|
||||||
inputs.home-manager.nixosModules.default
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
inputs.impermanence.nixosModules.impermanence
|
||||||
./configs/zsh.nix
|
./configs/zsh.nix
|
||||||
./configs/neovim.nix
|
./configs/neovim.nix
|
||||||
./configs/tmux.nix
|
./configs/tmux.nix
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
"/var/lib/systemd/coredump"
|
"/var/lib/systemd/coredump"
|
||||||
];
|
];
|
||||||
files = [
|
files = [
|
||||||
|
"/var/lib/sops-nix/key.txt"
|
||||||
"/etc/machine-id"
|
"/etc/machine-id"
|
||||||
"/root/.zsh_history"
|
"/root/.zsh_history"
|
||||||
];
|
];
|
@@ -1,25 +1,12 @@
|
|||||||
{ inputs, ... }:
|
{ config, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../user
|
../common
|
||||||
|
../../users/nick
|
||||||
./configs/pipewire.nix
|
./configs/pipewire.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
time.timeZone = "Europe/Athens";
|
time.timeZone = "Europe/Athens";
|
||||||
|
services.getty.autologinUser = config.users.users.nick.name;
|
||||||
home-manager = {
|
|
||||||
extraSpecialArgs = { inherit inputs; };
|
|
||||||
backupFileExtension = "bak";
|
|
||||||
};
|
|
||||||
|
|
||||||
programs = {
|
|
||||||
fuse.userAllowOther = true;
|
|
||||||
dconf.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [ "d /persist/home/ 0755 root root -" ];
|
|
||||||
|
|
||||||
user.vars = import ../../user/nick.nix;
|
|
||||||
user.autologin = true;
|
|
||||||
}
|
}
|
||||||
|
@@ -1,71 +1,62 @@
|
|||||||
{ config, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.format;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options.format = {
|
device ? throw "device argument is required",
|
||||||
device = lib.mkOption {
|
...
|
||||||
type = lib.types.str;
|
}:
|
||||||
description = "The device to format";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
{
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk.main = {
|
disk.main = {
|
||||||
type = "disk";
|
inherit device;
|
||||||
device = cfg.device;
|
type = "disk";
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
boot = {
|
boot = {
|
||||||
name = "boot";
|
name = "boot";
|
||||||
size = "1M";
|
size = "1M";
|
||||||
type = "EF02";
|
type = "EF02";
|
||||||
|
};
|
||||||
|
esp = {
|
||||||
|
name = "esp";
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
};
|
};
|
||||||
esp = {
|
};
|
||||||
name = "esp";
|
swap = {
|
||||||
size = "512M";
|
name = "swap";
|
||||||
type = "EF00";
|
size = "32G";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "swap";
|
||||||
format = "vfat";
|
resumeDevice = true;
|
||||||
mountpoint = "/boot";
|
};
|
||||||
|
};
|
||||||
|
root = {
|
||||||
|
name = "root";
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
name = "luks";
|
||||||
|
type = "luks";
|
||||||
|
settings = {
|
||||||
|
allowDiscards = true;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
swap = {
|
|
||||||
name = "swap";
|
|
||||||
size = "32G";
|
|
||||||
content = {
|
content = {
|
||||||
type = "swap";
|
type = "btrfs";
|
||||||
resumeDevice = true;
|
extraArgs = ["-f"];
|
||||||
};
|
subvolumes = {
|
||||||
};
|
"/root" = {
|
||||||
root = {
|
mountpoint = "/";
|
||||||
name = "root";
|
};
|
||||||
size = "100%";
|
"/persist" = {
|
||||||
content = {
|
mountpoint = "/persist";
|
||||||
name = "luks";
|
mountOptions = ["subvol=persist" "compress=zstd" "noatime"];
|
||||||
type = "luks";
|
};
|
||||||
settings = {
|
"/nix" = {
|
||||||
allowDiscards = true;
|
mountpoint = "/nix";
|
||||||
};
|
mountOptions = ["subvol=nix" "compress=zstd" "noatime"];
|
||||||
content = {
|
|
||||||
type = "btrfs";
|
|
||||||
extraArgs = ["-f"];
|
|
||||||
subvolumes = {
|
|
||||||
"/root" = {
|
|
||||||
mountpoint = "/";
|
|
||||||
};
|
|
||||||
"/persist" = {
|
|
||||||
mountpoint = "/persist";
|
|
||||||
mountOptions = ["subvol=persist" "compress=zstd" "noatime"];
|
|
||||||
};
|
|
||||||
"/nix" = {
|
|
||||||
mountpoint = "/nix";
|
|
||||||
mountOptions = ["subvol=nix" "compress=zstd" "noatime"];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@@ -1,12 +1,17 @@
|
|||||||
|
{ inputs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../format.nix
|
inputs.disko.nixosModules.disko
|
||||||
|
(import ../format.nix { device = "/dev/vda"; })
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
../default.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
format.device = "/dev/vda";
|
|
||||||
networking.hostName = "eirene-vm";
|
networking.hostName = "eirene-vm";
|
||||||
|
|
||||||
boot.kernelParams = [ "video=Virtual-1:2560x1600@60" ];
|
boot.kernelParams = [ "video=Virtual-1:2560x1600@60" ];
|
||||||
|
home-manager.sharedModules = [{ wayland.windowManager.hyprland.settings.monitor = "Virtual-1, 2560x1600@60, 0x0, 1"; }];
|
||||||
|
|
||||||
fileSystems."/host" = {
|
fileSystems."/host" = {
|
||||||
device = "host";
|
device = "host";
|
||||||
|
@@ -1,22 +0,0 @@
|
|||||||
{ config, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.git;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.git = {
|
|
||||||
vars = lib.mkOption {
|
|
||||||
type = lib.types.attrs;
|
|
||||||
description = "Variables for the user";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
programs.git = {
|
|
||||||
enable = true;
|
|
||||||
lfs.enable = true;
|
|
||||||
userEmail = cfg.vars.email;
|
|
||||||
userName = cfg.vars.fullName;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@@ -1,81 +0,0 @@
|
|||||||
{ config, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.hyprland;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.hyprland = {
|
|
||||||
initScript = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
description = "Script to execute on startup";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
wayland.windowManager.hyprland = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
"$mod" = "SUPER";
|
|
||||||
"$term" = "kitty";
|
|
||||||
|
|
||||||
bind = [
|
|
||||||
"$mod, Return, exec, $term"
|
|
||||||
"$mod, r, exec, rofi -show drun"
|
|
||||||
"$mod, b, exec, firefox"
|
|
||||||
|
|
||||||
"$mod, left, movefocus, l"
|
|
||||||
"$mod, h, movefocus, l"
|
|
||||||
"$mod, down, movefocus, d"
|
|
||||||
"$mod, j, movefocus, d"
|
|
||||||
"$mod, up, movefocus, u"
|
|
||||||
"$mod, k, movefocus, u"
|
|
||||||
"$mod, right, movefocus, r"
|
|
||||||
"$mod, l, movefocus, r"
|
|
||||||
|
|
||||||
"$mod_SHIFT, left, movewindow, l"
|
|
||||||
"$mod_SHIFT, h, movewindow, l"
|
|
||||||
"$mod_SHIFT, down, movewindow, d"
|
|
||||||
"$mod_SHIFT, j, movewindow, d"
|
|
||||||
"$mod_SHIFT, up, movewindow, u"
|
|
||||||
"$mod_SHIFT, k, movewindow, u"
|
|
||||||
"$mod_SHIFT, right, movewindow, r"
|
|
||||||
"$mod_SHIFT, l, movewindow, r"
|
|
||||||
|
|
||||||
"$mod_CTRL, left, resizeactive, -20 0"
|
|
||||||
"$mod_CTRL, h, resizeactive, -20 0"
|
|
||||||
"$mod_CTRL, down, resizeactive, 0 20"
|
|
||||||
"$mod_CTRL, j, resizeactive, 0 20"
|
|
||||||
"$mod_CTRL, up, resizeactive, 0 -20"
|
|
||||||
"$mod_CTRL, k, resizeactive, 0 -20"
|
|
||||||
"$mod_CTRL, right, resizeactive, 20 0"
|
|
||||||
"$mod_CTRL, l, resizeactive, 20 0"
|
|
||||||
|
|
||||||
"$mod, Tab, cyclenext"
|
|
||||||
"$mod, Tab, bringactivetotop"
|
|
||||||
"$mod_SHIFT, Tab, cyclenext, prev"
|
|
||||||
"$mod_SHIFT, Tab, bringactivetotop"
|
|
||||||
|
|
||||||
"$mod, f, fullscreen, 0"
|
|
||||||
"$mod, Space, togglefloating"
|
|
||||||
"$mod, Space, centerwindow"
|
|
||||||
"$mod, q, killactive"
|
|
||||||
|
|
||||||
"CTRL_ALT, Delete, exit"
|
|
||||||
];
|
|
||||||
|
|
||||||
bindm = [
|
|
||||||
"$mod, mouse:272, movewindow"
|
|
||||||
"$mod, mouse:273, resizewindow"
|
|
||||||
];
|
|
||||||
|
|
||||||
misc = {
|
|
||||||
"disable_hyprland_logo" = true;
|
|
||||||
"disable_splash_rendering" = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
exec-once = cfg.initScript;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@@ -1,21 +0,0 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.stylix;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.stylix = {
|
|
||||||
wallpaper = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
description = "The path to the wallpaper";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
stylix = {
|
|
||||||
enable = true;
|
|
||||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/da-one-sea.yaml";
|
|
||||||
image = cfg.wallpaper;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@@ -1,92 +0,0 @@
|
|||||||
{ config, inputs, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
wallpaper = ./wallpapers/clouds.png;
|
|
||||||
init = pkgs.pkgs.writeShellScriptBin "hyprland-init" ''
|
|
||||||
${pkgs.swww}/bin/swww-daemon &> /tmp/swww.log &
|
|
||||||
|
|
||||||
while ! swww query &> /dev/null; do
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
|
|
||||||
${pkgs.swww}/bin/swww img ${wallpaper}
|
|
||||||
'';
|
|
||||||
cfg = config.user;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.user = {
|
|
||||||
vars = lib.mkOption {
|
|
||||||
type = lib.types.attrs;
|
|
||||||
description = "Variables for the user";
|
|
||||||
};
|
|
||||||
|
|
||||||
autologin = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
description = "Automatically log in the user on boot";
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
users.users."${cfg.vars.user}" = {
|
|
||||||
isNormalUser = true;
|
|
||||||
createHome = true;
|
|
||||||
home = "/home/${cfg.vars.user}";
|
|
||||||
description = cfg.vars.fullName;
|
|
||||||
hashedPassword = "***REMOVED***";
|
|
||||||
extraGroups = [ "wheel" ];
|
|
||||||
linger = true;
|
|
||||||
uid = 1000;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [ "d /persist/home/${cfg.vars.user} 0700 ${cfg.vars.user} users -" ];
|
|
||||||
services.getty.autologinUser = lib.mkIf cfg.autologin cfg.vars.user;
|
|
||||||
programs.hyprland.enable = true;
|
|
||||||
|
|
||||||
home-manager.users."${cfg.vars.user}" = {
|
|
||||||
imports = [
|
|
||||||
inputs.impermanence.nixosModules.home-manager.impermanence
|
|
||||||
inputs.stylix.homeManagerModules.stylix
|
|
||||||
./configs/stylix.nix
|
|
||||||
./configs/hyprland.nix
|
|
||||||
./configs/zsh.nix
|
|
||||||
./configs/kitty.nix
|
|
||||||
./configs/firefox.nix
|
|
||||||
./configs/git.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
home = {
|
|
||||||
persistence."/persist/home/${cfg.vars.user}" = {
|
|
||||||
directories = [
|
|
||||||
"Documents"
|
|
||||||
"Downloads"
|
|
||||||
"Music"
|
|
||||||
"Pictures"
|
|
||||||
"Videos"
|
|
||||||
"Templates"
|
|
||||||
"VMs"
|
|
||||||
"git"
|
|
||||||
".mozilla"
|
|
||||||
];
|
|
||||||
files = [
|
|
||||||
".zsh_history"
|
|
||||||
];
|
|
||||||
allowOther = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
packages = with pkgs; [
|
|
||||||
rofi-wayland
|
|
||||||
swww
|
|
||||||
];
|
|
||||||
|
|
||||||
stateVersion = "24.05";
|
|
||||||
};
|
|
||||||
|
|
||||||
git.vars = cfg.vars;
|
|
||||||
hyprland.initScript = "${init}/bin/hyprland-init";
|
|
||||||
stylix.wallpaper = wallpaper;
|
|
||||||
|
|
||||||
systemd.user.startServices = "sd-switch";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
user = "nick";
|
|
||||||
email = "nick@karaolidis.com";
|
|
||||||
fullName = "Nikolaos Karaolidis";
|
|
||||||
}
|
|
2
user/secrets/.gitignore
vendored
2
user/secrets/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
6
users/common/configs/git.nix
Normal file
6
users/common/configs/git.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
lfs.enable = true;
|
||||||
|
};
|
||||||
|
}
|
64
users/common/configs/hyprland.nix
Normal file
64
users/common/configs/hyprland.nix
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
wayland.windowManager.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
"$mod" = "SUPER";
|
||||||
|
"$term" = "kitty";
|
||||||
|
|
||||||
|
bind = [
|
||||||
|
"$mod, Return, exec, $term"
|
||||||
|
"$mod, r, exec, rofi -show drun"
|
||||||
|
"$mod, b, exec, firefox"
|
||||||
|
|
||||||
|
"$mod, left, movefocus, l"
|
||||||
|
"$mod, h, movefocus, l"
|
||||||
|
"$mod, down, movefocus, d"
|
||||||
|
"$mod, j, movefocus, d"
|
||||||
|
"$mod, up, movefocus, u"
|
||||||
|
"$mod, k, movefocus, u"
|
||||||
|
"$mod, right, movefocus, r"
|
||||||
|
"$mod, l, movefocus, r"
|
||||||
|
|
||||||
|
"$mod_SHIFT, left, movewindow, l"
|
||||||
|
"$mod_SHIFT, h, movewindow, l"
|
||||||
|
"$mod_SHIFT, down, movewindow, d"
|
||||||
|
"$mod_SHIFT, j, movewindow, d"
|
||||||
|
"$mod_SHIFT, up, movewindow, u"
|
||||||
|
"$mod_SHIFT, k, movewindow, u"
|
||||||
|
"$mod_SHIFT, right, movewindow, r"
|
||||||
|
"$mod_SHIFT, l, movewindow, r"
|
||||||
|
|
||||||
|
"$mod_CTRL, left, resizeactive, -20 0"
|
||||||
|
"$mod_CTRL, h, resizeactive, -20 0"
|
||||||
|
"$mod_CTRL, down, resizeactive, 0 20"
|
||||||
|
"$mod_CTRL, j, resizeactive, 0 20"
|
||||||
|
"$mod_CTRL, up, resizeactive, 0 -20"
|
||||||
|
"$mod_CTRL, k, resizeactive, 0 -20"
|
||||||
|
"$mod_CTRL, right, resizeactive, 20 0"
|
||||||
|
"$mod_CTRL, l, resizeactive, 20 0"
|
||||||
|
|
||||||
|
"$mod, Tab, cyclenext"
|
||||||
|
"$mod, Tab, bringactivetotop"
|
||||||
|
"$mod_SHIFT, Tab, cyclenext, prev"
|
||||||
|
"$mod_SHIFT, Tab, bringactivetotop"
|
||||||
|
|
||||||
|
"$mod, f, fullscreen, 0"
|
||||||
|
"$mod, Space, togglefloating"
|
||||||
|
"$mod, Space, centerwindow"
|
||||||
|
"$mod, q, killactive"
|
||||||
|
|
||||||
|
"CTRL_ALT, Delete, exit"
|
||||||
|
];
|
||||||
|
|
||||||
|
bindm = [
|
||||||
|
"$mod, mouse:272, movewindow"
|
||||||
|
"$mod, mouse:273, resizewindow"
|
||||||
|
];
|
||||||
|
|
||||||
|
misc = {
|
||||||
|
"disable_hyprland_logo" = true;
|
||||||
|
"disable_splash_rendering" = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
3
users/common/configs/stylix.nix
Normal file
3
users/common/configs/stylix.nix
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
stylix.enable = true;
|
||||||
|
}
|
95
users/common/default.nix
Normal file
95
users/common/default.nix
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
{ config, inputs, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
normalUsers = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.home-manager.nixosModules.default
|
||||||
|
./extra.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
hyprland.enable = true;
|
||||||
|
fuse.userAllowOther = true;
|
||||||
|
dconf.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
extraSpecialArgs = { inherit inputs; };
|
||||||
|
backupFileExtension = "bak";
|
||||||
|
sharedModules = [{
|
||||||
|
imports = [
|
||||||
|
inputs.impermanence.nixosModules.home-manager.impermanence
|
||||||
|
inputs.stylix.homeManagerModules.stylix
|
||||||
|
./configs/stylix.nix
|
||||||
|
./configs/hyprland.nix
|
||||||
|
./configs/git.nix
|
||||||
|
./configs/zsh.nix
|
||||||
|
./configs/kitty.nix
|
||||||
|
./configs/firefox.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
home = {
|
||||||
|
packages = with pkgs; [
|
||||||
|
rofi-wayland
|
||||||
|
swww
|
||||||
|
];
|
||||||
|
|
||||||
|
stateVersion = "24.05";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.startServices = "sd-switch";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [ "d /persist/home/ 0755 root root -" ] ++ lib.attrsets.mapAttrsToList (user: config:
|
||||||
|
"d /persist${config.home} 0700 ${user} users -"
|
||||||
|
) normalUsers;
|
||||||
|
|
||||||
|
home-manager.users = lib.attrsets.mapAttrs' (user: config: lib.attrsets.nameValuePair
|
||||||
|
(user)
|
||||||
|
(let
|
||||||
|
init = pkgs.pkgs.writeShellScriptBin "hyprland-init" ''
|
||||||
|
${pkgs.swww}/bin/swww-daemon &> /tmp/swww.log &
|
||||||
|
|
||||||
|
while ! swww query &> /dev/null; do
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
|
||||||
|
${pkgs.swww}/bin/swww img ${config.wallpaper}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home.persistence."/persist${config.home}" = {
|
||||||
|
directories = [
|
||||||
|
"Documents"
|
||||||
|
"Downloads"
|
||||||
|
"Music"
|
||||||
|
"Pictures"
|
||||||
|
"Videos"
|
||||||
|
"Templates"
|
||||||
|
"VMs"
|
||||||
|
"git"
|
||||||
|
".mozilla"
|
||||||
|
];
|
||||||
|
files = [
|
||||||
|
".zsh_history"
|
||||||
|
];
|
||||||
|
allowOther = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.git = {
|
||||||
|
userName = config.fullName;
|
||||||
|
userEmail = config.email;
|
||||||
|
};
|
||||||
|
|
||||||
|
stylix = {
|
||||||
|
image = config.wallpaper;
|
||||||
|
base16Scheme = config.base16Scheme;
|
||||||
|
};
|
||||||
|
|
||||||
|
wayland.windowManager.hyprland.settings.exec-once = "${init}/bin/hyprland-init";
|
||||||
|
})
|
||||||
|
) normalUsers;
|
||||||
|
}
|
32
users/common/extra.nix
Normal file
32
users/common/extra.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
userOptions = with lib; { config, ... }: {
|
||||||
|
options.email = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "Email address of the user.";
|
||||||
|
};
|
||||||
|
|
||||||
|
options.fullName = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "Full name of the user.";
|
||||||
|
};
|
||||||
|
|
||||||
|
options.wallpaper = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
description = "Path to the user's wallpaper.";
|
||||||
|
};
|
||||||
|
|
||||||
|
options.base16Scheme = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
description = "Base16 scheme to use for the user's color palette.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = with lib; with types; {
|
||||||
|
users.users = mkOption {
|
||||||
|
type = attrsOf (submodule userOptions);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
19
users/nick/default.nix
Normal file
19
users/nick/default.nix
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ../common ];
|
||||||
|
|
||||||
|
users.users.nick = {
|
||||||
|
isNormalUser = true;
|
||||||
|
home = "/home/nick";
|
||||||
|
email = "nick@karaolidis.com";
|
||||||
|
fullName = "Nikolaos Karaolidis";
|
||||||
|
description = config.users.users.nick.fullName;
|
||||||
|
hashedPassword = "***REMOVED***";
|
||||||
|
extraGroups = [ "wheel" ];
|
||||||
|
linger = true;
|
||||||
|
uid = 1000;
|
||||||
|
wallpaper = ./wallpapers/clouds.png;
|
||||||
|
base16Scheme = "${pkgs.base16-schemes}/share/themes/da-one-sea.yaml";
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user