Skip to content

Commit

Permalink
Reformat code.
Browse files Browse the repository at this point in the history
  • Loading branch information
kurnevsky committed Dec 16, 2024
1 parent a2c7376 commit a1596be
Show file tree
Hide file tree
Showing 49 changed files with 2,724 additions and 1,975 deletions.
116 changes: 68 additions & 48 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@
};
};

outputs = inputs:
outputs =
inputs:
let
collectFlakeInputs = input:
[ input ] ++ builtins.concatMap collectFlakeInputs
(builtins.attrValues (input.inputs or { }));
collectFlakeInputs =
input:
[ input ] ++ builtins.concatMap collectFlakeInputs (builtins.attrValues (input.inputs or { }));
users = {
root = "root";
kurnevsky = "kurnevsky";
Expand All @@ -117,7 +118,10 @@
./modules/common.nix
./modules/bfq.nix
./modules/overlays.nix
(for-all-home-users (with users; [ root kurnevsky ]) common-home)
(for-all-home-users (with users; [
root
kurnevsky
]) common-home)
# Keep flake inputs from being garbage collected
{ system.extraDependencies = collectFlakeInputs inputs.self; }
];
Expand All @@ -132,7 +136,13 @@
}
inputs.solaar.nixosModules.default
(for-all-home-users (with users; [ ww ]) common-home)
(import ./modules/emacs.nix (with users; [ kurnevsky ww ]))
(import ./modules/emacs.nix (
with users;
[
kurnevsky
ww
]
))
./modules/desktop.nix
./modules/kde.nix
./modules/sandbox.nix
Expand All @@ -144,40 +154,53 @@
./modules/torbrowser.nix
./modules/nspawn.nix
./modules/zswap.nix
({ pkgs, ... }: {
environment.systemPackages =
[ inputs.agenix.packages.${pkgs.system}.default ];
})
(
{ pkgs, ... }:
{
environment.systemPackages = [ inputs.agenix.packages.${pkgs.system}.default ];
}
)
];
llamaOverride = pkgs: config: llama:
import ./modules/with-native-optimizations.nix
config.networking.hostName (llama.overrideAttrs (old: {
postInstall = (old.postInstall or "") + ''
find $out/bin -type f ! -wholename '*/llama*' -exec ${pkgs.util-linux}/bin/rename "" 'llama-' {} \;
'';
}));
llamaDefault = { pkgs, config, ... }: {
environment.systemPackages = [
(llamaOverride pkgs config
inputs.llama-cpp.packages.${pkgs.system}.default)
];
};
llamaOpencl = { pkgs, config, ... }: {
environment.systemPackages = [
(llamaOverride pkgs config
inputs.llama-cpp.packages.${pkgs.system}.opencl)
];
};
llamaRocm = gpuTargets:
{ pkgs, config, ... }: {
llamaOverride =
pkgs: config: llama:
import ./modules/with-native-optimizations.nix config.networking.hostName (
llama.overrideAttrs (old: {
postInstall =
(old.postInstall or "")
+ ''
find $out/bin -type f ! -wholename '*/llama*' -exec ${pkgs.util-linux}/bin/rename "" 'llama-' {} \;
'';
})
);
llamaDefault =
{ pkgs, config, ... }:
{
environment.systemPackages = [
(llamaOverride pkgs config inputs.llama-cpp.packages.${pkgs.system}.default)
];
};
llamaOpencl =
{ pkgs, config, ... }:
{
environment.systemPackages = [
(llamaOverride pkgs config
(inputs.llama-cpp.packages.${pkgs.system}.rocm.override {
(llamaOverride pkgs config inputs.llama-cpp.packages.${pkgs.system}.opencl)
];
};
llamaRocm =
gpuTargets:
{ pkgs, config, ... }:
{
environment.systemPackages = [
(llamaOverride pkgs config (
inputs.llama-cpp.packages.${pkgs.system}.rocm.override {
rocmGpuTargets = gpuTargets;
}))
}
))
];
};
in {
in
{
formatter.x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
nixosConfigurations = {
dell = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
Expand Down Expand Up @@ -239,8 +262,7 @@
system = "x86_64-linux";
modules = [
{
_module.args.rootfs =
inputs.self.nixosConfigurations.pinephone-vm.config.mobile.outputs.rootfs;
_module.args.rootfs = inputs.self.nixosConfigurations.pinephone-vm.config.mobile.outputs.rootfs;
}
(import "${inputs.mobile-nixos}/lib/configuration.nix" {
device = "uefi-x86_64";
Expand All @@ -261,19 +283,17 @@
];
};
};
nixOnDroidConfigurations.default =
inputs.nix-on-droid.lib.nixOnDroidConfiguration {
pkgs = import inputs.nixpkgs { system = "aarch64-linux"; };
modules = [
./modules/android.nix
./machines/android/configuration.nix
{ _module.args.emacs-overlay = inputs.emacs-overlay.overlay; }
];
};
nixOnDroidConfigurations.default = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
pkgs = import inputs.nixpkgs { system = "aarch64-linux"; };
modules = [
./modules/android.nix
./machines/android/configuration.nix
{ _module.args.emacs-overlay = inputs.emacs-overlay.overlay; }
];
};
packages.x86_64-linux = {
# nix build -L '/etc/nixos#phone-vm' && ./result -enable-kvm -smp 2
phone-vm =
inputs.self.nixosConfigurations.pinephone-vm.config.mobile.outputs.uefi.vm;
phone-vm = inputs.self.nixosConfigurations.pinephone-vm.config.mobile.outputs.uefi.vm;
# nix build -L '/etc/nixos#phone-vm-encrypted' && ./result -enable-kvm -smp 2
phone-vm-encrypted =
inputs.self.nixosConfigurations.pinephone-vm-encrypted.config.mobile.outputs.uefi.vm;
Expand Down
85 changes: 48 additions & 37 deletions machines/acer/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
cleanTmpDir = true;
kernelPackages = pkgs.linuxPackages_latest;
kernel.sysctl."kernel.sysrq" = 1;
kernelPatches = [{
name = "nouveau";
patch = ./nouveau.patch;
}];
kernelPatches = [
{
name = "nouveau";
patch = ./nouveau.patch;
}
];
loader.grub = {
enable = true;
device = "/dev/sda";
Expand All @@ -31,7 +33,11 @@
# WireGuard
51871
];
trustedInterfaces = [ "wg0" "icmp" "dns0" ];
trustedInterfaces = [
"wg0"
"icmp"
"dns0"
];
};
wireguard.enable = true;
};
Expand Down Expand Up @@ -130,22 +136,22 @@
# Enable pam_systemd module to set dbus environment variable.
pam.services.login.startSession = true;
rtkit.enable = true;
sudo.extraRules = [{
runAs = "root";
users = [ "parents" ];
commands = [
{
command =
"/run/current-system/sw/bin/systemctl start iodine-digitalocean.service";
options = [ "NOPASSWD" ];
}
{
command =
"/run/current-system/sw/bin/systemctl start hans-digitalocean.service";
options = [ "NOPASSWD" ];
}
];
}];
sudo.extraRules = [
{
runAs = "root";
users = [ "parents" ];
commands = [
{
command = "/run/current-system/sw/bin/systemctl start iodine-digitalocean.service";
options = [ "NOPASSWD" ];
}
{
command = "/run/current-system/sw/bin/systemctl start hans-digitalocean.service";
options = [ "NOPASSWD" ];
}
];
}
];
};

hardware = {
Expand All @@ -164,7 +170,10 @@
isNormalUser = true;
shell = pkgs.zsh;
passwordFile = "/secrets/parents";
extraGroups = [ "audio" "video" ];
extraGroups = [
"audio"
"video"
];
};
hans.group = "hans";
};
Expand Down Expand Up @@ -200,22 +209,26 @@
PrivateKeyFile = "/secrets/wg/private.key";
ListenPort = 51871;
};
wireguardPeers = [{
PublicKey = "5JHCxIYeZ50k7YJM+kLAbqGW4LAXpI5lycYEWSVxkBE=";
PresharedKeyFile = "/secrets/wg/preshared.psk";
AllowedIPs = "192.168.14.0/24";
Endpoint = "kurnevsky.net:51871";
PersistentKeepalive = 25;
}];
wireguardPeers = [
{
PublicKey = "5JHCxIYeZ50k7YJM+kLAbqGW4LAXpI5lycYEWSVxkBE=";
PresharedKeyFile = "/secrets/wg/preshared.psk";
AllowedIPs = "192.168.14.0/24";
Endpoint = "kurnevsky.net:51871";
PersistentKeepalive = 25;
}
];
};
};
networks."99-wg0" = {
name = "wg0";
address = [ "192.168.14.4/32" ];
routes = [{
Destination = "192.168.14.0/24";
Scope = "link";
}];
routes = [
{
Destination = "192.168.14.0/24";
Scope = "link";
}
];
};
};
};
Expand All @@ -237,10 +250,8 @@
Service = {
Type = "simple";
# wait for Xorg started by ${USER}
ExecStartPre =
"${pkgs.bash}/bin/sh -c 'while ! ${pkgs.procps}/bin/pgrep -U \"$USER\" plasmashell; do ${pkgs.coreutils}/bin/sleep 2; done'";
ExecStart =
"${pkgs.tigervnc}/bin/x0vncserver -rfbauth /home/\${USER}/.vnc/passwd";
ExecStartPre = "${pkgs.bash}/bin/sh -c 'while ! ${pkgs.procps}/bin/pgrep -U \"$USER\" plasmashell; do ${pkgs.coreutils}/bin/sleep 2; done'";
ExecStart = "${pkgs.tigervnc}/bin/x0vncserver -rfbauth /home/\${USER}/.vnc/passwd";
};
Install.WantedBy = [ "default.target" ];
};
Expand Down
23 changes: 16 additions & 7 deletions machines/acer/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
{ config, lib, modulesPath, ... }:
{
config,
lib,
modulesPath,
...
}:

{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];

boot = {
initrd = {
availableKernelModules =
[ "uhci_hcd" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" ];
availableKernelModules = [
"uhci_hcd"
"ehci_pci"
"ahci"
"usb_storage"
"sd_mod"
"sr_mod"
];
kernelModules = [ "dm-snapshot" ];
};
kernelModules = [ ];
Expand All @@ -29,9 +40,7 @@
};
};

swapDevices =
[{ device = "/dev/disk/by-uuid/e15e4a3e-c561-4511-83a0-db50009d2349"; }];
swapDevices = [ { device = "/dev/disk/by-uuid/e15e4a3e-c561-4511-83a0-db50009d2349"; } ];

hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
13 changes: 8 additions & 5 deletions machines/android/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
user = let id = 10162;
in {
uid = id;
gid = id;
};
user =
let
id = 10162;
in
{
uid = id;
gid = id;
};

system.stateVersion = "23.05";
home-manager.config.home.stateVersion = "23.05";
Expand Down
Loading

0 comments on commit a1596be

Please sign in to comment.