From 2176df3047cb4a12e6a9d7e1c24e704f1d49d501 Mon Sep 17 00:00:00 2001 From: pegasust Date: Thu, 12 Jan 2023 23:42:21 -0700 Subject: [PATCH] nix-fmt --- dev-shell.nix | 11 +- flake.nix | 1 + hosts/bao/default.nix | 15 +- hosts/bao/hardware-configuration.nix | 13 +- hosts/default.nix | 157 +++++----- hosts/lester/hardware-configuration.nix | 9 +- hosts/lizzi/default.nix | 15 +- hosts/nyx/hardware-configuration.nix | 11 +- hosts/prince/hardware-configuration.nix | 1 + lib/default.nix | 35 ++- lib/serde.nix | 14 +- lib/test.nix | 4 +- modules/amdgpu.sys.nix | 2 +- modules/base.sys.nix | 12 +- modules/default.nix | 2 +- modules/kde.sys.nix | 2 +- modules/minimal.sys.nix | 22 +- modules/mosh.sys.nix | 10 +- modules/nvgpu.sys.nix | 4 +- modules/opengl.sys.nix | 39 +-- modules/secrets.nix | 5 +- modules/storage.perso.sys.nix | 46 +-- modules/tailscale.sys.nix | 11 +- modules/wifi.sys.nix | 2 +- nix-conf/home-manager/base/default.nix | 22 +- nix-conf/home-manager/base/git.nix | 4 +- nix-conf/home-manager/base/keepass.nix | 6 +- .../home-manager/base/productive_desktop.nix | 6 +- nix-conf/home-manager/base/shells.nix | 12 +- nix-conf/home-manager/base/ssh.nix | 2 +- nix-conf/home-manager/flake.nix | 37 ++- .../home-manager/fromYamlSandbox/flake.nix | 200 +++++++------ nix-conf/home-manager/home.nix | 14 +- nix-conf/home-manager/profiles/default.nix | 4 +- nix-conf/home-manager/profiles/hwtr.nix | 1 + nix-conf/lib/default.nix | 8 +- nix-conf/lib/serde/default.nix | 12 +- nix-conf/secrets.nix | 5 +- nix-conf/system/configuration.nix | 2 +- nix-conf/system/flake.nix | 281 +++++++++--------- nix-conf/system/hardware-configuration.nix | 9 +- .../profiles/bao/hardware-configuration.nix | 13 +- .../lester/hardware-configuration.nix | 9 +- .../profiles/nyx/hardware-configuration.nix | 11 +- .../prince/hardware-configuration.nix | 1 + out-of-tree/nixGL/all.nix | 6 +- out-of-tree/nixGL/default.nix | 33 +- out-of-tree/nixGL/flake.nix | 27 +- out-of-tree/nixGL/nixGL.nix | 2 +- secrets.nix | 5 +- secrets/default.nix | 6 +- templates/default.nix | 6 +- templates/rust-monorepo/default.nix | 17 +- templates/rust-monorepo/shell.nix | 17 +- templates/rust/default.nix | 17 +- templates/rust/shell.nix | 17 +- users/default.nix | 19 +- 57 files changed, 687 insertions(+), 587 deletions(-) diff --git a/dev-shell.nix b/dev-shell.nix index 95871f2..69b54a4 100644 --- a/dev-shell.nix +++ b/dev-shell.nix @@ -4,20 +4,21 @@ # Should also incorporate shortcuts like scripts/{hm-switch,conf-sysnix}.sh in here instead # # It should not contain PDE -{pkgs? import {} -,lib -,...}: pkgs.mkShell { +{ pkgs ? import { } +, lib +, ... +}: pkgs.mkShell { # mkShell doesn't care about the differences across nativeBuildInputs, # buildInputs, or packages buildInputs = [ # shell scripts - (lib.shellAsDrv {script = ''echo "hello world"''; pname = "hello";}) + (lib.shellAsDrv { script = ''echo "hello world"''; pname = "hello"; }) # TODO: decompose hm-switch.sh with a base version (where HOME_MANAGER_BIN is injected) # (lib.shellAsDrv {script = builtins.readFile ./scripts/hm-switch.sh; pname = "hm-switch";}) pkgs.rust4cargo ]; # env vars - lol="hello world"; + lol = "hello world"; } diff --git a/flake.nix b/flake.nix index ae13cbe..a5427b2 100644 --- a/flake.nix +++ b/flake.nix @@ -123,5 +123,6 @@ debug = { inherit final_inputs hosts users modules lib inputs_w_lib unit_tests pkgs nixpkgs; }; + formatter."${system}" = pkgs.nixpkgs-fmt; }; } diff --git a/hosts/bao/default.nix b/hosts/bao/default.nix index f24f049..6559c04 100644 --- a/hosts/bao/default.nix +++ b/hosts/bao/default.nix @@ -1,5 +1,12 @@ -{nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat -,pkgs, lib, proj_root}: { - -} +{ nixpkgs +, agenix +, home-manager +, flake-utils +, nixgl +, rust-overlay +, flake-compat +, pkgs +, lib +, proj_root +}: { } diff --git a/hosts/bao/hardware-configuration.nix b/hosts/bao/hardware-configuration.nix index 2851c4f..fb30806 100644 --- a/hosts/bao/hardware-configuration.nix +++ b/hosts/bao/hardware-configuration.nix @@ -5,25 +5,28 @@ { imports = - [ (modulesPath + "/installer/scan/not-detected.nix") + [ + (modulesPath + "/installer/scan/not-detected.nix") ]; boot.loader.systemd-boot.enable = true; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; # boot.initrd.kernelModules = [ "amdgpu" ]; - boot.initrd.kernelModules = []; - boot.kernelModules = [ "kvm-amd" "coretemp"]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" "coretemp" ]; boot.extraModulePackages = [ ]; fileSystems."/" = # Might be wise to use /dev/nvme0p1 instead - { device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2"; + { + device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2"; fsType = "ext4"; }; fileSystems."/boot" = # Might be wise to use /dev/nvme0p2 instead - { device = "/dev/disk/by-uuid/EBA6-394D"; + { + device = "/dev/disk/by-uuid/EBA6-394D"; fsType = "vfat"; }; diff --git a/hosts/default.nix b/hosts/default.nix index adea74f..6b17415 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,75 +1,90 @@ -{nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat -,pkgs, lib, proj_root, nixosDefaultVersion? "22.05", defaultSystem? "x86_64-linux",...}@finalInputs: let -config = { - bao.metadata = { - # req - hostName = "bao"; - # opts - ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBuAaAE7TiQmMH300VRj/pYCri1qPmHjd+y9aX2J0Fs"; - nixosVersion = "22.11"; - system = "x86_64-linux"; - preset = "base"; +{ nixpkgs +, agenix +, home-manager +, flake-utils +, nixgl +, rust-overlay +, flake-compat +, pkgs +, lib +, proj_root +, nixosDefaultVersion ? "22.05" +, defaultSystem ? "x86_64-linux" +, ... +}@finalInputs: +let + config = { + bao.metadata = { + # req + hostName = "bao"; + # opts + ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBuAaAE7TiQmMH300VRj/pYCri1qPmHjd+y9aX2J0Fs"; + nixosVersion = "22.11"; + system = "x86_64-linux"; + preset = "base"; + }; + # TODO: add override so that we can add wsl config on top + bao.nixosConfig = { + modules = [ + (import ../modules/nvgpu.sys.nix) + (import ../modules/kde.sys.nix) + (import ../modules/pulseaudio.sys.nix) + (import ../modules/storage.perso.sys.nix) + ]; + }; }; - # TODO: add override so that we can add wsl config on top - bao.nixosConfig = { - modules = [ - (import ../modules/nvgpu.sys.nix) - (import ../modules/kde.sys.nix) - (import ../modules/pulseaudio.sys.nix) - (import ../modules/storage.perso.sys.nix) - ]; - }; -}; -propagate = hostConfig@{metadata, nixosConfig}: let - # req - inherit (metadata) hostName; - # opts - ssh_pubkey = lib.attrByPath ["ssh_pubkey"] null metadata; # metadata.ssh_pubkey??undefined - users = lib.attrByPath ["users"] {} metadata; - nixosVersion = lib.attrByPath ["nixosVersion"] nixosDefaultVersion metadata; - system = lib.attrByPath ["system"] defaultSystem metadata; - preset = lib.attrByPath ["preset"] "base" metadata; - # infer - hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix"; - # alias to prevent infinite recursion - _nixosConfig = nixosConfig; -in { - inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig; - nixosConfig = _nixosConfig // { - inherit system; - modules = [ - { - config._module.args = { - inherit proj_root; - my-lib = finalInputs.lib; - }; - } - hardwareConfig - { - system.stateVersion = nixosVersion; - networking.hostName = hostName; - users.users = users; - } - { - imports = [agenix.nixosModule]; - environment.systemPackages = [agenix.defaultPackage.x86_64-linux]; - } - (import "${proj_root.modules.path}/secrets.nix") - (import "${proj_root.modules.path}/${preset}.sys.nix") - ] ++ _nixosConfig.modules; - }; -}; -# we are blessed by the fact that we engulfed nixpkgs.lib.* at top level -mkHostFromPropagated = propagatedHostConfig@{nixosConfig,...}: nixpkgs.lib.nixosSystem nixosConfig; -<<<<<<< HEAD -mkHost = hostConfig: (lib.pipe [propagate mkHostFromPropagated] hostConfig); -trimNull = lib.filterAttrsRecursive (name: value: value != null); -flattenPubkey = lib.mapAttrs (hostName: meta_config: meta_config.metadata.ssh_pubkey); -======= -mkHost = hostConfig: (lib.pipe hostConfig [propagate mkHostFromPropagated]); ->>>>>>> 4619ea4 (rekey) -in { + propagate = hostConfig@{ metadata, nixosConfig }: + let + # req + inherit (metadata) hostName; + # opts + ssh_pubkey = lib.attrByPath [ "ssh_pubkey" ] null metadata; # metadata.ssh_pubkey??undefined + users = lib.attrByPath [ "users" ] { } metadata; + nixosVersion = lib.attrByPath [ "nixosVersion" ] nixosDefaultVersion metadata; + system = lib.attrByPath [ "system" ] defaultSystem metadata; + preset = lib.attrByPath [ "preset" ] "base" metadata; + # infer + hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix"; + # alias to prevent infinite recursion + _nixosConfig = nixosConfig; + in + { + inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig; + nixosConfig = _nixosConfig // { + inherit system; + modules = [ + { + config._module.args = { + inherit proj_root; + my-lib = finalInputs.lib; + }; + } + hardwareConfig + { + system.stateVersion = nixosVersion; + networking.hostName = hostName; + users.users = users; + } + { + imports = [ agenix.nixosModule ]; + environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ]; + } + (import "${proj_root.modules.path}/secrets.nix") + (import "${proj_root.modules.path}/${preset}.sys.nix") + ] ++ _nixosConfig.modules; + }; + }; + # we are blessed by the fact that we engulfed nixpkgs.lib.* at top level + mkHostFromPropagated = propagatedHostConfig@{ nixosConfig, ... }: nixpkgs.lib.nixosSystem nixosConfig; + <<<<<<< HEAD + mkHost = hostConfig: (lib.pipe [ propagate mkHostFromPropagated ] hostConfig); + trimNull = lib.filterAttrsRecursive (name: value: value != null); + flattenPubkey = lib.mapAttrs (hostName: meta_config: meta_config.metadata.ssh_pubkey); + ======= + mkHost = hostConfig: (lib.pipe hostConfig [ propagate mkHostFromPropagated ]); + >>>>>>> 4619ea4 (rekey) + in { nixosConfigurations = lib.mapAttrs (name: hostConfig: mkHost hostConfig) config; # {bao = "ssh-ed25519 ..."; another_host = "ssh-rsa ...";} pubKeys = lib.getPubkey config; -} + } diff --git a/hosts/lester/hardware-configuration.nix b/hosts/lester/hardware-configuration.nix index aa59e37..e45b92a 100644 --- a/hosts/lester/hardware-configuration.nix +++ b/hosts/lester/hardware-configuration.nix @@ -5,7 +5,8 @@ { imports = - [ (modulesPath + "/profiles/qemu-guest.nix") + [ + (modulesPath + "/profiles/qemu-guest.nix") ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; @@ -23,13 +24,13 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/sda"; + { + device = "/dev/sda"; fsType = "ext4"; }; swapDevices = - [ { device = "/dev/sdb"; } - ]; + [{ device = "/dev/sdb"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/lizzi/default.nix b/hosts/lizzi/default.nix index 145cab8..9596da8 100644 --- a/hosts/lizzi/default.nix +++ b/hosts/lizzi/default.nix @@ -1,4 +1,11 @@ -{nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat -,pkgs, lib, proj_root}: { - -} +{ nixpkgs +, agenix +, home-manager +, flake-utils +, nixgl +, rust-overlay +, flake-compat +, pkgs +, lib +, proj_root +}: { } diff --git a/hosts/nyx/hardware-configuration.nix b/hosts/nyx/hardware-configuration.nix index 36b63dd..88ffe66 100644 --- a/hosts/nyx/hardware-configuration.nix +++ b/hosts/nyx/hardware-configuration.nix @@ -5,7 +5,8 @@ { imports = - [ (modulesPath + "/profiles/qemu-guest.nix") + [ + (modulesPath + "/profiles/qemu-guest.nix") ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; @@ -13,7 +14,7 @@ boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - boot.kernelParams = ["console=ttyS0,19200n8"]; + boot.kernelParams = [ "console=ttyS0,19200n8" ]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -23,13 +24,13 @@ boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; fileSystems."/" = - { device = "/dev/sda"; + { + device = "/dev/sda"; fsType = "ext4"; }; swapDevices = - [ { device = "/dev/sdb"; } - ]; + [{ device = "/dev/sdb"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/prince/hardware-configuration.nix b/hosts/prince/hardware-configuration.nix index e69de29..8b13789 100644 --- a/hosts/prince/hardware-configuration.nix +++ b/hosts/prince/hardware-configuration.nix @@ -0,0 +1 @@ + diff --git a/lib/default.nix b/lib/default.nix index 37fcefb..6568f0c 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,23 +1,28 @@ -{pkgs -# ,nixpkgs -,proj_root -# ,agenix -,nixosDefaultVersion? "22.05" -,defaultSystem? "x86_64-linux" -,...}@inputs: let +{ pkgs + # ,nixpkgs +, proj_root + # ,agenix +, nixosDefaultVersion ? "22.05" +, defaultSystem ? "x86_64-linux" +, ... +}@inputs: +let lib = pkgs.lib; - inputs_w_lib = (inputs // {inherit lib;}); + inputs_w_lib = (inputs // { inherit lib; }); serde = import ./serde.nix inputs_w_lib; - shellAsDrv = {script, pname}: (pkgs.callPackage ( - # just a pattern that we must remember: args to this are children of pkgs. - {writeShellScriptBin}: writeShellScriptBin pname script - ) {}); + shellAsDrv = { script, pname }: (pkgs.callPackage + ( + # just a pattern that we must remember: args to this are children of pkgs. + { writeShellScriptBin }: writeShellScriptBin pname script + ) + { }); trimNull = lib.filterAttrs (name: value: value != null); # ssh - flattenPubkey = lib.mapAttrs (_identity: meta_config: lib.attrByPath ["metadata" "ssh_pubkey"] null meta_config); - getPubkey = config: (lib.pipe config [flattenPubkey trimNull]); + flattenPubkey = lib.mapAttrs (_identity: meta_config: lib.attrByPath [ "metadata" "ssh_pubkey" ] null meta_config); + getPubkey = config: (lib.pipe config [ flattenPubkey trimNull ]); # procedure = -in { +in +{ # short-hand to create a shell derivation # NOTE: this is pure. This means, env vars from devShells might not # be accessible unless MAYBE they are `export`ed diff --git a/lib/serde.nix b/lib/serde.nix index 73d5eed..d0d5732 100644 --- a/lib/serde.nix +++ b/lib/serde.nix @@ -3,9 +3,9 @@ # TODO: Add to* formats from pkgs.formats.* { pkgs , lib -,... +, ... } @ inputs: -let +let yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage ({ runCommand }: # runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33 @@ -16,14 +16,16 @@ let echo "$yamlContent" | yq >$out '') { }; -in { +in +{ # Takes in a yaml string and produces a derivation with translated JSON at $outputPath # similar to builtins.fromJSON, turns a YAML string to nix attrset fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json")); fromYamlPath = yamlPath: builtins.fromJSON ( builtins.readFile ( - yamlToJsonDrv ( - builtins.readFile yamlPath) - "any-output.json")); + yamlToJsonDrv + ( + builtins.readFile yamlPath) + "any-output.json")); # TODO: fromToml? } diff --git a/lib/test.nix b/lib/test.nix index 169522e..da4b506 100644 --- a/lib/test.nix +++ b/lib/test.nix @@ -1,3 +1 @@ -{lib,...}: { - -} +{ lib, ... }: { } diff --git a/modules/amdgpu.sys.nix b/modules/amdgpu.sys.nix index 43ae3f7..d07dc1f 100644 --- a/modules/amdgpu.sys.nix +++ b/modules/amdgpu.sys.nix @@ -1,5 +1,5 @@ { - imports = [./gpu.sys.nix]; + imports = [ ./gpu.sys.nix ]; boot.initrd.kernelModules = [ "amdgpu" ]; services.xserver.enable = true; services.xserver.videoDrivers = [ "amdgpu" ]; diff --git a/modules/base.sys.nix b/modules/base.sys.nix index e2e043d..8bc5c8a 100644 --- a/modules/base.sys.nix +++ b/modules/base.sys.nix @@ -1,15 +1,15 @@ -{pkgs -,lib -,proj_root -,... -}:{ +{ pkgs +, lib +, proj_root +, ... +}: { imports = [ ./minimal.sys.nix ./mosh.sys.nix ./tailscale.sys.nix ./ssh.sys.nix ]; - environment.systemPackages = [pkgs.lm_sensors]; + environment.systemPackages = [ pkgs.lm_sensors ]; time.timeZone = "America/Phoenix"; } diff --git a/modules/default.nix b/modules/default.nix index 9fe8c60..be9a414 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1 +1 @@ -inputs: {} +inputs: { } diff --git a/modules/kde.sys.nix b/modules/kde.sys.nix index fc0b862..e5b427f 100644 --- a/modules/kde.sys.nix +++ b/modules/kde.sys.nix @@ -1,6 +1,6 @@ { pkgs , my-lib -,... +, ... }: { environment.noXlibs = my-lib.mkForce false; # TODO: wireless networking diff --git a/modules/minimal.sys.nix b/modules/minimal.sys.nix index bd5a729..da0b92c 100644 --- a/modules/minimal.sys.nix +++ b/modules/minimal.sys.nix @@ -1,21 +1,21 @@ -{pkgs -,lib -,proj_root -,modulesPath -,... -}:{ - imports = ["${modulesPath}/profiles/minimal.nix"]; +{ pkgs +, lib +, proj_root +, modulesPath +, ... +}: { + imports = [ "${modulesPath}/profiles/minimal.nix" ]; # prune old builds after a while nix.settings.auto-optimise-store = true; - nix.package = pkgs.nixFlakes; # nix flakes + nix.package = pkgs.nixFlakes; # nix flakes nix.extraOptions = '' experimental-features = nix-command flakes ''; programs.neovim = { - enable = true; - defaultEditor = true; + enable = true; + defaultEditor = true; }; - programs.git.enable = true; + programs.git.enable = true; environment.systemPackages = [ pkgs.gnumake pkgs.wget diff --git a/modules/mosh.sys.nix b/modules/mosh.sys.nix index 975f356..193f661 100644 --- a/modules/mosh.sys.nix +++ b/modules/mosh.sys.nix @@ -1,9 +1,9 @@ -{pkgs -,lib -,config -,... +{ pkgs +, lib +, config +, ... }: { - environment.systemPackages = [pkgs.mosh]; + environment.systemPackages = [ pkgs.mosh ]; networking.firewall = lib.mkIf config.networking.firewall.enable { allowedUDPPortRanges = [ { from = 60000; to = 61000; } # mosh diff --git a/modules/nvgpu.sys.nix b/modules/nvgpu.sys.nix index e637694..4b6d3e7 100644 --- a/modules/nvgpu.sys.nix +++ b/modules/nvgpu.sys.nix @@ -1,5 +1,5 @@ -{config,...}: { - imports = [./gpu.sys.nix]; +{ config, ... }: { + imports = [ ./gpu.sys.nix ]; nixpkgs.config.allowUnfree = true; services.xserver.enable = true; services.xserver.videoDrivers = [ "nvidia" ]; diff --git a/modules/opengl.sys.nix b/modules/opengl.sys.nix index 6beebda..d7aa0c8 100644 --- a/modules/opengl.sys.nix +++ b/modules/opengl.sys.nix @@ -1,18 +1,21 @@ -{config, pkgs, lib}: - let - gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ]; - gpu_conf = { - # openCL - hardware.opengl = { - enable = true; - extraPackages = let - inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime; - in [rocm-opencl-icd rocm-opencl-runtime]; - # Vulkan - driSupport = true; - driSupport32Bit = true; - package = pkgs.mesa.drivers; - package32 = pkgs.pkgsi686Linux.mesa.drivers; - }; - }; - in; +{ config, pkgs, lib }: +let + gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ]; + gpu_conf = { + # openCL + hardware.opengl = { + enable = true; + extraPackages = + let + inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime; + in + [ rocm-opencl-icd rocm-opencl-runtime ]; + # Vulkan + driSupport = true; + driSupport32Bit = true; + package = pkgs.mesa.drivers; + package32 = pkgs.pkgsi686Linux.mesa.drivers; + }; + }; +in + ; diff --git a/modules/secrets.nix b/modules/secrets.nix index cae2025..d491da3 100644 --- a/modules/secrets.nix +++ b/modules/secrets.nix @@ -1,5 +1,6 @@ -{proj_root -,...}: { +{ proj_root +, ... +}: { age.secrets.s3fs = { file = "${proj_root.secrets.path}/s3fs.age"; # mode = "600"; # owner + group only diff --git a/modules/storage.perso.sys.nix b/modules/storage.perso.sys.nix index d30e477..4a0b365 100644 --- a/modules/storage.perso.sys.nix +++ b/modules/storage.perso.sys.nix @@ -1,5 +1,5 @@ # Personal configuration on storage solution -{ pkgs, config, lib,... }: { +{ pkgs, config, lib, ... }: { environment.systemPackages = [ pkgs.s3fs pkgs.cifs-utils @@ -70,28 +70,32 @@ bucket = "digital-garden"; }) ( - let args = { - "-fstype" = "cifs"; - credentials = config.age.secrets._nhitrl_cred.path; - user = null; - uid = "1001"; - gid = "100"; - dir_mode = "0777"; - file_mode = "0777"; - }; - in "felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d" + let + args = { + "-fstype" = "cifs"; + credentials = config.age.secrets._nhitrl_cred.path; + user = null; + uid = "1001"; + gid = "100"; + dir_mode = "0777"; + file_mode = "0777"; + }; + in + "felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d" ) ( - let args = { - "-fstype" = "cifs"; - credentials = config.age.secrets._nhitrl_cred.path; - user = null; - uid = "1001"; - gid = "100"; - dir_mode = "0777"; - file_mode = "0777"; - }; - in "felia_f ${confToBackendArg args} ://felia.coati-celsius.ts.net/f" + let + args = { + "-fstype" = "cifs"; + credentials = config.age.secrets._nhitrl_cred.path; + user = null; + uid = "1001"; + gid = "100"; + dir_mode = "0777"; + file_mode = "0777"; + }; + in + "felia_f ${confToBackendArg args} ://felia.coati-celsius.ts.net/f" ) ]; persoConf = pkgs.writeText "auto.personal" (builtins.concatStringsSep "\n" personalStorage); diff --git a/modules/tailscale.sys.nix b/modules/tailscale.sys.nix index e7da3d5..f926523 100644 --- a/modules/tailscale.sys.nix +++ b/modules/tailscale.sys.nix @@ -1,8 +1,9 @@ -{pkgs -,config -,lib -,...}: { - environment.systemPackages = [pkgs.tailscale]; +{ pkgs +, config +, lib +, ... +}: { + environment.systemPackages = [ pkgs.tailscale ]; services.tailscale.enable = true; systemd.services.tailscale-autoconnect = { diff --git a/modules/wifi.sys.nix b/modules/wifi.sys.nix index 90de687..1d615ee 100644 --- a/modules/wifi.sys.nix +++ b/modules/wifi.sys.nix @@ -1,4 +1,4 @@ -{config,...}: { +{ config, ... }: { networking.wireless.enable = true; networking.wireless.environmentFile = config.age.secrets."wifi.env"; networking.wireless.networks = { diff --git a/nix-conf/home-manager/base/default.nix b/nix-conf/home-manager/base/default.nix index 5621907..a64a7a1 100644 --- a/nix-conf/home-manager/base/default.nix +++ b/nix-conf/home-manager/base/default.nix @@ -1,12 +1,12 @@ -{ - mkModuleArgs = import ./mkModuleArgs.nix; - modules = [ - ./alacritty.nix - ./git.nix - ./ssh.nix - ./shells.nix - { - config.programs.home-manager.enable = true; - } - ]; +{ + mkModuleArgs = import ./mkModuleArgs.nix; + modules = [ + ./alacritty.nix + ./git.nix + ./ssh.nix + ./shells.nix + { + config.programs.home-manager.enable = true; + } + ]; } diff --git a/nix-conf/home-manager/base/git.nix b/nix-conf/home-manager/base/git.nix index 8db840b..c9eec86 100644 --- a/nix-conf/home-manager/base/git.nix +++ b/nix-conf/home-manager/base/git.nix @@ -66,9 +66,9 @@ in example = 3000; }; }; -# TODO : anyway to override configuration? + # TODO : anyway to override configuration? config.programs.git = { - inherit (cfg) enable ignores; + inherit (cfg) enable ignores; userName = cfg.name; userEmail = cfg.email; aliases = baseAliases // cfg.aliases; diff --git a/nix-conf/home-manager/base/keepass.nix b/nix-conf/home-manager/base/keepass.nix index 84f6ca3..e985131 100644 --- a/nix-conf/home-manager/base/keepass.nix +++ b/nix-conf/home-manager/base/keepass.nix @@ -22,8 +22,8 @@ in keyfile_path = lib.mkOption { type = lib.types.nullOr lib.types.path; description = '' - Path to key file for the database - If null, then the field is unset + Path to key file for the database + If null, then the field is unset ''; default = null; example = "/path/to/mykeyfile.key"; @@ -47,7 +47,7 @@ in ] ++ (if cfg.use_gui or config.base.graphics._enable then [ pkgs.keepass # Personal secret management ] else [ ]); - home.file.".kp/config.ini".text = lib.generators.toINI {} (trimNull { + home.file.".kp/config.ini".text = lib.generators.toINI { } (trimNull { default = { KEEPASSDB = cfg.path; KEEPASSDB_KEYFILE = cfg.keyfile_path; diff --git a/nix-conf/home-manager/base/productive_desktop.nix b/nix-conf/home-manager/base/productive_desktop.nix index 52c18ac..64cc0ba 100644 --- a/nix-conf/home-manager/base/productive_desktop.nix +++ b/nix-conf/home-manager/base/productive_desktop.nix @@ -1,9 +1,9 @@ # A module that takes care of a GUI-ful, productive desktop environment -inputs@{pkgs,...}: { +inputs@{ pkgs, ... }: { imports = [ # slack - ({pkgs,...}: { - home.packages = [pkgs.slack]; + ({ pkgs, ... }: { + home.packages = [ pkgs.slack ]; }) ./private_chromium.nix ]; diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index 071deac..6c278ee 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -83,12 +83,12 @@ in oh-my-zsh = { enable = true; plugins = [ - "git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases + "git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases # "sudo" # double-escape to prepend sudo # UPDATE: just use vi-mode lol "command-not-found" # suggests which package to install; does not support nixos (we have solution already) "gitignore" # `gi list` -> `gi java >>.gitignore` - "ripgrep" # adds completion for `rg` - "rust" # compe for rustc/cargo + "ripgrep" # adds completion for `rg` + "rust" # compe for rustc/cargo # "vi-mode" # edit promps with vi motions :) ]; }; @@ -96,9 +96,9 @@ in # VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true; # VI_MODE_SET_CURSOR = true; # ZVM_VI_ESCAPE_BINDKEY = ""; - ZVM_READKEY_ENGINE="$ZVM_READKEY_ENGINE_NEX"; - ZVM_KEYTIMEOUT=0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) - ZVM_ESCAPE_KEYTIMEOUT=0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) + ZVM_READKEY_ENGINE = "$ZVM_READKEY_ENGINE_NEX"; + ZVM_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) + ZVM_ESCAPE_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) }; initExtra = (cfg.shellInitExtra or "") + '' source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh diff --git a/nix-conf/home-manager/base/ssh.nix b/nix-conf/home-manager/base/ssh.nix index 637651e..dd02bdf 100644 --- a/nix-conf/home-manager/base/ssh.nix +++ b/nix-conf/home-manager/base/ssh.nix @@ -1,7 +1,7 @@ { config , proj_root , myLib -, ... +, ... }: let cfg = config.base.ssh; in diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 206d56f..c62a6b6 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -36,7 +36,18 @@ , ... }: let - system = "x86_64-linux"; + # config_fn:: system -> config + cross_platform = config_fn: ({ + packages = builtins.foldl' + (prev: system: prev // { + "${system}" = config_fn system; + }) + { } + flake-utils.lib.defaultSystems; + }); + in + cross_platform (system: + let overlays = import ./../../overlays.nix flake_inputs; # pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays; pkgs = import nixpkgs { @@ -46,11 +57,11 @@ # lib = (import ../lib { inherit pkgs; lib = pkgs.lib; }); base = import ./base; inherit (base) mkModuleArgs; - - kde_module = {config, pkgs, ...}: { + + kde_module = { config, pkgs, ... }: { fonts.fontconfig.enable = true; home.packages = [ - (pkgs.nerdfonts.override {fonts = ["DroidSansMono"];}) + (pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; }) ]; # For some reasons, Windows es in the font name as DroidSansMono NF # so we need to override this @@ -62,13 +73,14 @@ inherit overlays pkgs base; }; homeConfigurations = - let x11_wsl = '' - # x11 output for WSL - export DISPLAY=$(ip route list default | awk '{print $3}'):0 - export LIBGL_ALWAYS_INDIRECT=1 - ''; + let + x11_wsl = '' + # x11 output for WSL + export DISPLAY=$(ip route list default | awk '{print $3}'):0 + export LIBGL_ALWAYS_INDIRECT=1 + ''; in - rec { + { "hungtr" = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = base.modules ++ [ @@ -109,6 +121,7 @@ }; }; }; + "htran" = home-manager.lib.homeManagerConfiguration { }; "nixos@Felia" = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ @@ -161,7 +174,7 @@ } ./base/productive_desktop.nix ]; - + extraSpecialArgs = mkModuleArgs { inherit pkgs; myHome = { @@ -174,5 +187,5 @@ }; }; }; - }; + }); } diff --git a/nix-conf/home-manager/fromYamlSandbox/flake.nix b/nix-conf/home-manager/fromYamlSandbox/flake.nix index 3525075..1bfc84a 100644 --- a/nix-conf/home-manager/fromYamlSandbox/flake.nix +++ b/nix-conf/home-manager/fromYamlSandbox/flake.nix @@ -1,109 +1,111 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - from-yaml ={ + from-yaml = { url = "github:pegasust/fromYaml"; flake = false; }; }; - outputs = {nixpkgs,from-yaml, ...}: let - system = "x86_64-linux"; - pkgs = import nixpkgs {inherit system;}; - lib = { - fromYaml = import "${from-yaml}/fromYaml.nix" {lib = pkgs.lib;}; + outputs = { nixpkgs, from-yaml, ... }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + lib = { + fromYaml = import "${from-yaml}/fromYaml.nix" { lib = pkgs.lib; }; + }; + in + { + inherit nixpkgs; + inherit from-yaml; + inherit lib; + inherit pkgs; + fromYamlFn = lib.fromYaml; + yamlCmd = str: (builtins.fromJSON (pkgs.runCommand "echo ${str} | yq")); + test_0 = '' + key_bindings: + - hello: + "N" + ''; + key_bind = '' + key_bindings: + - { key: N, mods: Control, action: CreateNewWindow } + # - { key: Paste, action: Paste } + # - { key: Copy, action: Copy } + #- { key: L, mods: Control, action: ClearLogNotice } + #- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" } + #- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp } + #- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown } + #- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop } + #- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } + + # Vi Mode + #- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode } + - { key: Escape, mods: Shift, mode: ~Search, action: ToggleViMode } + #- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom } + #- { key: Escape, mode: Vi|~Search, action: ClearSelection } + #- { key: I, mode: Vi|~Search, action: ToggleViMode } + #- { key: I, mode: Vi|~Search, action: ScrollToBottom } + #- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode } + #- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp } + #- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown } + #- { key: G, mode: Vi|~Search, action: ScrollToTop } + #- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom } + #- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp } + #- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown } + #- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp } + #- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown } + #- { key: Y, mode: Vi|~Search, action: Copy } + #- { key: Y, mode: Vi|~Search, action: ClearSelection } + #- { key: Copy, mode: Vi|~Search, action: ClearSelection } + #- { key: V, mode: Vi|~Search, action: ToggleNormalSelection } + #- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection } + #- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection } + #- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection } + #- { key: Return, mode: Vi|~Search, action: Open } + #- { key: Z, mode: Vi|~Search, action: CenterAroundViCursor } + #- { key: K, mode: Vi|~Search, action: Up } + #- { key: J, mode: Vi|~Search, action: Down } + #- { key: H, mode: Vi|~Search, action: Left } + #- { key: L, mode: Vi|~Search, action: Right } + #- { key: Up, mode: Vi|~Search, action: Up } + #- { key: Down, mode: Vi|~Search, action: Down } + #- { key: Left, mode: Vi|~Search, action: Left } + #- { key: Right, mode: Vi|~Search, action: Right } + #- { key: Key0, mode: Vi|~Search, action: First } + #- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last } + #- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied } + #- { key: H, mods: Shift, mode: Vi|~Search, action: High } + #- { key: M, mods: Shift, mode: Vi|~Search, action: Middle } + #- { key: L, mods: Shift, mode: Vi|~Search, action: Low } + #- { key: B, mode: Vi|~Search, action: SemanticLeft } + #- { key: W, mode: Vi|~Search, action: SemanticRight } + #- { key: E, mode: Vi|~Search, action: SemanticRightEnd } + #- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft } + #- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight } + #- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd } + #- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket } + #- { key: Slash, mode: Vi|~Search, action: SearchForward } + #- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward } + #- { key: N, mode: Vi|~Search, action: SearchNext } + #- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious } + + # Search Mode + #- { key: Return, mode: Search|Vi, action: SearchConfirm } + #- { key: Escape, mode: Search, action: SearchCancel } + #- { key: C, mods: Control, mode: Search, action: SearchCancel } + #- { key: U, mods: Control, mode: Search, action: SearchClear } + #- { key: W, mods: Control, mode: Search, action: SearchDeleteWord } + #- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious } + #- { key: N, mods: Control, mode: Search, action: SearchHistoryNext } + #- { key: Up, mode: Search, action: SearchHistoryPrevious } + #- { key: Down, mode: Search, action: SearchHistoryNext } + #- { key: Return, mode: Search|~Vi, action: SearchFocusNext } + #- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious } + + # (Windows, Linux, and BSD only) + - { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } + - { key: C, mods: Control|Shift, action: Copy } + ''; }; - in { - inherit nixpkgs; - inherit from-yaml; - inherit lib; - inherit pkgs; - fromYamlFn = lib.fromYaml; - yamlCmd = str: (builtins.fromJSON(pkgs.runCommand "echo ${str} | yq")); - test_0 = '' - key_bindings: - - hello: - "N" - ''; - key_bind = '' -key_bindings: - - { key: N, mods: Control, action: CreateNewWindow } - # - { key: Paste, action: Paste } - # - { key: Copy, action: Copy } - #- { key: L, mods: Control, action: ClearLogNotice } - #- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" } - #- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp } - #- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown } - #- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop } - #- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } - - # Vi Mode - #- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode } - - { key: Escape, mods: Shift, mode: ~Search, action: ToggleViMode } - #- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom } - #- { key: Escape, mode: Vi|~Search, action: ClearSelection } - #- { key: I, mode: Vi|~Search, action: ToggleViMode } - #- { key: I, mode: Vi|~Search, action: ScrollToBottom } - #- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode } - #- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp } - #- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown } - #- { key: G, mode: Vi|~Search, action: ScrollToTop } - #- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom } - #- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp } - #- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown } - #- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp } - #- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown } - #- { key: Y, mode: Vi|~Search, action: Copy } - #- { key: Y, mode: Vi|~Search, action: ClearSelection } - #- { key: Copy, mode: Vi|~Search, action: ClearSelection } - #- { key: V, mode: Vi|~Search, action: ToggleNormalSelection } - #- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection } - #- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection } - #- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection } - #- { key: Return, mode: Vi|~Search, action: Open } - #- { key: Z, mode: Vi|~Search, action: CenterAroundViCursor } - #- { key: K, mode: Vi|~Search, action: Up } - #- { key: J, mode: Vi|~Search, action: Down } - #- { key: H, mode: Vi|~Search, action: Left } - #- { key: L, mode: Vi|~Search, action: Right } - #- { key: Up, mode: Vi|~Search, action: Up } - #- { key: Down, mode: Vi|~Search, action: Down } - #- { key: Left, mode: Vi|~Search, action: Left } - #- { key: Right, mode: Vi|~Search, action: Right } - #- { key: Key0, mode: Vi|~Search, action: First } - #- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last } - #- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied } - #- { key: H, mods: Shift, mode: Vi|~Search, action: High } - #- { key: M, mods: Shift, mode: Vi|~Search, action: Middle } - #- { key: L, mods: Shift, mode: Vi|~Search, action: Low } - #- { key: B, mode: Vi|~Search, action: SemanticLeft } - #- { key: W, mode: Vi|~Search, action: SemanticRight } - #- { key: E, mode: Vi|~Search, action: SemanticRightEnd } - #- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft } - #- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight } - #- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd } - #- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket } - #- { key: Slash, mode: Vi|~Search, action: SearchForward } - #- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward } - #- { key: N, mode: Vi|~Search, action: SearchNext } - #- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious } - - # Search Mode - #- { key: Return, mode: Search|Vi, action: SearchConfirm } - #- { key: Escape, mode: Search, action: SearchCancel } - #- { key: C, mods: Control, mode: Search, action: SearchCancel } - #- { key: U, mods: Control, mode: Search, action: SearchClear } - #- { key: W, mods: Control, mode: Search, action: SearchDeleteWord } - #- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious } - #- { key: N, mods: Control, mode: Search, action: SearchHistoryNext } - #- { key: Up, mode: Search, action: SearchHistoryPrevious } - #- { key: Down, mode: Search, action: SearchHistoryNext } - #- { key: Return, mode: Search|~Vi, action: SearchFocusNext } - #- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious } - - # (Windows, Linux, and BSD only) - - { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } - - { key: C, mods: Control|Shift, action: Copy } - ''; - }; } diff --git a/nix-conf/home-manager/home.nix b/nix-conf/home-manager/home.nix index 77ec91a..3e14e2c 100644 --- a/nix-conf/home-manager/home.nix +++ b/nix-conf/home-manager/home.nix @@ -26,14 +26,14 @@ in }; home.packages = pkgs.lib.unique ([ # pkgs.ncdu - pkgs.rclone # cloud file operations - pkgs.htop # system diagnostics in CLI - pkgs.ripgrep # content fuzzy search - pkgs.unzip # compression - pkgs.zip # compression + pkgs.rclone # cloud file operations + pkgs.htop # system diagnostics in CLI + pkgs.ripgrep # content fuzzy search + pkgs.unzip # compression + pkgs.zip # compression # cool utilities - pkgs.yq # Yaml adaptor for jq (only pretty print, little query) + pkgs.yq # Yaml adaptor for jq (only pretty print, little query) pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation pkgs.logseq # TODO: only include if have GL # Obsidian alt pkgs.mosh # Parsec for SSH @@ -46,7 +46,7 @@ in # pkgs.python310.numpy # pkgs.python310Packages.tensorflow # pkgs.python310Packages.scikit-learn - ] ++ (myHome.packages or [ ]) + ] ++ (myHome.packages or [ ]) ); ## Configs ## diff --git a/nix-conf/home-manager/profiles/default.nix b/nix-conf/home-manager/profiles/default.nix index 81bfa4b..1734c70 100644 --- a/nix-conf/home-manager/profiles/default.nix +++ b/nix-conf/home-manager/profiles/default.nix @@ -1,5 +1,5 @@ # main module exporter for different configuration profiles -{pkgs, libs,...} @ inputs: +{ pkgs, libs, ... } @ inputs: { - hwtr = import ./hwtr.nix; + hwtr = import ./hwtr.nix; } diff --git a/nix-conf/home-manager/profiles/hwtr.nix b/nix-conf/home-manager/profiles/hwtr.nix index e69de29..8b13789 100644 --- a/nix-conf/home-manager/profiles/hwtr.nix +++ b/nix-conf/home-manager/profiles/hwtr.nix @@ -0,0 +1 @@ + diff --git a/nix-conf/lib/default.nix b/nix-conf/lib/default.nix index 27f412c..c7ec7d9 100644 --- a/nix-conf/lib/default.nix +++ b/nix-conf/lib/default.nix @@ -1,8 +1,10 @@ { pkgs , lib ? pkgs.lib -, ... }@flake_import: -let serde = import ./serde { inherit pkgs lib; }; - recursiveUpdate = lib.recursiveUpdate; +, ... +}@flake_import: +let + serde = import ./serde { inherit pkgs lib; }; + recursiveUpdate = lib.recursiveUpdate; in recursiveUpdate (recursiveUpdate pkgs.lib lib) { fromYaml = serde.fromYaml; diff --git a/nix-conf/lib/serde/default.nix b/nix-conf/lib/serde/default.nix index b29166b..b4c9299 100644 --- a/nix-conf/lib/serde/default.nix +++ b/nix-conf/lib/serde/default.nix @@ -4,7 +4,7 @@ { pkgs , lib } @ inputs: -let +let yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage ({ runCommand }: # runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33 @@ -15,14 +15,16 @@ let echo "$yamlContent" | yq >$out '') { }; -in { +in +{ # Takes in a yaml string and produces a derivation with translated JSON at $outputPath # similar to builtins.fromJSON, turns a YAML string to nix attrset fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json")); fromYamlPath = yamlPath: builtins.fromJSON ( builtins.readFile ( - yamlToJsonDrv ( - builtins.readFile yamlPath) - "any-output.json")); + yamlToJsonDrv + ( + builtins.readFile yamlPath) + "any-output.json")); # TODO: fromToml? } diff --git a/nix-conf/secrets.nix b/nix-conf/secrets.nix index ad3c77c..0c5bf16 100644 --- a/nix-conf/secrets.nix +++ b/nix-conf/secrets.nix @@ -1,4 +1,4 @@ -let +let # user-specific (~/.ssh/id_ed25519.pub) users = { "hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; @@ -10,7 +10,8 @@ let all = users // systems; # stands for calculus c_ = builtins; -in { +in +{ "system/secrets/s3fs.age".publicKeys = c_.attrValues (all); "system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all); "system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all); diff --git a/nix-conf/system/configuration.nix b/nix-conf/system/configuration.nix index 7242c14..1ab2020 100755 --- a/nix-conf/system/configuration.nix +++ b/nix-conf/system/configuration.nix @@ -29,7 +29,7 @@ with lib; isNormalUser = true; home = "/home/hungtr"; description = "pegasust/hungtr"; - extraGroups = [ "wheel" "networkmanager" "audio"]; + extraGroups = [ "wheel" "networkmanager" "audio" ]; }; users.users.root = { # openssh runs in root, no? This is because port < 1024 requires root. diff --git a/nix-conf/system/flake.nix b/nix-conf/system/flake.nix index c3943ad..31f4dde 100644 --- a/nix-conf/system/flake.nix +++ b/nix-conf/system/flake.nix @@ -8,8 +8,8 @@ }; outputs = { self, nixpkgs, agenix, ... }: - let - lib = nixpkgs.lib; + let + lib = nixpkgs.lib; proj_root = ./../..; # TODO: Change respectively to the system or make a nix shell to alias `nix run github:ryantm/agenix -- ` base_modules = [ @@ -27,10 +27,11 @@ age.secrets._nhitrl_cred = { file = ./secrets/_nhitrl.age; }; - environment.systemPackages = [agenix.defaultPackage.x86_64-linux]; + environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ]; } ]; - in { + in + { # Windows with NixOS WSL nixosConfigurations.Felia = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -206,163 +207,165 @@ }; nixosConfigurations.bao = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs.hostname = "bao"; + specialArgs.hostname = "bao"; modules = base_modules ++ [ ./configuration.nix ./../../modules/storage.perso.sys.nix # GPU, sound, networking stuffs ({ config, pkgs, lib, ... }: - let - gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ]; - gpu_conf = { - # openCL - hardware.opengl = { - enable = true; - extraPackages = let - inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime; - in [rocm-opencl-icd rocm-opencl-runtime]; - # Vulkan - driSupport = true; - driSupport32Bit = true; - package = pkgs.mesa.drivers; - package32 = pkgs.pkgsi686Linux.mesa.drivers; + let + gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ]; + gpu_conf = { + # openCL + hardware.opengl = { + enable = true; + extraPackages = + let + inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime; + in + [ rocm-opencl-icd rocm-opencl-runtime ]; + # Vulkan + driSupport = true; + driSupport32Bit = true; + package = pkgs.mesa.drivers; + package32 = pkgs.pkgsi686Linux.mesa.drivers; + }; }; - }; - amd_rx470 = { - # early amd gpu usage - boot.initrd.kernelModules = ["amdgpu"]; + amd_rx470 = { + # early amd gpu usage + boot.initrd.kernelModules = [ "amdgpu" ]; + services.xserver.enable = true; + services.xserver.videoDrivers = [ "amdgpu" ]; + }; + nv_rtx3060 = { + nixpkgs.config.allowUnfree = true; + services.xserver.enable = true; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + systemPackages = [ ] ++ gpu_pkgs; + in + lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 { + # Use UEFI + boot.loader.systemd-boot.enable = true; + + networking.hostName = "bao"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Enable the X11 windowing system. services.xserver.enable = true; - services.xserver.videoDrivers = ["amdgpu"]; - }; - nv_rtx3060 = { - nixpkgs.config.allowUnfree = true; - services.xserver.enable = true; - services.xserver.videoDrivers = ["nvidia"]; - hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - systemPackages = [] ++ gpu_pkgs; - in - lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 { - # Use UEFI - boot.loader.systemd-boot.enable = true; + # KDE & Plasma 5 + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5 = { + enable = true; + excludePackages = let plasma5 = pkgs.libsForQt5; in [ + plasma5.elisa # audio viewer + plasma5.konsole # I use alacritty instaed + plasma5.plasma-browser-integration + plasma5.print-manager # will enable if I need + plasma5.khelpcenter # why not just write manpages instead :( + # plasma5.ksshaskpass # pls just put prompts on my dear terminal + ]; + }; - networking.hostName = "bao"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + # disables KDE's setting of askpassword + programs.ssh.askPassword = ""; + programs.ssh.enableAskPassword = false; - # Enable the X11 windowing system. - services.xserver.enable = true; - # KDE & Plasma 5 - services.xserver.displayManager.sddm.enable = true; - services.xserver.desktopManager.plasma5 = { - enable = true; - excludePackages = let plasma5 = pkgs.libsForQt5; in [ - plasma5.elisa # audio viewer - plasma5.konsole # I use alacritty instaed - plasma5.plasma-browser-integration - plasma5.print-manager # will enable if I need - plasma5.khelpcenter # why not just write manpages instead :( - # plasma5.ksshaskpass # pls just put prompts on my dear terminal - ]; - }; - - # disables KDE's setting of askpassword - programs.ssh.askPassword = ""; - programs.ssh.enableAskPassword = false; + time.timeZone = "America/Phoenix"; + # Configure keymap in X11 + services.xserver.layout = "us"; + # services.xserver.xkbOptions = { + # "eurosign:e"; + # "caps:escape" # map caps to escape. + # }; - time.timeZone = "America/Phoenix"; - # Configure keymap in X11 - services.xserver.layout = "us"; - # services.xserver.xkbOptions = { - # "eurosign:e"; - # "caps:escape" # map caps to escape. - # }; + # Enable CUPS to print documents. + # services.printing.enable = true; - # Enable CUPS to print documents. - # services.printing.enable = true; + # Enable sound. (pulse audio) + sound.enable = true; + programs.dconf.enable = true; + hardware.pulseaudio.enable = true; + hardware.pulseaudio.support32Bit = true; + nixpkgs.config.pulseaudio = true; + hardware.pulseaudio.extraConfig = "load-module module-combine-sink"; - # Enable sound. (pulse audio) - sound.enable = true; - programs.dconf.enable = true; - hardware.pulseaudio.enable = true; - hardware.pulseaudio.support32Bit = true; - nixpkgs.config.pulseaudio = true; - hardware.pulseaudio.extraConfig = "load-module module-combine-sink"; - - # Sound: pipewire - # sound.enable = false; - # hardware.pulseaudio.enable = false; - # services.pipewire = { - # enable = true; - # alsa.enable = true; - # alsa.support32Bit = true; - # pulse.enable = true; - # # Might want to use JACK in the future - # jack.enable = true; - # }; - # - # security.rtkit.enable = true; + # Sound: pipewire + # sound.enable = false; + # hardware.pulseaudio.enable = false; + # services.pipewire = { + # enable = true; + # alsa.enable = true; + # alsa.support32Bit = true; + # pulse.enable = true; + # # Might want to use JACK in the future + # jack.enable = true; + # }; + # + # security.rtkit.enable = true; - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - # users.users.alice = { - # isNormalUser = true; - # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - # packages = with pkgs; [ - # firefox - # thunderbird - # ]; - # }; - # Just an initial user to get this started lol - users.users.user = { - initialPassword = "pw123"; - extraGroups = [ "wheel" "networkmanager" "audio"]; - isNormalUser = true; - }; + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.alice = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # packages = with pkgs; [ + # firefox + # thunderbird + # ]; + # }; + # Just an initial user to get this started lol + users.users.user = { + initialPassword = "pw123"; + extraGroups = [ "wheel" "networkmanager" "audio" ]; + isNormalUser = true; + }; - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - neovim - wget - ] ++ systemPackages; + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim + wget + ] ++ systemPackages; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; - # List services that you want to enable: + # List services that you want to enable: - # Enable the OpenSSH daemon. - services.openssh.enable = true; + # Enable the OpenSSH daemon. + services.openssh.enable = true; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "22.11"; # Did you read the comment? - })) + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.11"; # Did you read the comment? + })) ]; }; }; diff --git a/nix-conf/system/hardware-configuration.nix b/nix-conf/system/hardware-configuration.nix index aa59e37..e45b92a 100644 --- a/nix-conf/system/hardware-configuration.nix +++ b/nix-conf/system/hardware-configuration.nix @@ -5,7 +5,8 @@ { imports = - [ (modulesPath + "/profiles/qemu-guest.nix") + [ + (modulesPath + "/profiles/qemu-guest.nix") ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; @@ -23,13 +24,13 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/sda"; + { + device = "/dev/sda"; fsType = "ext4"; }; swapDevices = - [ { device = "/dev/sdb"; } - ]; + [{ device = "/dev/sdb"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/profiles/bao/hardware-configuration.nix b/nix-conf/system/profiles/bao/hardware-configuration.nix index c29572c..3d4935d 100644 --- a/nix-conf/system/profiles/bao/hardware-configuration.nix +++ b/nix-conf/system/profiles/bao/hardware-configuration.nix @@ -5,24 +5,27 @@ { imports = - [ (modulesPath + "/installer/scan/not-detected.nix") + [ + (modulesPath + "/installer/scan/not-detected.nix") ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; # boot.initrd.kernelModules = [ "amdgpu" ]; - boot.initrd.kernelModules = []; - boot.kernelModules = [ "kvm-amd" "coretemp"]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" "coretemp" ]; boot.extraModulePackages = [ ]; fileSystems."/" = # Might be wise to use /dev/nvme0p1 instead - { device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2"; + { + device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2"; fsType = "ext4"; }; fileSystems."/boot" = # Might be wise to use /dev/nvme0p2 instead - { device = "/dev/disk/by-uuid/EBA6-394D"; + { + device = "/dev/disk/by-uuid/EBA6-394D"; fsType = "vfat"; }; diff --git a/nix-conf/system/profiles/lester/hardware-configuration.nix b/nix-conf/system/profiles/lester/hardware-configuration.nix index aa59e37..e45b92a 100644 --- a/nix-conf/system/profiles/lester/hardware-configuration.nix +++ b/nix-conf/system/profiles/lester/hardware-configuration.nix @@ -5,7 +5,8 @@ { imports = - [ (modulesPath + "/profiles/qemu-guest.nix") + [ + (modulesPath + "/profiles/qemu-guest.nix") ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; @@ -23,13 +24,13 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/sda"; + { + device = "/dev/sda"; fsType = "ext4"; }; swapDevices = - [ { device = "/dev/sdb"; } - ]; + [{ device = "/dev/sdb"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/profiles/nyx/hardware-configuration.nix b/nix-conf/system/profiles/nyx/hardware-configuration.nix index 36b63dd..88ffe66 100644 --- a/nix-conf/system/profiles/nyx/hardware-configuration.nix +++ b/nix-conf/system/profiles/nyx/hardware-configuration.nix @@ -5,7 +5,8 @@ { imports = - [ (modulesPath + "/profiles/qemu-guest.nix") + [ + (modulesPath + "/profiles/qemu-guest.nix") ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; @@ -13,7 +14,7 @@ boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - boot.kernelParams = ["console=ttyS0,19200n8"]; + boot.kernelParams = [ "console=ttyS0,19200n8" ]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -23,13 +24,13 @@ boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; fileSystems."/" = - { device = "/dev/sda"; + { + device = "/dev/sda"; fsType = "ext4"; }; swapDevices = - [ { device = "/dev/sdb"; } - ]; + [{ device = "/dev/sdb"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/profiles/prince/hardware-configuration.nix b/nix-conf/system/profiles/prince/hardware-configuration.nix index e69de29..8b13789 100644 --- a/nix-conf/system/profiles/prince/hardware-configuration.nix +++ b/nix-conf/system/profiles/prince/hardware-configuration.nix @@ -0,0 +1 @@ + diff --git a/out-of-tree/nixGL/all.nix b/out-of-tree/nixGL/all.nix index 47fadc0..20d1862 100644 --- a/out-of-tree/nixGL/all.nix +++ b/out-of-tree/nixGL/all.nix @@ -20,6 +20,6 @@ let ''; }); in - (with pure; [nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel]) - ++ (with versionFile440.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia]) - ++ (with versionFile510.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia]) +(with pure; [ nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel ]) +++ (with versionFile440.auto; [ nixGLNvidia nixGLDefault nixVulkanNvidia ]) +++ (with versionFile510.auto; [ nixGLNvidia nixGLDefault nixVulkanNvidia ]) diff --git a/out-of-tree/nixGL/default.nix b/out-of-tree/nixGL/default.nix index 9f232a5..3419421 100644 --- a/out-of-tree/nixGL/default.nix +++ b/out-of-tree/nixGL/default.nix @@ -1,24 +1,25 @@ -{ ## Nvidia informations. +{ + ## Nvidia informations. # Version of the system kernel module. Let it to null to enable auto-detection. - nvidiaVersion ? null, - # Hash of the Nvidia driver .run file. null is fine, but fixing a value here + nvidiaVersion ? null +, # Hash of the Nvidia driver .run file. null is fine, but fixing a value here # will be more reproducible and more efficient. - nvidiaHash ? null, - # Alternatively, you can pass a path that points to a nvidia version file + nvidiaHash ? null +, # Alternatively, you can pass a path that points to a nvidia version file # and let nixGL extract the version from it. That file must be a copy of # /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see # https://github.com/NixOS/nix/issues/3539 ). - nvidiaVersionFile ? null, - # Enable 32 bits driver + nvidiaVersionFile ? null +, # Enable 32 bits driver # This is on by default, you can switch it to off if you want to reduce a # bit the size of nixGL closure. - enable32bits ? true, - # Make sure to enable config.allowUnfree to the instance of nixpkgs to be + enable32bits ? true +, # Make sure to enable config.allowUnfree to the instance of nixpkgs to be # able to access the nvidia drivers. pkgs ? import { config = { allowUnfree = true; }; - }, - # Enable all Intel specific extensions which only works on x86_64 + } +, # Enable all Intel specific extensions which only works on x86_64 enableIntelX86Extensions ? true }: pkgs.callPackage ./nixGL.nix ({ @@ -28,8 +29,8 @@ pkgs.callPackage ./nixGL.nix ({ nvidiaHash enable32bits ; - } // (if enableIntelX86Extensions then {} - else { - intel-media-driver = null; - vaapiIntel = null; - })) +} // (if enableIntelX86Extensions then { } +else { + intel-media-driver = null; + vaapiIntel = null; +})) diff --git a/out-of-tree/nixGL/flake.nix b/out-of-tree/nixGL/flake.nix index 6e63cfd..bbb7c43 100644 --- a/out-of-tree/nixGL/flake.nix +++ b/out-of-tree/nixGL/flake.nix @@ -8,13 +8,14 @@ (flake-utils.lib.eachDefaultSystem (system: let isIntelX86Platform = system == "x86_64-linux"; - nix_pkgs = import nixpkgs {inherit system;}; + nix_pkgs = import nixpkgs { inherit system; }; pkgs = import ./default.nix { pkgs = nix_pkgs; enable32bits = isIntelX86Platform; enableIntelX86Extensions = isIntelX86Platform; }; - in rec { + in + rec { packages = { # makes it easy to use "nix run nixGL --impure -- program" @@ -31,16 +32,16 @@ # deprecated attributes for retro compatibility defaultPackage = packages; })) // rec { - # deprecated attributes for retro compatibility - overlay = overlays.default; - overlays.default = final: _: - let isIntelX86Platform = final.system == "x86_64-linux"; - in { - nixgl = import ./default.nix { - pkgs = final; - enable32bits = isIntelX86Platform; - enableIntelX86Extensions = isIntelX86Platform; - }; + # deprecated attributes for retro compatibility + overlay = overlays.default; + overlays.default = final: _: + let isIntelX86Platform = final.system == "x86_64-linux"; + in { + nixgl = import ./default.nix { + pkgs = final; + enable32bits = isIntelX86Platform; + enableIntelX86Extensions = isIntelX86Platform; }; - }; + }; + }; } diff --git a/out-of-tree/nixGL/nixGL.nix b/out-of-tree/nixGL/nixGL.nix index 35ce159..fa74b0c 100644 --- a/out-of-tree/nixGL/nixGL.nix +++ b/out-of-tree/nixGL/nixGL.nix @@ -62,7 +62,7 @@ let It contains the builder for different nvidia configuration, parametrized by the version of the driver and sha256 sum of the driver installer file. */ - nvidiaPackages = { version, sha256? fetch_db."${version}".sha256 }: + nvidiaPackages = { version, sha256 ? fetch_db."${version}".sha256 }: let nvidiaDrivers = (linuxPackages.nvidia_x11.override { }).overrideAttrs (oldAttrs: { diff --git a/secrets.nix b/secrets.nix index cb26df4..04e5d81 100644 --- a/secrets.nix +++ b/secrets.nix @@ -1,4 +1,4 @@ -let +let inherit ((import ( let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in @@ -13,7 +13,8 @@ let inherit (pubKeys) users hosts; all = users // hosts; c_ = builtins; -in { +in +{ "secrets/s3fs.age".publicKeys = c_.attrValues (all); "secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all); "secrets/_nhitrl.age".publicKeys = c_.attrValues (all); diff --git a/secrets/default.nix b/secrets/default.nix index 4808c6c..0624482 100644 --- a/secrets/default.nix +++ b/secrets/default.nix @@ -1,5 +1,6 @@ # TODO: put ssh keys as user/host config -inputs: let +inputs: +let # user-specific (~/.ssh/id_ed25519.pub) users = { "hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; @@ -11,7 +12,8 @@ inputs: let all = users // systems; # stands for calculus c_ = builtins; -in { +in +{ "system/secrets/s3fs.age".publicKeys = c_.attrValues (all); "system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all); "system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all); diff --git a/templates/default.nix b/templates/default.nix index 70d9fe4..f08cde1 100644 --- a/templates/default.nix +++ b/templates/default.nix @@ -1,8 +1,8 @@ # TODO: templates should be able to have initial states like # repo name, author,... -{pkgs -,lib -,... +{ pkgs +, lib +, ... }: { rust = { path = ./rust; diff --git a/templates/rust-monorepo/default.nix b/templates/rust-monorepo/default.nix index 39bacff..89308a3 100644 --- a/templates/rust-monorepo/default.nix +++ b/templates/rust-monorepo/default.nix @@ -1,7 +1,10 @@ -(import ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } -) { - src = ./.; -}).defaultNix +(import + ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; + sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; + } + ) + { + src = ./.; + }).defaultNix diff --git a/templates/rust-monorepo/shell.nix b/templates/rust-monorepo/shell.nix index 77db547..47458ad 100644 --- a/templates/rust-monorepo/shell.nix +++ b/templates/rust-monorepo/shell.nix @@ -1,7 +1,10 @@ -(import ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } -) { - src = ./.; -}).shellNix +(import + ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; + sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; + } + ) + { + src = ./.; + }).shellNix diff --git a/templates/rust/default.nix b/templates/rust/default.nix index 39bacff..89308a3 100644 --- a/templates/rust/default.nix +++ b/templates/rust/default.nix @@ -1,7 +1,10 @@ -(import ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } -) { - src = ./.; -}).defaultNix +(import + ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; + sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; + } + ) + { + src = ./.; + }).defaultNix diff --git a/templates/rust/shell.nix b/templates/rust/shell.nix index 77db547..47458ad 100644 --- a/templates/rust/shell.nix +++ b/templates/rust/shell.nix @@ -1,7 +1,10 @@ -(import ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } -) { - src = ./.; -}).shellNix +(import + ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; + sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; + } + ) + { + src = ./.; + }).shellNix diff --git a/users/default.nix b/users/default.nix index 5489424..030b376 100644 --- a/users/default.nix +++ b/users/default.nix @@ -1,12 +1,13 @@ -{lib,...}@inputs: let -config = { - hungtr.metadata = { +{ lib, ... }@inputs: +let + config = { + hungtr.metadata = { }; + "hungtr@bao".metadata = { + ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; + }; }; - "hungtr@bao".metadata = { - ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; - }; -}; -in { - homeConfigurations = {}; +in +{ + homeConfigurations = { }; pubKeys = lib.getPubkey config; }