diff options
42 files changed, 913 insertions, 684 deletions
diff --git a/README.md b/README.md index 7d3c095..c5db79d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Installation steps are in [Documentation/INSTALLING.md](./Documentation/INSTALLI ## Structure Here is an overview of the repos' structure: -``` +```hs . ├── flake.nix ├── flake.lock diff --git a/flake.nix b/flake.nix index d8ad14b..adac7fd 100644 --- a/flake.nix +++ b/flake.nix @@ -53,50 +53,82 @@ }; }; - outputs = inputs @ { self, nixpkgs, home-manager, nix-darwin, ... }: - let - user = "baitinq"; - - secrets = import ./secrets; - - dotfiles = ./dotfiles; - - hosts = [ - { host = "phobos"; extraOverlays = [ ]; extraModules = [ ]; timezone = secrets.main_timezone; location = secrets.main_location; } - { host = "luna"; extraOverlays = [ ]; extraModules = [ ]; timezone = secrets.main_timezone; location = secrets.main_location; } - ]; - - hardwares = [ - { hardware = "pc"; stateVersion = "22.05"; } - { hardware = "laptop"; stateVersion = "22.05"; } - { hardware = "chromebook"; stateVersion = "22.05"; } - { hardware = "thinkpad"; stateVersion = "22.05"; } - { hardware = "virtualbox"; stateVersion = "22.05"; } - ]; - - systems = [ - { system = "x86_64-linux"; } - { system = "x86_64-darwin"; } - { system = "aarch64-linux"; } - { system = "aarch64-darwin"; } - ]; - - - commonInherits = { - inherit (nixpkgs) lib; - inherit inputs nixpkgs home-manager nix-darwin; - inherit user secrets dotfiles hosts hardwares systems; - }; - in - { - nixosConfigurations = import ./hosts (commonInherits // { + outputs = inputs @ { + self, + nixpkgs, + home-manager, + nix-darwin, + ... + }: let + user = "baitinq"; + + secrets = import ./secrets; + + dotfiles = ./dotfiles; + + hosts = [ + { + host = "phobos"; + extraOverlays = []; + extraModules = []; + timezone = secrets.main_timezone; + location = secrets.main_location; + } + { + host = "luna"; + extraOverlays = []; + extraModules = []; + timezone = secrets.main_timezone; + location = secrets.main_location; + } + ]; + + hardwares = [ + { + hardware = "pc"; + stateVersion = "22.05"; + } + { + hardware = "laptop"; + stateVersion = "22.05"; + } + { + hardware = "chromebook"; + stateVersion = "22.05"; + } + { + hardware = "thinkpad"; + stateVersion = "22.05"; + } + { + hardware = "virtualbox"; + stateVersion = "22.05"; + } + ]; + + systems = [ + {system = "x86_64-linux";} + {system = "x86_64-darwin";} + {system = "aarch64-linux";} + {system = "aarch64-darwin";} + ]; + + commonInherits = { + inherit (nixpkgs) lib; + inherit inputs nixpkgs home-manager nix-darwin; + inherit user secrets dotfiles hosts hardwares systems; + }; + in { + nixosConfigurations = import ./hosts (commonInherits + // { isNixOS = true; isMacOS = false; isIso = false; isHardware = true; }); - darwinConfigurations = import ./hosts (commonInherits // { + darwinConfigurations = import ./hosts (commonInherits + // { isNixOS = false; isMacOS = true; isIso = false; @@ -104,14 +136,16 @@ user = "${secrets.darwin_user}"; }); - homeConfigurations = import ./hosts (commonInherits // { + homeConfigurations = import ./hosts (commonInherits + // { isNixOS = false; isMacOS = false; isIso = false; isHardware = false; }); - isoConfigurations = import ./hosts (commonInherits // { + isoConfigurations = import ./hosts (commonInherits + // { isNixOS = true; isMacOS = false; isIso = true; @@ -119,34 +153,34 @@ user = "nixos"; }); - nixosNoHardwareConfigurations = import ./hosts (commonInherits // { + nixosNoHardwareConfigurations = import ./hosts (commonInherits + // { isNixOS = true; isMacOS = false; isIso = false; isHardware = false; }); + deploy = { + magicRollback = true; + autoRollback = true; + + nodes = + builtins.mapAttrs + (_: nixosConfig: { + hostname = "${nixosConfig.config.networking.hostName}"; + + profiles.system = { + user = "root"; + path = inputs.deploy-rs.lib.${nixosConfig.config.nixpkgs.system}.activate.nixos nixosConfig; + }; + }) + self.nixosConfigurations; + }; - deploy = { - magicRollback = true; - autoRollback = true; - - nodes = builtins.mapAttrs - (_: nixosConfig: { - hostname = "${nixosConfig.config.networking.hostName}"; - - profiles.system = { - user = "root"; - path = inputs.deploy-rs.lib.${nixosConfig.config.nixpkgs.system}.activate.nixos nixosConfig; - }; - }) - self.nixosConfigurations; - }; - - # This is highly advised, and will prevent many possible mistakes - checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; - + # This is highly advised, and will prevent many possible mistakes + checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; - tests = inputs.nixtest.run ./.; - }; + tests = inputs.nixtest.run ./.; + }; } diff --git a/hardware/chromebook/default.nix b/hardware/chromebook/default.nix index 922f0a8..f8d36a4 100644 --- a/hardware/chromebook/default.nix +++ b/hardware/chromebook/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { imports = [ ./hardware.nix diff --git a/hardware/chromebook/disks.nix b/hardware/chromebook/disks.nix index c191b25..ff46d2e 100644 --- a/hardware/chromebook/disks.nix +++ b/hardware/chromebook/disks.nix @@ -1,5 +1,10 @@ -{ inputs, lib, config, pkgs, ... }: -let +{ + inputs, + lib, + config, + pkgs, + ... +}: let MMC = "/dev/disk/by-id/mmc-AGND3R_0x48d44fdc"; SD = "/dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000208-0:0"; @@ -40,7 +45,7 @@ let partitionsMountScript = '' mount -t tmpfs none /mnt mkdir -p /mnt/{boot,nix,persist,home} - + cryptsetup open --type luks /dev/disk/by-partlabel/boot encrypted_boot mount /dev/mapper/encrypted_boot /mnt/boot mkdir -p /mnt/boot/efi @@ -62,16 +67,14 @@ let # Utility to compare the root tree diff-root = pkgs.writers.writeDashBin "diff-root" '' - export PATH=${with pkgs; lib.makeBinPath [ diffutils less ]}:$PATH + export PATH=${with pkgs; lib.makeBinPath [diffutils less]}:$PATH current="$(mktemp current-root.XXX --tmpdir)" trap 'rm "$current"' EXIT INT HUP ${save-root}/bin/save-root "$current" diff -u /run/initial-root "$current" --color=always | ''${PAGER:-less -R} ''; -in -{ +in { config = { - environment.persistence."/persist" = { directories = [ "/var/log" @@ -91,7 +94,7 @@ in fileSystems."/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "mode=755" ]; + options = ["defaults" "mode=755"]; }; boot.initrd.luks.devices."encrypted_boot" = { @@ -115,7 +118,7 @@ in device = "/dev/mapper/encrypted_nix"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; boot.initrd.luks.devices."encrypted_home_and_persist".device = "/dev/disk/by-partlabel/home_and_persist"; @@ -124,22 +127,21 @@ in device = "/dev/mapper/encrypted_home_and_persist_pool-persist"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/home" = { device = "/dev/mapper/encrypted_home_and_persist_pool-home"; fsType = "btrfs"; - options = [ "compress-force=zstd" ]; + options = ["compress-force=zstd"]; }; services.btrfs.autoScrub.enable = true; - swapDevices = [ ]; + swapDevices = []; zramSwap.enable = true; - environment.systemPackages = [ config.disks-create config.disks-format @@ -150,37 +152,42 @@ in systemd.services.save-root-snapshot = { description = "save a snapshot of the initial root tree"; - wantedBy = [ "sysinit.target" ]; - requires = [ "-.mount" ]; - after = [ "-.mount" ]; + wantedBy = ["sysinit.target"]; + requires = ["-.mount"]; + after = ["-.mount"]; serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = true; serviceConfig.ExecStart = ''${save-root}/bin/save-root /run/initial-root''; }; }; - options.disks-create = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-create"; - paths = [ (writeScriptBin default.name partitionsCreateScript) parted ]; + options.disks-create = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-create"; + paths = [(writeScriptBin default.name partitionsCreateScript) parted]; + }; }; - }; - options.disks-format = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-format"; - paths = [ (writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs ]; + options.disks-format = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-format"; + paths = [(writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs]; + }; }; - }; - options.disks-mount = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-mount"; - paths = [ (writeScriptBin default.name partitionsMountScript) cryptsetup lvm2 ]; + options.disks-mount = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-mount"; + paths = [(writeScriptBin default.name partitionsMountScript) cryptsetup lvm2]; + }; }; - }; - } diff --git a/hardware/chromebook/hardware.nix b/hardware/chromebook/hardware.nix index e945c6d..df93eef 100644 --- a/hardware/chromebook/hardware.nix +++ b/hardware/chromebook/hardware.nix @@ -1,29 +1,34 @@ -{ config, lib, inputs, pkgs, modulesPath, ... }: -let - powerMode = "schedutil"; -in { + config, + lib, + inputs, + pkgs, + modulesPath, + ... +}: let + powerMode = "schedutil"; +in { imports = [ ./disks.nix ]; boot = { - blacklistedKernelModules = [ "uvcvideo" ]; + blacklistedKernelModules = ["uvcvideo"]; initrd = { - availableKernelModules = [ "xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd" ]; - kernelModules = [ "i915" ]; + availableKernelModules = ["xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd"]; + kernelModules = ["i915"]; }; kernelPackages = pkgs.linuxPackages_latest; - kernelModules = [ "kvm_intel" ]; - extraModulePackages = [ ]; - kernelParams = [ "net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off" ]; + kernelModules = ["kvm_intel"]; + extraModulePackages = []; + kernelParams = ["net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off"]; }; powerManagement.cpuFreqGovernor = powerMode; services = { xserver = { - videoDrivers = [ "intel" ]; + videoDrivers = ["intel"]; # Enable touchpad support (enabled default in most desktopManager). synaptics = { diff --git a/hardware/laptop/default.nix b/hardware/laptop/default.nix index b0125ee..df624c3 100644 --- a/hardware/laptop/default.nix +++ b/hardware/laptop/default.nix @@ -1,4 +1,3 @@ -{ ... }: -{ - imports = [ ./hardware.nix ]; +{...}: { + imports = [./hardware.nix]; } diff --git a/hardware/laptop/disks.nix b/hardware/laptop/disks.nix index 45202e5..a7df432 100644 --- a/hardware/laptop/disks.nix +++ b/hardware/laptop/disks.nix @@ -1,5 +1,12 @@ -{ config, lib, inputs, pkgs, modulesPath, isIso, ... }: -let +{ + config, + lib, + inputs, + pkgs, + modulesPath, + isIso, + ... +}: let HDD = "/dev/disk/by-id/wwn-0x5000c5009e0984c7"; partitionsCreateScript = '' @@ -54,16 +61,14 @@ let # Utility to compare the root tree diff-root = pkgs.writers.writeDashBin "diff-root" '' - export PATH=${with pkgs; lib.makeBinPath [ diffutils less ]}:$PATH + export PATH=${with pkgs; lib.makeBinPath [diffutils less]}:$PATH current="$(mktemp current-root.XXX --tmpdir)" trap 'rm "$current"' EXIT INT HUP ${save-root}/bin/save-root "$current" diff -u /run/initial-root "$current" --color=always | ''${PAGER:-less -R} ''; -in -{ +in { config = { - environment.persistence."/persist" = { directories = [ "/var/log" @@ -83,7 +88,7 @@ in fileSystems."/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "mode=755" ]; + options = ["defaults" "mode=755"]; }; boot.initrd.luks.devices."encrypted_boot" = { @@ -107,29 +112,28 @@ in device = "/dev/mapper/encrypted_root_pool-nix"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/persist" = { device = "/dev/mapper/encrypted_root_pool-persist"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/home" = { device = "/dev/mapper/encrypted_root_pool-home"; fsType = "btrfs"; - options = [ "compress-force=zstd" ]; + options = ["compress-force=zstd"]; }; - swapDevices = [ ]; + swapDevices = []; services.btrfs.autoScrub.enable = true; zramSwap.enable = true; - environment.systemPackages = [ config.disks-create config.disks-format @@ -140,37 +144,42 @@ in systemd.services.save-root-snapshot = { description = "save a snapshot of the initial root tree"; - wantedBy = [ "sysinit.target" ]; - requires = [ "-.mount" ]; - after = [ "-.mount" ]; + wantedBy = ["sysinit.target"]; + requires = ["-.mount"]; + after = ["-.mount"]; serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = true; serviceConfig.ExecStart = ''${save-root}/bin/save-root /run/initial-root''; }; }; - options.disks-create = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-create"; - paths = [ (writeScriptBin default.name partitionsCreateScript) parted ]; + options.disks-create = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-create"; + paths = [(writeScriptBin default.name partitionsCreateScript) parted]; + }; }; - }; - options.disks-format = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-format"; - paths = [ (writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs ]; + options.disks-format = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-format"; + paths = [(writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs]; + }; }; - }; - options.disks-mount = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-mount"; - paths = [ (writeScriptBin default.name partitionsMountScript) cryptsetup lvm2 ]; + options.disks-mount = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-mount"; + paths = [(writeScriptBin default.name partitionsMountScript) cryptsetup lvm2]; + }; }; - }; - } diff --git a/hardware/laptop/hardware.nix b/hardware/laptop/hardware.nix index bbd684b..bc1f3cb 100644 --- a/hardware/laptop/hardware.nix +++ b/hardware/laptop/hardware.nix @@ -1,28 +1,33 @@ -{ config, lib, inputs, pkgs, modulesPath, ... }: -let - powerMode = "performance"; -in { + config, + lib, + inputs, + pkgs, + modulesPath, + ... +}: let + powerMode = "performance"; +in { imports = [ ./disks.nix ]; boot = { initrd = { - availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "sdhci_pci" ]; - kernelModules = [ ]; + availableKernelModules = ["xhci_pci" "ahci" "usbhid" "sd_mod" "sdhci_pci"]; + kernelModules = []; }; kernelPackages = pkgs.linuxPackages_latest; - kernelModules = [ "kvm_intel" ]; - extraModulePackages = [ ]; - kernelParams = [ "net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off" ]; + kernelModules = ["kvm_intel"]; + extraModulePackages = []; + kernelParams = ["net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off"]; }; powerManagement.cpuFreqGovernor = powerMode; services = { xserver = { - videoDrivers = [ "nvidia" ]; + videoDrivers = ["nvidia"]; # Enable touchpad support (enabled default in most desktopManager). synaptics = { @@ -57,5 +62,4 @@ in }; }; }; - } diff --git a/hardware/pc/default.nix b/hardware/pc/default.nix index 15d6b76..9b90a53 100644 --- a/hardware/pc/default.nix +++ b/hardware/pc/default.nix @@ -1,6 +1,5 @@ -{ ... }: -{ - imports = [ ./hardware.nix ]; +{...}: { + imports = [./hardware.nix]; boot.loader.timeout = 5; } diff --git a/hardware/pc/disks.nix b/hardware/pc/disks.nix index 9672344..ded0350 100644 --- a/hardware/pc/disks.nix +++ b/hardware/pc/disks.nix @@ -1,5 +1,12 @@ -{ config, lib, inputs, pkgs, modulesPath, isIso, ... }: -let +{ + config, + lib, + inputs, + pkgs, + modulesPath, + isIso, + ... +}: let HDD = "/dev/disk/by-id/nvme-WD_BLACK_SN770_1TB_2251AD458811"; partitionsCreateScript = '' @@ -50,16 +57,14 @@ let # Utility to compare the root tree diff-root = pkgs.writers.writeDashBin "diff-root" '' - export PATH=${with pkgs; lib.makeBinPath [ diffutils less ]}:$PATH + export PATH=${with pkgs; lib.makeBinPath [diffutils less]}:$PATH current="$(mktemp current-root.XXX --tmpdir)" trap 'rm "$current"' EXIT INT HUP ${save-root}/bin/save-root "$current" diff -u /run/initial-root "$current" --color=always | ''${PAGER:-less -R} ''; -in -{ +in { config = { - environment.persistence."/persist" = { directories = [ "/var/log" @@ -79,7 +84,7 @@ in fileSystems."/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "mode=755" ]; + options = ["defaults" "mode=755"]; }; fileSystems."/boot" = { @@ -98,29 +103,28 @@ in device = "/dev/mapper/encrypted_root_pool-nix"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/persist" = { device = "/dev/mapper/encrypted_root_pool-persist"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/home" = { device = "/dev/mapper/encrypted_root_pool-home"; fsType = "btrfs"; - options = [ "compress-force=zstd" ]; + options = ["compress-force=zstd"]; }; - swapDevices = [ ]; + swapDevices = []; services.btrfs.autoScrub.enable = true; zramSwap.enable = true; - environment.systemPackages = [ config.disks-create config.disks-format @@ -131,37 +135,42 @@ in systemd.services.save-root-snapshot = { description = "save a snapshot of the initial root tree"; - wantedBy = [ "sysinit.target" ]; - requires = [ "-.mount" ]; - after = [ "-.mount" ]; + wantedBy = ["sysinit.target"]; + requires = ["-.mount"]; + after = ["-.mount"]; serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = true; serviceConfig.ExecStart = ''${save-root}/bin/save-root /run/initial-root''; }; }; - options.disks-create = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-create"; - paths = [ (writeScriptBin default.name partitionsCreateScript) parted ]; + options.disks-create = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-create"; + paths = [(writeScriptBin default.name partitionsCreateScript) parted]; + }; }; - }; - options.disks-format = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-format"; - paths = [ (writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs ]; + options.disks-format = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-format"; + paths = [(writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs]; + }; }; - }; - options.disks-mount = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-mount"; - paths = [ (writeScriptBin default.name partitionsMountScript) cryptsetup lvm2 ]; + options.disks-mount = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-mount"; + paths = [(writeScriptBin default.name partitionsMountScript) cryptsetup lvm2]; + }; }; - }; - } diff --git a/hardware/pc/hardware.nix b/hardware/pc/hardware.nix index b62a323..df982bf 100644 --- a/hardware/pc/hardware.nix +++ b/hardware/pc/hardware.nix @@ -1,8 +1,13 @@ -{ config, lib, inputs, pkgs, modulesPath, ... }: -let - powerMode = "performance"; -in { + config, + lib, + inputs, + pkgs, + modulesPath, + ... +}: let + powerMode = "performance"; +in { imports = [ ./disks.nix "${modulesPath}/profiles/all-hardware.nix" @@ -10,20 +15,20 @@ in boot = { initrd = { - availableKernelModules = [ "xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd" ]; - kernelModules = [ ]; + availableKernelModules = ["xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd"]; + kernelModules = []; }; kernelPackages = pkgs.linuxPackages_latest; - kernelModules = [ "kvm_intel" "amdgpu" ]; - extraModulePackages = [ ]; - kernelParams = [ "boot.shell_on_fail" "net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off" ]; + kernelModules = ["kvm_intel" "amdgpu"]; + extraModulePackages = []; + kernelParams = ["boot.shell_on_fail" "net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off"]; }; powerManagement.cpuFreqGovernor = powerMode; services = { xserver = { - videoDrivers = [ "amdgpu" ]; + videoDrivers = ["amdgpu"]; }; fstrim.enable = true; }; @@ -35,5 +40,4 @@ in enable = true; }; }; - } diff --git a/hardware/thinkpad/default.nix b/hardware/thinkpad/default.nix index adc1519..67d1fd5 100644 --- a/hardware/thinkpad/default.nix +++ b/hardware/thinkpad/default.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { imports = [ ./hardware.nix @@ -25,5 +24,4 @@ ectool cbmem ]; - } diff --git a/hardware/thinkpad/disks.nix b/hardware/thinkpad/disks.nix index 543c24c..c5a9ec9 100644 --- a/hardware/thinkpad/disks.nix +++ b/hardware/thinkpad/disks.nix @@ -1,5 +1,12 @@ -{ config, lib, inputs, pkgs, modulesPath, isIso, ... }: -let +{ + config, + lib, + inputs, + pkgs, + modulesPath, + isIso, + ... +}: let HDD = "/dev/disk/by-id/ata-CT250MX500SSD1_1918E2006A3A"; partitionsCreateScript = '' @@ -54,16 +61,14 @@ let # Utility to compare the root tree diff-root = pkgs.writers.writeDashBin "diff-root" '' - export PATH=${with pkgs; lib.makeBinPath [ diffutils less ]}:$PATH + export PATH=${with pkgs; lib.makeBinPath [diffutils less]}:$PATH current="$(mktemp current-root.XXX --tmpdir)" trap 'rm "$current"' EXIT INT HUP ${save-root}/bin/save-root "$current" diff -u /run/initial-root "$current" --color=always | ''${PAGER:-less -R} ''; -in -{ +in { config = { - environment.persistence."/persist" = { directories = [ "/var/log" @@ -83,7 +88,7 @@ in fileSystems."/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "mode=755" ]; + options = ["defaults" "mode=755"]; }; boot.initrd.luks.devices."encrypted_boot" = { @@ -107,29 +112,28 @@ in device = "/dev/mapper/encrypted_root_pool-nix"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/persist" = { device = "/dev/mapper/encrypted_root_pool-persist"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/home" = { device = "/dev/mapper/encrypted_root_pool-home"; fsType = "btrfs"; - options = [ "compress-force=zstd" ]; + options = ["compress-force=zstd"]; }; - swapDevices = [ ]; + swapDevices = []; services.btrfs.autoScrub.enable = true; zramSwap.enable = true; - environment.systemPackages = [ config.disks-create config.disks-format @@ -140,37 +144,42 @@ in systemd.services.save-root-snapshot = { description = "save a snapshot of the initial root tree"; - wantedBy = [ "sysinit.target" ]; - requires = [ "-.mount" ]; - after = [ "-.mount" ]; + wantedBy = ["sysinit.target"]; + requires = ["-.mount"]; + after = ["-.mount"]; serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = true; serviceConfig.ExecStart = ''${save-root}/bin/save-root /run/initial-root''; }; }; - options.disks-create = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-create"; - paths = [ (writeScriptBin default.name partitionsCreateScript) parted ]; + options.disks-create = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-create"; + paths = [(writeScriptBin default.name partitionsCreateScript) parted]; + }; }; - }; - options.disks-format = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-format"; - paths = [ (writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs ]; + options.disks-format = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-format"; + paths = [(writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs]; + }; }; - }; - options.disks-mount = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-mount"; - paths = [ (writeScriptBin default.name partitionsMountScript) cryptsetup lvm2 ]; + options.disks-mount = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-mount"; + paths = [(writeScriptBin default.name partitionsMountScript) cryptsetup lvm2]; + }; }; - }; - } diff --git a/hardware/thinkpad/hardware.nix b/hardware/thinkpad/hardware.nix index f3f3f5c..acc9cb5 100644 --- a/hardware/thinkpad/hardware.nix +++ b/hardware/thinkpad/hardware.nix @@ -1,29 +1,34 @@ -{ config, lib, inputs, pkgs, modulesPath, ... }: -let - powerMode = "schedutil"; -in { + config, + lib, + inputs, + pkgs, + modulesPath, + ... +}: let + powerMode = "schedutil"; +in { imports = [ ./disks.nix ]; boot = { - blacklistedKernelModules = [ "uvcvideo" ]; + blacklistedKernelModules = ["uvcvideo"]; initrd = { - availableKernelModules = [ "xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd" ]; - kernelModules = [ "i915" ]; + availableKernelModules = ["xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd"]; + kernelModules = ["i915"]; }; kernelPackages = pkgs.linuxPackages_latest; - kernelModules = [ "kvm_intel" ]; - extraModulePackages = [ ]; - kernelParams = [ "net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off" ]; + kernelModules = ["kvm_intel"]; + extraModulePackages = []; + kernelParams = ["net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off"]; }; powerManagement.cpuFreqGovernor = powerMode; services = { xserver = { - videoDrivers = [ "intel" ]; + videoDrivers = ["intel"]; # Enable touchpad support (enabled default in most desktopManager). synaptics = { @@ -50,5 +55,4 @@ in ]; }; }; - } diff --git a/hardware/virtualbox/default.nix b/hardware/virtualbox/default.nix index b0125ee..df624c3 100644 --- a/hardware/virtualbox/default.nix +++ b/hardware/virtualbox/default.nix @@ -1,4 +1,3 @@ -{ ... }: -{ - imports = [ ./hardware.nix ]; +{...}: { + imports = [./hardware.nix]; } diff --git a/hardware/virtualbox/disks.nix b/hardware/virtualbox/disks.nix index 927e230..e1e2e55 100644 --- a/hardware/virtualbox/disks.nix +++ b/hardware/virtualbox/disks.nix @@ -1,5 +1,12 @@ -{ config, lib, inputs, pkgs, modulesPath, isIso, ... }: -let +{ + config, + lib, + inputs, + pkgs, + modulesPath, + isIso, + ... +}: let HDD = "/dev/disk/by-path/pci-0000:00:0d.0-ata-1"; partitionsCreateScript = '' @@ -50,16 +57,14 @@ let # Utility to compare the root tree diff-root = pkgs.writers.writeDashBin "diff-root" '' - export PATH=${with pkgs; lib.makeBinPath [ diffutils less ]}:$PATH + export PATH=${with pkgs; lib.makeBinPath [diffutils less]}:$PATH current="$(mktemp current-root.XXX --tmpdir)" trap 'rm "$current"' EXIT INT HUP ${save-root}/bin/save-root "$current" diff -u /run/initial-root "$current" --color=always | ''${PAGER:-less -R} ''; -in -{ +in { config = { - environment.persistence."/persist" = { directories = [ "/var/log" @@ -79,7 +84,7 @@ in fileSystems."/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "mode=755" ]; + options = ["defaults" "mode=755"]; }; fileSystems."/boot" = { @@ -98,29 +103,28 @@ in device = "/dev/mapper/encrypted_root_pool-nix"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/persist" = { device = "/dev/mapper/encrypted_root_pool-persist"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/home" = { device = "/dev/mapper/encrypted_root_pool-home"; fsType = "btrfs"; - options = [ "compress-force=zstd" ]; + options = ["compress-force=zstd"]; }; - swapDevices = [ ]; + swapDevices = []; services.btrfs.autoScrub.enable = true; zramSwap.enable = true; - environment.systemPackages = [ config.disks-create config.disks-format @@ -131,37 +135,42 @@ in systemd.services.save-root-snapshot = { description = "save a snapshot of the initial root tree"; - wantedBy = [ "sysinit.target" ]; - requires = [ "-.mount" ]; - after = [ "-.mount" ]; + wantedBy = ["sysinit.target"]; + requires = ["-.mount"]; + after = ["-.mount"]; serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = true; serviceConfig.ExecStart = ''${save-root}/bin/save-root /run/initial-root''; }; }; - options.disks-create = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-create"; - paths = [ (writeScriptBin default.name partitionsCreateScript) parted ]; + options.disks-create = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-create"; + paths = [(writeScriptBin default.name partitionsCreateScript) parted]; + }; }; - }; - options.disks-format = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-format"; - paths = [ (writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs ]; + options.disks-format = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-format"; + paths = [(writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs]; + }; }; - }; - options.disks-mount = with lib; mkOption rec { - type = types.package; - default = with pkgs; symlinkJoin { - name = "disks-mount"; - paths = [ (writeScriptBin default.name partitionsMountScript) cryptsetup lvm2 ]; + options.disks-mount = with lib; + mkOption rec { + type = types.package; + default = with pkgs; + symlinkJoin { + name = "disks-mount"; + paths = [(writeScriptBin default.name partitionsMountScript) cryptsetup lvm2]; + }; }; - }; - } diff --git a/hardware/virtualbox/hardware.nix b/hardware/virtualbox/hardware.nix index b5ce8b7..8ac24b1 100644 --- a/hardware/virtualbox/hardware.nix +++ b/hardware/virtualbox/hardware.nix @@ -1,19 +1,24 @@ -{ config, lib, inputs, pkgs, modulesPath, ... }: { + config, + lib, + inputs, + pkgs, + modulesPath, + ... +}: { imports = [ ./disks.nix ]; boot = { initrd = { - availableKernelModules = - [ "ata_piix" "ohci_pci" "sd_mod" "sr_mod" ]; - kernelModules = [ ]; + availableKernelModules = ["ata_piix" "ohci_pci" "sd_mod" "sr_mod"]; + kernelModules = []; }; kernelPackages = pkgs.linuxPackages_latest; - kernelModules = [ ]; - extraModulePackages = [ ]; - kernelParams = [ "net.ifnames=0" "biosdevname=0" "mitigations=off" ]; + kernelModules = []; + extraModulePackages = []; + kernelParams = ["net.ifnames=0" "biosdevname=0" "mitigations=off"]; }; services.xserver = { @@ -32,5 +37,4 @@ }; virtualisation.virtualbox.guest.enable = true; - } diff --git a/hosts/configuration.nix b/hosts/configuration.nix index f71f497..1800966 100644 --- a/hosts/configuration.nix +++ b/hosts/configuration.nix @@ -1,6 +1,17 @@ -{ secrets, dotfiles, lib, pkgs, config, hostname, inputs, user, timezone, system, stateVersion, ... }: { - + secrets, + dotfiles, + lib, + pkgs, + config, + hostname, + inputs, + user, + timezone, + system, + stateVersion, + ... +}: { imports = [ "${inputs.impermanence}/nixos.nix" @@ -30,7 +41,7 @@ timeout = 5; }; - supportedFilesystems = [ "ntfs" ]; + supportedFilesystems = ["ntfs"]; tmp.useTmpfs = true; }; @@ -42,10 +53,10 @@ extraHosts = builtins.readFile "${inputs.hosts}/hosts"; dhcpcd.enable = true; resolvconf.enable = true; - nameservers = [ "127.0.0.1" ]; + nameservers = ["127.0.0.1"]; firewall = { enable = true; - allowedTCPPorts = [ 80 22 9090 ]; + allowedTCPPorts = [80 22 9090]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. }; @@ -67,7 +78,7 @@ "${user}" = { isNormalUser = true; - extraGroups = [ "wheel" "audio" "video" ]; # Enable ‘sudo’ for the user. + extraGroups = ["wheel" "audio" "video"]; # Enable ‘sudo’ for the user. hashedPassword = secrets.baitinq.hashed_password; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID99gQ/AgXhgwAjs+opsRXMbWpXFRT2aqAOUbN3DsrhQ (none)" @@ -131,14 +142,14 @@ inputs.deploy-rs.defaultPackage."${system}" ]; - environment.defaultPackages = [ ]; + environment.defaultPackages = []; xdg.portal = { enable = true; wlr.enable = true; config.common.default = "*"; # gtk portal needed to make gtk apps happy - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + extraPortals = [pkgs.xdg-desktop-portal-gtk]; }; security = { @@ -158,10 +169,12 @@ PasswordAuthentication = false; KbdInteractiveAuthentication = false; }; - listenAddresses = [{ - addr = "0.0.0.0"; - port = 22; - }]; + listenAddresses = [ + { + addr = "0.0.0.0"; + port = 22; + } + ]; }; gnome.gnome-keyring.enable = true; unbound.enable = true; @@ -202,7 +215,7 @@ nix = { registry.nixpkgs.flake = inputs.nixpkgs; - nixPath = [ "nixpkgs=/etc/channels/nixpkgs" "nixos-config=/etc/nixos/configuration.nix" "/nix/var/nix/profiles/per-user/root/channels" ]; + nixPath = ["nixpkgs=/etc/channels/nixpkgs" "nixos-config=/etc/nixos/configuration.nix" "/nix/var/nix/profiles/per-user/root/channels"]; gc = { automatic = true; dates = "daily"; @@ -210,7 +223,7 @@ }; package = pkgs.nixVersions.stable; settings = { - experimental-features = [ "nix-command" "flakes" "ca-derivations" "auto-allocate-uids" ]; + experimental-features = ["nix-command" "flakes" "ca-derivations" "auto-allocate-uids"]; auto-optimise-store = true; auto-allocate-uids = true; max-jobs = "auto"; @@ -228,4 +241,3 @@ # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = stateVersion; # Did you read the comment? } - diff --git a/hosts/darwin.nix b/hosts/darwin.nix index 209465b..61a9055 100644 --- a/hosts/darwin.nix +++ b/hosts/darwin.nix @@ -1,5 +1,8 @@ -{ pkgs, user, ... }: { + pkgs, + user, + ... +}: { users.users."${user}".home = "/Users/${user}"; environment.systemPackages = with pkgs; [ diff --git a/hosts/default.nix b/hosts/default.nix index 68adebe..10d9b50 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,33 +1,63 @@ -{ lib, inputs, secrets, dotfiles, hosts, hardwares, systems, isNixOS, isMacOS, isIso, isHardware, user, nixpkgs, home-manager, nix-darwin, ... }: -let - mkHost = { host, hardware, stateVersion, system, timezone, location, extraOverlays, extraModules }: isNixOS: isMacOS: isIso: isHardware: - let - pkgs = import nixpkgs { - inherit system; - config = { - allowUnfree = true; - allowBroken = true; - allowUnsupportedSystem = true; - }; - overlays = [ +{ + lib, + inputs, + secrets, + dotfiles, + hosts, + hardwares, + systems, + isNixOS, + isMacOS, + isIso, + isHardware, + user, + nixpkgs, + home-manager, + nix-darwin, + ... +}: let + mkHost = { + host, + hardware, + stateVersion, + system, + timezone, + location, + extraOverlays, + extraModules, + }: isNixOS: isMacOS: isIso: isHardware: let + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + allowBroken = true; + allowUnsupportedSystem = true; + }; + overlays = + [ inputs.nur.overlays.default # inputs.neovim-nightly-overlay.overlay (import ../packages) (import ../overlays) - ] ++ extraOverlays; - }; + ] + ++ extraOverlays; + }; - extraArgs = { inherit pkgs inputs isIso isHardware user secrets dotfiles timezone location hardware system stateVersion; hostname = host + "-" + hardware; }; + extraArgs = { + inherit pkgs inputs isIso isHardware user secrets dotfiles timezone location hardware system stateVersion; + hostname = host + "-" + hardware; + }; - extraSpecialModules = extraModules ++ lib.optional isHardware ../hardware/${hardware} ++ lib.optional isIso "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"; - in + extraSpecialModules = extraModules ++ lib.optional isHardware ../hardware/${hardware} ++ lib.optional isIso "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"; + in if isNixOS then nixpkgs.lib.nixosSystem - { - inherit system; - specialArgs = extraArgs; - modules = [ + { + inherit system; + specialArgs = extraArgs; + modules = + [ ./configuration.nix ./${host} home-manager.nixosModules.home-manager @@ -38,52 +68,62 @@ let home-manager.users.${user} = { imports = [ ./home.nix - ./${ host }/home.nix + ./${host}/home.nix ]; }; } inputs.nix-index.nixosModules.nix-index - ] ++ extraSpecialModules; - } + ] + ++ extraSpecialModules; + } else if isMacOS then nix-darwin.lib.darwinSystem - { - inherit system; - specialArgs = extraArgs; - modules = [ - ./darwin.nix - home-manager.darwinModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = extraArgs; - home-manager.users."manuel.palenzuela" = { - imports = [ - ./home-darwin.nix - ]; - }; - } - ]; - } + { + inherit system; + specialArgs = extraArgs; + modules = [ + ./darwin.nix + home-manager.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = extraArgs; + home-manager.users."manuel.palenzuela" = { + imports = [ + ./home-darwin.nix + ]; + }; + } + ]; + } else home-manager.lib.homeManagerConfiguration - { - inherit pkgs; - extraSpecialArgs = extraArgs; - modules = [ - ./home.nix - ./${ host }/home.nix - ]; - }; + { + inherit pkgs; + extraSpecialArgs = extraArgs; + modules = [ + ./home.nix + ./${host}/home.nix + ]; + }; hardwarePermutatedHosts = lib.concatMap (hardware: map (host: host // hardware) hosts) hardwares; systemsPermutatedHosts = lib.concatMap (system: map (host: host // system) hardwarePermutatedHosts) systems; permutatedHosts = systemsPermutatedHosts; in /* - We have a list of sets. - Map each element of the list applying the mkHost function to its elements and returning a set in the listToAttrs format - builtins.listToAttrs on the result + We have a list of sets. + Map each element of the list applying the mkHost function to its elements and returning a set in the listToAttrs format + builtins.listToAttrs on the result */ -builtins.listToAttrs (map (mInput@{ host, hardware, system, ... }: { name = host + "-" + hardware + "-" + system; value = mkHost mInput isNixOS isMacOS isIso isHardware; }) permutatedHosts) + builtins.listToAttrs (map (mInput @ { + host, + hardware, + system, + ... + }: { + name = host + "-" + hardware + "-" + system; + value = mkHost mInput isNixOS isMacOS isIso isHardware; + }) + permutatedHosts) diff --git a/hosts/home-darwin.nix b/hosts/home-darwin.nix index ce924d5..913261f 100644 --- a/hosts/home-darwin.nix +++ b/hosts/home-darwin.nix @@ -1,5 +1,11 @@ -{ pkgs, stateVersion, lib, dotfiles, user, ... }: { + pkgs, + stateVersion, + lib, + dotfiles, + user, + ... +}: { imports = [ ]; @@ -12,41 +18,42 @@ ]; }; - services = { }; + services = {}; programs = { emacs = { enable = true; - extraPackages = epkgs: with epkgs; [ - use-package + extraPackages = epkgs: + with epkgs; [ + use-package - direnv + direnv - evil - evil-collection + evil + evil-collection - doom-modeline - dashboard + doom-modeline + dashboard - projectile - lsp-ui + projectile + lsp-ui - lsp-bridge - rust-mode - rustic - company - flycheck - lsp-haskell + lsp-bridge + rust-mode + rustic + company + flycheck + lsp-haskell - nix-mode - haskell-mode - typescript-mode - jq-mode + nix-mode + haskell-mode + typescript-mode + jq-mode - doom-themes + doom-themes - dired-sidebar - ]; + dired-sidebar + ]; extraConfig = builtins.readFile "${dotfiles}/.emacs"; }; }; diff --git a/hosts/home.nix b/hosts/home.nix index aff09f4..8c21be9 100644 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -1,5 +1,16 @@ -{ config, lib, pkgs, inputs, user, hostname, secrets, dotfiles, location, stateVersion, ... }: { + config, + lib, + pkgs, + inputs, + user, + hostname, + secrets, + dotfiles, + location, + stateVersion, + ... +}: { imports = [ ../modules/email ]; @@ -8,71 +19,72 @@ username = "${user}"; homeDirectory = "/home/${user}"; - packages = with pkgs; [ - scrot - redshift - discord - tdesktop - mpv - sxiv - #dwm - #st - alacritty - # ghostty - dmenu - unclutter - clipmenu - dunst - sxhkd - zathura - feh - pavucontrol - polkit_gnome - nixpkgs-fmt - virt-manager - xmonadctl - xdotool #needed for xmobar clickable workspaces - xlockmore - arandr - # jrnl - # todo-txt-cli - # element-desktop - speedtest-cli - libnotify - dwmbar - manga-cli - mov-cli - calibre - kcc - slack - openvpn - smart-wallpaper - waybar - wl-clipboard - sway - swayidle - swaylock-effects - swaybg - river - wlr-randr - wlsunset - vscode - chromium - grim - qbittorrent - slurp - appimage-run - google-cloud-sdk - ghidra - ollama - kubectl - kubectx - kubernetes-helm - ] ++ - (with pkgs.custom; [ - lemacs - kindlegen - ]); + packages = with pkgs; + [ + scrot + redshift + discord + tdesktop + mpv + sxiv + #dwm + #st + alacritty + # ghostty + dmenu + unclutter + clipmenu + dunst + sxhkd + zathura + feh + pavucontrol + polkit_gnome + nixpkgs-fmt + virt-manager + xmonadctl + xdotool #needed for xmobar clickable workspaces + xlockmore + arandr + # jrnl + # todo-txt-cli + # element-desktop + speedtest-cli + libnotify + dwmbar + manga-cli + mov-cli + calibre + kcc + slack + openvpn + smart-wallpaper + waybar + wl-clipboard + sway + swayidle + swaylock-effects + swaybg + river + wlr-randr + wlsunset + vscode + chromium + grim + qbittorrent + slurp + appimage-run + google-cloud-sdk + ghidra + ollama + kubectl + kubectx + kubernetes-helm + ] + ++ (with pkgs.custom; [ + lemacs + kindlegen + ]); }; xsession.windowManager.xmonad = { @@ -106,7 +118,7 @@ enable = true; enableSshSupport = true; enableExtraSocket = true; - sshKeys = [ "BC10A40920B576F641480795B9C7E01A4E47DA9F" ]; + sshKeys = ["BC10A40920B576F641480795B9C7E01A4E47DA9F"]; defaultCacheTtl = 43200; #12h defaultCacheTtlSsh = 43200; maxCacheTtl = 86400; #24h @@ -145,7 +157,7 @@ extraConfig = { push.autoSetupRemote = true; init.defaultBranch = "master"; - safe.directory = [ "*" ]; + safe.directory = ["*"]; sendemail = { smtpserver = "smtp.gmail.com"; smtpserverport = "587"; @@ -163,43 +175,44 @@ emacs = { enable = true; - extraPackages = epkgs: with epkgs; [ - direnv - which-key + extraPackages = epkgs: + with epkgs; [ + direnv + which-key - evil - evil-collection + evil + evil-collection - general + general - doom-modeline - doom-themes - dashboard + doom-modeline + doom-themes + dashboard - projectile + projectile - corfu - kind-icon - eldoc-box + corfu + kind-icon + eldoc-box - vertico - consult - orderless - marginalia + vertico + consult + orderless + marginalia - treesit-auto + treesit-auto - go-mode - gotest - rustic + go-mode + gotest + rustic - treemacs - minimap - centaur-tabs + treemacs + minimap + centaur-tabs - shell-pop - eat - ]; + shell-pop + eat + ]; extraConfig = builtins.readFile "${dotfiles}/.emacs"; }; @@ -217,50 +230,50 @@ extraConfig = lib.strings.concatStrings [ (builtins.readFile "${inputs.arkenfox-userjs}/user.js") '' - // Re-enables URL usages as a search bar. - /* 0801 */ user_pref("keyword.enabled", true); - user_pref("browser.search.suggest.enabled", true); // 0804: live search suggestions - // Re-allows COPY / CUT from "non-privileged" content as it actually breaks many websites. - /* 2404 */ user_pref("dom.allow_cut_copy", true); - // Disables RFP letter-boxing to avoid big white borders on screen. - /* 4504 */ user_pref("privacy.resistFingerprinting.letterboxing", false); - // Set UI density to normal - user_pref("browser.uidensity", 0); - // DRM content :( - user_pref("media.gmp-widevinecdm.enabled", true); - user_pref("media.eme.enabled", true); - user_pref("webgl.disabled", false); // 4520 - user_pref("network.http.referer.XOriginTrimmingPolicy", 0); - user_pref("privacy.clearOnShutdown.history", false); // 2811: don't clear history on close - user_pref("browser.startup.page", 3); // 0102: enable session restore - user_pref("signon.rememberSignons", true); // 5003: enable saving passwords - /* [UX,-HIST] Remember more closed tabs for undo. */ - user_pref("browser.sessionstore.max_tabs_undo", 27); // 1020 - /* [UX,-HIST] Restore all state for closed tab or previous session after Firefox restart. */ - user_pref("browser.sessionstore.privacy_level", 0); // 1021 - user_pref("browser.sessionstore.interval", 15000); // 1023 - /* [UX,-HIST] Enable search and form history. */ - user_pref("browser.formfill.enable", true); // 0860 - user_pref("general.autoScroll", true); - //user_pref("network.cookie.lifetimePolicy", 0); //keep cookies 2801 - user_pref("network.cookie.cookieBehavior", 5); // 2701 - user_pref("privacy.clearOnShutdown.offlineApps", false); - user_pref("privacy.cpd.offlineApps", false); - user_pref("privacy.cpd.history", false); // 2812 to match when you use Ctrl-Shift-Del - user_pref("privacy.clearOnShutdown.cookies", false); - user_pref("privacy.clearOnShutdown.downloads", false); - user_pref("privacy.clearOnShutdown.formdata", false); - user_pref("privacy.clearOnShutdown.sessions", false); - user_pref("extensions.pocket.enabled", false); // 0900: disable Pocket - user_pref("_user.js.baitinq", "Survived the overrides :)"); - '' + // Re-enables URL usages as a search bar. + /* 0801 */ user_pref("keyword.enabled", true); + user_pref("browser.search.suggest.enabled", true); // 0804: live search suggestions + // Re-allows COPY / CUT from "non-privileged" content as it actually breaks many websites. + /* 2404 */ user_pref("dom.allow_cut_copy", true); + // Disables RFP letter-boxing to avoid big white borders on screen. + /* 4504 */ user_pref("privacy.resistFingerprinting.letterboxing", false); + // Set UI density to normal + user_pref("browser.uidensity", 0); + // DRM content :( + user_pref("media.gmp-widevinecdm.enabled", true); + user_pref("media.eme.enabled", true); + user_pref("webgl.disabled", false); // 4520 + user_pref("network.http.referer.XOriginTrimmingPolicy", 0); + user_pref("privacy.clearOnShutdown.history", false); // 2811: don't clear history on close + user_pref("browser.startup.page", 3); // 0102: enable session restore + user_pref("signon.rememberSignons", true); // 5003: enable saving passwords + /* [UX,-HIST] Remember more closed tabs for undo. */ + user_pref("browser.sessionstore.max_tabs_undo", 27); // 1020 + /* [UX,-HIST] Restore all state for closed tab or previous session after Firefox restart. */ + user_pref("browser.sessionstore.privacy_level", 0); // 1021 + user_pref("browser.sessionstore.interval", 15000); // 1023 + /* [UX,-HIST] Enable search and form history. */ + user_pref("browser.formfill.enable", true); // 0860 + user_pref("general.autoScroll", true); + //user_pref("network.cookie.lifetimePolicy", 0); //keep cookies 2801 + user_pref("network.cookie.cookieBehavior", 5); // 2701 + user_pref("privacy.clearOnShutdown.offlineApps", false); + user_pref("privacy.cpd.offlineApps", false); + user_pref("privacy.cpd.history", false); // 2812 to match when you use Ctrl-Shift-Del + user_pref("privacy.clearOnShutdown.cookies", false); + user_pref("privacy.clearOnShutdown.downloads", false); + user_pref("privacy.clearOnShutdown.formdata", false); + user_pref("privacy.clearOnShutdown.sessions", false); + user_pref("extensions.pocket.enabled", false); // 0900: disable Pocket + user_pref("_user.js.baitinq", "Survived the overrides :)"); + '' ]; }; }; - rtorrent = { enable = true; }; + rtorrent = {enable = true;}; - obs-studio = { enable = true; }; + obs-studio = {enable = true;}; bash = { enable = true; @@ -375,7 +388,6 @@ bindkey "\e\x7f" backward-kill-word ''; }; - }; xdg = { @@ -415,5 +427,4 @@ xdg.userDirs.desktop = "$HOME/"; home.stateVersion = stateVersion; - } diff --git a/hosts/luna/default.nix b/hosts/luna/default.nix index 2fde132..0bb60f6 100644 --- a/hosts/luna/default.nix +++ b/hosts/luna/default.nix @@ -1,6 +1,14 @@ -{ config, pkgs, lib, secrets, hostname, inputs, user, ... }: { - - imports = [ ]; +{ + config, + pkgs, + lib, + secrets, + hostname, + inputs, + user, + ... +}: { + imports = []; services = { # Configure keymap in X11 @@ -25,6 +33,4 @@ environment.systemPackages = with pkgs; [ ]; - } - diff --git a/hosts/luna/home.nix b/hosts/luna/home.nix index 1169b3c..b230601 100644 --- a/hosts/luna/home.nix +++ b/hosts/luna/home.nix @@ -1,12 +1,23 @@ -{ config, lib, pkgs, inputs, user, hostname, location, secrets, dotfiles, ... }: { - home.packages = with pkgs; [ - xorg.xmodmap - trackma - adl - ] ++ - (with pkgs.custom; [ - ]); + config, + lib, + pkgs, + inputs, + user, + hostname, + location, + secrets, + dotfiles, + ... +}: { + home.packages = with pkgs; + [ + xorg.xmodmap + trackma + adl + ] + ++ (with pkgs.custom; [ + ]); programs.firefox.profiles.default.settings = { "gfx.webrender.all" = true; @@ -38,12 +49,12 @@ ''; "sxhkd/sxhkdrc".text = - builtins.readFile "${dotfiles}/sxhkd/xmonad" + - builtins.readFile "${dotfiles}/sxhkd/base" + - '' - + builtins.readFile "${dotfiles}/sxhkd/xmonad" + + builtins.readFile "${dotfiles}/sxhkd/base" + + '' + #enter and leave game mode - alt + shift + F11: ctrl + shift + F11 + alt + shift + F11: ctrl + shift + F11 pkill -ALRM sxhkd # Make sxhkd reload its configuration files @@ -158,5 +169,4 @@ ! bind Super+L to search keycode 133 = XF86Search ''; - } diff --git a/hosts/phobos/default.nix b/hosts/phobos/default.nix index b8d6f69..b30bf1e 100644 --- a/hosts/phobos/default.nix +++ b/hosts/phobos/default.nix @@ -1,5 +1,13 @@ -{ config, pkgs, lib, secrets, hostname, inputs, user, ... }: { - +{ + config, + pkgs, + lib, + secrets, + hostname, + inputs, + user, + ... +}: { imports = [ ../../modules/bluetooth ]; @@ -19,18 +27,18 @@ # proxy.noProxy = "127.0.0.1,localhost,internal.domain"; }; - environment.systemPackages = with pkgs; - [ - ]; + environment.systemPackages = with pkgs; [ + ]; programs = { steam.enable = true; }; - /* services.udev.extraRules = '' - SUBSYSTEM=="input", ACTION=="add", ATTRS{bInterfaceProtocol}=="02", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceSubClass}=="01", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/${user}/.Xauthority", RUN+="${pkgs.xorg.xf86inputsynaptics}/bin/synclient TouchpadOff=1" - SUBSYSTEM=="input", ACTION=="remove", ATTRS{bInterfaceProtocol}=="02", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceSubClass}=="01", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/${user}/.Xauthority", RUN+="${pkgs.xorg.xf86inputsynaptics}/bin/synclient TouchpadOff=0" - ''; + /* + services.udev.extraRules = '' + SUBSYSTEM=="input", ACTION=="add", ATTRS{bInterfaceProtocol}=="02", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceSubClass}=="01", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/${user}/.Xauthority", RUN+="${pkgs.xorg.xf86inputsynaptics}/bin/synclient TouchpadOff=1" + SUBSYSTEM=="input", ACTION=="remove", ATTRS{bInterfaceProtocol}=="02", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceSubClass}=="01", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/${user}/.Xauthority", RUN+="${pkgs.xorg.xf86inputsynaptics}/bin/synclient TouchpadOff=0" + ''; */ services.boinc = { @@ -38,8 +46,6 @@ dataDir = "/var/lib/boinc"; }; - users.users.${user}.extraGroups = [ "boinc" ]; - users.users.boinc.extraGroups = [ "video" ]; - + users.users.${user}.extraGroups = ["boinc"]; + users.users.boinc.extraGroups = ["video"]; } - diff --git a/hosts/phobos/home.nix b/hosts/phobos/home.nix index 4dd57fd..a74ab86 100644 --- a/hosts/phobos/home.nix +++ b/hosts/phobos/home.nix @@ -1,15 +1,26 @@ -{ config, lib, pkgs, inputs, user, hostname, location, secrets, dotfiles, ... }: { - home.packages = with pkgs; [ - minecraft - trackma - adl - jetbrains.idea-community - gimp - godot_4 - ] ++ - (with pkgs.custom; [ - ]); + config, + lib, + pkgs, + inputs, + user, + hostname, + location, + secrets, + dotfiles, + ... +}: { + home.packages = with pkgs; + [ + minecraft + trackma + adl + jetbrains.idea-community + gimp + godot_4 + ] + ++ (with pkgs.custom; [ + ]); programs.firefox.profiles.default.settings = { "gfx.webrender.all" = true; @@ -41,13 +52,13 @@ ''; "sxhkd/sxhkdrc".text = - builtins.readFile "${dotfiles}/sxhkd/xmonad" + - builtins.readFile "${dotfiles}/sxhkd/base" + - '' - + builtins.readFile "${dotfiles}/sxhkd/xmonad" + + builtins.readFile "${dotfiles}/sxhkd/base" + + '' + # Not supported by swhkd #enter and leave game mode - #alt + shift + F11: ctrl + shift + F11 + #alt + shift + F11: ctrl + shift + F11 # pkill -ALRM sxhkd # Make sxhkd reload its configuration files @@ -116,5 +127,4 @@ # exec ~/.config/i3/scripts/toggletouchpad.sh ''; }; - } diff --git a/modules/bluetooth/default.nix b/modules/bluetooth/default.nix index b45d082..d3958ef 100644 --- a/modules/bluetooth/default.nix +++ b/modules/bluetooth/default.nix @@ -1,6 +1,8 @@ -{ config, pkgs, ... }: - { + config, + pkgs, + ... +}: { hardware.bluetooth.enable = true; services.blueman.enable = true; diff --git a/modules/doas/default.nix b/modules/doas/default.nix index 39cb03b..9abc038 100644 --- a/modules/doas/default.nix +++ b/modules/doas/default.nix @@ -1,15 +1,19 @@ -{ config, pkgs, ... }: - { + config, + pkgs, + ... +}: { security = { sudo.enable = false; doas = { enable = true; - extraRules = [{ - groups = [ "wheel" ]; - keepEnv = true; - persist = true; - }]; + extraRules = [ + { + groups = ["wheel"]; + keepEnv = true; + persist = true; + } + ]; }; }; } diff --git a/modules/email/default.nix b/modules/email/default.nix index 67dbeaa..4305071 100644 --- a/modules/email/default.nix +++ b/modules/email/default.nix @@ -1,5 +1,10 @@ -{ config, pkgs, lib, secrets, ... }: { + config, + pkgs, + lib, + secrets, + ... +}: { services = { mbsync.enable = true; imapnotify.enable = true; @@ -45,7 +50,7 @@ imapnotify = { enable = true; - boxes = [ "Inbox" ]; + boxes = ["Inbox"]; onNotifyPost = '' ${pkgs.libnotify}/bin/notify-send "New mail arrived." ''; @@ -71,7 +76,8 @@ set use_from = yes set index_format='%4C %Z %<[y?%<[m?%<[d?%[%H:%M ]&%[%a %d]>&%[%b %d]>&%[%m/%y ]> %-15.15L (%?l?%4l&%4c?) %s' ''; - /*extraConfig = '' + /* + extraConfig = '' set imap_user = 'manuelpalenzuelamerino@gmail.com' set imap_pass = '${secrets.email."manuelpalenzuelamerino@gmail.com".password}' set spoolfile = imaps://imap.gmail.com/INBOX @@ -84,11 +90,11 @@ set smtp_url = "smtp://manuelpalenzuelamerino@smtp.gmail.com:587/" set smtp_pass = ${secrets.email."manuelpalenzuelamerino@gmail.com".password} set ssl_force_tls = yes # Require encrypted connection - '';*/ + ''; + */ }; passwordCommand = "${pkgs.coreutils}/bin/echo ${secrets.email."manuelpalenzuelamerino@gmail.com".password}"; }; }; }; } - diff --git a/modules/fonts/default.nix b/modules/fonts/default.nix index 7203f30..75182e4 100644 --- a/modules/fonts/default.nix +++ b/modules/fonts/default.nix @@ -1,4 +1,8 @@ -{ config, pkgs, ... }: { +{ + config, + pkgs, + ... +}: { fonts = { packages = with pkgs; [ noto-fonts @@ -12,7 +16,7 @@ ]; fontconfig = { defaultFonts = { - monospace = [ "TX-02" "Inconsolata LGC" ]; + monospace = ["TX-02" "Inconsolata LGC"]; }; }; }; diff --git a/modules/pipewire/default.nix b/modules/pipewire/default.nix index 3eeaa79..2ce9099 100644 --- a/modules/pipewire/default.nix +++ b/modules/pipewire/default.nix @@ -1,6 +1,8 @@ -{ config, pkgs, ... }: - { + config, + pkgs, + ... +}: { security.rtkit.enable = true; services.pipewire = { enable = true; @@ -13,6 +15,5 @@ }; # Recent fix for pipewire-pulse breakage - systemd.user.services.pipewire-pulse.path = [ pkgs.pulseaudio ]; + systemd.user.services.pipewire-pulse.path = [pkgs.pulseaudio]; } - diff --git a/modules/power-save/default.nix b/modules/power-save/default.nix index e132655..21cb0fd 100644 --- a/modules/power-save/default.nix +++ b/modules/power-save/default.nix @@ -1,12 +1,14 @@ -{ config, pkgs, ... }: { - + config, + pkgs, + ... +}: { environment.systemPackages = with pkgs; [ powertop ]; boot = { - kernelParams = [ "pcie_aspm.policy=powersave" ]; + kernelParams = ["pcie_aspm.policy=powersave"]; extraModprobeConfig = '' options snd_hda_intel power_save=1 options iwlwifi power_save=1 d0i3_disable=0 uapsd_disable=0 diff --git a/modules/virtualisation/default.nix b/modules/virtualisation/default.nix index 1aa4cb2..8d9f14d 100644 --- a/modules/virtualisation/default.nix +++ b/modules/virtualisation/default.nix @@ -1,6 +1,9 @@ -{ config, pkgs, user, ... }: - { + config, + pkgs, + user, + ... +}: { virtualisation = { docker = { enable = true; @@ -18,6 +21,6 @@ docker-compose ]; - users.users.${user}.extraGroups = [ "libvirtd" "docker" ]; - users.extraGroups.vboxusers.members = [ "user-with-access-to-virtualbox" ]; + users.users.${user}.extraGroups = ["libvirtd" "docker"]; + users.extraGroups.vboxusers.members = ["user-with-access-to-virtualbox"]; } diff --git a/modules/xorg/default.nix b/modules/xorg/default.nix index 55c704f..2ed01ca 100644 --- a/modules/xorg/default.nix +++ b/modules/xorg/default.nix @@ -1,5 +1,8 @@ -{ config, pkgs, ... }: { + config, + pkgs, + ... +}: { # Starting graphical-session.target doesn't work coz systemd. NixOS has a bug # where the graphical-session.target isn't started on wayland (https://github.com/NixOS/nixpkgs/issues/169143). # We are kind of screwed :) @@ -25,18 +28,16 @@ systemd.user.services.polkit-gnome-authentication-agent-1 = { description = "polkit-gnome-authentication-agent-1"; - wants = [ "graphical-session.target" ]; - wantedBy = [ "graphical-session.target" ]; - after = [ "graphical-session.target" ]; + wants = ["graphical-session.target"]; + wantedBy = ["graphical-session.target"]; + after = ["graphical-session.target"]; serviceConfig = { Type = "simple"; - ExecStart = - "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; Restart = "on-failure"; RestartSec = 1; TimeoutStopSec = 10; }; }; systemd.user.services.polkit-gnome-authentication-agent-1.enable = true; - } diff --git a/overlays/base/default.nix b/overlays/base/default.nix index 1338de0..d7953cd 100644 --- a/overlays/base/default.nix +++ b/overlays/base/default.nix @@ -1,5 +1,4 @@ -final: prev: -{ +final: prev: { dwm = prev.dwm.overrideAttrs (old: { src = prev.fetchFromGitHub { owner = "Baitinq"; @@ -17,11 +16,11 @@ final: prev: sha256 = "sha256-MyNMxdaWtgjClZGIHUtYwwx51u5NII5Ce4BnOnUojo8="; }; NIX_CFLAGS_COMPILE = "-lXrender -lm"; - patches = [ ./patches/dmenu_height.patch ]; + patches = [./patches/dmenu_height.patch]; }); st = prev.st.overrideAttrs (old: { - buildInputs = old.buildInputs ++ [ prev.harfbuzz ]; + buildInputs = old.buildInputs ++ [prev.harfbuzz]; src = prev.fetchFromGitHub { owner = "LukeSmithxyz"; repo = "st"; @@ -30,7 +29,7 @@ final: prev: }; }); - minecraft = prev.minecraft.override { jre = prev.jdk8; }; + minecraft = prev.minecraft.override {jre = prev.jdk8;}; xwinwrap = prev.xwinwrap.overrideAttrs (old: { src = prev.fetchFromGitHub { @@ -65,22 +64,22 @@ final: prev: }); mpv = prev.mpv.override { - scripts = [ prev.mpvScripts.mpris ]; + scripts = [prev.mpvScripts.mpris]; }; - emacs = (prev.symlinkJoin { + emacs = prev.symlinkJoin { inherit (prev.emacs) name; inherit (prev.emacs) version; - paths = [ prev.emacs ]; - nativeBuildInputs = [ prev.makeBinaryWrapper ]; - postBuild = "wrapProgram $out/bin/emacs --prefix PATH : ${prev.lib.makeBinPath [ prev.nodejs prev.ripgrep ]}"; - }); + paths = [prev.emacs]; + nativeBuildInputs = [prev.makeBinaryWrapper]; + postBuild = "wrapProgram $out/bin/emacs --prefix PATH : ${prev.lib.makeBinPath [prev.nodejs prev.ripgrep]}"; + }; - neovim = (prev.symlinkJoin { + neovim = prev.symlinkJoin { inherit (prev.neovim) name; inherit (prev.neovim) version; - paths = [ prev.neovim ]; - nativeBuildInputs = [ prev.makeBinaryWrapper ]; - postBuild = "wrapProgram $out/bin/nvim --prefix PATH : ${prev.lib.makeBinPath [ prev.nodejs prev.fd prev.ripgrep prev.fswatch ]}"; - }); + paths = [prev.neovim]; + nativeBuildInputs = [prev.makeBinaryWrapper]; + postBuild = "wrapProgram $out/bin/nvim --prefix PATH : ${prev.lib.makeBinPath [prev.nodejs prev.fd prev.ripgrep prev.fswatch]}"; + }; } diff --git a/overlays/default.nix b/overlays/default.nix index ef828bf..858dc6e 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,7 +1,6 @@ -final: prev: -let +final: prev: let overlays = [ (import ./base) ]; in -prev.lib.composeManyExtensions overlays final prev + prev.lib.composeManyExtensions overlays final prev diff --git a/packages/default.nix b/packages/default.nix index 33866ca..f6387ff 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,8 +1,7 @@ -final: prev: -{ +final: prev: { custom = { - kindlegen = prev.callPackage ./kindlegen { }; - lemacs = prev.callPackage ./lemacs { }; - swhkd = prev.callPackage ./swhkd { }; + kindlegen = prev.callPackage ./kindlegen {}; + lemacs = prev.callPackage ./lemacs {}; + swhkd = prev.callPackage ./swhkd {}; }; } diff --git a/packages/kindlegen/default.nix b/packages/kindlegen/default.nix index dd86dec..f96d0c8 100644 --- a/packages/kindlegen/default.nix +++ b/packages/kindlegen/default.nix @@ -1,42 +1,50 @@ -{ fetchurl, lib, stdenv, unzip }: - -let +{ + fetchurl, + lib, + stdenv, + unzip, +}: let version = "2.9"; - fileVersion = builtins.replaceStrings [ "." ] [ "_" ] version; - - sha256 = { - x86_64-linux = "sha256-2ZLFM5YcV2Ym38hxU8WMrRDjHDF6edqYohLeM+ASgpk="; - }.${stdenv.hostPlatform.system} or (throw "system #{stdenv.hostPlatform.system.} is not supported"); - - url = { - x86_64-linux = "https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz"; - }.${stdenv.hostPlatform.system} or (throw "system #{stdenv.hostPlatform.system.} is not supported"); - + fileVersion = builtins.replaceStrings ["."] ["_"] version; + + sha256 = + { + x86_64-linux = "sha256-2ZLFM5YcV2Ym38hxU8WMrRDjHDF6edqYohLeM+ASgpk="; + } + .${stdenv.hostPlatform.system} + or (throw "system #{stdenv.hostPlatform.system.} is not supported"); + + url = + { + x86_64-linux = "https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz"; + } + .${stdenv.hostPlatform.system} + or (throw "system #{stdenv.hostPlatform.system.} is not supported"); in -stdenv.mkDerivation { - pname = "kindlegen"; - inherit version; - - src = fetchurl { - inherit url; - inherit sha256; - }; - - sourceRoot = "."; - - nativeBuildInputs = lib.optional (lib.hasSuffix ".zip" url) unzip; - - installPhase = '' - mkdir -p $out/bin $out/share/kindlegen/doc - install -m755 kindlegen $out/bin/kindlegen - cp -r *.txt *.html docs/* $out/share/kindlegen/doc - ''; - - meta = with lib; { - description = "Convert documents to .mobi for use with Amazon Kindle"; - homepage = "https://www.amazon.com/gp/feature.html?docId=1000765211"; - license = licenses.unfree; - maintainers = with maintainers; [ peterhoeg ]; - platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "i686-darwin" "x86_64-cygwin" "i686-cygwin" ]; - }; -} + stdenv.mkDerivation { + pname = "kindlegen"; + inherit version; + + src = fetchurl { + inherit url; + inherit sha256; + }; + + sourceRoot = "."; + + nativeBuildInputs = lib.optional (lib.hasSuffix ".zip" url) unzip; + + installPhase = '' + mkdir -p $out/bin $out/share/kindlegen/doc + install -m755 kindlegen $out/bin/kindlegen + cp -r *.txt *.html docs/* $out/share/kindlegen/doc + ''; + + meta = with lib; { + description = "Convert documents to .mobi for use with Amazon Kindle"; + homepage = "https://www.amazon.com/gp/feature.html?docId=1000765211"; + license = licenses.unfree; + maintainers = with maintainers; [peterhoeg]; + platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin" "i686-darwin" "x86_64-cygwin" "i686-cygwin"]; + }; + } diff --git a/packages/lemacs/default.nix b/packages/lemacs/default.nix index b6ad489..fdf6341 100644 --- a/packages/lemacs/default.nix +++ b/packages/lemacs/default.nix @@ -1,4 +1,4 @@ -{ writeShellScriptBin, ... }: +{writeShellScriptBin, ...}: writeShellScriptBin "lemacs" '' if [ -n "$DISPLAY" ]; then emacsclient -a "" -n -c "$@" diff --git a/packages/swhkd/default.nix b/packages/swhkd/default.nix index 4682a36..3bf5091 100644 --- a/packages/swhkd/default.nix +++ b/packages/swhkd/default.nix @@ -1,4 +1,9 @@ -{ rustPlatform, fetchFromGitHub, pkgs, ... }: +{ + rustPlatform, + fetchFromGitHub, + pkgs, + ... +}: rustPlatform.buildRustPackage rec { name = "swhkd"; @@ -6,7 +11,7 @@ rustPlatform.buildRustPackage rec { pkgconfig ]; - buildInputs = with pkgs; [ systemd ]; + buildInputs = with pkgs; [systemd]; src = fetchFromGitHub { owner = "waycrate"; @@ -17,5 +22,5 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-E5AE18CfeX1HI/FbGDFoUDsPyG/CpJrD+8Ky7c+EQUw="; } - # Doesn't yet work because NixOS' kernel isn't compiled with CONFIG_RFKILL_INPUT=y + diff --git a/secrets/wireguard/default.nix b/secrets/wireguard/default.nix index 8d2f1fc..9b155c0 100644 --- a/secrets/wireguard/default.nix +++ b/secrets/wireguard/default.nix Binary files differdiff --git a/tests/flake_test.nix b/tests/flake_test.nix index 6579c22..65f57eb 100644 --- a/tests/flake_test.nix +++ b/tests/flake_test.nix @@ -1,7 +1,6 @@ let flake = import ../flake.nix; -in -[ +in [ { name = "home-manger should follow nixpkgs"; actual = flake.inputs.home-manager.inputs.nixpkgs.follows; |