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

181
flake.nix
View File

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

View File

@ -4,58 +4,51 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
[
(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.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/mapper/crypt-pv";
device = "/dev/mapper/crypt-pv"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=root" ];
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" = fileSystems."/home" = {
{ device = "/dev/mapper/crypt-pv";
device = "/dev/mapper/crypt-pv"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=home" ];
options = [ "subvol=home" ]; };
};
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "/dev/mapper/crypt-pv";
device = "/dev/mapper/crypt-pv"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=nix" ];
options = [ "subvol=nix" ]; };
};
fileSystems."/etc" = fileSystems."/etc" = {
{ device = "/dev/mapper/crypt-pv";
device = "/dev/mapper/crypt-pv"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=etc" ];
options = [ "subvol=etc" ]; };
};
fileSystems."/var" = fileSystems."/var" = {
{ device = "/dev/mapper/crypt-pv";
device = "/dev/mapper/crypt-pv"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=var" ];
options = [ "subvol=var" ]; };
};
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/1425-B41E";
device = "/dev/disk/by-uuid/1425-B41E"; fsType = "vfat";
fsType = "vfat"; };
};
fileSystems."/home/nathan/Music" = { fileSystems."/home/nathan/Music" = {
device = "10.0.0.139:/mnt/tank/root/nathan/music"; device = "10.0.0.139:/mnt/tank/root/nathan/music";
@ -70,15 +63,15 @@
fsType = "nfs"; fsType = "nfs";
}; };
swapDevices = swapDevices = [{
[{ device = "/dev/disk/by-partuuid/f9d26ecd-7df5-48ad-bc19-b9ac4e91b0ee";
device = "/dev/disk/by-partuuid/f9d26ecd-7df5-48ad-bc19-b9ac4e91b0ee"; randomEncryption = {
randomEncryption = { cipher = "aes-xts-plain64";
cipher = "aes-xts-plain64"; enable = true;
enable = true; source = "/dev/random";
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, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
[
(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.initrd.kernelModules = [ ];
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=root,compress-force=zstd:1" ];
options = [ "subvol=root,compress-force=zstd:1" ]; };
};
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/61AB-C10E";
device = "/dev/disk/by-uuid/61AB-C10E"; fsType = "vfat";
fsType = "vfat"; };
};
fileSystems."/home" = fileSystems."/home" = {
{ device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=home,compress-force=zstd:1" ];
options = [ "subvol=home,compress-force=zstd:1" ]; };
};
fileSystems."/etc" = fileSystems."/etc" = {
{ device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=etc,compress-force=zstd:1" ];
options = [ "subvol=etc,compress-force=zstd:1" ]; };
};
fileSystems."/var" = fileSystems."/var" = {
{ device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=var,compress-force=zstd:1" ];
options = [ "subvol=var,compress-force=zstd:1" ]; };
};
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b"; fsType = "btrfs";
fsType = "btrfs"; options = [ "subvol=nix,compress-force=zstd:6" ];
options = [ "subvol=nix,compress-force=zstd:6" ]; };
};
swapDevices = swapDevices =
[{ device = "/dev/disk/by-uuid/09eb9e97-3105-4b60-88f7-ac3a01a2c130"; }]; [{ device = "/dev/disk/by-uuid/09eb9e97-3105-4b60-88f7-ac3a01a2c130"; }];

View File

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

View File

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

View File

@ -1,14 +1,19 @@
{ modulesPath, ... }: { modulesPath, ... }: {
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.loader.grub = { boot.loader.grub = {
efiSupport = true; efiSupport = true;
efiInstallAsRemovable = true; efiInstallAsRemovable = true;
device = "nodev"; 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" ]; boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; }; fileSystems."/" = {
device = "/dev/sda1";
fsType = "ext4";
};
swapDevices = [{ device = "/swapfile"; }]; swapDevices = [{ device = "/swapfile"; }];
} }

View File

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

View File

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

View File

@ -1,47 +1,52 @@
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
{ {
config = lib.mkIf config.nathan.programs.emacs.enable { config = lib.mkMerge [
# Dependencies of my emacs environment (lib.mkIf config.nathan.programs.emacs.enable (let
home.packages = with pkgs; [ myAspell = pkgs.aspellWithDicts (d: [ d.en d.en-science d.en-computers ]);
# For markdown rendering in {
python39Packages.grip # Dependencies of my emacs environment
# For graph generation home.packages = with pkgs; [
graphviz # For markdown rendering
sqlite python39Packages.grip
# For latex editing # For graph generation
texlive.combined.scheme-medium graphviz
# For notifications sqlite
libnotify # For latex editing
# For flash cards texlive.combined.scheme-medium
anki # For notifications
# For spelling libnotify
aspell # For spelling
aspellDicts.en myAspell
aspellDicts.en-science # For nix
aspellDicts.en-computers rnix-lsp
# For nix manix
rnix-lsp nix-doc
manix nixfmt
nix-doc # For email
# For email mu
mu # Desktop file for org-protocol
# Desktop file for org-protocol (makeDesktopItem {
(makeDesktopItem { name = "org-protocol";
name = "org-protocol"; exec = "emacsclient %u";
exec = "emacsclient %u"; comment = "Org protocol";
comment = "Org protocol"; desktopName = "org-protocol";
desktopName = "org-protocol"; type = "Application";
type = "Application"; mimeTypes = [ "x-scheme-handler/org-protocol" ];
mimeTypes = [ "x-scheme-handler/org-protocol" ]; })
})
];
programs.emacs = {
enable = true;
package = config.nathan.programs.emacs.package;
extraPackages = epkgs: [
pkgs.mu
]; ];
}; 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, ... }: { config, lib, pkgs, inputs, ... }:
let let
inherit (import ../../modules/lib.nix { inherit lib; inherit pkgs; }) nLib; inherit (import ../../modules/lib.nix {
in inherit lib;
with lib; with nLib; { inherit pkgs;
})
nLib;
in with lib;
with nLib; {
imports = [ imports = [
../options.nix ../options.nix
./programs/sway.nix ./programs/sway.nix
@ -25,13 +29,12 @@ with lib; with nLib; {
# Services, these are platform specific so they go here # Services, these are platform specific so they go here
services = { services = {
# Synthing, enabled by default on linux desktop # 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 # Email syncing
# Disabled by default since this requires manual setup on the machine # Disabled by default since this requires manual setup on the machine
# TODO: Get this working on darwin # TODO: Get this working on darwin
email = { email = { enable = mkEnableOption "Email"; };
enable = mkEnableOption "Email";
};
}; };
# Linux specific programs # Linux specific programs
programs = { programs = {
@ -42,12 +45,11 @@ with lib; with nLib; {
gpg = mkEnableOptionT "gpg"; gpg = mkEnableOptionT "gpg";
}; };
devel = { devel = {
jvm = mkDefaultOption "JVM Development Utilites" config.nathan.config.isDesktop; jvm = mkDefaultOption "JVM Development Utilites"
config.nathan.config.isDesktop;
}; };
# Install games # Install games
games = { games = { launcher = mkEnableOption "Game launcher"; };
launcher = mkEnableOption "Game launcher";
};
# Swaywm and supoorting application configuration # Swaywm and supoorting application configuration
swaywm = { swaywm = {
enable = mkDefaultOption "swaywm" config.nathan.config.isDesktop; enable = mkDefaultOption "swaywm" config.nathan.config.isDesktop;
@ -55,20 +57,24 @@ with lib; with nLib; {
# Communications applications # Communications applications
communications = { communications = {
# Enable by default if we are on a linux desktop # 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 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 appilcations, on by default on linux desktop
media = { 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 { mopidyExtraConfig = mkOption {
description = "Extra config files for mopidy"; description = "Extra config files for mopidy";
default = [ ]; default = [ ];
}; };
}; };
# Firefox, enabled by default on linux desktop # 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; enable = config.nathan.programs.firefox;
package = pkgs.firefox-beta-bin; 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 # We should be managing xdg stuff
xdg = { xdg = {
enable = true; enable = true;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,17 @@
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
let 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 { irisDesktopItem = pkgs.makeDesktopItem {
name = "iris"; name = "iris";
desktopName = "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; terminal = false;
}; };
in in {
{
config = lib.mkIf config.nathan.programs.media.enable { config = lib.mkIf config.nathan.programs.media.enable {
# General Packages # General Packages
home.packages = with pkgs; [ home.packages = with pkgs; [
@ -33,18 +36,12 @@ in
]; ];
# extraConfigFiles = config.nathan.programs.media.mopidyExtraConfig; # extraConfigFiles = config.nathan.programs.media.mopidyExtraConfig;
settings = { settings = {
file = { file = { media_dirs = [ "~/Music" ]; };
media_dirs = [
"~/Music"
];
};
local = { local = {
enabled = true; enabled = true;
media_dir = "~/Music"; media_dir = "~/Music";
}; };
mpd = { mpd = { enabled = true; };
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 { config = lib.mkIf config.nathan.programs.util.wine {
home.packages = with pkgs; [ home.packages = with pkgs; [ proton-caller wineWowPackages.waylandFull ];
proton-caller
wineWowPackages.waylandFull
];
}; };
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,9 +53,7 @@
autoGC = true; autoGC = true;
}; };
harden = false; harden = false;
virtualization = { virtualization = { docker = true; };
docker = true;
};
}; };
}; };
# Configure bootloader # Configure bootloader
@ -69,9 +67,7 @@
terminal_input serial; terminal_input serial;
terminal_output serial terminal_output serial
''; '';
boot.kernelParams = [ boot.kernelParams = [ "console=ttyS0" ];
"console=ttyS0"
];
# Configure networking # Configure networking
networking = { networking = {
domain = "community.rs"; domain = "community.rs";
@ -101,9 +97,7 @@
}; };
# Add www-html for my self # Add www-html for my self
users.users.nathan = { users.users.nathan = { extraGroups = [ "www-html" ]; };
extraGroups = [ "www-html" ];
};
# Configure matrix registration # Configure matrix registration
services.matrix-synapse = { services.matrix-synapse = {
@ -112,8 +106,12 @@
allow_guest_access = false; allow_guest_access = false;
allow_public_rooms_over_federation = true; allow_public_rooms_over_federation = true;
experimental_features = { spaces_enabled = true; }; experimental_features = { spaces_enabled = true; };
auto_join_rooms = [ "#space:community.rs" "#rules:community.rs" "#info:community.rs" ]; auto_join_rooms =
turn_uris = [ "turn:turn.community.rs:3478?transport=udp" "turn:turn.community.rs:3478?transport=tcp" ]; [ "#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"; turn_user_lifetime = "1h";
}; };
extraConfigFiles = [ config.sops.secrets."matrix-secrets.yaml".path ]; extraConfigFiles = [ config.sops.secrets."matrix-secrets.yaml".path ];
@ -151,74 +149,63 @@
}; };
# Configure the vhost for the domain # Configure the vhost for the domain
services.nginx.virtualHosts = services.nginx.virtualHosts = let
let fqdn = let
fqdn = join = hostName: domain:
let hostName + lib.optionalString (domain != null) ".${domain}";
join = hostName: domain: hostName + lib.optionalString (domain != null) ".${domain}"; in join config.networking.hostName config.networking.domain;
in in {
join config.networking.hostName config.networking.domain; "${config.networking.domain}" = {
in enableACME = true;
{ forceSSL = true;
"${config.networking.domain}" = {
enableACME = true;
forceSSL = true;
locations."= /.well-known/matrix/server".extraConfig = locations."= /.well-known/matrix/server".extraConfig = let
let # use 443 instead of the default 8448 port to unite
# use 443 instead of the default 8448 port to unite # the client-server and server-server port for simplicity
# the client-server and server-server port for simplicity server = { "m.server" = "${fqdn}:443"; };
server = { "m.server" = "${fqdn}:443"; }; in ''
in add_header Content-Type application/json;
'' return 200 '${builtins.toJSON server}';
add_header Content-Type application/json; '';
return 200 '${builtins.toJSON server}'; locations."= /.well-known/matrix/client".extraConfig = let
''; client = {
locations."= /.well-known/matrix/client".extraConfig = "m.homeserver" = { "base_url" = "https://${fqdn}"; };
let "m.identity_server" = { "base_url" = "https://vector.im"; };
client = { };
"m.homeserver" = { "base_url" = "https://${fqdn}"; }; # ACAO required to allow element-web on any URL to request this json file
"m.identity_server" = { "base_url" = "https://vector.im"; }; in ''
}; add_header Content-Type application/json;
# ACAO required to allow element-web on any URL to request this json file add_header Access-Control-Allow-Origin *;
in return 200 '${builtins.toJSON client}';
'' '';
add_header Content-Type application/json; locations."/".extraConfig = ''
add_header Access-Control-Allow-Origin *; rewrite ^(.*)$ http://www.community.rs$1 redirect;
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";
};
}; };
# 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; autoGC = true;
}; };
harden = false; harden = false;
virtualization = { virtualization = { docker = true; };
docker = true;
};
}; };
}; };
# Configure bootloader # Configure bootloader
@ -92,96 +90,91 @@
home-manager.users.nathan = import ./home.nix; home-manager.users.nathan = import ./home.nix;
# Setup minecraft container # Setup minecraft container
containers.minecraft = containers.minecraft = let
let b2AccountID = "00284106ead1ac40000000002";
b2AccountID = "00284106ead1ac40000000002"; b2KeyFile = "${config.sops.secrets."friendpack-backblaze".path}";
b2KeyFile = "${config.sops.secrets."friendpack-backblaze".path}"; b2Bucket = "ForwardProgressServerBackup";
b2Bucket = "ForwardProgressServerBackup"; in {
in config = { pkgs, lib, ... }@attrs:
{ let
config = { pkgs, lib, ... }@attrs: # OpenJDK 17
let javaPackage = pkgs.jdk;
# OpenJDK 17 in {
javaPackage = pkgs.jdk; imports = [ inputs.quilt-server.nixosModules.default ];
in ###
{ ## Container stuff
imports = [ ###
inputs.quilt-server.nixosModules.default # Let nix know this is a container
]; boot.isContainer = true;
### # Set system state version
## Container stuff system.stateVersion = "22.05";
### # Setup networking
# Let nix know this is a container networking.useDHCP = false;
boot.isContainer = true; # Allow minecraft out
# Set system state version networking.firewall.allowedTCPPorts = [ 25565 ];
system.stateVersion = "22.05";
# Setup networking
networking.useDHCP = false;
# Allow minecraft out
networking.firewall.allowedTCPPorts = [ 25565 ];
### ###
## User ## User
### ###
users = { users = {
mutableUsers = false; mutableUsers = false;
# Enable us to not use a password, this is a container # Enable us to not use a password, this is a container
allowNoPasswordLogin = true; allowNoPasswordLogin = true;
}; };
### ###
## Configure module ## Configure module
### ###
forward-progress = { forward-progress = {
services = { services = {
minecraft = { minecraft = {
enable = true; enable = true;
minecraft-version = "1.18.2"; minecraft-version = "1.18.2";
quilt-version = "0.17.1-beta.6"; quilt-version = "0.17.1-beta.6";
ram = 6144; ram = 6144;
properties = { properties = {
motd = "Nathan's Private Modded Minecraft"; motd = "Nathan's Private Modded Minecraft";
white-list = true; white-list = true;
enforce-whitelist = true; enforce-whitelist = true;
};
packwiz-url = "https://pack.forward-progress.net/0.3/pack.toml";
acceptEula = true;
}; };
backup = { packwiz-url = "https://pack.forward-progress.net/0.3/pack.toml";
acceptEula = true;
};
backup = {
enable = true;
backblaze = {
enable = true; enable = true;
backblaze = { accountId = b2AccountID;
enable = true; keyFile = b2KeyFile;
accountId = b2AccountID; bucket = b2Bucket;
keyFile = b2KeyFile;
bucket = b2Bucket;
};
}; };
}; };
}; };
}; };
autoStart = true;
bindMounts = {
"/var/minecraft" = {
hostPath = "/var/minecraft";
isReadOnly = false;
};
"/run/secrets/friendpack-backblaze" = {
hostPath = "/run/secrets/friendpack-backblaze";
};
}; };
forwardPorts = [ autoStart = true;
{ bindMounts = {
containerPort = 25565; "/var/minecraft" = {
hostPort = 25565; hostPath = "/var/minecraft";
protocol = "tcp"; isReadOnly = false;
} };
{ "/run/secrets/friendpack-backblaze" = {
containerPort = 25565; hostPath = "/run/secrets/friendpack-backblaze";
hostPort = 25565; };
protocol = "udp";
}
];
}; };
forwardPorts = [
{
containerPort = 25565;
hostPort = 25565;
protocol = "tcp";
}
{
containerPort = 25565;
hostPort = 25565;
protocol = "udp";
}
];
};
# Setup vhost for pack website # Setup vhost for pack website
services.nginx.virtualHosts."pack.forward-progress.net" = { services.nginx.virtualHosts."pack.forward-progress.net" = {
@ -200,56 +193,48 @@
}; };
# Setup the gitlab runners # Setup the gitlab runners
services.gitlab-runner = services.gitlab-runner = let
let nix-shared = with lib; {
nix-shared = with lib; { dockerImage = "nixpkgs/nix-flakes";
dockerImage = "nixpkgs/nix-flakes"; dockerVolumes = [ "/var/sharedstore:/sharedstore" ];
dockerVolumes = [ dockerDisableCache = true;
"/var/sharedstore:/sharedstore" dockerPrivileged = true;
]; };
dockerDisableCache = true; in {
dockerPrivileged = true; enable = true;
}; concurrent = 4;
in checkInterval = 1;
{ services = {
enable = true; # default-asuran = {
concurrent = 4; # registrationConfigFile = "/var/lib/secret/gitlab-runner/asuran-default";
checkInterval = 1; # dockerImage = "debian:stable";
services = { # dockerVolumes = [
# default-asuran = { # "/var/run/docker.sock:/var/run/docker.sock"
# registrationConfigFile = "/var/lib/secret/gitlab-runner/asuran-default"; # ];
# dockerImage = "debian:stable"; # dockerPrivileged = true;
# dockerVolumes = [ # tagList = [ "linux-own" ];
# "/var/run/docker.sock:/var/run/docker.sock" # };
# ];
# dockerPrivileged = true;
# tagList = [ "linux-own" ];
# };
nix-asuran = nix-shared // { nix-asuran = nix-shared // {
registrationConfigFile = config.sops.secrets.nix-asuran.path; registrationConfigFile = config.sops.secrets.nix-asuran.path;
tagList = [ "nix" ]; tagList = [ "nix" ];
requestConcurrency = 8; requestConcurrency = 8;
limit = 4; limit = 4;
runUntagged = true; runUntagged = true;
};
}; };
}; };
};
# Setup searx-ng docker # Setup searx-ng docker
virtualisation.oci-containers.containers."searx-ng" = { virtualisation.oci-containers.containers."searx-ng" = {
image = "searxng/searxng"; image = "searxng/searxng";
autoStart = true; autoStart = true;
ports = [ "8091:8080" ]; ports = [ "8091:8080" ];
volumes = [ volumes = [ "/var/searxng:/etc/searxng" ];
"/var/searxng:/etc/searxng"
];
}; };
services.nginx.virtualHosts."searx-ng.mccarty.io" = { services.nginx.virtualHosts."searx-ng.mccarty.io" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = { proxyPass = "http://localhost:8091"; };
proxyPass = "http://localhost:8091";
};
}; };
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,33 +1,26 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let nathan = config.nathan;
nathan = config.nathan; in with lib; {
in
with lib;
{
config = mkMerge [ config = mkMerge [
(mkIf nathan.programs.utils.core (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 {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
gcc # Basic command line utilities
binutils 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 = { nLib = {
# mkEnableOption, but defaults to true # mkEnableOption, but defaults to true
mkEnableOptionT = name: lib.mkOption { mkEnableOptionT = name:
default = true; lib.mkOption {
example = false; default = true;
description = "Whether to enable ${name}."; example = false;
type = lib.types.bool; description = "Whether to enable ${name}.";
}; type = lib.types.bool;
};
# mkEnableOption, but with a default # mkEnableOption, but with a default
mkDefaultOption = name: default: lib.mkOption { mkDefaultOption = name: default:
default = default; lib.mkOption {
example = false; default = default;
description = "Whether to enable ${name}."; example = false;
type = lib.types.bool; description = "Whether to enable ${name}.";
}; type = lib.types.bool;
};
# Returns an empty list if the current system is not linux # Returns an empty list if the current system is not linux
ifLinux = value: if pkgs.stdenv.isLinux then value else [ ]; ifLinux = value: if pkgs.stdenv.isLinux then value else [ ];
# Appends if the predicate is true # Appends if the predicate is true

View File

@ -1,8 +1,11 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (import ../lib.nix { inherit lib; inherit pkgs; }) nLib; inherit (import ../lib.nix {
in inherit lib;
{ inherit pkgs;
})
nLib;
in {
imports = [ imports = [
../options.nix ../options.nix
./base.nix ./base.nix
@ -23,163 +26,169 @@ in
./linux/base.nix ./linux/base.nix
]; ];
options = with lib; with nLib; { options = with lib;
nathan = { with nLib; {
# Control enabling of services nathan = {
# Services are system specific so they go here # Control enabling of services
services = { # Services are system specific so they go here
# Use zramSwap, enabled by default services = {
zramSwap = mkDefaultOption "zram memory compression" config.nathan.config.isDesktop; # Use zramSwap, enabled by default
# Enable ssh and configure firewall zramSwap = mkDefaultOption "zram memory compression"
# On by default config.nathan.config.isDesktop;
ssh = mkEnableOptionT "ssh"; # Enable ssh and configure firewall
# 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
# On by default # On by default
autoGC = mkEnableOptionT "Nix store optimization and auto gc"; ssh = mkEnableOptionT "ssh";
# Automatic updating of the system # Enable tailscale, on by default on linux
# On by default tailscale = {
autoUpdate = mkEnableOptionT "Nix autoupdating"; 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 # Linux (desktop/server, not android) specific programs
# On by default if the system is a desktop programs = {
swaywm = { # Install games
enable = mkOption { games = mkEnableOption "games";
default = config.nathan.config.isDesktop; # 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; example = true;
description = "Whether to setup swaywm"; description = "Whether to install the 'nathan' user";
type = lib.types.bool; type = lib.types.bool;
}; };
}; # Should we harden this system?
# Virtualization configuration # On by default
# All on by default if the system is a desktop harden = mkEnableOptionT "Apply system hardening";
virtualization = { # Enable audio subsystem
qemu = mkDefaultOption "qemu" config.nathan.config.isDesktop; # On by default if the system is a desktop
docker = mkDefaultOption "docker" config.nathan.config.isDesktop; audio = mkDefaultOption "audio" config.nathan.config.isDesktop;
lxc = mkDefaultOption "lxc" config.nathan.config.isDesktop; # Basic grub configuration
nixos = mkDefaultOption "nixos containers" config.nathan.config.isDesktop; # Off by default
}; setupGrub = mkEnableOption "Setup grub";
# Support for interacting with a dual booted windows system # Install fonts
windows = { # On by default if the system is a desktop
enable = mkEnableOption "Windows Integration"; fonts = mkDefaultOption "fonts" config.nathan.config.isDesktop;
mount = { # Enable unfree software
enable = mkDefaultOption "Mount a bitlockered windows partition" config.nathan.config.windows.enable; # On by default
device = mkOption { enableUnfree = mkEnableOptionT "unfree software";
description = "Device to mount"; # Nix configuration
example = "/dev/sda2"; nix = {
type = types.str; # 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"; # Virtualization configuration
example = "/dev/sda2"; # All on by default if the system is a desktop
type = types.str; virtualization = {
}; qemu = mkDefaultOption "qemu" config.nathan.config.isDesktop;
keyFile = mkOption { docker = mkDefaultOption "docker" config.nathan.config.isDesktop;
description = "File containing the recovery key for the partition"; lxc = mkDefaultOption "lxc" config.nathan.config.isDesktop;
type = types.str; 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 = { config = {
# Enable the firewall # Enable the firewall
@ -187,9 +196,7 @@ in
# Enable unfree packages # Enable unfree packages
nixpkgs.config.allowUnfree = config.nathan.config.enableUnfree; nixpkgs.config.allowUnfree = config.nathan.config.enableUnfree;
# Work around for discord jank ugh # Work around for discord jank ugh
nixpkgs.config.permittedInsecurePackages = [ nixpkgs.config.permittedInsecurePackages = [ "electron-13.6.9" ];
"electron-13.6.9"
];
# Set system state version # Set system state version
system.stateVersion = "22.05"; system.stateVersion = "22.05";

View File

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

View File

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

View File

@ -1,20 +1,16 @@
{ config, lib, pkgs, inputs, ... }@attrs: { config, lib, pkgs, inputs, ... }@attrs:
with lib; with lib; {
{
config = mkMerge [ config = mkMerge [
(mkIf pkgs.stdenv.isLinux (mkIf pkgs.stdenv.isLinux {
{ zramSwap = mkIf config.nathan.services.zramSwap {
zramSwap = mkIf config.nathan.services.zramSwap enable = true;
{ algorithm = "lz4";
enable = true; memoryPercent = 25;
algorithm = "lz4"; };
memoryPercent = 25; nix = mkIf config.nathan.config.nix.autoGC { autoOptimiseStore = true; };
}; })
nix = mkIf config.nathan.config.nix.autoGC { (mkIf config.nathan.config.harden
autoOptimiseStore = true; (import "${inputs.nixpkgs}/nixos/modules/profiles/hardened.nix" attrs))
};
})
(mkIf config.nathan.config.harden (import "${inputs.nixpkgs}/nixos/modules/profiles/hardened.nix" attrs))
(mkIf config.nathan.config.harden { (mkIf config.nathan.config.harden {
boot.kernelPackages = pkgs.linuxPackages_5_18_hardened; boot.kernelPackages = pkgs.linuxPackages_5_18_hardened;
security = { security = {
@ -22,33 +18,27 @@ with lib;
unprivilegedUsernsClone = true; 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 # Use the zen kernel with muqss turned on
boot.kernelPackages = boot.kernelPackages = let
let linuxZenWMuQSS = pkgs.linuxPackagesFor
linuxZenWMuQSS = pkgs.linuxPackagesFor (pkgs.linuxPackages_zen.kernel.override { (pkgs.linuxPackages_zen.kernel.override {
structuredExtraConfig = with lib.kernel; { structuredExtraConfig = with lib.kernel; { SCHED_MUQSS = yes; };
SCHED_MUQSS = yes;
};
ignoreConfigErrors = true; 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 service cludge
{ {
systemd.user.extraConfig = '' systemd.user.extraConfig = ''

View File

@ -1,34 +1,31 @@
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
let let np = config.nathan.programs;
np = config.nathan.programs; in with lib; {
in
with lib;
{
config = mkIf np.games { config = mkIf np.games {
environment.systemPackages = environment.systemPackages = let
let # https://github.com/Admicos/minecraft-wayland
# https://github.com/Admicos/minecraft-wayland glfw-patched = pkgs.glfw-wayland.overrideAttrs (attrs: {
glfw-patched = pkgs.glfw-wayland.overrideAttrs (attrs: { patches = attrs.patches ++ [
patches = attrs.patches ++ [ ../../../patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch
../../../patches/minecraft/0003-Don-t-crash-on-calls-to-focus-or-icon.patch ../../../patches/minecraft/0004-wayland-fix-broken-opengl-screenshots-on-mutter.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
]; ];
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 for maintaing modpacks
packwiz packwiz
]; ];
in in stable-packages ++ unstable-packages;
stable-packages ++ unstable-packages;
# Install steam # Install steam
programs.steam.enable = true; programs.steam.enable = true;
}; };

View File

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

View File

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

View File

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

View File

@ -1,350 +1,345 @@
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
let let nathan = config.nathan;
nathan = config.nathan; in with lib; {
in
with lib;
{
config = mkMerge [ config = mkMerge [
(mkIf nathan.services.matrix.enable (mkIf nathan.services.matrix.enable {
{ # Enable nginx
# Enable nginx nathan.services.nginx.enable = true;
nathan.services.nginx.enable = true; services = {
services = { # Setup postgres
# Setup postgres postgresql = {
postgresql = { enable = true;
enable = true; initialScript = pkgs.writeText "synapse-init.sql" ''
initialScript = pkgs.writeText "synapse-init.sql" '' CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'matrix-synapse';
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'matrix-synapse'; CREATE DATABASE "synapse" WITH OWNER "synapse"
CREATE DATABASE "synapse" WITH OWNER "synapse" TEMPLATE template0
TEMPLATE template0 LC_COLLATE = "C"
LC_COLLATE = "C" LC_CTYPE = "C";
LC_CTYPE = "C"; '';
''; };
}; # Setup synapse
# Setup synapse matrix-synapse = {
matrix-synapse = { enable = true;
enable = true; settings = {
settings = { enable_registration = nathan.services.matrix.enableRegistration;
enable_registration = nathan.services.matrix.enableRegistration; server_name = nathan.services.matrix.baseDomain;
server_name = nathan.services.matrix.baseDomain;
listeners = [ listeners = [{
{ port = 8008;
port = 8008; bind_addresses = [ "::1" ];
bind_addresses = [ "::1" ]; type = "http";
type = "http"; tls = false;
tls = false; x_forwarded = true;
x_forwarded = true; resources = [{
resources = [ names = [ "client" "federation" ];
{ compress = false;
names = [ "client" "federation" ]; }];
compress = false; }];
} database.args = {
]; user = "matrix-synapse";
} database = "synapse";
];
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 /
};
}; };
}; };
}; };
} # Configure nginx
) nginx.virtualHosts = {
(mkIf nathan.services.matrix.element { "matrix.${nathan.services.matrix.baseDomain}" = {
services.nginx.virtualHosts."element.${nathan.services.matrix.baseDomain}" = { enableACME = true;
enableACME = true; forceSSL = true;
forceSSL = true;
root = inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.element-web.override { locations."/".extraConfig = ''
conf = { rewrite ^(.*)$ http://${
default_server_config."m.homeserver" = { "element." + nathan.services.matrix.baseDomain
"base_url" = "https://matrix.${nathan.services.matrix.baseDomain}"; }$1 redirect;
"server_name" = "matrix.${nathan.services.matrix.baseDomain}"; '';
# 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, ... }: { config, lib, pkgs, ... }:
let let nathan = config.nathan;
nathan = config.nathan; in with lib; {
in
with lib;
{
config = mkMerge [ config = mkMerge [
(mkIf nathan.services.nginx.enable { (mkIf nathan.services.nginx.enable {
networking.firewall = { networking.firewall = {

View File

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

View File

@ -1,18 +1,11 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let nathan = config.nathan;
nathan = config.nathan; in with lib; {
in
with lib;
{
config = mkIf nathan.services.tailscale.enable { config = mkIf nathan.services.tailscale.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ tailscale ];
tailscale
];
# Enable the service # Enable the service
services.tailscale = { services.tailscale = { enable = true; };
enable = true;
};
# Setup sops # Setup sops
sops.secrets."tailscale-auth" = { sops.secrets."tailscale-auth" = {
@ -42,7 +35,9 @@ with lib;
exit 0 exit 0
fi fi
# otherwise authenticate with tailscale # 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, ... }: { config, lib, pkgs, inputs, ... }:
let let nc = config.nathan.config;
nc = config.nathan.config; in with lib; {
in
with lib;
{
config = mkIf nc.swaywm.enable { config = mkIf nc.swaywm.enable {
# Turn on GDM for login # Turn on GDM for login
services.xserver = { services.xserver = {
@ -13,9 +10,7 @@ with lib;
sddm = { sddm = {
enable = true; enable = true;
settings = { settings = {
Wayland = { Wayland = { CompositorCommand = "kwin_wayland --no-lockscreen"; };
CompositorCommand = "kwin_wayland --no-lockscreen";
};
}; };
theme = "sugar-dark"; theme = "sugar-dark";
}; };
@ -64,9 +59,7 @@ with lib;
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
}; };
environment.sessionVariables = { environment.sessionVariables = { MOZ_ENABLE_WAYLAND = "1"; };
MOZ_ENABLE_WAYLAND = "1";
};
# Enable the xdg-portal # Enable the xdg-portal
xdg = { xdg = {

View File

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

View File

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

View File

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

View File

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

View File

@ -1,38 +1,31 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let nathan = config.nathan;
nathan = config.nathan; in with lib; {
in
with lib;
{
config = mkMerge [ config = mkMerge [
(mkIf nathan.programs.utils.core (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 {
environment.packages = with pkgs; [ environment.packages = with pkgs; [
gcc # Basic command line utilities
binutils 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, ... }: { config, lib, pkgs, ... }:
let let
inherit (import ./lib.nix { inherit lib; inherit pkgs; }) nLib; inherit (import ./lib.nix {
in inherit lib;
{ inherit pkgs;
options = with lib; with nLib; { })
nathan = { nLib;
# Programs, many of these will be generic in {
programs = { options = with lib;
# Utility modules with nLib; {
utils = { nathan = {
# Core utililtes I want on every system # Programs, many of these will be generic
# Enabled by default programs = {
core = mkEnableOptionT "utils-core"; # Utility modules
# Development utilities that can't be installed through home manager due to collisions utils = {
devel = mkDefaultOption "devel" config.nathan.config.isDesktop; # 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
# General system configuration config = {
config = { # Name of the user to install
# Name of the user to install user = mkOption {
user = mkOption { default = "nathan";
default = "nathan"; example = "nathan";
example = "nathan"; description = "Username to use for common configuration";
description = "Username to use for common configuration"; type = lib.types.str;
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"; version = "4.2.5";
src = fetchurl { 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="; sha256 = "ibgWP3i0QGKnL0ZmDusouo2DoDxOkRZQFqIl8SEChbs=";
name = "${pname}-${version}.AppImage"; name = "${pname}-${version}.AppImage";
}; };

View File

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

View File

@ -1,38 +1,15 @@
{ config { config, lib, pkgs, stdenv, fetchurl, meson, ninja, pkg-config, git, cmake
, lib , makeDesktopItem, wayland, wayland-protocols, json_c, libxkbcommon, fontconfig
, pkgs , giflib, libjpeg, libjxl, libpng, librsvg, libwebp, libheif, libtiff, libexif
, stdenv , bash-completion, ... }:
, 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 { stdenv.mkDerivation rec {
pname = "swayimg"; pname = "swayimg";
version = "1.9"; version = "1.9";
src = fetchurl { 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="; sha256 = "sha256-aTojp3VevtsUQnGytnSYChxRogNtq8/5aXw+PGJY8Qg=";
name = "${pname}-${version}.tar.gz"; name = "${pname}-${version}.tar.gz";
}; };