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