Start port to darwin

Get a working basic darwin config, including:
- Emacs
- Core utils
- Linking nix applications into ~/Applications
- Managing homebrew through nix
- Switch from nixpkgs-fmt to nixfmt
- Compile aspell with the needed dicts to make getting it working on mac
  smoother
This commit is contained in:
Nathan McCarty 2022-10-13 22:13:43 -04:00
parent 5976b1195c
commit 754e42af79
66 changed files with 2239 additions and 2354 deletions

View File

@ -44,7 +44,9 @@
},
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs",
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
@ -354,16 +356,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665449268,
"narHash": "sha256-cw4xrQIAZUyJGj58Dp5VLICI0rscd+uap83afiFzlcA=",
"owner": "nixos",
"lastModified": 1665596265,
"narHash": "sha256-H7Ku1SF+7zDEqw8QOyEDA5blMJQW9MvdfgB+K3KJNLw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "285e77efe87df64105ec14b204de6636fb0a7a27",
"rev": "9234f5a17e1a7820b5e91ecd4ff0de449e293383",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"owner": "NixOS",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
@ -400,22 +402,6 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1665596265,
"narHash": "sha256-H7Ku1SF+7zDEqw8QOyEDA5blMJQW9MvdfgB+K3KJNLw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9234f5a17e1a7820b5e91ecd4ff0de449e293383",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"polymc": {
"inputs": {
"flake-compat": "flake-compat",
@ -472,7 +458,7 @@
"nix-on-droid": "nix-on-droid",
"nixos-generators": "nixos-generators",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable",
"polymc": "polymc",
"quilt-server": "quilt-server",

181
flake.nix
View File

@ -5,9 +5,24 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware";
home-manager = {
url = "github:nix-community/home-manager/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-on-droid = {
url = "github:t184256/nix-on-droid";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
darwin = {
url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpgks.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs";
};
emacs = {
url = "github:nix-community/emacs-overlay";
@ -21,14 +36,6 @@
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
polymc = {
url = "github:PolyMC/PolyMC";
inputs.nixpkgs.follows = "nixpkgs";
@ -57,73 +64,66 @@
};
};
nix-on-droid = {
url = "github:t184256/nix-on-droid";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
};
outputs =
{ self
, nixpkgs
, nixpkgs-unstable
, nixos-hardware
, fenix
, emacs
, mozilla
, sops-nix
, home-manager
, darwin
, polymc
, java
, quilt-server
, nixos-generators
, wsl
, gamescope
, nix-on-droid
}@inputs:
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, fenix, emacs
, mozilla, sops-nix, home-manager, darwin, polymc, java, quilt-server
, nixos-generators, wsl, gamescope, nix-on-droid }@inputs:
let
makeNixosSystem = { system, hostName, extraModules ? [ ], ourNixpkgs ? nixpkgs }: ourNixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inputs = inputs;
};
modules = [
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
./modules/linux/default.nix
({ pkgs, lib, config, ... }: {
# Configure hostname
networking = {
hostName = hostName;
};
# Setup sops
# Add default secrets
sops = {
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
};
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = (pkg: true);
# Home manager configuration
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {
inputs = inputs;
nixosConfig = config;
makeNixosSystem =
{ system, hostName, extraModules ? [ ], ourNixpkgs ? nixpkgs }:
ourNixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inputs = inputs; };
modules = [
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
./modules/linux/default.nix
({ pkgs, lib, config, ... }: {
# Configure hostname
networking = { hostName = hostName; };
# Setup sops
# Add default secrets
sops = { age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; };
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = (pkg: true);
# Home manager configuration
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {
inputs = inputs;
nixosConfig = config;
};
sharedModules = [ ./home-manager/linux/default.nix ];
};
sharedModules = [
./home-manager/linux/default.nix
];
};
})
] ++ extraModules;
};
in
rec {
})
] ++ extraModules;
};
makeDarwinSystem = { system, extraModules ? [ ] }:
darwin.lib.darwinSystem {
inherit system;
specialArgs = { inputs = inputs; };
modules = [
home-manager.darwinModules.home-manager
./modules/darwin/default.nix
({ pkgs, lib, config, ... }: {
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = (pkg: true);
# Home manager configuration
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {
inputs = inputs;
nixosConfig = config;
};
sharedModules = [ ./home-manager/darwin/default.nix ];
};
})
] ++ extraModules;
};
in rec {
# Real systems
nixosConfigurations = {
levitation = makeNixosSystem {
@ -138,27 +138,21 @@
oracles = makeNixosSystem {
system = "x86_64-linux";
hostName = "oracles";
extraModules = [
./hardware/oracles.nix
./machines/oracles/configuration.nix
];
extraModules =
[ ./hardware/oracles.nix ./machines/oracles/configuration.nix ];
};
matrix = makeNixosSystem {
system = "x86_64-linux";
hostName = "matrix";
extraModules = [
./hardware/matrix.nix
./machines/matrix/configuration.nix
];
extraModules =
[ ./hardware/matrix.nix ./machines/matrix/configuration.nix ];
};
tounge = makeNixosSystem {
system = "aarch64-linux";
hostName = "tounge";
extraModules = [
./machines/tounge/configuration.nix
];
extraModules = [ ./machines/tounge/configuration.nix ];
};
x86vm = makeNixosSystem {
@ -175,10 +169,15 @@
wsl = makeNixosSystem {
system = "x86_64-linux";
hostName = "wsl";
extraModules = [
wsl.nixosModules.wsl
./machines/wsl/configuration.nix
];
extraModules =
[ wsl.nixosModules.wsl ./machines/wsl/configuration.nix ];
};
};
# Mac systems
darwinConfigurations = {
"extremophile" = makeDarwinSystem {
system = "x86_64-darwin";
extraModules = [ ./machines/extremophile/configuration.nix ];
};
};
# Android systems
@ -197,9 +196,7 @@
inputs = inputs;
nixosConfig = config;
};
sharedModules = [
./home-manager/nix-on-droid/default.nix
];
sharedModules = [ ./home-manager/nix-on-droid/default.nix ];
};
})
];
@ -210,9 +207,7 @@
# Hyper-V image
hyperv = nixos-generators.nixosGenerate {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
./machines/hyperv/configuration.nix
];
modules = [ ./machines/hyperv/configuration.nix ];
format = "hyperv";
};
};

View File

@ -4,58 +4,51 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."crypt-pv".device = "/dev/disk/by-uuid/15e9f417-b35a-40fe-a066-595be13cf230";
boot.initrd.luks.devices."crypt-pv".device =
"/dev/disk/by-uuid/15e9f417-b35a-40fe-a066-595be13cf230";
fileSystems."/home" =
{
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/home" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/nix" =
{
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/nix" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/etc" =
{
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=etc" ];
};
fileSystems."/etc" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=etc" ];
};
fileSystems."/var" =
{
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=var" ];
};
fileSystems."/var" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=var" ];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/1425-B41E";
fsType = "vfat";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/1425-B41E";
fsType = "vfat";
};
fileSystems."/home/nathan/Music" = {
device = "10.0.0.139:/mnt/tank/root/nathan/music";
@ -70,15 +63,15 @@
fsType = "nfs";
};
swapDevices =
[{
device = "/dev/disk/by-partuuid/f9d26ecd-7df5-48ad-bc19-b9ac4e91b0ee";
randomEncryption = {
cipher = "aes-xts-plain64";
enable = true;
source = "/dev/random";
};
}];
swapDevices = [{
device = "/dev/disk/by-partuuid/f9d26ecd-7df5-48ad-bc19-b9ac4e91b0ee";
randomEncryption = {
cipher = "aes-xts-plain64";
enable = true;
source = "/dev/random";
};
}];
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@ -4,56 +4,48 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/profiles/qemu-guest.nix")
];
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=root,compress-force=zstd:1" ];
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=root,compress-force=zstd:1" ];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/61AB-C10E";
fsType = "vfat";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/61AB-C10E";
fsType = "vfat";
};
fileSystems."/home" =
{
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=home,compress-force=zstd:1" ];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=home,compress-force=zstd:1" ];
};
fileSystems."/etc" =
{
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=etc,compress-force=zstd:1" ];
};
fileSystems."/etc" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=etc,compress-force=zstd:1" ];
};
fileSystems."/var" =
{
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=var,compress-force=zstd:1" ];
};
fileSystems."/var" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=var,compress-force=zstd:1" ];
};
fileSystems."/nix" =
{
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=nix,compress-force=zstd:6" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=nix,compress-force=zstd:6" ];
};
swapDevices =
[{ device = "/dev/disk/by-uuid/09eb9e97-3105-4b60-88f7-ac3a01a2c130"; }];

View File

@ -4,56 +4,48 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/882E-B495";
fsType = "vfat";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/882E-B495";
fsType = "vfat";
};
fileSystems."/var" =
{
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=var" ];
};
fileSystems."/var" = {
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=var" ];
};
fileSystems."/etc" =
{
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=etc" ];
};
fileSystems."/etc" = {
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=etc" ];
};
fileSystems."/nix" =
{
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/home" =
{
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/26b08694-708a-447d-be16-abc3fc2b0d70";
fsType = "btrfs";
options = [ "subvol=home" ];
};
swapDevices =
[{ device = "/dev/disk/by-uuid/2c823521-9ab0-44bb-9f40-3963757cf4b5"; }];

View File

@ -4,56 +4,48 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/68FE-F04C";
fsType = "vfat";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/68FE-F04C";
fsType = "vfat";
};
fileSystems."/nix" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/var" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=var" ];
};
fileSystems."/var" = {
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=var" ];
};
fileSystems."/home" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/etc" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=etc" ];
};
fileSystems."/etc" = {
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=etc" ];
};
swapDevices =
[{ device = "/dev/disk/by-uuid/522c68bd-b23b-487d-80e3-fc41e2be130f"; }];

View File

@ -1,14 +1,19 @@
{ modulesPath, ... }:
{
{ modulesPath, ... }: {
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.loader.grub = {
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
};
fileSystems."/boot" = { device = "/dev/disk/by-uuid/94E8-7477"; fsType = "vfat"; };
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/94E8-7477";
fsType = "vfat";
};
boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
fileSystems."/" = {
device = "/dev/sda1";
fsType = "ext4";
};
swapDevices = [{ device = "/swapfile"; }];
}

View File

@ -1,6 +1,5 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
{
with lib; {
config = mkMerge [
(mkIf config.nathan.programs.util.core {
home.packages = with pkgs; [
@ -104,9 +103,7 @@ with lib;
delta.enable = true;
lfs.enable = true;
extraConfig = {
init = {
defaultBranch = "trunk";
};
init = { defaultBranch = "trunk"; };
log = {
showSignature = true;
abbrevCommit = true;
@ -125,31 +122,19 @@ with lib;
default = "simple";
followTags = true;
};
pull = {
rebase = true;
};
status = {
showUntrackedFiles = "all";
};
transfer = {
fsckobjects = true;
};
color = {
ui = "auto";
};
pull = { rebase = true; };
status = { showUntrackedFiles = "all"; };
transfer = { fsckobjects = true; };
color = { ui = "auto"; };
diff = {
mnemonicPrefix = true;
renames = true;
wordRegex = ".";
submodule = "log";
};
credential = {
helper = "cache";
};
credential = { helper = "cache"; };
# Disable annoying safe directory nonsense
safe = {
directory = "*";
};
safe = { directory = "*"; };
};
};
})
@ -252,9 +237,7 @@ with lib;
commit_hash_length = 6;
only_detached = false;
};
package = {
symbol = "";
};
package = { symbol = ""; };
time = {
disabled = false;
format = "[$time]($style)";
@ -274,13 +257,8 @@ with lib;
#########################
## JSON Utilities
#########################
programs.jq = {
enable = true;
};
home.packages = with pkgs; [
jc
fx
];
programs.jq = { enable = true; };
home.packages = with pkgs; [ jc fx ];
})
];
}

View File

@ -2,15 +2,19 @@
let
devel = config.nathan.programs.devel;
unstable = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}";
inherit (import ../../../modules/lib.nix { inherit lib; inherit pkgs; }) nLib;
in
inherit (import ../../../modules/lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
with lib; with nLib; {
in with lib;
with nLib; {
config = mkMerge [
# Core development utilites
(mkIf devel.core {
home.packages = with pkgs;
# General packages
# General packages
[
# Git addons
git-secret
@ -25,14 +29,10 @@ with lib; with nLib; {
];
programs = {
direnv = {
enable = true;
};
direnv = { enable = true; };
# Neovim
# (I'm not abonding emacs I just want the tutor)
neovim = {
enable = true;
};
neovim = { enable = true; };
};
})
# Rust development
@ -62,26 +62,13 @@ with lib; with nLib; {
})
# Python Development
(mkIf devel.python {
home.packages = with pkgs; [
python3Full
nodePackages.pyright
];
home.packages = with pkgs; [ python3Full nodePackages.pyright ];
})
# JavaScript/TypeScript Development
(mkIf devel.js {
home.packages = with pkgs; [
nodejs
yarn
nodePackages.typescript
deno
];
home.packages = with pkgs; [ nodejs yarn nodePackages.typescript deno ];
})
# Raku Development
(mkIf devel.raku {
home.packages = with pkgs; [
rakudo
zef
];
})
(mkIf devel.raku { home.packages = with pkgs; [ rakudo zef ]; })
];
}

View File

@ -1,47 +1,52 @@
{ config, lib, pkgs, inputs, ... }:
{
config = lib.mkIf config.nathan.programs.emacs.enable {
# Dependencies of my emacs environment
home.packages = with pkgs; [
# For markdown rendering
python39Packages.grip
# For graph generation
graphviz
sqlite
# For latex editing
texlive.combined.scheme-medium
# For notifications
libnotify
# For flash cards
anki
# For spelling
aspell
aspellDicts.en
aspellDicts.en-science
aspellDicts.en-computers
# For nix
rnix-lsp
manix
nix-doc
# For email
mu
# Desktop file for org-protocol
(makeDesktopItem {
name = "org-protocol";
exec = "emacsclient %u";
comment = "Org protocol";
desktopName = "org-protocol";
type = "Application";
mimeTypes = [ "x-scheme-handler/org-protocol" ];
})
];
programs.emacs = {
enable = true;
package = config.nathan.programs.emacs.package;
extraPackages = epkgs: [
pkgs.mu
config = lib.mkMerge [
(lib.mkIf config.nathan.programs.emacs.enable (let
myAspell = pkgs.aspellWithDicts (d: [ d.en d.en-science d.en-computers ]);
in {
# Dependencies of my emacs environment
home.packages = with pkgs; [
# For markdown rendering
python39Packages.grip
# For graph generation
graphviz
sqlite
# For latex editing
texlive.combined.scheme-medium
# For notifications
libnotify
# For spelling
myAspell
# For nix
rnix-lsp
manix
nix-doc
nixfmt
# For email
mu
# Desktop file for org-protocol
(makeDesktopItem {
name = "org-protocol";
exec = "emacsclient %u";
comment = "Org protocol";
desktopName = "org-protocol";
type = "Application";
mimeTypes = [ "x-scheme-handler/org-protocol" ];
})
];
};
};
programs.emacs = {
enable = true;
package = config.nathan.programs.emacs.package;
extraPackages = epkgs: [ pkgs.mu ];
};
}))
(lib.mkIf (config.nathan.programs.emacs.enable && pkgs.stdenv.isLinux) {
home.packages = with pkgs;
[
# For flash cards
anki
];
})
];
}

View File

@ -0,0 +1,46 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (import ../../modules/lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in with lib;
with nLib; {
imports = [
../options.nix
../common/programs/core.nix
../common/programs/devel.nix
../common/programs/emacs.nix
./programs/core.nix
];
options = { };
config = {
# Link applications in spotlight/launchpad
home.activation = mkIf pkgs.stdenv.isDarwin {
copyApplications = let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
baseDir="$HOME/Applications/Home Manager Apps"
if [ -d "$baseDir" ]; then
rm -rf "$baseDir"
fi
mkdir -p "$baseDir"
for appFile in ${apps}/Applications/*; do
target="$baseDir/$(basename "$appFile")"
$DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
$DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
done
'';
};
home.stateVersion = "22.05";
programs.home-manager.enable = true;
nathan.programs.emacs.package = lib.mkDefault pkgs.emacs28NativeComp;
};
}

View File

@ -0,0 +1,25 @@
{ config, lib, pkgs, inputs, ... }:
with lib; {
config = mkMerge [
(mkIf config.nathan.programs.util.fish {
#########################
## Fish Configuration
#########################
programs.fish = {
# Custom configuration
interactiveShellInit = ''
for p in /run/current-system/sw/bin
if not contains $p $fish_user_paths
set -g fish_user_paths $p $fish_user_paths
end
end
for p in /etc/profiles/per-user/nathan/bin
if not contains $p $fish_user_paths
set -g fish_user_paths $p $fish_user_paths
end
end
'';
};
})
];
}

View File

@ -1,8 +1,12 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (import ../../modules/lib.nix { inherit lib; inherit pkgs; }) nLib;
in
with lib; with nLib; {
inherit (import ../../modules/lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in with lib;
with nLib; {
imports = [
../options.nix
./programs/sway.nix
@ -25,13 +29,12 @@ with lib; with nLib; {
# Services, these are platform specific so they go here
services = {
# Synthing, enabled by default on linux desktop
syncthing = mkDefaultOption "Syncthing" (config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
syncthing = mkDefaultOption "Syncthing"
(config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
# Email syncing
# Disabled by default since this requires manual setup on the machine
# TODO: Get this working on darwin
email = {
enable = mkEnableOption "Email";
};
email = { enable = mkEnableOption "Email"; };
};
# Linux specific programs
programs = {
@ -42,12 +45,11 @@ with lib; with nLib; {
gpg = mkEnableOptionT "gpg";
};
devel = {
jvm = mkDefaultOption "JVM Development Utilites" config.nathan.config.isDesktop;
jvm = mkDefaultOption "JVM Development Utilites"
config.nathan.config.isDesktop;
};
# Install games
games = {
launcher = mkEnableOption "Game launcher";
};
games = { launcher = mkEnableOption "Game launcher"; };
# Swaywm and supoorting application configuration
swaywm = {
enable = mkDefaultOption "swaywm" config.nathan.config.isDesktop;
@ -55,20 +57,24 @@ with lib; with nLib; {
# Communications applications
communications = {
# Enable by default if we are on a linux desktop
enable = mkDefaultOption "Communication applications" (config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
enable = mkDefaultOption "Communication applications"
(config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
};
# Image editing software, on by default on desktop
image-editing = mkDefaultOption "Image Editing Software" config.nathan.config.isDesktop;
image-editing = mkDefaultOption "Image Editing Software"
config.nathan.config.isDesktop;
# Media appilcations, on by default on linux desktop
media = {
enable = mkDefaultOption "Media Applications" (config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
enable = mkDefaultOption "Media Applications"
(config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
mopidyExtraConfig = mkOption {
description = "Extra config files for mopidy";
default = [ ];
};
};
# Firefox, enabled by default on linux desktop
firefox = mkDefaultOption "Firefox" (config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
firefox = mkDefaultOption "Firefox"
(config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
};
};
};
@ -80,7 +86,8 @@ with lib; with nLib; {
enable = config.nathan.programs.firefox;
package = pkgs.firefox-beta-bin;
};
nathan.programs.emacs.package = lib.mkDefault inputs.emacs.packages."${pkgs.system}".emacsPgtkNativeComp;
nathan.programs.emacs.package =
lib.mkDefault inputs.emacs.packages."${pkgs.system}".emacsPgtkNativeComp;
# We should be managing xdg stuff
xdg = {
enable = true;

View File

@ -4,32 +4,38 @@
config = lib.mkIf config.nathan.programs.communications.enable {
home.packages = with pkgs;
let
unstable = import inputs.nixpkgs-unstable { config = { allowUnfree = true; }; inherit system; };
enableWayland = drv: bin: drv.overrideAttrs (
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.makeWrapper ];
unstable = import inputs.nixpkgs-unstable {
config = { allowUnfree = true; };
inherit system;
};
enableWayland = drv: bin:
drv.overrideAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ])
++ [ pkgs.makeWrapper ];
postFixup = (old.postFixup or "") + ''
wrapProgram $out/bin/${bin} \
--add-flags "--enable-features=UseOzonePlatform" \
--add-flags "--ozone-platform=wayland"
'';
}
);
discordWayland = pkgs.callPackage ../../../packages/discord/default.nix rec {
pname = "discord-electron";
binaryName = "Discord";
desktopName = "Discord (Wayland)";
version = "0.0.20";
src = fetchurl {
url = "https://dl.discordapp.net/apps/linux/${version}/discord-${version}.tar.gz";
hash = "sha256-3f7yuxigEF3e8qhCetCHKBtV4XUHsx/iYiaCCXjspYw=";
});
discordWayland =
pkgs.callPackage ../../../packages/discord/default.nix rec {
pname = "discord-electron";
binaryName = "Discord";
desktopName = "Discord (Wayland)";
version = "0.0.20";
src = fetchurl {
url =
"https://dl.discordapp.net/apps/linux/${version}/discord-${version}.tar.gz";
hash = "sha256-3f7yuxigEF3e8qhCetCHKBtV4XUHsx/iYiaCCXjspYw=";
};
electron = pkgs.electron_13;
};
electron = pkgs.electron_13;
};
zulipWayland = pkgs.makeDesktopItem {
name = "zulip-wayland";
desktopName = "Zulip (Wayland)";
exec = "${unstable.zulip}/bin/zulip --enable-features=UseOzonePlatform --ozone-platform=wayland";
exec =
"${unstable.zulip}/bin/zulip --enable-features=UseOzonePlatform --ozone-platform=wayland";
terminal = false;
icon = "zulip";
type = "Application";
@ -38,25 +44,27 @@
fbChromeDesktopItem = pkgs.makeDesktopItem {
name = "messenger-chrome";
desktopName = "Messenger (chrome)";
exec = "${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform -ozone-platform=wayland \"--app=https://messenger.com\"";
exec = ''
${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform -ozone-platform=wayland "--app=https://messenger.com"'';
terminal = false;
};
# Teams
teamsItem = pkgs.makeDesktopItem {
name = "teams-wayland";
desktopName = "Teams (Wayland)";
exec = "${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform -ozone-platform=wayland \"--app=https://teams.microsoft.com\"";
exec = ''
${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform -ozone-platform=wayland "--app=https://teams.microsoft.com"'';
terminal = false;
};
# Cinny
cinnyItem = pkgs.makeDesktopItem {
name = "cinny";
desktopName = "Cinny";
exec = "${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform -ozone-platform=wayland \"--app=https://app.cinny.in\"";
exec = ''
${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform -ozone-platform=wayland "--app=https://app.cinny.in"'';
terminal = false;
};
in
[
in [
# Discord
discordWayland
betterdiscordctl

View File

@ -2,15 +2,19 @@
let
devel = config.nathan.programs.devel;
unstable = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}";
inherit (import ../../../modules/lib.nix { inherit lib; inherit pkgs; }) nLib;
in
inherit (import ../../../modules/lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
with lib; with nLib; {
in with lib;
with nLib; {
config = mkMerge [
# Core development utilites
(mkIf devel.core {
home.packages = with pkgs;
# Linux specific packages
# Linux specific packages
[
clang
unstable.mold
@ -18,9 +22,10 @@ with lib; with nLib; {
})
# Rust development
(mkIf devel.rust {
home.packages = with pkgs; [
unstable.cargo-tarpaulin # Code coverage
];
home.packages = with pkgs;
[
unstable.cargo-tarpaulin # Code coverage
];
})
# JVM Development
(mkIf devel.jvm {

View File

@ -5,9 +5,7 @@ with lib; {
# eidolon game launcher
(mkIf config.nathan.programs.games.launcher {
# Install the launcher
home.packages = with pkgs; [
eidolon
];
home.packages = with pkgs; [ eidolon ];
})
];
}

View File

@ -2,9 +2,7 @@
{
config = lib.mkIf config.nathan.programs.util.gpg {
programs.gpg = {
enable = true;
};
programs.gpg = { enable = true; };
services.gpg-agent = {
enable = true;
enableSshSupport = true;

View File

@ -1,8 +1,6 @@
{ config, lib, pkgs, inputs, ... }:
let
unstable = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}";
in
{
let unstable = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}";
in {
config = lib.mkIf config.nathan.programs.image-editing {
home.packages = with pkgs; [
# RawTherapee for raw editing

View File

@ -1,14 +1,17 @@
{ config, lib, pkgs, inputs, ... }:
let
unstable = import inputs.nixpkgs-unstable { config = { allowUnfree = true; }; system = pkgs.system; };
unstable = import inputs.nixpkgs-unstable {
config = { allowUnfree = true; };
system = pkgs.system;
};
irisDesktopItem = pkgs.makeDesktopItem {
name = "iris";
desktopName = "Iris";
exec = "${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform -ozone-platform=wayland \"--app=http://localhost:6680/iris/\"";
exec = ''
${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform -ozone-platform=wayland "--app=http://localhost:6680/iris/"'';
terminal = false;
};
in
{
in {
config = lib.mkIf config.nathan.programs.media.enable {
# General Packages
home.packages = with pkgs; [
@ -33,18 +36,12 @@ in
];
# extraConfigFiles = config.nathan.programs.media.mopidyExtraConfig;
settings = {
file = {
media_dirs = [
"~/Music"
];
};
file = { media_dirs = [ "~/Music" ]; };
local = {
enabled = true;
media_dir = "~/Music";
};
mpd = {
enabled = true;
};
mpd = { enabled = true; };
};
};
};

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,6 @@
{
config = lib.mkIf config.nathan.programs.util.wine {
home.packages = with pkgs; [
proton-caller
wineWowPackages.waylandFull
];
home.packages = with pkgs; [ proton-caller wineWowPackages.waylandFull ];
};
}

View File

@ -3,11 +3,7 @@
with lib; {
config = mkIf config.nathan.services.email.enable {
# Packages used for mbsync + mu + protonmail-bridge
home.packages = with pkgs; [
pass
protonmail-bridge
mu
];
home.packages = with pkgs; [ pass protonmail-bridge mu ];
# Configure protonmail as a service
systemd.user.services.protonmail-bridge = {
Unit = {
@ -29,9 +25,7 @@ with lib; {
maildirBasePath = ".mail";
accounts = {
"nathan@mccarty.io" = {
maildir = {
path = "nathan@mccarty.io";
};
maildir = { path = "nathan@mccarty.io"; };
address = "nathan@mccarty.io";
primary = true;
realName = "Nathan McCarty";
@ -47,7 +41,8 @@ with lib; {
port = 1143;
tls = {
useStartTls = true;
certificatesFile = ../../../certificates/protonmail-${nixosConfig.networking.hostName}.pem;
certificatesFile =
../../../certificates/protonmail-${nixosConfig.networking.hostName}.pem;
};
};
smtp = {
@ -55,7 +50,8 @@ with lib; {
port = 1025;
tls = {
useStartTls = true;
certificatesFile = ../../../certificates/protonmail-${nixosConfig.networking.hostName}.pem;
certificatesFile =
../../../certificates/protonmail-${nixosConfig.networking.hostName}.pem;
};
};
mbsync = {
@ -64,37 +60,27 @@ with lib; {
remove = "both";
};
mu.enable = true;
msmtp = {
enable = true;
};
msmtp = { enable = true; };
};
};
};
## Enable email applications
# Setup mbsync for incoming emails
# For fun reasons this requires enabling the program and the service
programs.mbsync = {
enable = true;
};
programs.mbsync = { enable = true; };
services.mbsync = {
enable = true;
frequency = "*:0/1";
# Index manually with mu if we don't have emacs setup, but if we have the emacs service setup,
# run through emacsclient, as it will have the lock
postExec =
if config.nathan.programs.emacs.service
then
"${../../../scripts/update-mu4e.sh}"
else
"${pkgs.mu}/bin/mu index";
postExec = if config.nathan.programs.emacs.service then
"${../../../scripts/update-mu4e.sh}"
else
"${pkgs.mu}/bin/mu index";
};
# Setup mu for indexing emails
programs.mu = {
enable = true;
};
programs.mu = { enable = true; };
# Setup msmtp for outbound emails
programs.msmtp = {
enable = true;
};
programs.msmtp = { enable = true; };
};
}

View File

@ -1,8 +1,7 @@
{ config, lib, pkgs, inputs, ... }:
let
stray = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".syncthingtray;
in
{
in {
config = lib.mkIf config.nathan.services.syncthing {
services.syncthing = {
enable = true;
@ -13,9 +12,7 @@ in
};
# Add a delay to the service so it will start up after the bar
systemd.user.services.syncthingtray = {
Service = {
ExecStartPre = "/run/current-system/sw/bin/sleep 5";
};
Service = { ExecStartPre = "/run/current-system/sw/bin/sleep 5"; };
};
};
}

View File

@ -1,8 +1,12 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (import ../../modules/lib.nix { inherit lib; inherit pkgs; }) nLib;
in
with lib; with nLib; {
inherit (import ../../modules/lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in with lib;
with nLib; {
imports = [
../options.nix
../common/programs/core.nix

View File

@ -1,9 +1,12 @@
{ config, lib, pkgs, ... }:
let
inherit (import ../modules/lib.nix { inherit lib; inherit pkgs; }) nLib;
in
with lib; with nLib;
{
inherit (import ../modules/lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in with lib;
with nLib; {
options = {
nathan = {
programs = {
@ -17,30 +20,36 @@ with lib; with nLib;
# Git configuration, enabled by default
git = {
enable = mkEnableOptionT "git";
gpgSign = mkDefaultOption "git signatures" config.nathan.config.isDesktop;
gpgSign =
mkDefaultOption "git signatures" config.nathan.config.isDesktop;
};
# Bat configuration, enabled by default
bat = mkEnableOptionT "bat";
# JSON Utilities, enabled by default
json = mkEnableOptionT "json";
# Productivity application
productivity = mkDefaultOption "Productivity applications" config.nathan.config.isDesktop;
productivity = mkDefaultOption "Productivity applications"
config.nathan.config.isDesktop;
};
# Development applications, enabled by default on desktop
devel = {
core = mkDefaultOption "Core Development Utilites" config.nathan.config.isDesktop;
rust = mkDefaultOption "Rust Development Utilites" config.nathan.config.isDesktop;
python = mkDefaultOption "Python Development Utilites" config.nathan.config.isDesktop;
js = mkDefaultOption "JavaScript/TypeScript Development Utilites" config.nathan.config.isDesktop;
raku = mkDefaultOption "Raku Development Utilites" config.nathan.config.isDesktop;
core = mkDefaultOption "Core Development Utilites"
config.nathan.config.isDesktop;
rust = mkDefaultOption "Rust Development Utilites"
config.nathan.config.isDesktop;
python = mkDefaultOption "Python Development Utilites"
config.nathan.config.isDesktop;
js = mkDefaultOption "JavaScript/TypeScript Development Utilites"
config.nathan.config.isDesktop;
raku = mkDefaultOption "Raku Development Utilites"
config.nathan.config.isDesktop;
};
# Emacs, enabled by default on desktop
emacs = {
enable = mkDefaultOption "Emacs" config.nathan.config.isDesktop;
service = mkDefaultOption "Emacs Service" config.nathan.config.isDesktop;
package = mkOption {
description = "Emacs package to use";
};
service =
mkDefaultOption "Emacs Service" config.nathan.config.isDesktop;
package = mkOption { description = "Emacs package to use"; };
};
};
# General configuration options

View File

@ -0,0 +1,8 @@
{ config, lib, pkgs, inputs, ... }:
{
# Setup system configuration
nathan = { config = { isDesktop = true; }; };
# Setup home manager
home-manager.users.nathan = import ./home.nix;
}

View File

@ -0,0 +1,8 @@
{ config, lib, pkgs, ... }:
{
nathan = {
programs = { util = { git = { gpgSign = false; }; }; };
config = { isDesktop = true; };
};
}

View File

@ -2,14 +2,8 @@
{
nathan = {
services = {
email = {
enable = true;
};
};
config = {
isDesktop = true;
};
services = { email = { enable = true; }; };
config = { isDesktop = true; };
};
# # Sway outputs

View File

@ -18,9 +18,7 @@
};
# Setup system configuration
nathan = {
programs = {
games = true;
};
programs = { games = true; };
services = {
borg = {
enable = true;
@ -33,9 +31,7 @@
sshKey = config.sops.secrets."borg-ssh-key".path;
};
};
hardware = {
amdPassthrough = true;
};
hardware = { amdPassthrough = true; };
config = {
isDesktop = true;
setupGrub = true;
@ -68,30 +64,21 @@
home-manager.users.nathan = import ./home.nix;
# TPM setup
security = {
tpm2 = {
enable = true;
};
};
security = { tpm2 = { enable = true; }; };
boot = {
initrd = {
kernelModules = [ "tpm_crb" ];
systemd = {
enable = true;
};
systemd = { enable = true; };
};
kernelParams = [ "crypt-pv.luks.options=tpm2-device=auto" ];
};
# Install gamescope
environment.systemPackages = [
inputs.gamescope.defaultPackage."x86_64-linux"
];
environment.systemPackages =
[ inputs.gamescope.defaultPackage."x86_64-linux" ];
nixpkgs.config.packageOverrides = pkgs: {
steam = pkgs.steam.override {
extraPkgs = pkgs: [
inputs.gamescope.defaultPackage."x86_64-linux"
];
extraPkgs = pkgs: [ inputs.gamescope.defaultPackage."x86_64-linux" ];
};
};

View File

@ -2,21 +2,11 @@
{
nathan = {
services = {
email = {
enable = true;
};
};
config = {
isDesktop = true;
};
services = { email = { enable = true; }; };
config = { isDesktop = true; };
programs = {
util = {
wine = true;
};
games = {
launcher = true;
};
util = { wine = true; };
games = { launcher = true; };
};
};
@ -43,7 +33,10 @@
# GLPaper
{ command = "glpaper DP-1 ${../../custom-files/sway/selen.frag} --fork"; }
{ command = "glpaper DP-3 ${../../custom-files/sway/selen.frag} --fork"; }
{ command = "glpaper HDMI-A-1 ${../../custom-files/sway/selen.frag} --fork"; }
{
command =
"glpaper HDMI-A-1 ${../../custom-files/sway/selen.frag} --fork";
}
];
};
# Mako output configuration

View File

@ -53,9 +53,7 @@
autoGC = true;
};
harden = false;
virtualization = {
docker = true;
};
virtualization = { docker = true; };
};
};
# Configure bootloader
@ -69,9 +67,7 @@
terminal_input serial;
terminal_output serial
'';
boot.kernelParams = [
"console=ttyS0"
];
boot.kernelParams = [ "console=ttyS0" ];
# Configure networking
networking = {
domain = "community.rs";
@ -101,9 +97,7 @@
};
# Add www-html for my self
users.users.nathan = {
extraGroups = [ "www-html" ];
};
users.users.nathan = { extraGroups = [ "www-html" ]; };
# Configure matrix registration
services.matrix-synapse = {
@ -112,8 +106,12 @@
allow_guest_access = false;
allow_public_rooms_over_federation = true;
experimental_features = { spaces_enabled = true; };
auto_join_rooms = [ "#space:community.rs" "#rules:community.rs" "#info:community.rs" ];
turn_uris = [ "turn:turn.community.rs:3478?transport=udp" "turn:turn.community.rs:3478?transport=tcp" ];
auto_join_rooms =
[ "#space:community.rs" "#rules:community.rs" "#info:community.rs" ];
turn_uris = [
"turn:turn.community.rs:3478?transport=udp"
"turn:turn.community.rs:3478?transport=tcp"
];
turn_user_lifetime = "1h";
};
extraConfigFiles = [ config.sops.secrets."matrix-secrets.yaml".path ];
@ -151,74 +149,63 @@
};
# Configure the vhost for the domain
services.nginx.virtualHosts =
let
fqdn =
let
join = hostName: domain: hostName + lib.optionalString (domain != null) ".${domain}";
in
join config.networking.hostName config.networking.domain;
in
{
"${config.networking.domain}" = {
enableACME = true;
forceSSL = true;
services.nginx.virtualHosts = let
fqdn = let
join = hostName: domain:
hostName + lib.optionalString (domain != null) ".${domain}";
in join config.networking.hostName config.networking.domain;
in {
"${config.networking.domain}" = {
enableACME = true;
forceSSL = true;
locations."= /.well-known/matrix/server".extraConfig =
let
# use 443 instead of the default 8448 port to unite
# the client-server and server-server port for simplicity
server = { "m.server" = "${fqdn}:443"; };
in
''
add_header Content-Type application/json;
return 200 '${builtins.toJSON server}';
'';
locations."= /.well-known/matrix/client".extraConfig =
let
client = {
"m.homeserver" = { "base_url" = "https://${fqdn}"; };
"m.identity_server" = { "base_url" = "https://vector.im"; };
};
# ACAO required to allow element-web on any URL to request this json file
in
''
add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}';
'';
locations."/".extraConfig = ''
rewrite ^(.*)$ http://www.community.rs$1 redirect;
'';
};
# Main domain
"www.community.rs" = {
enableACME = true;
forceSSL = true;
locations."= /.well-known/matrix/server".extraConfig =
let
# use 443 instead of the default 8448 port to unite
# the client-server and server-server port for simplicity
server = { "m.server" = "${fqdn}:443"; };
in
''
add_header Content-Type application/json;
return 200 '${builtins.toJSON server}';
'';
locations."= /.well-known/matrix/client".extraConfig =
let
client = {
"m.homeserver" = { "base_url" = "https://${fqdn}"; };
"m.identity_server" = { "base_url" = "https://vector.im"; };
};
# ACAO required to allow element-web on any URL to request this json file
in
''
add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}';
'';
root = "/var/www";
};
locations."= /.well-known/matrix/server".extraConfig = let
# use 443 instead of the default 8448 port to unite
# the client-server and server-server port for simplicity
server = { "m.server" = "${fqdn}:443"; };
in ''
add_header Content-Type application/json;
return 200 '${builtins.toJSON server}';
'';
locations."= /.well-known/matrix/client".extraConfig = let
client = {
"m.homeserver" = { "base_url" = "https://${fqdn}"; };
"m.identity_server" = { "base_url" = "https://vector.im"; };
};
# ACAO required to allow element-web on any URL to request this json file
in ''
add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}';
'';
locations."/".extraConfig = ''
rewrite ^(.*)$ http://www.community.rs$1 redirect;
'';
};
# Main domain
"www.community.rs" = {
enableACME = true;
forceSSL = true;
locations."= /.well-known/matrix/server".extraConfig = let
# use 443 instead of the default 8448 port to unite
# the client-server and server-server port for simplicity
server = { "m.server" = "${fqdn}:443"; };
in ''
add_header Content-Type application/json;
return 200 '${builtins.toJSON server}';
'';
locations."= /.well-known/matrix/client".extraConfig = let
client = {
"m.homeserver" = { "base_url" = "https://${fqdn}"; };
"m.identity_server" = { "base_url" = "https://vector.im"; };
};
# ACAO required to allow element-web on any URL to request this json file
in ''
add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}';
'';
root = "/var/www";
};
};
}

View File

@ -63,9 +63,7 @@
autoGC = true;
};
harden = false;
virtualization = {
docker = true;
};
virtualization = { docker = true; };
};
};
# Configure bootloader
@ -92,96 +90,91 @@
home-manager.users.nathan = import ./home.nix;
# Setup minecraft container
containers.minecraft =
let
b2AccountID = "00284106ead1ac40000000002";
b2KeyFile = "${config.sops.secrets."friendpack-backblaze".path}";
b2Bucket = "ForwardProgressServerBackup";
in
{
config = { pkgs, lib, ... }@attrs:
let
# OpenJDK 17
javaPackage = pkgs.jdk;
in
{
imports = [
inputs.quilt-server.nixosModules.default
];
###
## Container stuff
###
# Let nix know this is a container
boot.isContainer = true;
# Set system state version
system.stateVersion = "22.05";
# Setup networking
networking.useDHCP = false;
# Allow minecraft out
networking.firewall.allowedTCPPorts = [ 25565 ];
containers.minecraft = let
b2AccountID = "00284106ead1ac40000000002";
b2KeyFile = "${config.sops.secrets."friendpack-backblaze".path}";
b2Bucket = "ForwardProgressServerBackup";
in {
config = { pkgs, lib, ... }@attrs:
let
# OpenJDK 17
javaPackage = pkgs.jdk;
in {
imports = [ inputs.quilt-server.nixosModules.default ];
###
## Container stuff
###
# Let nix know this is a container
boot.isContainer = true;
# Set system state version
system.stateVersion = "22.05";
# Setup networking
networking.useDHCP = false;
# Allow minecraft out
networking.firewall.allowedTCPPorts = [ 25565 ];
###
## User
###
users = {
mutableUsers = false;
# Enable us to not use a password, this is a container
allowNoPasswordLogin = true;
};
###
## User
###
users = {
mutableUsers = false;
# Enable us to not use a password, this is a container
allowNoPasswordLogin = true;
};
###
## Configure module
###
forward-progress = {
services = {
minecraft = {
enable = true;
minecraft-version = "1.18.2";
quilt-version = "0.17.1-beta.6";
ram = 6144;
properties = {
motd = "Nathan's Private Modded Minecraft";
white-list = true;
enforce-whitelist = true;
};
packwiz-url = "https://pack.forward-progress.net/0.3/pack.toml";
acceptEula = true;
###
## Configure module
###
forward-progress = {
services = {
minecraft = {
enable = true;
minecraft-version = "1.18.2";
quilt-version = "0.17.1-beta.6";
ram = 6144;
properties = {
motd = "Nathan's Private Modded Minecraft";
white-list = true;
enforce-whitelist = true;
};
backup = {
packwiz-url = "https://pack.forward-progress.net/0.3/pack.toml";
acceptEula = true;
};
backup = {
enable = true;
backblaze = {
enable = true;
backblaze = {
enable = true;
accountId = b2AccountID;
keyFile = b2KeyFile;
bucket = b2Bucket;
};
accountId = b2AccountID;
keyFile = b2KeyFile;
bucket = b2Bucket;
};
};
};
};
autoStart = true;
bindMounts = {
"/var/minecraft" = {
hostPath = "/var/minecraft";
isReadOnly = false;
};
"/run/secrets/friendpack-backblaze" = {
hostPath = "/run/secrets/friendpack-backblaze";
};
};
forwardPorts = [
{
containerPort = 25565;
hostPort = 25565;
protocol = "tcp";
}
{
containerPort = 25565;
hostPort = 25565;
protocol = "udp";
}
];
autoStart = true;
bindMounts = {
"/var/minecraft" = {
hostPath = "/var/minecraft";
isReadOnly = false;
};
"/run/secrets/friendpack-backblaze" = {
hostPath = "/run/secrets/friendpack-backblaze";
};
};
forwardPorts = [
{
containerPort = 25565;
hostPort = 25565;
protocol = "tcp";
}
{
containerPort = 25565;
hostPort = 25565;
protocol = "udp";
}
];
};
# Setup vhost for pack website
services.nginx.virtualHosts."pack.forward-progress.net" = {
@ -200,56 +193,48 @@
};
# Setup the gitlab runners
services.gitlab-runner =
let
nix-shared = with lib; {
dockerImage = "nixpkgs/nix-flakes";
dockerVolumes = [
"/var/sharedstore:/sharedstore"
];
dockerDisableCache = true;
dockerPrivileged = true;
};
in
{
enable = true;
concurrent = 4;
checkInterval = 1;
services = {
# default-asuran = {
# registrationConfigFile = "/var/lib/secret/gitlab-runner/asuran-default";
# dockerImage = "debian:stable";
# dockerVolumes = [
# "/var/run/docker.sock:/var/run/docker.sock"
# ];
# dockerPrivileged = true;
# tagList = [ "linux-own" ];
# };
services.gitlab-runner = let
nix-shared = with lib; {
dockerImage = "nixpkgs/nix-flakes";
dockerVolumes = [ "/var/sharedstore:/sharedstore" ];
dockerDisableCache = true;
dockerPrivileged = true;
};
in {
enable = true;
concurrent = 4;
checkInterval = 1;
services = {
# default-asuran = {
# registrationConfigFile = "/var/lib/secret/gitlab-runner/asuran-default";
# dockerImage = "debian:stable";
# dockerVolumes = [
# "/var/run/docker.sock:/var/run/docker.sock"
# ];
# dockerPrivileged = true;
# tagList = [ "linux-own" ];
# };
nix-asuran = nix-shared // {
registrationConfigFile = config.sops.secrets.nix-asuran.path;
tagList = [ "nix" ];
requestConcurrency = 8;
limit = 4;
runUntagged = true;
};
nix-asuran = nix-shared // {
registrationConfigFile = config.sops.secrets.nix-asuran.path;
tagList = [ "nix" ];
requestConcurrency = 8;
limit = 4;
runUntagged = true;
};
};
};
# Setup searx-ng docker
virtualisation.oci-containers.containers."searx-ng" = {
image = "searxng/searxng";
autoStart = true;
ports = [ "8091:8080" ];
volumes = [
"/var/searxng:/etc/searxng"
];
volumes = [ "/var/searxng:/etc/searxng" ];
};
services.nginx.virtualHosts."searx-ng.mccarty.io" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:8091";
};
locations."/" = { proxyPass = "http://localhost:8091"; };
};
}

View File

@ -1,10 +1,6 @@
{ config, lib, pkgs, ... }:
{
nathan = {
config = {
isDesktop = true;
};
};
nathan = { config = { isDesktop = true; }; };
home-manager.config = import ./home.nix;
}

View File

@ -1,9 +1,5 @@
{ config, lib, pkgs, ... }:
{
nathan = {
config = {
isDesktop = true;
};
};
nathan = { config = { isDesktop = true; }; };
}

View File

@ -34,10 +34,7 @@
};
borg = {
enable = true;
extraExcludes = [
"/var/lib/docker"
"/var/log"
];
extraExcludes = [ "/var/lib/docker" "/var/log" ];
passwordFile = config.sops.secrets."borg-password".path;
sshKey = config.sops.secrets."borg-ssh-key".path;
};
@ -49,9 +46,7 @@
autoGC = true;
};
harden = false;
virtualization = {
docker = true;
};
virtualization = { docker = true; };
};
};
# Configure networking
@ -87,14 +82,9 @@
"3080:80"
"30443:443"
];
volumes = [
"/var/lib/pihole/:/etc/pihole/"
"/var/lib/dnsmasq.d:/etc/dnsmasq.d/"
];
extraOptions = [
"--cap-add=NET_ADMIN"
"--dns=1.1.1.1"
];
volumes =
[ "/var/lib/pihole/:/etc/pihole/" "/var/lib/dnsmasq.d:/etc/dnsmasq.d/" ];
extraOptions = [ "--cap-add=NET_ADMIN" "--dns=1.1.1.1" ];
};
# Nginx virtual hosts

View File

@ -15,9 +15,7 @@
};
};
# Configure networking
networking = {
domain = "mccarty.io";
};
networking = { domain = "mccarty.io"; };
# Setup home manager
home-manager.users.nathan = import ./home.nix;
# Setup WSL

View File

@ -9,9 +9,7 @@
};
};
programs = {
util = {
productivity = true;
};
util = { productivity = true; };
devel = {
core = true;
rust = true;

View File

@ -2,9 +2,7 @@
{
nathan = {
programs = {
games = true;
};
programs = { games = true; };
config = {
isDesktop = true;
nix.autoUpdate = false;
@ -13,7 +11,5 @@
home-manager.users.nathan = import ./home.nix;
# Workaround to get sway working in qemu
environment.variables = {
"WLR_RENDERER" = "pixman";
};
environment.variables = { "WLR_RENDERER" = "pixman"; };
}

View File

@ -2,11 +2,7 @@
{
nathan = {
programs = {
util.git.gpgSign = false;
};
config = {
isDesktop = true;
};
programs = { util.git.gpgSign = false; };
config = { isDesktop = true; };
};
}

View File

@ -1,33 +1,26 @@
{ config, lib, pkgs, ... }:
let
nathan = config.nathan;
in
with lib;
{
let nathan = config.nathan;
in with lib; {
config = mkMerge [
(mkIf nathan.programs.utils.core
{
environment.systemPackages = with pkgs; [
# Basic command line utilities
wget
tmux
nano
unzip
any-nix-shell
htop
# For nslookup
dnsutils
# Mosh for better high-latency ssh
mosh
# PV for viewing pipes
pv
];
})
(mkIf nathan.programs.utils.devel {
(mkIf nathan.programs.utils.core {
environment.systemPackages = with pkgs; [
gcc
binutils
# Basic command line utilities
wget
tmux
nano
unzip
any-nix-shell
htop
# For nslookup
dnsutils
# Mosh for better high-latency ssh
mosh
# PV for viewing pipes
pv
];
})
(mkIf (nathan.programs.utils.devel && pkgs.stdenv.isLinux) {
environment.systemPackages = with pkgs; [ gcc binutils ];
})
];
}

View File

@ -0,0 +1,90 @@
{ config, lib, pkgs, ... }:
let
inherit (import ../lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in {
imports =
[ ../options.nix ../common/programs/utils.nix ./user.nix ./fonts.nix ];
options = with lib;
with nLib; {
nathan = {
config = {
# Install fonts
# On by default if the system is a desktop
fonts = mkDefaultOption "fonts" config.nathan.config.isDesktop;
};
programs = {
util = {
# Core macos utilities like iterm2 and what not
core = mkDefaultOption "core" true;
};
# Firefox, enabled by default on linux desktop
firefox = mkDefaultOption "Firefox" config.nathan.config.isDesktop;
syncthing =
mkDefaultOption "syncthing" config.nathan.config.isDesktop;
# Communications applications
communications = {
# Enable by default if we are on a linux desktop
enable = mkDefaultOption "Communication applications"
config.nathan.config.isDesktop;
};
};
};
};
config = {
# Link applications in spotlight/launchpad
system.activationScripts.applications.text = pkgs.lib.mkForce (''
echo "setting up ~/Applications..." >&2
rm -rf ~/Applications/Nix\ Apps
mkdir -p ~/Applications/Nix\ Apps
for app in $(find ${config.system.build.applications}/Applications -maxdepth 1 -type l); do
src="$(/usr/bin/stat -f%Y "$app")"
cp -r "$src" ~/Applications/Nix\ Apps
done
'');
# Set system state version
system.stateVersion = 4;
# Enable flakes
# Enable nix flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
services.nix-daemon.enable = true;
# Replace some macos packages
environment.systemPackages = with pkgs; [ coreutils-full openssh ];
programs.zsh.enable = true;
programs.fish.enable = true;
# Make nix managed fonts work
fonts.fontDir.enable = true;
# Make nix assume control of homebrew
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
upgrade = true;
cleanup = "zap";
};
casks = lib.mkMerge [
(lib.mkIf config.nathan.programs.util.core [{ name = "iterm2"; }])
(lib.mkIf config.nathan.programs.firefox [{ name = "firefox"; }])
(lib.mkIf config.nathan.programs.communications.enable [
{ name = "discord"; }
{ name = "betterdiscord-installer"; }
])
];
brews = lib.mkMerge [
(lib.mkIf config.nathan.programs.syncthing [{
name = "syncthing";
restart_service = true;
start_service = true;
}])
];
};
};
}

18
modules/darwin/fonts.nix Normal file
View File

@ -0,0 +1,18 @@
{ config, lib, pkgs, ... }:
let nc = config.nathan.config;
in with lib; {
# Generic desktop configuration
config = mkIf nc.fonts {
fonts.fonts = with pkgs; [
## Monospace Fonts
# FiraCode with nerd-fonts patch, as well as fira-code symbols for emacs
(nerdfonts.override { fonts = [ "FiraCode" ]; })
fira-code-symbols
fira
# Proportional
roboto
liberation_ttf
noto-fonts
];
};
}

22
modules/darwin/user.nix Normal file
View File

@ -0,0 +1,22 @@
{ config, lib, pkgs, ... }:
let nc = config.nathan.config;
in with lib; {
config = mkMerge [{
# Configure our user, if enabled
users.users."${nc.user}" = {
# Darwin is special
home = if pkgs.stdenv.isDarwin then
"/Users/${nc.user}"
else
"/home/${nc.user}";
description = "Nathan McCarty";
shell = pkgs.fish;
};
# If we isntall the user, make them trusted
nix.settings.trusted-users = [ "${nc.user}" ];
# If we setup the user, install the shell as well
environment.systemPackages = [ pkgs.fish ];
# Configure the timezone
time.timeZone = "America/New_York";
}];
}

View File

@ -3,19 +3,21 @@
{
nLib = {
# mkEnableOption, but defaults to true
mkEnableOptionT = name: lib.mkOption {
default = true;
example = false;
description = "Whether to enable ${name}.";
type = lib.types.bool;
};
mkEnableOptionT = name:
lib.mkOption {
default = true;
example = false;
description = "Whether to enable ${name}.";
type = lib.types.bool;
};
# mkEnableOption, but with a default
mkDefaultOption = name: default: lib.mkOption {
default = default;
example = false;
description = "Whether to enable ${name}.";
type = lib.types.bool;
};
mkDefaultOption = name: default:
lib.mkOption {
default = default;
example = false;
description = "Whether to enable ${name}.";
type = lib.types.bool;
};
# Returns an empty list if the current system is not linux
ifLinux = value: if pkgs.stdenv.isLinux then value else [ ];
# Appends if the predicate is true

View File

@ -1,8 +1,11 @@
{ config, lib, pkgs, ... }:
let
inherit (import ../lib.nix { inherit lib; inherit pkgs; }) nLib;
in
{
inherit (import ../lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in {
imports = [
../options.nix
./base.nix
@ -23,163 +26,169 @@ in
./linux/base.nix
];
options = with lib; with nLib; {
nathan = {
# Control enabling of services
# Services are system specific so they go here
services = {
# Use zramSwap, enabled by default
zramSwap = mkDefaultOption "zram memory compression" config.nathan.config.isDesktop;
# Enable ssh and configure firewall
# On by default
ssh = mkEnableOptionT "ssh";
# Enable tailscale, on by default on linux
tailscale = {
enable = mkDefaultOption "tailscale" pkgs.stdenv.isLinux;
};
# Borg backup
# Disabled by default as it requires configuration, but a really good idea to turn on
borg = {
enable = mkEnableOption "borg";
extraExcludes = mkOption {
default = [ ];
description = "List of extra paths to exclude";
};
extraIncludes = mkOption {
default = [ ];
description = "List of extra paths to include";
};
location = mkOption {
default = "de1955@de1955.rsync.net:computers";
description = "Location to backup to";
type = lib.types.str;
};
passwordFile = mkOption {
description = "Path to the password file";
type = lib.types.str;
};
sshKey = mkOption {
description = "Path to the ssh key";
type = lib.types.str;
};
startAt = mkOption {
description = "How often to run backups";
default = "hourly";
};
};
# Nginx
nginx = {
enable = mkEnableOption "nginx";
acme = mkEnableOption "ACME Integration";
};
# Matrix
matrix = {
enable = mkEnableOption "matrix";
baseDomain = mkOption {
description = "Base domain to use for the matrix services";
example = "mccarty.io";
type = lib.types.str;
};
element = mkDefaultOption "element" config.nathan.services.matrix.enable;
enableRegistration = mkEnableOption "synapse registration";
};
};
# Linux (desktop/server, not android) specific programs
programs = {
# Install games
games = mkEnableOption "games";
# Install gpg with yubikey support
# Enabled by default if the system is a desktop
gpg = mkDefaultOption "gpg" config.nathan.config.isDesktop;
utils = {
# Enable multi system emulation
# Enabled by default on desktop
binfmt = mkDefaultOption "binfmt" config.nathan.config.isDesktop;
};
};
# Control enabling of hardware support
hardware = {
# Logitech hardware support
# On by default if the system is a desktop
logitech = mkDefaultOption "logitech" config.nathan.config.isDesktop;
# AMD Single gpu passthrough
amdPassthrough = mkEnableOption "logitech";
};
# Linux specific configuration
config = {
# Wether or not to install the main user
installUser = mkOption {
default = pkgs.stdenv.isLinux;
example = true;
description = "Whether to install the 'nathan' user";
type = lib.types.bool;
};
# Should we harden this system?
# On by default
harden = mkEnableOptionT "Apply system hardening";
# Enable audio subsystem
# On by default if the system is a desktop
audio = mkDefaultOption "audio" config.nathan.config.isDesktop;
# Basic grub configuration
# Off by default
setupGrub = mkEnableOption "Setup grub";
# Install fonts
# On by default if the system is a desktop
fonts = mkDefaultOption "fonts" config.nathan.config.isDesktop;
# Enable unfree software
# On by default
enableUnfree = mkEnableOptionT "unfree software";
# Nix configuration
nix = {
# Automatic GC and optimization of the nix store
options = with lib;
with nLib; {
nathan = {
# Control enabling of services
# Services are system specific so they go here
services = {
# Use zramSwap, enabled by default
zramSwap = mkDefaultOption "zram memory compression"
config.nathan.config.isDesktop;
# Enable ssh and configure firewall
# On by default
autoGC = mkEnableOptionT "Nix store optimization and auto gc";
# Automatic updating of the system
# On by default
autoUpdate = mkEnableOptionT "Nix autoupdating";
ssh = mkEnableOptionT "ssh";
# Enable tailscale, on by default on linux
tailscale = {
enable = mkDefaultOption "tailscale" pkgs.stdenv.isLinux;
};
# Borg backup
# Disabled by default as it requires configuration, but a really good idea to turn on
borg = {
enable = mkEnableOption "borg";
extraExcludes = mkOption {
default = [ ];
description = "List of extra paths to exclude";
};
extraIncludes = mkOption {
default = [ ];
description = "List of extra paths to include";
};
location = mkOption {
default = "de1955@de1955.rsync.net:computers";
description = "Location to backup to";
type = lib.types.str;
};
passwordFile = mkOption {
description = "Path to the password file";
type = lib.types.str;
};
sshKey = mkOption {
description = "Path to the ssh key";
type = lib.types.str;
};
startAt = mkOption {
description = "How often to run backups";
default = "hourly";
};
};
# Nginx
nginx = {
enable = mkEnableOption "nginx";
acme = mkEnableOption "ACME Integration";
};
# Matrix
matrix = {
enable = mkEnableOption "matrix";
baseDomain = mkOption {
description = "Base domain to use for the matrix services";
example = "mccarty.io";
type = lib.types.str;
};
element =
mkDefaultOption "element" config.nathan.services.matrix.enable;
enableRegistration = mkEnableOption "synapse registration";
};
};
# Swaywm configuration
# On by default if the system is a desktop
swaywm = {
enable = mkOption {
default = config.nathan.config.isDesktop;
# Linux (desktop/server, not android) specific programs
programs = {
# Install games
games = mkEnableOption "games";
# Install gpg with yubikey support
# Enabled by default if the system is a desktop
gpg = mkDefaultOption "gpg" config.nathan.config.isDesktop;
utils = {
# Enable multi system emulation
# Enabled by default on desktop
binfmt = mkDefaultOption "binfmt" config.nathan.config.isDesktop;
};
};
# Control enabling of hardware support
hardware = {
# Logitech hardware support
# On by default if the system is a desktop
logitech = mkDefaultOption "logitech" config.nathan.config.isDesktop;
# AMD Single gpu passthrough
amdPassthrough = mkEnableOption "logitech";
};
# Linux specific configuration
config = {
# Wether or not to install the main user
installUser = mkOption {
default = pkgs.stdenv.isLinux;
example = true;
description = "Whether to setup swaywm";
description = "Whether to install the 'nathan' user";
type = lib.types.bool;
};
};
# Virtualization configuration
# All on by default if the system is a desktop
virtualization = {
qemu = mkDefaultOption "qemu" config.nathan.config.isDesktop;
docker = mkDefaultOption "docker" config.nathan.config.isDesktop;
lxc = mkDefaultOption "lxc" config.nathan.config.isDesktop;
nixos = mkDefaultOption "nixos containers" config.nathan.config.isDesktop;
};
# Support for interacting with a dual booted windows system
windows = {
enable = mkEnableOption "Windows Integration";
mount = {
enable = mkDefaultOption "Mount a bitlockered windows partition" config.nathan.config.windows.enable;
device = mkOption {
description = "Device to mount";
example = "/dev/sda2";
type = types.str;
# Should we harden this system?
# On by default
harden = mkEnableOptionT "Apply system hardening";
# Enable audio subsystem
# On by default if the system is a desktop
audio = mkDefaultOption "audio" config.nathan.config.isDesktop;
# Basic grub configuration
# Off by default
setupGrub = mkEnableOption "Setup grub";
# Install fonts
# On by default if the system is a desktop
fonts = mkDefaultOption "fonts" config.nathan.config.isDesktop;
# Enable unfree software
# On by default
enableUnfree = mkEnableOptionT "unfree software";
# Nix configuration
nix = {
# Automatic GC and optimization of the nix store
# On by default
autoGC = mkEnableOptionT "Nix store optimization and auto gc";
# Automatic updating of the system
# On by default
autoUpdate = mkEnableOptionT "Nix autoupdating";
};
# Swaywm configuration
# On by default if the system is a desktop
swaywm = {
enable = mkOption {
default = config.nathan.config.isDesktop;
example = true;
description = "Whether to setup swaywm";
type = lib.types.bool;
};
mountPoint = mkOption {
description = "Location to mount the device to";
example = "/dev/sda2";
type = types.str;
};
keyFile = mkOption {
description = "File containing the recovery key for the partition";
type = types.str;
};
# Virtualization configuration
# All on by default if the system is a desktop
virtualization = {
qemu = mkDefaultOption "qemu" config.nathan.config.isDesktop;
docker = mkDefaultOption "docker" config.nathan.config.isDesktop;
lxc = mkDefaultOption "lxc" config.nathan.config.isDesktop;
nixos =
mkDefaultOption "nixos containers" config.nathan.config.isDesktop;
};
# Support for interacting with a dual booted windows system
windows = {
enable = mkEnableOption "Windows Integration";
mount = {
enable = mkDefaultOption "Mount a bitlockered windows partition"
config.nathan.config.windows.enable;
device = mkOption {
description = "Device to mount";
example = "/dev/sda2";
type = types.str;
};
mountPoint = mkOption {
description = "Location to mount the device to";
example = "/dev/sda2";
type = types.str;
};
keyFile = mkOption {
description =
"File containing the recovery key for the partition";
type = types.str;
};
};
};
};
};
};
};
config = {
# Enable the firewall
@ -187,9 +196,7 @@ in
# Enable unfree packages
nixpkgs.config.allowUnfree = config.nathan.config.enableUnfree;
# Work around for discord jank ugh
nixpkgs.config.permittedInsecurePackages = [
"electron-13.6.9"
];
nixpkgs.config.permittedInsecurePackages = [ "electron-13.6.9" ];
# Set system state version
system.stateVersion = "22.05";

View File

@ -1,19 +1,14 @@
{ config, lib, pkgs, ... }:
let
nc = config.nathan.config;
in
with lib; {
let nc = config.nathan.config;
in with lib; {
# Generic desktop configuration
config = mkMerge [
(mkIf nc.isDesktop
{
# Ergodox
environment.systemPackages = with pkgs; [
wally-cli
];
hardware.keyboard.zsa.enable = true;
# Configure grub if configured
})
(mkIf nc.isDesktop {
# Ergodox
environment.systemPackages = with pkgs; [ wally-cli ];
hardware.keyboard.zsa.enable = true;
# Configure grub if configured
})
(mkIf nc.setupGrub {
# Boot, drivers, and host name
# Use grub
@ -57,15 +52,13 @@ with lib; {
package = pkgs.bluezFull;
};
# Add pulse audio packages, but do not enable them
environment.systemPackages = with pkgs;[
environment.systemPackages = with pkgs; [
pulseaudio
pavucontrol
noisetorch
];
# Add noisetorch for microphone noise canceling
programs.noisetorch = {
enable = true;
};
programs.noisetorch = { enable = true; };
# Configure fonts
})
(mkIf nc.fonts {

View File

@ -1,9 +1,6 @@
{ config, lib, pkgs, ... }:
let
nw = config.nathan.hardware;
in
with lib;
{
let nw = config.nathan.hardware;
in with lib; {
config = mkMerge [
{
hardware.logitech.wireless = mkIf nw.logitech {

View File

@ -1,20 +1,16 @@
{ config, lib, pkgs, inputs, ... }@attrs:
with lib;
{
with lib; {
config = mkMerge [
(mkIf pkgs.stdenv.isLinux
{
zramSwap = mkIf config.nathan.services.zramSwap
{
enable = true;
algorithm = "lz4";
memoryPercent = 25;
};
nix = mkIf config.nathan.config.nix.autoGC {
autoOptimiseStore = true;
};
})
(mkIf config.nathan.config.harden (import "${inputs.nixpkgs}/nixos/modules/profiles/hardened.nix" attrs))
(mkIf pkgs.stdenv.isLinux {
zramSwap = mkIf config.nathan.services.zramSwap {
enable = true;
algorithm = "lz4";
memoryPercent = 25;
};
nix = mkIf config.nathan.config.nix.autoGC { autoOptimiseStore = true; };
})
(mkIf config.nathan.config.harden
(import "${inputs.nixpkgs}/nixos/modules/profiles/hardened.nix" attrs))
(mkIf config.nathan.config.harden {
boot.kernelPackages = pkgs.linuxPackages_5_18_hardened;
security = {
@ -22,33 +18,27 @@ with lib;
unprivilegedUsernsClone = true;
};
})
(mkIf ((! config.nathan.config.harden) && config.nathan.config.isDesktop) {
(mkIf ((!config.nathan.config.harden) && config.nathan.config.isDesktop) {
# Use the zen kernel with muqss turned on
boot.kernelPackages =
let
linuxZenWMuQSS = pkgs.linuxPackagesFor (pkgs.linuxPackages_zen.kernel.override {
structuredExtraConfig = with lib.kernel; {
SCHED_MUQSS = yes;
};
boot.kernelPackages = let
linuxZenWMuQSS = pkgs.linuxPackagesFor
(pkgs.linuxPackages_zen.kernel.override {
structuredExtraConfig = with lib.kernel; { SCHED_MUQSS = yes; };
ignoreConfigErrors = true;
}
);
in
linuxZenWMuQSS;
});
in linuxZenWMuQSS;
})
(mkIf (config.nathan.config.nix.autoUpdate && pkgs.stdenv.isLinux) {
# Auto update daily at 2 am
system.autoUpgrade = {
enable = true;
allowReboot = true;
# Update from the flake
flake = "git+https://git.sr.ht/~thatonelutenist/system-flake?ref=trunk";
# Attempt to update daily at 2AM
dates = "2:00";
};
})
(mkIf
(config.nathan.config.nix.autoUpdate && pkgs.stdenv.isLinux)
{
# Auto update daily at 2 am
system.autoUpgrade = {
enable = true;
allowReboot = true;
# Update from the flake
flake = "git+https://git.sr.ht/~thatonelutenist/system-flake?ref=trunk";
# Attempt to update daily at 2AM
dates = "2:00";
};
})
# Systemd user service cludge
{
systemd.user.extraConfig = ''

View File

@ -1,34 +1,31 @@
{ config, lib, pkgs, inputs, ... }:
let
np = config.nathan.programs;
in
with lib;
{
let np = config.nathan.programs;
in with lib; {
config = mkIf np.games {
environment.systemPackages =
let
# https://github.com/Admicos/minecraft-wayland
glfw-patched = pkgs.glfw-wayland.overrideAttrs (attrs: {
patches = attrs.patches ++ [
../../../patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch
../../../patches/minecraft/0004-wayland-fix-broken-opengl-screenshots-on-mutter.patch
];
});
stable-packages = with pkgs; [
# Dwarf fortress
(dwarf-fortress-packages.dwarf-fortress-full.override {
enableFPS = true;
})
# PolyMC minecraft stuff
inputs.polymc.packages."${system}".polymc
glfw-patched
environment.systemPackages = let
# https://github.com/Admicos/minecraft-wayland
glfw-patched = pkgs.glfw-wayland.overrideAttrs (attrs: {
patches = attrs.patches ++ [
../../../patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch
../../../patches/minecraft/0004-wayland-fix-broken-opengl-screenshots-on-mutter.patch
];
unstable-packages = with inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}"; [
});
stable-packages = with pkgs; [
# Dwarf fortress
(dwarf-fortress-packages.dwarf-fortress-full.override {
enableFPS = true;
})
# PolyMC minecraft stuff
inputs.polymc.packages."${system}".polymc
glfw-patched
];
unstable-packages =
with inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}";
[
# Packwiz for maintaing modpacks
packwiz
];
in
stable-packages ++ unstable-packages;
in stable-packages ++ unstable-packages;
# Install steam
programs.steam.enable = true;
};

View File

@ -2,9 +2,7 @@
let
np = config.nathan.programs;
nc = config.nathan.config;
in
with lib;
{
in with lib; {
config = mkIf np.gpg {
# Enable ykpersonalize to work
services.udev.packages = [ pkgs.yubikey-personalization ];
@ -12,9 +10,6 @@ with lib;
services.pcscd.enable = true;
# install gnupg and yubikey personalization
environment.systemPackages = with pkgs; [
gnupg
yubikey-personalization
];
environment.systemPackages = with pkgs; [ gnupg yubikey-personalization ];
};
}

View File

@ -1,12 +1,7 @@
{ config, lib, pkgs, ... }:
let
nathan = config.nathan;
in
with lib;
{
imports = [
../../common/programs/utils.nix
];
let nathan = config.nathan;
in with lib; {
imports = [ ../../common/programs/utils.nix ];
config = mkMerge [
(mkIf nathan.programs.utils.binfmt {
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];

View File

@ -3,17 +3,11 @@
with lib; {
config = mkIf config.nathan.services.borg.enable {
# Add borg to the system packages
environment.systemPackages = with pkgs; [
borgbackup
];
environment.systemPackages = with pkgs; [ borgbackup ];
services.borgbackup.jobs = {
rsyncnet = {
paths = [
"/home"
"/var"
"/etc"
"/root"
] ++ config.nathan.services.borg.extraIncludes;
paths = [ "/home" "/var" "/etc" "/root" ]
++ config.nathan.services.borg.extraIncludes;
exclude = [
"*/.cache"
"*/.tmp"
@ -25,7 +19,8 @@ with lib; {
"/var/dislocker"
"/var/cache"
] ++ config.nathan.services.borg.extraExcludes;
repo = "${config.nathan.services.borg.location}/${config.networking.hostName}";
repo =
"${config.nathan.services.borg.location}/${config.networking.hostName}";
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.nathan.services.borg.passwordFile}";

View File

@ -1,350 +1,345 @@
{ config, lib, pkgs, inputs, ... }:
let
nathan = config.nathan;
in
with lib;
{
let nathan = config.nathan;
in with lib; {
config = mkMerge [
(mkIf nathan.services.matrix.enable
{
# Enable nginx
nathan.services.nginx.enable = true;
services = {
# Setup postgres
postgresql = {
enable = true;
initialScript = pkgs.writeText "synapse-init.sql" ''
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'matrix-synapse';
CREATE DATABASE "synapse" WITH OWNER "synapse"
TEMPLATE template0
LC_COLLATE = "C"
LC_CTYPE = "C";
'';
};
# Setup synapse
matrix-synapse = {
enable = true;
settings = {
enable_registration = nathan.services.matrix.enableRegistration;
server_name = nathan.services.matrix.baseDomain;
(mkIf nathan.services.matrix.enable {
# Enable nginx
nathan.services.nginx.enable = true;
services = {
# Setup postgres
postgresql = {
enable = true;
initialScript = pkgs.writeText "synapse-init.sql" ''
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'matrix-synapse';
CREATE DATABASE "synapse" WITH OWNER "synapse"
TEMPLATE template0
LC_COLLATE = "C"
LC_CTYPE = "C";
'';
};
# Setup synapse
matrix-synapse = {
enable = true;
settings = {
enable_registration = nathan.services.matrix.enableRegistration;
server_name = nathan.services.matrix.baseDomain;
listeners = [
{
port = 8008;
bind_addresses = [ "::1" ];
type = "http";
tls = false;
x_forwarded = true;
resources = [
{
names = [ "client" "federation" ];
compress = false;
}
];
}
];
database.args = {
user = "matrix-synapse";
database = "synapse";
};
};
};
# Configure nginx
nginx.virtualHosts = {
"matrix.${nathan.services.matrix.baseDomain}" = {
enableACME = true;
forceSSL = true;
locations."/".extraConfig = ''
rewrite ^(.*)$ http://${"element." + nathan.services.matrix.baseDomain}$1 redirect;
'';
# forward all Matrix API calls to the synapse Matrix homeserver
locations."/_matrix" = {
proxyPass = "http://[::1]:8008"; # without a trailing /
};
locations."/_synapse" = {
proxyPass = "http://[::1]:8008"; # without a trailing /
};
listeners = [{
port = 8008;
bind_addresses = [ "::1" ];
type = "http";
tls = false;
x_forwarded = true;
resources = [{
names = [ "client" "federation" ];
compress = false;
}];
}];
database.args = {
user = "matrix-synapse";
database = "synapse";
};
};
};
}
)
(mkIf nathan.services.matrix.element {
services.nginx.virtualHosts."element.${nathan.services.matrix.baseDomain}" = {
enableACME = true;
forceSSL = true;
root = inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.element-web.override {
conf = {
default_server_config."m.homeserver" = {
"base_url" = "https://matrix.${nathan.services.matrix.baseDomain}";
"server_name" = "matrix.${nathan.services.matrix.baseDomain}";
# Configure nginx
nginx.virtualHosts = {
"matrix.${nathan.services.matrix.baseDomain}" = {
enableACME = true;
forceSSL = true;
locations."/".extraConfig = ''
rewrite ^(.*)$ http://${
"element." + nathan.services.matrix.baseDomain
}$1 redirect;
'';
# forward all Matrix API calls to the synapse Matrix homeserver
locations."/_matrix" = {
proxyPass = "http://[::1]:8008"; # without a trailing /
};
locations."/_synapse" = {
proxyPass = "http://[::1]:8008"; # without a trailing /
};
showLabsSettings = true;
settingDefaults.custom_themes = [
{
"name" = "Discord Dark";
"is_dark" = true;
"colors" = {
"accent-color" = "#747ff4";
"primary-color" = "#00aff4";
"warning-color" = "#ed4245d9";
"sidebar-color" = "#202225";
"roomlist-background-color" = "#2f3136";
"roomlist-text-color" = "#dcddde";
"roomlist-text-secondary-color" = "#8e9297";
"roomlist-highlights-color" = "#4f545c52";
"roomlist-separator-color" = "#40444b";
"timeline-background-color" = "#36393f";
"timeline-text-color" = "#dcddde";
"timeline-text-secondary-color" = "#b9bbbe";
"timeline-highlights-color" = "#04040512";
"reaction-row-button-selected-bg-color" = "#b9bbbe";
};
}
{
"name" = "Dracula Flat";
"is_dark" = true;
"colors" = {
"accent-color" = "#bd93f9";
"primary-color" = "#bd93f9";
"warning-color" = "#bd93f9";
"sidebar-color" = "#1e1f29";
"roomlist-background-color" = "#1e1f29";
"roomlist-text-color" = "#eeeeee";
"roomlist-text-secondary-color" = "#eeeeee";
"roomlist-highlights-color" = "#00000030";
"roomlist-separator-color" = "#00000000";
"timeline-background-color" = "#1e1f29";
"timeline-text-color" = "#eeeeee";
"timeline-text-secondary-color" = "#dddddd";
"timeline-highlights-color" = "#00000030";
"reaction-row-button-selected-bg-color" = "#b9bbbe";
};
}
{
"name" = "Dracula";
"is_dark" = true;
"colors" = {
"accent-color" = "#bd93f9";
"primary-color" = "#bd93f9";
"warning-color" = "#bd93f9";
"sidebar-color" = "#1e1f29";
"roomlist-background-color" = "#1e1f29";
"roomlist-text-color" = "#eeeeee";
"roomlist-text-secondary-color" = "#eeeeee";
"roomlist-highlights-color" = "#00000030";
"roomlist-separator-color" = "#4d4d4d90";
"timeline-background-color" = "#282A36";
"timeline-text-color" = "#eeeeee";
"timeline-text-secondary-color" = "#dddddd";
"timeline-highlights-color" = "#00000030";
"reaction-row-button-selected-bg-color" = "#b9bbbe";
};
}
{
"name" = "Geeko dark theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#73ba25";
"primary-color" = "#35b9ab";
"warning-color" = "#bf616a";
"sidebar-color" = "#2a2a2a";
"roomlist-background-color" = "#4a4a4a";
"roomlist-text-color" = "#fff";
"roomlist-text-secondary-color" = "#ddd";
"roomlist-highlights-color" = "#2a2a2a";
"roomlist-separator-color" = "#3a3a3a";
"timeline-background-color" = "#3a3a3a";
"timeline-text-color" = "#eee";
"timeline-text-secondary-color" = "#6da741";
"timeline-highlights-color" = "#bf616a";
"reaction-row-button-selected-bg-color" = "#bf616a";
};
}
{
"name" = "Luxury Dark theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#D9BC00";
"primary-color" = "#FFDD00";
"warning-color" = "#FBC403";
"sidebar-color" = "#020F1B";
"roomlist-background-color" = "#011223";
"roomlist-highlights-color" = "#1E354A";
"roomlist-separator-color" = "#05192D";
"roomlist-text-color" = "#FFEC70";
"roomlist-text-secondary-color" = "#FFF3A4";
"timeline-background-color" = "#05192D";
"timeline-highlights-color" = "#011223";
"timeline-text-color" = "#FFF3A4";
"timeline-text-secondary-color" = "#A79000";
"reaction-row-button-selected-bg-color" = "#FFEC70";
};
}
{
"name" = "Nord dark theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#a3be8c";
"primary-color" = "#88c0d0";
"warning-color" = "#bf616a";
"sidebar-color" = "#2e3440";
"roomlist-background-color" = "#3b4252";
"roomlist-text-color" = "#ebcb8b";
"roomlist-text-secondary-color" = "#e5e9f0";
"roomlist-highlights-color" = "#2e3440";
"roomlist-separator-color" = "#434c5e";
"timeline-background-color" = "#434c5e";
"timeline-text-color" = "#eceff4";
"timeline-text-secondary-color" = "#81a1c1";
"timeline-highlights-color" = "#3b4252";
"reaction-row-button-selected-bg-color" = "#bf616a";
};
}
{
"name" = "Nord light theme";
"is_dark" = false;
"colors" = {
"accent-color" = "#a3be8c";
"primary-color" = "#5e81ac";
"warning-color" = "#bf616a";
"sidebar-color" = "#d8dee9";
"roomlist-background-color" = "#e5e9f0";
"roomlist-text-color" = "#d08770";
"roomlist-text-secondary-color" = "#3b4252";
"roomlist-highlights-color" = "#eceff4";
"roomlist-separator-color" = "#eceff4";
"timeline-background-color" = "#eceff4";
"timeline-text-color" = "#2e3440";
"timeline-text-secondary-color" = "#3b4252";
"timeline-highlights-color" = "#e5e9f0";
"reaction-row-button-selected-bg-color" = "#bf616a";
};
}
{
"name" = "Selenized black theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#70b433";
"primary-color" = "#4695f7";
"warning-color" = "#ed4a46";
"sidebar-color" = "#181818";
"roomlist-background-color" = "#252525";
"roomlist-text-color" = "#ffffff";
"roomlist-text-secondary-color" = "#b9b9b9";
"roomlist-highlights-color" = "#3b3b3b";
"roomlist-separator-color" = "#121212";
"timeline-background-color" = "#181818";
"timeline-text-color" = "#FFFFFF";
"timeline-text-secondary-color" = "#777777";
"timeline-highlights-color" = "#252525";
"reaction-row-button-selected-bg-color" = "#4695f7";
};
}
{
"name" = "Selenized dark theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#41c7b9";
"primary-color" = "#4695f7";
"warning-color" = "#fa5750";
"sidebar-color" = "#103c48";
"roomlist-background-color" = "#184956";
"roomlist-text-color" = "#dbb32d";
"roomlist-text-secondary-color" = "#FFFFFF";
"roomlist-highlights-color" = "#2d5b69";
"roomlist-separator-color" = "#2d5b69";
"timeline-background-color" = "#2d5b69";
"timeline-text-color" = "#FFFFFF";
"timeline-text-secondary-color" = "#72898f";
"timeline-highlights-color" = "#184956";
"reaction-row-button-selected-bg-color" = "#4695f7";
};
}
{
"name" = "Selenized light theme";
"is_dark" = false;
"colors" = {
"accent-color" = "#ad8900";
"primary-color" = "#009c8f";
"warning-color" = "#d2212d";
"sidebar-color" = "#d5cdb6";
"roomlist-background-color" = "#ece3cc";
"roomlist-text-color" = "#c25d1e";
"roomlist-text-secondary-color" = "#000000";
"roomlist-highlights-color" = "#fbf3db";
"roomlist-separator-color" = "#fbf3db";
"timeline-background-color" = "#fbf3db";
"timeline-text-color" = "#000000";
"timeline-text-secondary-color" = "#777777";
"timeline-highlights-color" = "#ece3cc";
"reaction-row-button-selected-bg-color" = "#4695f7";
};
}
{
"name" = "Solarized Dark";
"is_dark" = true;
"colors" = {
"accent-color" = "#b58900";
"primary-color" = "#268bd2";
"warning-color" = "#dc322f";
"sidebar-color" = "#002b36";
"roomlist-background-color" = "#073642";
"roomlist-text-color" = "#839496";
"roomlist-text-secondary-color" = "#93a1a1";
"roomlist-highlights-color" = "#586e75";
"timeline-background-color" = "#002b36";
"timeline-text-color" = "#839496";
"timeline-text-secondary-color" = "#586e75";
"timeline-highlights-color" = "#073642";
"reaction-row-button-selected-bg-color" = "#268bd2";
};
}
{
"name" = "ThomCat black theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#cc7b19";
"primary-color" = "#9F8652";
"warning-color" = "#f9c003";
"sidebar-color" = "#000000";
"roomlist-background-color" = "#191919";
"roomlist-text-color" = "#cc7b19";
"roomlist-text-secondary-color" = "#e5e5e5";
"roomlist-highlights-color" = "#323232";
"roomlist-separator-color" = "#4c4c4c";
"timeline-background-color" = "#000000";
"timeline-text-color" = "#e5e5e5";
"timeline-text-secondary-color" = "#b2b2b2";
"timeline-highlights-color" = "#212121";
"reaction-row-button-selected-bg-color" = "#cc7b19";
};
}
];
};
};
};
})
(mkIf nathan.services.matrix.element {
services.nginx.virtualHosts."element.${nathan.services.matrix.baseDomain}" =
{
enableACME = true;
forceSSL = true;
root =
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.element-web.override {
conf = {
default_server_config."m.homeserver" = {
"base_url" =
"https://matrix.${nathan.services.matrix.baseDomain}";
"server_name" = "matrix.${nathan.services.matrix.baseDomain}";
};
showLabsSettings = true;
settingDefaults.custom_themes = [
{
"name" = "Discord Dark";
"is_dark" = true;
"colors" = {
"accent-color" = "#747ff4";
"primary-color" = "#00aff4";
"warning-color" = "#ed4245d9";
"sidebar-color" = "#202225";
"roomlist-background-color" = "#2f3136";
"roomlist-text-color" = "#dcddde";
"roomlist-text-secondary-color" = "#8e9297";
"roomlist-highlights-color" = "#4f545c52";
"roomlist-separator-color" = "#40444b";
"timeline-background-color" = "#36393f";
"timeline-text-color" = "#dcddde";
"timeline-text-secondary-color" = "#b9bbbe";
"timeline-highlights-color" = "#04040512";
"reaction-row-button-selected-bg-color" = "#b9bbbe";
};
}
{
"name" = "Dracula Flat";
"is_dark" = true;
"colors" = {
"accent-color" = "#bd93f9";
"primary-color" = "#bd93f9";
"warning-color" = "#bd93f9";
"sidebar-color" = "#1e1f29";
"roomlist-background-color" = "#1e1f29";
"roomlist-text-color" = "#eeeeee";
"roomlist-text-secondary-color" = "#eeeeee";
"roomlist-highlights-color" = "#00000030";
"roomlist-separator-color" = "#00000000";
"timeline-background-color" = "#1e1f29";
"timeline-text-color" = "#eeeeee";
"timeline-text-secondary-color" = "#dddddd";
"timeline-highlights-color" = "#00000030";
"reaction-row-button-selected-bg-color" = "#b9bbbe";
};
}
{
"name" = "Dracula";
"is_dark" = true;
"colors" = {
"accent-color" = "#bd93f9";
"primary-color" = "#bd93f9";
"warning-color" = "#bd93f9";
"sidebar-color" = "#1e1f29";
"roomlist-background-color" = "#1e1f29";
"roomlist-text-color" = "#eeeeee";
"roomlist-text-secondary-color" = "#eeeeee";
"roomlist-highlights-color" = "#00000030";
"roomlist-separator-color" = "#4d4d4d90";
"timeline-background-color" = "#282A36";
"timeline-text-color" = "#eeeeee";
"timeline-text-secondary-color" = "#dddddd";
"timeline-highlights-color" = "#00000030";
"reaction-row-button-selected-bg-color" = "#b9bbbe";
};
}
{
"name" = "Geeko dark theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#73ba25";
"primary-color" = "#35b9ab";
"warning-color" = "#bf616a";
"sidebar-color" = "#2a2a2a";
"roomlist-background-color" = "#4a4a4a";
"roomlist-text-color" = "#fff";
"roomlist-text-secondary-color" = "#ddd";
"roomlist-highlights-color" = "#2a2a2a";
"roomlist-separator-color" = "#3a3a3a";
"timeline-background-color" = "#3a3a3a";
"timeline-text-color" = "#eee";
"timeline-text-secondary-color" = "#6da741";
"timeline-highlights-color" = "#bf616a";
"reaction-row-button-selected-bg-color" = "#bf616a";
};
}
{
"name" = "Luxury Dark theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#D9BC00";
"primary-color" = "#FFDD00";
"warning-color" = "#FBC403";
"sidebar-color" = "#020F1B";
"roomlist-background-color" = "#011223";
"roomlist-highlights-color" = "#1E354A";
"roomlist-separator-color" = "#05192D";
"roomlist-text-color" = "#FFEC70";
"roomlist-text-secondary-color" = "#FFF3A4";
"timeline-background-color" = "#05192D";
"timeline-highlights-color" = "#011223";
"timeline-text-color" = "#FFF3A4";
"timeline-text-secondary-color" = "#A79000";
"reaction-row-button-selected-bg-color" = "#FFEC70";
};
}
{
"name" = "Nord dark theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#a3be8c";
"primary-color" = "#88c0d0";
"warning-color" = "#bf616a";
"sidebar-color" = "#2e3440";
"roomlist-background-color" = "#3b4252";
"roomlist-text-color" = "#ebcb8b";
"roomlist-text-secondary-color" = "#e5e9f0";
"roomlist-highlights-color" = "#2e3440";
"roomlist-separator-color" = "#434c5e";
"timeline-background-color" = "#434c5e";
"timeline-text-color" = "#eceff4";
"timeline-text-secondary-color" = "#81a1c1";
"timeline-highlights-color" = "#3b4252";
"reaction-row-button-selected-bg-color" = "#bf616a";
};
}
{
"name" = "Nord light theme";
"is_dark" = false;
"colors" = {
"accent-color" = "#a3be8c";
"primary-color" = "#5e81ac";
"warning-color" = "#bf616a";
"sidebar-color" = "#d8dee9";
"roomlist-background-color" = "#e5e9f0";
"roomlist-text-color" = "#d08770";
"roomlist-text-secondary-color" = "#3b4252";
"roomlist-highlights-color" = "#eceff4";
"roomlist-separator-color" = "#eceff4";
"timeline-background-color" = "#eceff4";
"timeline-text-color" = "#2e3440";
"timeline-text-secondary-color" = "#3b4252";
"timeline-highlights-color" = "#e5e9f0";
"reaction-row-button-selected-bg-color" = "#bf616a";
};
}
{
"name" = "Selenized black theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#70b433";
"primary-color" = "#4695f7";
"warning-color" = "#ed4a46";
"sidebar-color" = "#181818";
"roomlist-background-color" = "#252525";
"roomlist-text-color" = "#ffffff";
"roomlist-text-secondary-color" = "#b9b9b9";
"roomlist-highlights-color" = "#3b3b3b";
"roomlist-separator-color" = "#121212";
"timeline-background-color" = "#181818";
"timeline-text-color" = "#FFFFFF";
"timeline-text-secondary-color" = "#777777";
"timeline-highlights-color" = "#252525";
"reaction-row-button-selected-bg-color" = "#4695f7";
};
}
{
"name" = "Selenized dark theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#41c7b9";
"primary-color" = "#4695f7";
"warning-color" = "#fa5750";
"sidebar-color" = "#103c48";
"roomlist-background-color" = "#184956";
"roomlist-text-color" = "#dbb32d";
"roomlist-text-secondary-color" = "#FFFFFF";
"roomlist-highlights-color" = "#2d5b69";
"roomlist-separator-color" = "#2d5b69";
"timeline-background-color" = "#2d5b69";
"timeline-text-color" = "#FFFFFF";
"timeline-text-secondary-color" = "#72898f";
"timeline-highlights-color" = "#184956";
"reaction-row-button-selected-bg-color" = "#4695f7";
};
}
{
"name" = "Selenized light theme";
"is_dark" = false;
"colors" = {
"accent-color" = "#ad8900";
"primary-color" = "#009c8f";
"warning-color" = "#d2212d";
"sidebar-color" = "#d5cdb6";
"roomlist-background-color" = "#ece3cc";
"roomlist-text-color" = "#c25d1e";
"roomlist-text-secondary-color" = "#000000";
"roomlist-highlights-color" = "#fbf3db";
"roomlist-separator-color" = "#fbf3db";
"timeline-background-color" = "#fbf3db";
"timeline-text-color" = "#000000";
"timeline-text-secondary-color" = "#777777";
"timeline-highlights-color" = "#ece3cc";
"reaction-row-button-selected-bg-color" = "#4695f7";
};
}
{
"name" = "Solarized Dark";
"is_dark" = true;
"colors" = {
"accent-color" = "#b58900";
"primary-color" = "#268bd2";
"warning-color" = "#dc322f";
"sidebar-color" = "#002b36";
"roomlist-background-color" = "#073642";
"roomlist-text-color" = "#839496";
"roomlist-text-secondary-color" = "#93a1a1";
"roomlist-highlights-color" = "#586e75";
"timeline-background-color" = "#002b36";
"timeline-text-color" = "#839496";
"timeline-text-secondary-color" = "#586e75";
"timeline-highlights-color" = "#073642";
"reaction-row-button-selected-bg-color" = "#268bd2";
};
}
{
"name" = "ThomCat black theme";
"is_dark" = true;
"colors" = {
"accent-color" = "#cc7b19";
"primary-color" = "#9F8652";
"warning-color" = "#f9c003";
"sidebar-color" = "#000000";
"roomlist-background-color" = "#191919";
"roomlist-text-color" = "#cc7b19";
"roomlist-text-secondary-color" = "#e5e5e5";
"roomlist-highlights-color" = "#323232";
"roomlist-separator-color" = "#4c4c4c";
"timeline-background-color" = "#000000";
"timeline-text-color" = "#e5e5e5";
"timeline-text-secondary-color" = "#b2b2b2";
"timeline-highlights-color" = "#212121";
"reaction-row-button-selected-bg-color" = "#cc7b19";
};
}
];
};
};
};
})
];
}

View File

@ -1,9 +1,6 @@
{ config, lib, pkgs, ... }:
let
nathan = config.nathan;
in
with lib;
{
let nathan = config.nathan;
in with lib; {
config = mkMerge [
(mkIf nathan.services.nginx.enable {
networking.firewall = {

View File

@ -1,9 +1,6 @@
{ config, lib, pkgs, ... }:
let
nathan = config.nathan;
in
with lib;
{
let nathan = config.nathan;
in with lib; {
config = mkIf nathan.services.ssh {
networking.firewall = {
allowedTCPPorts = [ 22 ];
@ -15,12 +12,10 @@ with lib;
extraConfig = ''
StreamLocalBindUnlink yes
'';
listenAddresses = [
{
addr = "0.0.0.0";
port = 22;
}
];
listenAddresses = [{
addr = "0.0.0.0";
port = 22;
}];
permitRootLogin = "no";
passwordAuthentication = false;
};

View File

@ -1,18 +1,11 @@
{ config, lib, pkgs, ... }:
let
nathan = config.nathan;
in
with lib;
{
let nathan = config.nathan;
in with lib; {
config = mkIf nathan.services.tailscale.enable {
environment.systemPackages = with pkgs; [
tailscale
];
environment.systemPackages = with pkgs; [ tailscale ];
# Enable the service
services.tailscale = {
enable = true;
};
services.tailscale = { enable = true; };
# Setup sops
sops.secrets."tailscale-auth" = {
@ -42,7 +35,9 @@ with lib;
exit 0
fi
# otherwise authenticate with tailscale
${tailscale}/bin/tailscale up -authkey $(cat ${config.sops.secrets."tailscale-auth".path})
${tailscale}/bin/tailscale up -authkey $(cat ${
config.sops.secrets."tailscale-auth".path
})
'';
};

View File

@ -1,9 +1,6 @@
{ config, lib, pkgs, inputs, ... }:
let
nc = config.nathan.config;
in
with lib;
{
let nc = config.nathan.config;
in with lib; {
config = mkIf nc.swaywm.enable {
# Turn on GDM for login
services.xserver = {
@ -13,9 +10,7 @@ with lib;
sddm = {
enable = true;
settings = {
Wayland = {
CompositorCommand = "kwin_wayland --no-lockscreen";
};
Wayland = { CompositorCommand = "kwin_wayland --no-lockscreen"; };
};
theme = "sugar-dark";
};
@ -64,9 +59,7 @@ with lib;
wrapperFeatures.gtk = true;
};
environment.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
};
environment.sessionVariables = { MOZ_ENABLE_WAYLAND = "1"; };
# Enable the xdg-portal
xdg = {

View File

@ -1,8 +1,6 @@
{ config, lib, pkgs, ... }:
let
nc = config.nathan.config;
in
with lib; {
let nc = config.nathan.config;
in with lib; {
config = mkMerge [
{
users = {
@ -10,18 +8,30 @@ with lib; {
mutableUsers = !(nc.installUser && nc.harden);
# Configure our user, if enabled
users."${nc.user}" = mkMerge [
(mkIf nc.installUser
{
# Darwin is special
home = if pkgs.stdenv.isDarwin then "/Users/nathan" else "/home/nathan";
description = "Nathan McCarty";
shell = pkgs.fish;
# Linux specific configuration next
})
(mkIf nc.installUser {
# Darwin is special
home = if pkgs.stdenv.isDarwin then
"/Users/${nc.user}"
else
"/home/${nc.user}";
description = "Nathan McCarty";
shell = pkgs.fish;
# Linux specific configuration next
})
(mkIf (nc.installUser && pkgs.stdenv.isLinux) {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "audio" "docker" "libvirtd" "uinput" "adbusers" "plugdev" ];
hashedPassword = "$6$ShBAPGwzKZuB7eEv$cbb3erUqtVGFo/Vux9UwT2NkbVG9VGCxJxPiZFYL0DIc3t4GpYxjkM0M7fFnh.6V8MoSKLM/TvOtzdWbYwI58.";
extraGroups = [
"wheel"
"networkmanager"
"audio"
"docker"
"libvirtd"
"uinput"
"adbusers"
"plugdev"
];
hashedPassword =
"$6$ShBAPGwzKZuB7eEv$cbb3erUqtVGFo/Vux9UwT2NkbVG9VGCxJxPiZFYL0DIc3t4GpYxjkM0M7fFnh.6V8MoSKLM/TvOtzdWbYwI58.";
openssh.authorizedKeys.keys = [
# yubikey ssh key
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILRs6zVljIlQEZ8F+aEBqqbpeFJwCw3JdveZ8TQWfkev cardno:000615938515"
@ -38,15 +48,10 @@ with lib; {
# If we install the user, enable sudo
security.sudo.enable = mkDefault nc.installUser;
# If we isntall the user, make them trusted
nix.settings.trusted-users =
if nc.installUser then [
"nathan"
] else [ ];
nix.settings.trusted-users = if nc.installUser then [ "nathan" ] else [ ];
# If we setup the user, install the shell as well
environment.systemPackages =
if nc.installUser then [
pkgs.fish
] else [ ];
if nc.installUser then [ pkgs.fish ] else [ ];
# Configure the timezone
time.timeZone = "America/New_York";
}

View File

@ -1,21 +1,15 @@
{ config, lib, pkgs, ... }:
let
nc = config.nathan.config;
in
with lib;
{
let nc = config.nathan.config;
in with lib; {
config = mkMerge [
(mkIf nc.virtualization.qemu
{
# Enable the kernel modules
boot.kernelModules = [ "kvm-amd" "kvm-intel" ];
# Enable libvirt
virtualisation.libvirtd.enable = true;
# Install virt-manager
environment.systemPackages = with pkgs; [
virtmanager
];
})
(mkIf nc.virtualization.qemu {
# Enable the kernel modules
boot.kernelModules = [ "kvm-amd" "kvm-intel" ];
# Enable libvirt
virtualisation.libvirtd.enable = true;
# Install virt-manager
environment.systemPackages = with pkgs; [ virtmanager ];
})
(mkIf nc.virtualization.docker {
# Enable docker
virtualisation.docker = {
@ -31,9 +25,7 @@ with lib;
enable = true;
recommendedSysctlSettings = true;
};
users.users.${nc.user} = mkIf nc.installUser {
extraGroups = [ "lxd" ];
};
users.users.${nc.user} = mkIf nc.installUser { extraGroups = [ "lxd" ]; };
})
(mkIf nc.virtualization.nixos {
# Setup networking for nixos containers

View File

@ -1,30 +1,26 @@
{ config, lib, pkgs, ... }:
with lib;{
with lib; {
config = mkIf config.nathan.config.windows.enable {
# Enable ntfs support
boot.supportedFilesystems = [ "ntfs" ];
# Install dislocker for mounting bitlocker encrypted partitions
environment.systemPackages = with pkgs; [
dislocker
];
environment.systemPackages = with pkgs; [ dislocker ];
systemd.services.mount-windows =
let
mount = config.nathan.config.windows.mount;
in
mkIf mount.enable {
let mount = config.nathan.config.windows.mount;
in mkIf mount.enable {
description = "Mount ${mount.device} to ${mount.mountPoint}";
wantedBy = [ "multi-user.target" ];
path = with pkgs; [
bash
dislocker
];
path = with pkgs; [ bash dislocker ];
serviceConfig = {
Type = "forking";
ExecStart =
"${../../scripts/windows/mount.sh} ${mount.device} ${mount.mountPoint} ${mount.keyFile}";
ExecStop = "${../../scripts/windows/unmount.sh} ${mount.device} ${mount.mountPoint}";
ExecStart = "${
../../scripts/windows/mount.sh
} ${mount.device} ${mount.mountPoint} ${mount.keyFile}";
ExecStop = "${
../../scripts/windows/unmount.sh
} ${mount.device} ${mount.mountPoint}";
};
};
};

View File

@ -1,19 +1,17 @@
{ config, lib, pkgs, ... }:
let
inherit (import ../lib.nix { inherit lib; inherit pkgs; }) nLib;
in
{
imports = [
../options.nix
./programs/util.nix
];
inherit (import ../lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in {
imports = [ ../options.nix ./programs/util.nix ];
options = with lib; with nLib; { };
config = {
environment.packages = with pkgs; [
nettools
];
environment.packages = with pkgs; [ nettools ];
# Set system state version
system.stateVersion = "22.05";

View File

@ -1,38 +1,31 @@
{ config, lib, pkgs, ... }:
let
nathan = config.nathan;
in
with lib;
{
let nathan = config.nathan;
in with lib; {
config = mkMerge [
(mkIf nathan.programs.utils.core
{
environment.packages = with pkgs; [
# Basic command line utilities
wget
tmux
nano
unzip
any-nix-shell
htop
which
# For being able to update the flake
gitFull
# For nslookup
dnsutils
# Mosh for better high-latency ssh
mosh
# PV for viewing pipes
pv
# Openssh
openssh
];
})
(mkIf nathan.programs.utils.devel {
(mkIf nathan.programs.utils.core {
environment.packages = with pkgs; [
gcc
binutils
# Basic command line utilities
wget
tmux
nano
unzip
any-nix-shell
htop
which
# For being able to update the flake
gitFull
# For nslookup
dnsutils
# Mosh for better high-latency ssh
mosh
# PV for viewing pipes
pv
# Openssh
openssh
];
})
(mkIf nathan.programs.utils.devel {
environment.packages = with pkgs; [ gcc binutils ];
})
];
}

View File

@ -1,42 +1,46 @@
{ config, lib, pkgs, ... }:
let
inherit (import ./lib.nix { inherit lib; inherit pkgs; }) nLib;
in
{
options = with lib; with nLib; {
nathan = {
# Programs, many of these will be generic
programs = {
# Utility modules
utils = {
# Core utililtes I want on every system
# Enabled by default
core = mkEnableOptionT "utils-core";
# Development utilities that can't be installed through home manager due to collisions
devel = mkDefaultOption "devel" config.nathan.config.isDesktop;
inherit (import ./lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in {
options = with lib;
with nLib; {
nathan = {
# Programs, many of these will be generic
programs = {
# Utility modules
utils = {
# Core utililtes I want on every system
# Enabled by default
core = mkEnableOptionT "utils-core";
# Development utilities that can't be installed through home manager due to collisions
devel = mkDefaultOption "devel" config.nathan.config.isDesktop;
};
};
};
# General system configuration
config = {
# Name of the user to install
user = mkOption {
default = "nathan";
example = "nathan";
description = "Username to use for common configuration";
type = lib.types.str;
# General system configuration
config = {
# Name of the user to install
user = mkOption {
default = "nathan";
example = "nathan";
description = "Username to use for common configuration";
type = lib.types.str;
};
# Name of the user to install
email = mkOption {
default = "nathan@mccarty.io";
example = "nathan@mccarty.io";
description = "Email to use for common configuration";
type = lib.types.str;
};
# Is this system a desktop?
# Off by default
isDesktop = mkEnableOption "Desktop specific settings";
};
# Name of the user to install
email = mkOption {
default = "nathan@mccarty.io";
example = "nathan@mccarty.io";
description = "Email to use for common configuration";
type = lib.types.str;
};
# Is this system a desktop?
# Off by default
isDesktop = mkEnableOption "Desktop specific settings";
};
};
};
}

View File

@ -5,7 +5,8 @@ stdenv.mkDerivation rec {
version = "4.2.5";
src = fetchurl {
url = "https://github.com/JannisX11/blockbench/releases/download/v${version}/Blockbench_${version}.AppImage";
url =
"https://github.com/JannisX11/blockbench/releases/download/v${version}/Blockbench_${version}.AppImage";
sha256 = "ibgWP3i0QGKnL0ZmDusouo2DoDxOkRZQFqIl8SEChbs=";
name = "${pname}-${version}.AppImage";
};

View File

@ -1,63 +1,14 @@
{ pname
, version
, src
, binaryName
, desktopName
, autoPatchelfHook
, makeDesktopItem
, lib
, stdenv
, wrapGAppsHook
, alsaLib
, at-spi2-atk
, at-spi2-core
, atk
, cairo
, cups
, dbus
, expat
, fontconfig
, freetype
, gdk-pixbuf
, glib
, gtk3
, libcxx
, libdrm
, libnotify
, libpulseaudio
, libuuid
, libX11
, libXScrnSaver
, libXcomposite
, libXcursor
, libXdamage
, libXext
, libXfixes
, libXi
, libXrandr
, libXrender
, libXtst
, libxcb
, libxshmfence
, mesa
, nspr
, nss
, pango
, systemd
, libappindicator-gtk3
, libdbusmenu
, writeScript
, common-updater-scripts
, electron
, nodePackages
, libgcc
, glibc
}:
{ pname, version, src, binaryName, desktopName, autoPatchelfHook
, makeDesktopItem, lib, stdenv, wrapGAppsHook, alsaLib, at-spi2-atk
, at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig, freetype, gdk-pixbuf
, glib, gtk3, libcxx, libdrm, libnotify, libpulseaudio, libuuid, libX11
, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext, libXfixes
, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence, mesa, nspr, nss
, pango, systemd, libappindicator-gtk3, libdbusmenu, writeScript
, common-updater-scripts, electron, nodePackages, libgcc, glibc }:
let
inherit binaryName;
in
stdenv.mkDerivation rec {
let inherit binaryName;
in stdenv.mkDerivation rec {
inherit pname version src;
nativeBuildInputs = [
@ -80,11 +31,7 @@ stdenv.mkDerivation rec {
autoPatchelfHook
];
buildInputs = [
electron
libgcc
glibc
];
buildInputs = [ electron libgcc glibc ];
dontWrapGApps = true;
@ -131,49 +78,47 @@ stdenv.mkDerivation rec {
libgcc
];
installPhase =
let
electron_exec = "${electron}/bin/electron";
in
''
mkdir -p $out/{bin,opt/${binaryName},share/pixmaps}
mv * $out/opt/${binaryName}
chmod +x $out/opt/${binaryName}/${binaryName}
ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${pname}.png
mkdir -p $out/share/applications
ls $out/share/applications
sed "s|OUTDIR|$out|" ${desktopItem}/share/applications/${pname}.desktop > $out/share/applications/${pname}.desktop
# Hacks for system electron
asar e $out/opt/${binaryName}/resources/app.asar $out/opt/${binaryName}/resources/app
rm $out/opt/${binaryName}/resources/app.asar
sed -i "s|process.resourcesPath|'$out/opt/${binaryName}/resources'|" $out/opt/${binaryName}/resources/app/app_bootstrap/buildInfo.js
sed -i "s|exeDir,|'$out/share/pixmaps',|" $out/opt/${binaryName}/resources/app/app_bootstrap/autoStart/linux.js
asar p $out/opt/${binaryName}/resources/app $out/opt/${binaryName}/resources/app.asar --unpack-dir '**'
installPhase = let electron_exec = "${electron}/bin/electron";
in ''
mkdir -p $out/{bin,opt/${binaryName},share/pixmaps}
mv * $out/opt/${binaryName}
chmod +x $out/opt/${binaryName}/${binaryName}
ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${pname}.png
mkdir -p $out/share/applications
ls $out/share/applications
sed "s|OUTDIR|$out|" ${desktopItem}/share/applications/${pname}.desktop > $out/share/applications/${pname}.desktop
# Hacks for system electron
asar e $out/opt/${binaryName}/resources/app.asar $out/opt/${binaryName}/resources/app
rm $out/opt/${binaryName}/resources/app.asar
sed -i "s|process.resourcesPath|'$out/opt/${binaryName}/resources'|" $out/opt/${binaryName}/resources/app/app_bootstrap/buildInfo.js
sed -i "s|exeDir,|'$out/share/pixmaps',|" $out/opt/${binaryName}/resources/app/app_bootstrap/autoStart/linux.js
asar p $out/opt/${binaryName}/resources/app $out/opt/${binaryName}/resources/app.asar --unpack-dir '**'
# executable wrapper
makeWrapper '${electron_exec}' "$out/bin/${binaryName}" \
--add-flags "--enable-features=UseOzonePlatform --ozone-platform=wayland $out/opt/${binaryName}/resources/app.asar"\
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/"\
--prefix LD_LIBRARY_PATH : ${libPath}
ln -s $out/bin/${binaryName} $out/bin/${lib.strings.toLower binaryName}
'';
# executable wrapper
makeWrapper '${electron_exec}' "$out/bin/${binaryName}" \
--add-flags "--enable-features=UseOzonePlatform --ozone-platform=wayland $out/opt/${binaryName}/resources/app.asar"\
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/"\
--prefix LD_LIBRARY_PATH : ${libPath}
ln -s $out/bin/${binaryName} $out/bin/${lib.strings.toLower binaryName}
'';
desktopItem =
makeDesktopItem {
name = pname;
exec = "${binaryName}";
icon = pname;
inherit desktopName;
genericName = meta.description;
categories = [ "Network" "InstantMessaging" ];
mimeTypes = [ "x-scheme-handler/discord" ];
};
desktopItem = makeDesktopItem {
name = pname;
exec = "${binaryName}";
icon = pname;
inherit desktopName;
genericName = meta.description;
categories = [ "Network" "InstantMessaging" ];
mimeTypes = [ "x-scheme-handler/discord" ];
};
passthru.updateScript = writeScript "discord-update-script" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnugrep common-updater-scripts
set -eou pipefail;
url=$(curl -sI "https://discordapp.com/api/download/${builtins.replaceStrings ["discord-" "discord"] ["" "stable"] pname}?platform=linux&format=tar.gz" | grep -oP 'location: \K\S+')
url=$(curl -sI "https://discordapp.com/api/download/${
builtins.replaceStrings [ "discord-" "discord" ] [ "" "stable" ] pname
}?platform=linux&format=tar.gz" | grep -oP 'location: \K\S+')
version=''${url##https://dl*.discordapp.net/apps/linux/}
version=''${version%%/*.tar.gz}
update-source-version ${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix

View File

@ -1,38 +1,15 @@
{ config
, lib
, pkgs
, stdenv
, fetchurl
, meson
, ninja
, pkg-config
, git
, cmake
, makeDesktopItem
, wayland
, wayland-protocols
, json_c
, libxkbcommon
, fontconfig
, giflib
, libjpeg
, libjxl
, libpng
, librsvg
, libwebp
, libheif
, libtiff
, libexif
, bash-completion
, ...
}:
{ config, lib, pkgs, stdenv, fetchurl, meson, ninja, pkg-config, git, cmake
, makeDesktopItem, wayland, wayland-protocols, json_c, libxkbcommon, fontconfig
, giflib, libjpeg, libjxl, libpng, librsvg, libwebp, libheif, libtiff, libexif
, bash-completion, ... }:
stdenv.mkDerivation rec {
pname = "swayimg";
version = "1.9";
src = fetchurl {
url = "https://github.com/artemsen/swayimg/archive/refs/tags/v${version}.tar.gz";
url =
"https://github.com/artemsen/swayimg/archive/refs/tags/v${version}.tar.gz";
sha256 = "sha256-aTojp3VevtsUQnGytnSYChxRogNtq8/5aXw+PGJY8Qg=";
name = "${pname}-${version}.tar.gz";
};