chore: format nix files treewide
This commit is contained in:
parent
e1652efa53
commit
90d10606bc
30 changed files with 387 additions and 319 deletions
36
flake.nix
36
flake.nix
|
@ -16,20 +16,24 @@
|
||||||
nvf.inputs.nixpkgs.follows = "nixpkgs";
|
nvf.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs:
|
outputs =
|
||||||
inputs.snowfall-lib.mkFlake {
|
inputs:
|
||||||
inherit inputs;
|
inputs.snowfall-lib.mkFlake {
|
||||||
src = ./.;
|
inherit inputs;
|
||||||
snowfall.namespace = "pantheon";
|
src = ./.;
|
||||||
systems.modules.nixos = with inputs; [
|
snowfall.namespace = "pantheon";
|
||||||
disko.nixosModules.disko
|
systems.modules.nixos = with inputs; [
|
||||||
impermanence.nixosModules.impermanence
|
disko.nixosModules.disko
|
||||||
sops-nix.nixosModules.sops
|
impermanence.nixosModules.impermanence
|
||||||
];
|
sops-nix.nixosModules.sops
|
||||||
homes.modules = with inputs; [
|
];
|
||||||
impermanence.homeManagerModules.impermanence
|
homes.modules = with inputs; [
|
||||||
nix-index-database.hmModules.nix-index
|
impermanence.homeManagerModules.impermanence
|
||||||
nvf.homeManagerModules.default
|
nix-index-database.hmModules.nix-index
|
||||||
];
|
nvf.homeManagerModules.default
|
||||||
};
|
];
|
||||||
|
outputs-builder = channels: {
|
||||||
|
formatter = channels.nixpkgs.nixfmt-rfc-style;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
{ config, pkgs, osConfig, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
osConfig,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
cli.shell = "zsh";
|
cli.shell = "zsh";
|
||||||
cli.editor = "nvf";
|
cli.editor = "nvf";
|
||||||
|
@ -23,12 +28,12 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
home.persistence."/persist/home/rafiq".directories = [
|
home.persistence."/persist/home/rafiq".directories = [
|
||||||
"repos"
|
"repos"
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.direnv = {
|
programs.direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
nix-direnv.enable = true;
|
nix-direnv.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
{config, lib, osConfig, ... }:
|
|
||||||
{
|
{
|
||||||
options.cli = {
|
config,
|
||||||
|
lib,
|
||||||
|
osConfig,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
options.cli = {
|
||||||
shell = lib.pantheon.mkStrOption;
|
shell = lib.pantheon.mkStrOption;
|
||||||
editor = lib.pantheon.mkStrOption;
|
editor = lib.pantheon.mkStrOption;
|
||||||
file-browser = lib.pantheon.mkStrOption;
|
file-browser = lib.pantheon.mkStrOption;
|
||||||
|
@ -14,7 +19,9 @@
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
programs.zoxide.enable = true;
|
programs.zoxide.enable = true;
|
||||||
home.persistence."/persist/home/${config.snowfallorg.user.name}".directories = [ "./local/share/zoxide" ];
|
home.persistence."/persist/home/${config.snowfallorg.user.name}".directories = [
|
||||||
|
"./local/share/zoxide"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
programs.nix-index.enable = true;
|
programs.nix-index.enable = true;
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
programs.nvf = {
|
programs.nvf = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.vim = {
|
settings.vim = {
|
||||||
keymaps = import ./keymaps.nix;
|
keymaps = import ./keymaps.nix;
|
||||||
utility.yazi-nvim = {
|
utility.yazi-nvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
mappings = {
|
mappings = {
|
||||||
openYazi = "t";
|
openYazi = "t";
|
||||||
openYaziDir = "T";
|
openYaziDir = "T";
|
||||||
};
|
};
|
||||||
setupOpts.open_for_directories = true;
|
setupOpts.open_for_directories = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
desc = "Open the file path under the cursor, making the file if it doesn't exist.";
|
desc = "Open the file path under the cursor, making the file if it doesn't exist.";
|
||||||
key = "gf";
|
key = "gf";
|
||||||
mode = "n";
|
mode = "n";
|
||||||
action = ":cd %:p:h<CR>:e <cfile><CR>";
|
action = ":cd %:p:h<CR>:e <cfile><CR>";
|
||||||
silent = true;
|
silent = true;
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
{
|
{
|
||||||
config =
|
config = lib.mkIf (config.cli.file-browser == "yazi") {
|
||||||
lib.mkIf (config.cli.file-browser == "yazi")
|
|
||||||
{
|
|
||||||
home.sessionVariables.FILE_BROWSER = "yazi";
|
home.sessionVariables.FILE_BROWSER = "yazi";
|
||||||
programs.yazi = {
|
programs.yazi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
{
|
{
|
||||||
config = lib.mkIf (config.cli.shell == "zsh") {
|
config = lib.mkIf (config.cli.shell == "zsh") {
|
||||||
home.sessionVariables.SHELL = "zsh";
|
home.sessionVariables.SHELL = "zsh";
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableVteIntegration = true;
|
enableVteIntegration = true;
|
||||||
syntaxHighlighting.enable = true;
|
syntaxHighlighting.enable = true;
|
||||||
history.share = true;
|
history.share = true;
|
||||||
history.size = 10000;
|
history.size = 10000;
|
||||||
history.ignoreDups = true;
|
history.ignoreDups = true;
|
||||||
history.ignoreSpace = true;
|
history.ignoreSpace = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
imports = [ ./git.nix ];
|
imports = [ ./git.nix ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
{lib,config,...}:
|
{ lib, config, ... }:
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config";
|
home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config";
|
||||||
home.shellAliases = {
|
home.shellAliases = {
|
||||||
gs = "git status";
|
gs = "git status";
|
||||||
gc = "git commit";
|
gc = "git commit";
|
||||||
gcam = "git commit -am";
|
gcam = "git commit -am";
|
||||||
gu = "git push";
|
gu = "git push";
|
||||||
gy = "git pull";
|
gy = "git pull";
|
||||||
};
|
};
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userName = config.cli.git.name;
|
userName = config.cli.git.name;
|
||||||
userEmail = config.cli.git.email;
|
userEmail = config.cli.git.email;
|
||||||
signing.key = "~/.ssh/id_ed25519.pub";
|
signing.key = "~/.ssh/id_ed25519.pub";
|
||||||
signing.signByDefault = true;
|
signing.signByDefault = true;
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
init.defaultBranch = config.cli.git.defaultBranch;
|
init.defaultBranch = config.cli.git.defaultBranch;
|
||||||
push.autoSetupRemote = true;
|
push.autoSetupRemote = true;
|
||||||
pull.rebase = false;
|
pull.rebase = false;
|
||||||
core.editor = "$EDITOR";
|
core.editor = "$EDITOR";
|
||||||
gpg.format = "ssh";
|
gpg.format = "ssh";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
{
|
{
|
||||||
config = lib.mkIf (config.desktop.browser == "firefox") {
|
config = lib.mkIf (config.desktop.browser == "firefox") {
|
||||||
home.persistence."/persist/home/rafiq".directories = [ ".mozilla/firefox" ];
|
home.persistence."/persist/home/rafiq".directories = [ ".mozilla/firefox" ];
|
||||||
home.sessionVariables.BROWSER = "firefox";
|
home.sessionVariables.BROWSER = "firefox";
|
||||||
programs.firefox = {
|
programs.firefox = {
|
||||||
enable = true;
|
enable = true;
|
||||||
profiles.rafiq.id = 0;
|
profiles.rafiq.id = 0;
|
||||||
profiles.test.id = 1;
|
profiles.test.id = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
{ config, lib, osConfig, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
osConfig,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
options.desktop = {
|
options.desktop = {
|
||||||
windowManager = lib.pantheon.mkStrOption;
|
windowManager = lib.pantheon.mkStrOption;
|
||||||
|
@ -6,14 +11,12 @@
|
||||||
terminal = lib.pantheon.mkStrOption;
|
terminal = lib.pantheon.mkStrOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
config = {
|
assertions = [
|
||||||
assertions =
|
{
|
||||||
[
|
assertion = (osConfig.desktop.windowManager == config.desktop.windowManager);
|
||||||
{
|
message = "You have set your home window manager to one that is not installed on this system.";
|
||||||
assertion = (osConfig.desktop.windowManager == config.desktop.windowManager);
|
}
|
||||||
message = "You have set your home window manager to one that is not installed on this system.";
|
];
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf (config.desktop.terminal == "kitty") {
|
(lib.mkIf (config.desktop.terminal == "kitty") {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
{ config, lib, osConfig, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
osConfig,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
mainMonitor = osConfig.desktop.mainMonitor;
|
mainMonitor = osConfig.desktop.mainMonitor;
|
||||||
in
|
in
|
||||||
|
@ -7,48 +12,50 @@ in
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
config = lib.mkIf (config.desktop.windowManager == "hyprland") (lib.mkMerge [
|
config = lib.mkIf (config.desktop.windowManager == "hyprland") (
|
||||||
{
|
lib.mkMerge [
|
||||||
xdg.configFile."uwsm/env".text = # sh
|
{
|
||||||
''
|
xdg.configFile."uwsm/env".text = # sh
|
||||||
|
''
|
||||||
'';
|
|
||||||
wayland.windowManager.hyprland = {
|
|
||||||
enable = true;
|
|
||||||
systemd.enable = false;
|
|
||||||
settings = {
|
|
||||||
ecosystem.no_update_news = true;
|
|
||||||
"$hypr" = "CTRL_SUPER_ALT_SHIFT";
|
|
||||||
|
|
||||||
monitor = [
|
'';
|
||||||
"${mainMonitor.id}, ${mainMonitor.resolution}@${mainMonitor.refresh-rate}, auto, ${mainMonitor.scale}"
|
wayland.windowManager.hyprland = {
|
||||||
", preferred, auto, 1"
|
enable = true;
|
||||||
];
|
systemd.enable = false;
|
||||||
|
settings = {
|
||||||
|
ecosystem.no_update_news = true;
|
||||||
|
"$hypr" = "CTRL_SUPER_ALT_SHIFT";
|
||||||
|
|
||||||
bind = [
|
monitor = [
|
||||||
"$hypr, Q, exec, uwsm stop"
|
"${mainMonitor.id}, ${mainMonitor.resolution}@${mainMonitor.refresh-rate}, auto, ${mainMonitor.scale}"
|
||||||
"SUPER, W, killactive"
|
", preferred, auto, 1"
|
||||||
|
];
|
||||||
|
|
||||||
"SUPER, return, exec, uwsm app -- $TERMINAL"
|
bind = [
|
||||||
"SUPER, O, exec, uwsm app -- $BROWSER"
|
"$hypr, Q, exec, uwsm stop"
|
||||||
|
"SUPER, W, killactive"
|
||||||
|
|
||||||
"SUPER, H, cyclenext, visible"
|
"SUPER, return, exec, uwsm app -- $TERMINAL"
|
||||||
"SUPER, L, cyclenext, visible prev"
|
"SUPER, O, exec, uwsm app -- $BROWSER"
|
||||||
"SUPER_ALT, H, movewindow, l"
|
|
||||||
"SUPER_ALT, J, movewindow, d"
|
"SUPER, H, cyclenext, visible"
|
||||||
"SUPER_ALT, K, movewindow, u"
|
"SUPER, L, cyclenext, visible prev"
|
||||||
"SUPER_ALT, L, movewindow, r"
|
"SUPER_ALT, H, movewindow, l"
|
||||||
"ALT_SHIFT, H, resizeactive, -10% 0"
|
"SUPER_ALT, J, movewindow, d"
|
||||||
"ALT_SHIFT, J, resizeactive, 0 -10%"
|
"SUPER_ALT, K, movewindow, u"
|
||||||
"ALT_SHIFT, K, resizeactive, 0 10%"
|
"SUPER_ALT, L, movewindow, r"
|
||||||
"ALT_SHIFT, L, resizeactive, 10% 0"
|
"ALT_SHIFT, H, resizeactive, -10% 0"
|
||||||
"SUPER_CTRL, H, workspace, r-1"
|
"ALT_SHIFT, J, resizeactive, 0 -10%"
|
||||||
"SUPER_CTRL, L, workspace, r+1"
|
"ALT_SHIFT, K, resizeactive, 0 10%"
|
||||||
"$hypr, H, movetoworkspace, r-1"
|
"ALT_SHIFT, L, resizeactive, 10% 0"
|
||||||
"$hypr, L, movetoworkspace, r+1"
|
"SUPER_CTRL, H, workspace, r-1"
|
||||||
];
|
"SUPER_CTRL, L, workspace, r+1"
|
||||||
};
|
"$hypr, H, movetoworkspace, r-1"
|
||||||
};
|
"$hypr, L, movetoworkspace, r+1"
|
||||||
}
|
];
|
||||||
]);
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
home.persistence."/persist/home/${config.snowfallorg.user.name}" = {
|
home.persistence."/persist/home/${config.snowfallorg.user.name}" = {
|
||||||
directories = [
|
directories = [
|
||||||
".ssh"
|
".ssh"
|
||||||
".config/sops/age"
|
".config/sops/age"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
allowOther = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
home.stateVersion = "24.11";
|
home.stateVersion = "24.11";
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
{config, lib, pkgs, ...}:
|
|
||||||
{
|
{
|
||||||
imports = [];
|
config,
|
||||||
|
lib,
|
||||||
options.cli = {};
|
pkgs,
|
||||||
|
...
|
||||||
config = lib.mkMerge [
|
}:
|
||||||
{
|
{
|
||||||
programs.zsh.enable = true;
|
imports = [ ];
|
||||||
users.defaultUserShell = pkgs.zsh;
|
|
||||||
environment.pathsToLink = [ "/share/zsh" ]; # enables completion
|
options.cli = { };
|
||||||
}
|
|
||||||
];
|
config = lib.mkMerge [
|
||||||
|
{
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
users.defaultUserShell = pkgs.zsh;
|
||||||
|
environment.pathsToLink = [ "/share/zsh" ]; # enables completion
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
options.desktop = {
|
options.desktop = {
|
||||||
mainMonitor = {
|
mainMonitor = {
|
||||||
id = lib.pantheon.mkStrOption;
|
id = lib.pantheon.mkStrOption;
|
||||||
scale = lib.pantheon.mkStrOption;
|
scale = lib.pantheon.mkStrOption;
|
||||||
resolution = lib.pantheon.mkStrOption;
|
resolution = lib.pantheon.mkStrOption;
|
||||||
refresh-rate = lib.pantheon.mkStrOption;
|
refresh-rate = lib.pantheon.mkStrOption;
|
||||||
};
|
};
|
||||||
windowManager = lib.pantheon.mkStrOption;
|
windowManager = lib.pantheon.mkStrOption;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,21 +2,21 @@
|
||||||
{
|
{
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf (config.desktop.windowManager == "hyprland") {
|
(lib.mkIf (config.desktop.windowManager == "hyprland") {
|
||||||
environment.loginShellInit = # sh
|
environment.loginShellInit = # sh
|
||||||
''
|
''
|
||||||
if [[ -z "$SSH_CLIENT" && -z "$SSH_CONNECTION" ]]; then
|
if [[ -z "$SSH_CLIENT" && -z "$SSH_CONNECTION" ]]; then
|
||||||
if uwsm check may-start; then
|
if uwsm check may-start; then
|
||||||
exec uwsm start hyprland-uwsm.desktop
|
exec uwsm start hyprland-uwsm.desktop
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
'';
|
fi
|
||||||
|
'';
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
ELECTRON_OZONE_PLATFORM_HINT = "auto";
|
ELECTRON_OZONE_PLATFORM_HINT = "auto";
|
||||||
NIXOS_OZONE_WL = "1";
|
NIXOS_OZONE_WL = "1";
|
||||||
};
|
};
|
||||||
programs.hyprland = {
|
programs.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
withUWSM = true;
|
withUWSM = true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
services.pipewire = {
|
services.pipewire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +1,89 @@
|
||||||
{lib, config, ...}:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.hardware.drives.btrfs;
|
cfg = config.hardware.drives.btrfs;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf (cfg.enable) (lib.mkMerge [
|
config = lib.mkIf (cfg.enable) (
|
||||||
{
|
lib.mkMerge [
|
||||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
{
|
||||||
disko.devices.disk.main = {
|
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||||
device = cfg.drive;
|
disko.devices.disk.main = {
|
||||||
type = "disk";
|
device = cfg.drive;
|
||||||
content.type = "gpt";
|
type = "disk";
|
||||||
content.partitions = {
|
content.type = "gpt";
|
||||||
boot.name = "boot";
|
content.partitions = {
|
||||||
boot.size = "1M";
|
boot.name = "boot";
|
||||||
boot.type = "EF02";
|
boot.size = "1M";
|
||||||
esp.name = "ESP";
|
boot.type = "EF02";
|
||||||
esp.size = "500M";
|
esp.name = "ESP";
|
||||||
esp.type = "EF00";
|
esp.size = "500M";
|
||||||
esp.content = {
|
esp.type = "EF00";
|
||||||
type = "filesystem";
|
esp.content = {
|
||||||
format = "vfat";
|
type = "filesystem";
|
||||||
mountpoint = "/boot";
|
format = "vfat";
|
||||||
};
|
mountpoint = "/boot";
|
||||||
swap.size = "4G";
|
};
|
||||||
swap.content = {
|
swap.size = "4G";
|
||||||
type = "swap";
|
swap.content = {
|
||||||
resumeDevice = true;
|
type = "swap";
|
||||||
};
|
resumeDevice = true;
|
||||||
root.name = "root";
|
};
|
||||||
root.size = "100%";
|
root.name = "root";
|
||||||
root.content = {
|
root.size = "100%";
|
||||||
type = "lvm_pv";
|
root.content = {
|
||||||
vg = "root_vg";
|
type = "lvm_pv";
|
||||||
};
|
vg = "root_vg";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
disko.devices.lvm_vg.root_vg = {
|
disko.devices.lvm_vg.root_vg = {
|
||||||
type = "lvm_vg";
|
type = "lvm_vg";
|
||||||
lvs.root.size = "100%FREE";
|
lvs.root.size = "100%FREE";
|
||||||
lvs.root.content.type = "btrfs";
|
lvs.root.content.type = "btrfs";
|
||||||
lvs.root.content.extraArgs = ["-f"];
|
lvs.root.content.extraArgs = [ "-f" ];
|
||||||
lvs.root.content.subvolumes = {
|
lvs.root.content.subvolumes = {
|
||||||
"/root".mountpoint = "/";
|
"/root".mountpoint = "/";
|
||||||
"/persist".mountpoint = "/persist";
|
"/persist".mountpoint = "/persist";
|
||||||
"/persist".mountOptions = ["subvol=persist" "noatime"];
|
"/persist".mountOptions = [
|
||||||
"/nix".mountpoint = "/nix";
|
"subvol=persist"
|
||||||
"/nix".mountOptions = ["subvol=nix" "noatime"];
|
"noatime"
|
||||||
};
|
];
|
||||||
};
|
"/nix".mountpoint = "/nix";
|
||||||
}
|
"/nix".mountOptions = [
|
||||||
(lib.mkIf (cfg.ephemeralRoot) {
|
"subvol=nix"
|
||||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
"noatime"
|
||||||
mkdir /btrfs_tmp
|
];
|
||||||
mount /dev/root_vg/root /btrfs_tmp
|
};
|
||||||
if [[ -e /btrfs_tmp/root ]]; then
|
};
|
||||||
mkdir -p /btrfs_tmp/old_roots
|
}
|
||||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
(lib.mkIf (cfg.ephemeralRoot) {
|
||||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||||
fi
|
mkdir /btrfs_tmp
|
||||||
|
mount /dev/root_vg/root /btrfs_tmp
|
||||||
|
if [[ -e /btrfs_tmp/root ]]; then
|
||||||
|
mkdir -p /btrfs_tmp/old_roots
|
||||||
|
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||||
|
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||||
|
fi
|
||||||
|
|
||||||
delete_subvolume_recursively() {
|
delete_subvolume_recursively() {
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||||
done
|
done
|
||||||
btrfs subvolume delete "$1"
|
btrfs subvolume delete "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||||
delete_subvolume_recursively "$i"
|
delete_subvolume_recursively "$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
btrfs subvolume create /btrfs_tmp/root
|
btrfs subvolume create /btrfs_tmp/root
|
||||||
umount /btrfs_tmp
|
umount /btrfs_tmp
|
||||||
'';
|
'';
|
||||||
programs.fuse.userAllowOther = true;
|
programs.fuse.userAllowOther = true;
|
||||||
})
|
})
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
{
|
{
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf (config.hardware.platform == "amd"){
|
(lib.mkIf (config.hardware.platform == "amd") {
|
||||||
hardware.cpu.amd.updateMicrocode = true;
|
hardware.cpu.amd.updateMicrocode = true;
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{lib,...}:
|
{ lib, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./btrfs.nix
|
./btrfs.nix
|
||||||
|
|
|
@ -2,20 +2,22 @@
|
||||||
{
|
{
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
networking.useDHCP = lib.mkDefault true;
|
networking.useDHCP = lib.mkDefault true;
|
||||||
networking.hostName = config.system.hostname;
|
networking.hostName = config.system.hostname;
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
PrintMotd = true;};
|
PrintMotd = true;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
services.tailscale = {
|
services.tailscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
authKeyFile = config.sops.secrets."keys/tailscale".path;};
|
authKeyFile = config.sops.secrets."keys/tailscale".path;
|
||||||
environment.persistence."/persist".files = [ "/var/lib/tailscale/tailscaled.state"];
|
};
|
||||||
|
environment.persistence."/persist".files = [ "/var/lib/tailscale/tailscaled.state" ];
|
||||||
}
|
}
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,21 +1,28 @@
|
||||||
{ lib, config, pkgs, ... }:
|
|
||||||
{
|
{
|
||||||
config = lib.mkIf (config.hardware.gpu == "nvidia") (lib.mkMerge [
|
lib,
|
||||||
{
|
config,
|
||||||
#TODO: Setup CUDA
|
pkgs,
|
||||||
hardware.graphics.enable = true;
|
...
|
||||||
hardware.graphics.extraPackages = with pkgs; [
|
}:
|
||||||
nvidia-vaapi-driver
|
{
|
||||||
];
|
config = lib.mkIf (config.hardware.gpu == "nvidia") (
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
lib.mkMerge [
|
||||||
hardware.nvidia.open = true;
|
{
|
||||||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.latest;
|
#TODO: Setup CUDA
|
||||||
nixpkgs.config.allowUnfree = true;
|
hardware.graphics.enable = true;
|
||||||
environment.variables = {
|
hardware.graphics.extraPackages = with pkgs; [
|
||||||
LIBVA_DRIVER_NAME = "nvidia";
|
nvidia-vaapi-driver
|
||||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
];
|
||||||
NVD_BACKEND = "direct";
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
};
|
hardware.nvidia.open = true;
|
||||||
}
|
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.latest;
|
||||||
]);
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
environment.variables = {
|
||||||
|
LIBVA_DRIVER_NAME = "nvidia";
|
||||||
|
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||||
|
NVD_BACKEND = "direct";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,19 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
{
|
{
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
boot.initrd.availableKernelModules = [
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
"nvme"
|
||||||
|
"xhci_pci"
|
||||||
|
"ahci"
|
||||||
|
"usbhid"
|
||||||
|
"usb_storage"
|
||||||
|
"sd_mod"
|
||||||
|
];
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
}
|
}
|
||||||
(lib.mkIf (config.system.bootloader == "systemd-boot"){
|
(lib.mkIf (config.system.bootloader == "systemd-boot") {
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, ...}:
|
{ config, lib, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./boot.nix
|
./boot.nix
|
||||||
|
@ -9,10 +9,10 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
options.system = {
|
options.system = {
|
||||||
hostname = lib.pantheon.mkStrOption;
|
hostname = lib.pantheon.mkStrOption;
|
||||||
mainUser.name = lib.pantheon.mkStrOption;
|
mainUser.name = lib.pantheon.mkStrOption;
|
||||||
mainUser.publicKey = lib.pantheon.mkStrOption;
|
mainUser.publicKey = lib.pantheon.mkStrOption;
|
||||||
bootloader = lib.pantheon.mkStrOption;
|
bootloader = lib.pantheon.mkStrOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
{
|
{
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
time.timeZone = "Asia/Singapore";
|
time.timeZone = "Asia/Singapore";
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
{
|
{
|
||||||
sops = {
|
sops = {
|
||||||
defaultSopsFile = lib.snowfall.fs.get-file "secrets/secrets.yaml";
|
defaultSopsFile = lib.snowfall.fs.get-file "secrets/secrets.yaml";
|
||||||
age.sshKeyPaths = ["/persist/home/rafiq/.ssh/id_ed25519"];
|
age.sshKeyPaths = [ "/persist/home/rafiq/.ssh/id_ed25519" ];
|
||||||
secrets = {
|
secrets = {
|
||||||
"keys/tailscale" = {};
|
"keys/tailscale" = { };
|
||||||
"rafiq/hashedPassword".neededForUsers = true;
|
"rafiq/hashedPassword".neededForUsers = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
users.groups.users = {
|
users.groups.users = {
|
||||||
gid = 100;
|
gid = 100;
|
||||||
members = [ "${config.system.mainUser.name}" ];
|
members = [ "${config.system.mainUser.name}" ];
|
||||||
};
|
};
|
||||||
users.users."${config.system.mainUser.name}" = {
|
users.users."${config.system.mainUser.name}" = {
|
||||||
linger = true;
|
linger = true;
|
||||||
uid = 1000;
|
uid = 1000;
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
hashedPasswordFile = config.sops.secrets."${config.system.mainUser.name}/hashedPassword".path;
|
hashedPasswordFile = config.sops.secrets."${config.system.mainUser.name}/hashedPassword".path;
|
||||||
extraGroups = [ "wheel" ];
|
extraGroups = [ "wheel" ];
|
||||||
openssh.authorizedKeys.keys = [ config.system.mainUser.publicKey ];
|
openssh.authorizedKeys.keys = [ config.system.mainUser.publicKey ];
|
||||||
};
|
};
|
||||||
services.getty.autologinUser = config.system.mainUser.name;
|
services.getty.autologinUser = config.system.mainUser.name;
|
||||||
security.sudo.wheelNeedsPassword = false;
|
security.sudo.wheelNeedsPassword = false;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
pkgs.writeShellScriptBin "rebuild" # sh
|
pkgs.writeShellScriptBin "rebuild" # sh
|
||||||
''
|
''
|
||||||
if [ ! -f "flake.nix" ]; then
|
if [ ! -f "flake.nix" ]; then
|
||||||
echo "flake.nix not found in current directory. exiting..."
|
echo "flake.nix not found in current directory. exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git add . && \
|
git add . && \
|
||||||
nixos-rebuild switch --flake . --use-remote-sudo && \
|
nixos-rebuild switch --flake . --use-remote-sudo && \
|
||||||
echo "=== opening test shell. ===" && \
|
echo "=== opening test shell. ===" && \
|
||||||
echo "=== exit = commit ===" && \
|
echo "=== exit = commit ===" && \
|
||||||
echo "=== exit 1 = abort ===" && \
|
echo "=== exit 1 = abort ===" && \
|
||||||
$SHELL && \
|
$SHELL && \
|
||||||
git commit -a
|
git commit -a
|
||||||
''
|
''
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
system.hostname = "nemesis";
|
system.hostname = "nemesis";
|
||||||
system.mainUser.name = "rafiq";
|
system.mainUser.name = "rafiq";
|
||||||
|
@ -14,10 +19,10 @@
|
||||||
|
|
||||||
desktop.windowManager = "hyprland";
|
desktop.windowManager = "hyprland";
|
||||||
desktop.mainMonitor = {
|
desktop.mainMonitor = {
|
||||||
id = "desc:OOO AN-270W04K";
|
id = "desc:OOO AN-270W04K";
|
||||||
scale = "1";
|
scale = "1";
|
||||||
resolution = "2560x1440";
|
resolution = "2560x1440";
|
||||||
refresh-rate = "144";
|
refresh-rate = "144";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
@ -26,7 +31,7 @@ refresh-rate = "144";
|
||||||
environment.persistence."/persist" = {
|
environment.persistence."/persist" = {
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
directories = [
|
directories = [
|
||||||
"/var/lib/systemd"
|
"/var/lib/systemd"
|
||||||
];
|
];
|
||||||
files = [
|
files = [
|
||||||
"/etc/ssh/ssh_host_ed25519_key"
|
"/etc/ssh/ssh_host_ed25519_key"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue