chore: format nix files treewide

This commit is contained in:
Mohammad Rafiq 2025-05-20 12:53:13 +08:00
parent e1652efa53
commit 90d10606bc
No known key found for this signature in database
30 changed files with 387 additions and 319 deletions

View file

@ -16,7 +16,8 @@
nvf.inputs.nixpkgs.follows = "nixpkgs"; nvf.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = inputs: outputs =
inputs:
inputs.snowfall-lib.mkFlake { inputs.snowfall-lib.mkFlake {
inherit inputs; inherit inputs;
src = ./.; src = ./.;
@ -27,9 +28,12 @@
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
]; ];
homes.modules = with inputs; [ homes.modules = with inputs; [
impermanence.homeManagerModules.impermanence impermanence.homeManagerModules.impermanence
nix-index-database.hmModules.nix-index nix-index-database.hmModules.nix-index
nvf.homeManagerModules.default nvf.homeManagerModules.default
]; ];
outputs-builder = channels: {
formatter = channels.nixpkgs.nixfmt-rfc-style;
};
}; };
} }

View file

@ -1,4 +1,9 @@
{ config, pkgs, osConfig, ... }: {
config,
pkgs,
osConfig,
...
}:
{ {
cli.shell = "zsh"; cli.shell = "zsh";
cli.editor = "nvf"; cli.editor = "nvf";

View file

@ -1,4 +1,9 @@
{config, lib, osConfig, ... }: {
config,
lib,
osConfig,
...
}:
{ {
options.cli = { options.cli = {
shell = lib.pantheon.mkStrOption; shell = 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;

View file

@ -6,4 +6,4 @@
action = ":cd %:p:h<CR>:e <cfile><CR>"; action = ":cd %:p:h<CR>:e <cfile><CR>";
silent = true; silent = true;
} }
] ]

View file

@ -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;

View file

@ -1,4 +1,4 @@
{lib,config,...}: { lib, config, ... }:
{ {
config = { config = {
home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config"; home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config";

View file

@ -1,4 +1,9 @@
{ config, lib, osConfig, ... }: {
config,
lib,
osConfig,
...
}:
{ {
options.desktop = { options.desktop = {
windowManager = lib.pantheon.mkStrOption; windowManager = lib.pantheon.mkStrOption;
@ -6,10 +11,8 @@
terminal = lib.pantheon.mkStrOption; terminal = lib.pantheon.mkStrOption;
}; };
config = { config = {
assertions = assertions = [
[
{ {
assertion = (osConfig.desktop.windowManager == config.desktop.windowManager); assertion = (osConfig.desktop.windowManager == config.desktop.windowManager);
message = "You have set your home window manager to one that is not installed on this system."; message = "You have set your home window manager to one that is not installed on this system.";

View file

@ -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") {

View file

@ -1,4 +1,9 @@
{ config, lib, osConfig, ... }: {
config,
lib,
osConfig,
...
}:
let let
mainMonitor = osConfig.desktop.mainMonitor; mainMonitor = osConfig.desktop.mainMonitor;
in in
@ -7,7 +12,8 @@ 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
'' ''
@ -50,5 +56,6 @@ in
}; };
}; };
} }
]); ]
);
} }

View file

@ -1,14 +1,19 @@
{config, lib, pkgs, ...}:
{ {
imports = []; config,
lib,
options.cli = {}; pkgs,
...
config = lib.mkMerge [ }:
{ {
imports = [ ];
options.cli = { };
config = lib.mkMerge [
{
programs.zsh.enable = true; programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
environment.pathsToLink = [ "/share/zsh" ]; # enables completion environment.pathsToLink = [ "/share/zsh" ]; # enables completion
} }
]; ];
} }

View file

@ -1,9 +1,10 @@
{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" ]; boot.initrd.kernelModules = [ "dm-snapshot" ];
disko.devices.disk.main = { disko.devices.disk.main = {
@ -40,13 +41,19 @@ in
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 = [
"subvol=persist"
"noatime"
];
"/nix".mountpoint = "/nix"; "/nix".mountpoint = "/nix";
"/nix".mountOptions = ["subvol=nix" "noatime"]; "/nix".mountOptions = [
"subvol=nix"
"noatime"
];
}; };
}; };
} }
@ -77,5 +84,6 @@ in
''; '';
programs.fuse.userAllowOther = true; programs.fuse.userAllowOther = true;
}) })
]); ]
);
} }

View file

@ -1,7 +1,7 @@
{ 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" ];
}) })

View file

@ -1,4 +1,4 @@
{lib,...}: { lib, ... }:
{ {
imports = [ imports = [
./btrfs.nix ./btrfs.nix

View file

@ -7,15 +7,17 @@
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" ];
} }
]; ];

View file

@ -1,6 +1,12 @@
{ lib, config, pkgs, ... }:
{ {
config = lib.mkIf (config.hardware.gpu == "nvidia") (lib.mkMerge [ lib,
config,
pkgs,
...
}:
{
config = lib.mkIf (config.hardware.gpu == "nvidia") (
lib.mkMerge [
{ {
#TODO: Setup CUDA #TODO: Setup CUDA
hardware.graphics.enable = true; hardware.graphics.enable = true;
@ -17,5 +23,6 @@
NVD_BACKEND = "direct"; NVD_BACKEND = "direct";
}; };
} }
]); ]
);
} }

View file

@ -2,10 +2,17 @@
{ {
config = lib.mkMerge [ config = lib.mkMerge [
{ {
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.loader.efi.canTouchEfiVariables = true; 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;
}) })
]; ];

View file

@ -1,4 +1,4 @@
{ config, lib, ...}: { config, lib, ... }:
{ {
imports = [ imports = [
./boot.nix ./boot.nix

View file

@ -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;
}; };
}; };

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
config = lib.mkMerge [ config = lib.mkMerge [
{ {

View file

@ -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
'' ''

View file

@ -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";