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",

137
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,54 +64,27 @@
}; };
}; };
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 =
{ system, hostName, extraModules ? [ ], ourNixpkgs ? nixpkgs }:
ourNixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { specialArgs = { inputs = inputs; };
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 # Setup sops
# Add default secrets # Add default secrets
sops = { sops = { age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; };
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
};
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = (pkg: true); nixpkgs.config.allowUnfreePredicate = (pkg: true);
# Home manager configuration # Home manager configuration
@ -115,15 +95,35 @@
inputs = inputs; inputs = inputs;
nixosConfig = config; nixosConfig = config;
}; };
sharedModules = [ sharedModules = [ ./home-manager/linux/default.nix ];
./home-manager/linux/default.nix
];
}; };
}) })
] ++ extraModules; ] ++ extraModules;
}; };
in makeDarwinSystem = { system, extraModules ? [ ] }:
rec { darwin.lib.darwinSystem {
inherit system;
specialArgs = { inputs = inputs; };
modules = [
home-manager.darwinModules.home-manager
./modules/darwin/default.nix
({ pkgs, lib, config, ... }: {
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = (pkg: true);
# Home manager configuration
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {
inputs = inputs;
nixosConfig = config;
};
sharedModules = [ ./home-manager/darwin/default.nix ];
};
})
] ++ extraModules;
};
in rec {
# Real systems # 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,55 +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 = [ "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";
}; };
@ -70,8 +63,7 @@
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";
@ -80,5 +72,6 @@
}; };
}]; }];
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View File

@ -4,52 +4,44 @@
{ 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" ];

View File

@ -4,52 +4,44 @@
{ 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" ];

View File

@ -4,52 +4,44 @@
{ 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" ];

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,10 +2,14 @@
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 {
@ -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,7 +1,10 @@
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
{ {
config = lib.mkIf config.nathan.programs.emacs.enable { config = lib.mkMerge [
(lib.mkIf config.nathan.programs.emacs.enable (let
myAspell = pkgs.aspellWithDicts (d: [ d.en d.en-science d.en-computers ]);
in {
# Dependencies of my emacs environment # Dependencies of my emacs environment
home.packages = with pkgs; [ home.packages = with pkgs; [
# For markdown rendering # For markdown rendering
@ -13,17 +16,13 @@
texlive.combined.scheme-medium texlive.combined.scheme-medium
# For notifications # For notifications
libnotify libnotify
# For flash cards
anki
# For spelling # For spelling
aspell myAspell
aspellDicts.en
aspellDicts.en-science
aspellDicts.en-computers
# For nix # For nix
rnix-lsp rnix-lsp
manix manix
nix-doc nix-doc
nixfmt
# For email # For email
mu mu
# Desktop file for org-protocol # Desktop file for org-protocol
@ -39,9 +38,15 @@
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = config.nathan.programs.emacs.package; package = config.nathan.programs.emacs.package;
extraPackages = epkgs: [ extraPackages = epkgs: [ pkgs.mu ];
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,24 +4,29 @@
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 =
"https://dl.discordapp.net/apps/linux/${version}/discord-${version}.tar.gz";
hash = "sha256-3f7yuxigEF3e8qhCetCHKBtV4XUHsx/iYiaCCXjspYw="; hash = "sha256-3f7yuxigEF3e8qhCetCHKBtV4XUHsx/iYiaCCXjspYw=";
}; };
electron = pkgs.electron_13; electron = pkgs.electron_13;
@ -29,7 +34,8 @@
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,10 +2,14 @@
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 {
@ -18,7 +22,8 @@ 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
]; ];
}) })

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;
};
}; };
}; };
}; };

View File

@ -1,15 +1,11 @@
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
let let nathan = config.nathan;
nathan = config.nathan; in with lib; {
in config = mkIf nathan.programs.swaywm.enable (let
with lib; swaylock-command = ''
{ ${pkgs.swaylock-effects}/bin/swaylock --screenshots --grace 30 --indicator --clock --timestr "%-I:%M:%S %p" --datestr "%A %Y-%M-%d" --effect-blur 20x3'';
config = mkIf nathan.programs.swaywm.enable (
let
swaylock-command = "${pkgs.swaylock-effects}/bin/swaylock --screenshots --grace 30 --indicator --clock --timestr \"%-I:%M:%S %p\" --datestr \"%A %Y-%M-%d\" --effect-blur 20x3";
swayimg = pkgs.callPackage ../../../packages/swayimg/default.nix { }; swayimg = pkgs.callPackage ../../../packages/swayimg/default.nix { };
in in {
{
home.packages = with pkgs; [ home.packages = with pkgs; [
# Locking and display management # Locking and display management
wdisplays wdisplays
@ -69,23 +65,17 @@ with lib;
# Make pinentry float # Make pinentry float
{ {
command = "floating enable"; command = "floating enable";
criteria = { criteria = { app_id = "pinentry-qt"; };
app_id = "pinentry-qt";
};
} }
# Make swayimg float, this is required to make it work # Make swayimg float, this is required to make it work
{ {
command = "floating enable"; command = "floating enable";
criteria = { criteria = { app_id = "^swayimg.*"; };
app_id = "^swayimg.*";
};
} }
# Work around for chrome ui bug # Work around for chrome ui bug
{ {
command = "shortcuts_inhibitor disable"; command = "shortcuts_inhibitor disable";
criteria = { criteria = { app_id = "^chrome-.*_-.*$"; };
app_id = "^chrome-.*_-.*$";
};
} }
]; ];
}; };
@ -140,25 +130,27 @@ with lib;
}; };
}; };
# Setup keybindings # Setup keybindings
keybindings = keybindings = let modifer = "Mod4";
let in lib.mkOptionDefault {
modifer = "Mod4";
in
lib.mkOptionDefault {
"${modifer}+q" = "kill"; "${modifer}+q" = "kill";
"${modifer}+z" = "exec ${swaylock-command}"; "${modifer}+z" = "exec ${swaylock-command}";
## Sreenshot keybinds ## Sreenshot keybinds
# Copy area to clipboard # Copy area to clipboard
"${modifer}+x" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area"; "${modifer}+x" =
"exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area";
# Copy window to clipboard # Copy window to clipboard
"${modifer}+Ctrl+x" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy window"; "${modifer}+Ctrl+x" =
"exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy window";
# Clpy entire output to clipboard # Clpy entire output to clipboard
"${modifer}+Alt+x" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy output"; "${modifer}+Alt+x" =
"exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy output";
# Make the mute key work # Make the mute key work
"XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle"; "XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle";
# Make the volume keys work # Make the volume keys work
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%"; "XF86AudioRaiseVolume" =
"XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%"; "exec pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" =
"exec pactl set-sink-volume @DEFAULT_SINK@ -5%";
# Play/pause and next song # Play/pause and next song
"XF86AudioPlay" = "exec mpc toggle"; "XF86AudioPlay" = "exec mpc toggle";
"XF86AudioNext" = "exec mpc next"; "XF86AudioNext" = "exec mpc next";
@ -169,9 +161,7 @@ with lib;
{ command = "mako"; } { command = "mako"; }
]; ];
# Turn on numlock by default # Turn on numlock by default
input = { input = { "*" = { xkb_numlock = "enable"; }; };
"*" = { xkb_numlock = "enable"; };
};
}; };
}; };
######################### #########################
@ -213,8 +203,8 @@ with lib;
# Turn off the displays after 10 minutes of inactivity # Turn off the displays after 10 minutes of inactivity
{ {
timeout = 600; timeout = 600;
command = "swaymsg \"output * dpms off\""; command = ''swaymsg "output * dpms off"'';
resumeCommand = "swaymsg \"output * dpms on\""; resumeCommand = ''swaymsg "output * dpms on"'';
} }
]; ];
}; };
@ -224,9 +214,7 @@ with lib;
programs.waybar = { programs.waybar = {
enable = true; enable = true;
package = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".waybar; package = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".waybar;
systemd = { systemd = { enable = false; };
enable = false;
};
settings = { settings = {
mainBar = { mainBar = {
layer = "top"; layer = "top";
@ -235,34 +223,20 @@ with lib;
modules-left = [ "sway/workspaces" "sway/mode" ]; modules-left = [ "sway/workspaces" "sway/mode" ];
modules-center = [ "sway/window" ]; modules-center = [ "sway/window" ];
modules-right = [ "mpd" "clock" "tray" ]; modules-right = [ "mpd" "clock" "tray" ];
"sway/workspaces" = { "sway/workspaces" = { disable-scroll = true; };
disable-scroll = true; "sway/window" = { icon = true; };
}; "clock" = { format = "{:%I:%M%p %Y-%m-%d}"; };
"sway/window" = { "window" = { icon = true; };
icon = true; "tray" = { spacing = 5; };
};
"clock" = {
format = "{:%I:%M%p %Y-%m-%d}";
};
"window" = {
icon = true;
};
"tray" = {
spacing = 5;
};
"mpd" = { "mpd" = {
format = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S})"; format =
"{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S})";
format-disconnected = "Disconnected "; format-disconnected = "Disconnected ";
format-stopped = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped "; format-stopped =
consume-icons = { "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ";
on = "🍴"; consume-icons = { on = "🍴"; };
}; random-icons = { on = "🔀"; };
random-icons = { repeat-icons = { on = "🔁"; };
on = "🔀";
};
repeat-icons = {
on = "🔁";
};
state-icons = { state-icons = {
paused = ""; paused = "";
playing = ""; playing = "";
@ -628,6 +602,5 @@ with lib;
"image/tiff" = [ "swayimg.desktop" ]; "image/tiff" = [ "swayimg.desktop" ];
"image/bmp" = [ "swayimg.desktop" ]; "image/bmp" = [ "swayimg.desktop" ];
}; };
} });
);
} }

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
then
"${../../../scripts/update-mu4e.sh}" "${../../../scripts/update-mu4e.sh}"
else else
"${pkgs.mu}/bin/mu index"; "${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,38 +149,31 @@
}; };
# 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;
in
{
"${config.networking.domain}" = { "${config.networking.domain}" = {
enableACME = true; enableACME = true;
forceSSL = 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; add_header Content-Type application/json;
return 200 '${builtins.toJSON server}'; return 200 '${builtins.toJSON server}';
''; '';
locations."= /.well-known/matrix/client".extraConfig = locations."= /.well-known/matrix/client".extraConfig = let
let
client = { client = {
"m.homeserver" = { "base_url" = "https://${fqdn}"; }; "m.homeserver" = { "base_url" = "https://${fqdn}"; };
"m.identity_server" = { "base_url" = "https://vector.im"; }; "m.identity_server" = { "base_url" = "https://vector.im"; };
}; };
# ACAO required to allow element-web on any URL to request this json file # ACAO required to allow element-web on any URL to request this json file
in in ''
''
add_header Content-Type application/json; add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}'; return 200 '${builtins.toJSON client}';
@ -195,25 +186,21 @@
"www.community.rs" = { "www.community.rs" = {
enableACME = true; enableACME = true;
forceSSL = 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; add_header Content-Type application/json;
return 200 '${builtins.toJSON server}'; return 200 '${builtins.toJSON server}';
''; '';
locations."= /.well-known/matrix/client".extraConfig = locations."= /.well-known/matrix/client".extraConfig = let
let
client = { client = {
"m.homeserver" = { "base_url" = "https://${fqdn}"; }; "m.homeserver" = { "base_url" = "https://${fqdn}"; };
"m.identity_server" = { "base_url" = "https://vector.im"; }; "m.identity_server" = { "base_url" = "https://vector.im"; };
}; };
# ACAO required to allow element-web on any URL to request this json file # ACAO required to allow element-web on any URL to request this json file
in in ''
''
add_header Content-Type application/json; add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}'; return 200 '${builtins.toJSON client}';

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,22 +90,17 @@
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: config = { pkgs, lib, ... }@attrs:
let let
# OpenJDK 17 # OpenJDK 17
javaPackage = pkgs.jdk; javaPackage = pkgs.jdk;
in in {
{ imports = [ inputs.quilt-server.nixosModules.default ];
imports = [
inputs.quilt-server.nixosModules.default
];
### ###
## Container stuff ## Container stuff
### ###
@ -200,18 +193,14 @@
}; };
# 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 = [ dockerVolumes = [ "/var/sharedstore:/sharedstore" ];
"/var/sharedstore:/sharedstore"
];
dockerDisableCache = true; dockerDisableCache = true;
dockerPrivileged = true; dockerPrivileged = true;
}; };
in in {
{
enable = true; enable = true;
concurrent = 4; concurrent = 4;
checkInterval = 1; checkInterval = 1;
@ -241,15 +230,11 @@
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,12 +1,8 @@
{ 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; [ environment.systemPackages = with pkgs; [
# Basic command line utilities # Basic command line utilities
wget wget
@ -23,11 +19,8 @@ with lib;
pv pv
]; ];
}) })
(mkIf nathan.programs.utils.devel { (mkIf (nathan.programs.utils.devel && pkgs.stdenv.isLinux) {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ gcc binutils ];
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,14 +3,16 @@
{ {
nLib = { nLib = {
# mkEnableOption, but defaults to true # mkEnableOption, but defaults to true
mkEnableOptionT = name: lib.mkOption { mkEnableOptionT = name:
lib.mkOption {
default = true; default = true;
example = false; example = false;
description = "Whether to enable ${name}."; description = "Whether to enable ${name}.";
type = lib.types.bool; type = lib.types.bool;
}; };
# mkEnableOption, but with a default # mkEnableOption, but with a default
mkDefaultOption = name: default: lib.mkOption { mkDefaultOption = name: default:
lib.mkOption {
default = default; default = default;
example = false; example = false;
description = "Whether to enable ${name}."; description = "Whether to enable ${name}.";

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,13 +26,15 @@ in
./linux/base.nix ./linux/base.nix
]; ];
options = with lib; with nLib; { options = with lib;
with nLib; {
nathan = { nathan = {
# Control enabling of services # Control enabling of services
# Services are system specific so they go here # Services are system specific so they go here
services = { services = {
# Use zramSwap, enabled by default # Use zramSwap, enabled by default
zramSwap = mkDefaultOption "zram memory compression" config.nathan.config.isDesktop; zramSwap = mkDefaultOption "zram memory compression"
config.nathan.config.isDesktop;
# Enable ssh and configure firewall # Enable ssh and configure firewall
# On by default # On by default
ssh = mkEnableOptionT "ssh"; ssh = mkEnableOptionT "ssh";
@ -80,7 +85,8 @@ in
example = "mccarty.io"; example = "mccarty.io";
type = lib.types.str; type = lib.types.str;
}; };
element = mkDefaultOption "element" config.nathan.services.matrix.enable; element =
mkDefaultOption "element" config.nathan.services.matrix.enable;
enableRegistration = mkEnableOption "synapse registration"; enableRegistration = mkEnableOption "synapse registration";
}; };
}; };
@ -154,13 +160,15 @@ in
qemu = mkDefaultOption "qemu" config.nathan.config.isDesktop; qemu = mkDefaultOption "qemu" config.nathan.config.isDesktop;
docker = mkDefaultOption "docker" config.nathan.config.isDesktop; docker = mkDefaultOption "docker" config.nathan.config.isDesktop;
lxc = mkDefaultOption "lxc" config.nathan.config.isDesktop; lxc = mkDefaultOption "lxc" config.nathan.config.isDesktop;
nixos = mkDefaultOption "nixos containers" config.nathan.config.isDesktop; nixos =
mkDefaultOption "nixos containers" config.nathan.config.isDesktop;
}; };
# Support for interacting with a dual booted windows system # Support for interacting with a dual booted windows system
windows = { windows = {
enable = mkEnableOption "Windows Integration"; enable = mkEnableOption "Windows Integration";
mount = { mount = {
enable = mkDefaultOption "Mount a bitlockered windows partition" config.nathan.config.windows.enable; enable = mkDefaultOption "Mount a bitlockered windows partition"
config.nathan.config.windows.enable;
device = mkOption { device = mkOption {
description = "Device to mount"; description = "Device to mount";
example = "/dev/sda2"; example = "/dev/sda2";
@ -172,7 +180,8 @@ in
type = types.str; type = types.str;
}; };
keyFile = mkOption { keyFile = mkOption {
description = "File containing the recovery key for the partition"; description =
"File containing the recovery key for the partition";
type = types.str; type = types.str;
}; };
}; };
@ -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,16 +1,11 @@
{ 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; [ environment.systemPackages = with pkgs; [ wally-cli ];
wally-cli
];
hardware.keyboard.zsa.enable = true; hardware.keyboard.zsa.enable = true;
# Configure grub if configured # Configure grub if configured
}) })
@ -63,9 +58,7 @@ with lib; {
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; enable = true;
algorithm = "lz4"; algorithm = "lz4";
memoryPercent = 25; memoryPercent = 25;
}; };
nix = mkIf config.nathan.config.nix.autoGC { nix = mkIf config.nathan.config.nix.autoGC { autoOptimiseStore = true; };
autoOptimiseStore = true;
};
}) })
(mkIf config.nathan.config.harden (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 = {
@ -24,21 +20,15 @@ with lib;
}) })
(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 (mkIf (config.nathan.config.nix.autoUpdate && pkgs.stdenv.isLinux) {
(config.nathan.config.nix.autoUpdate && pkgs.stdenv.isLinux)
{
# Auto update daily at 2 am # Auto update daily at 2 am
system.autoUpgrade = { system.autoUpgrade = {
enable = true; enable = true;

View File

@ -1,12 +1,8 @@
{ 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 ++ [
@ -23,12 +19,13 @@ with lib;
inputs.polymc.packages."${system}".polymc inputs.polymc.packages."${system}".polymc
glfw-patched glfw-patched
]; ];
unstable-packages = with inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}"; [ 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,12 +1,8 @@
{ 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 = {
@ -28,21 +24,17 @@ with lib;
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" ]; names = [ "client" "federation" ];
compress = false; compress = false;
} }];
]; }];
}
];
database.args = { database.args = {
user = "matrix-synapse"; user = "matrix-synapse";
database = "synapse"; database = "synapse";
@ -56,7 +48,9 @@ with lib;
forceSSL = true; forceSSL = true;
locations."/".extraConfig = '' locations."/".extraConfig = ''
rewrite ^(.*)$ http://${"element." + nathan.services.matrix.baseDomain}$1 redirect; rewrite ^(.*)$ http://${
"element." + nathan.services.matrix.baseDomain
}$1 redirect;
''; '';
# forward all Matrix API calls to the synapse Matrix homeserver # forward all Matrix API calls to the synapse Matrix homeserver
@ -69,16 +63,18 @@ with lib;
}; };
}; };
}; };
} })
)
(mkIf nathan.services.matrix.element { (mkIf nathan.services.matrix.element {
services.nginx.virtualHosts."element.${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 { root =
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.element-web.override {
conf = { conf = {
default_server_config."m.homeserver" = { default_server_config."m.homeserver" = {
"base_url" = "https://matrix.${nathan.services.matrix.baseDomain}"; "base_url" =
"https://matrix.${nathan.services.matrix.baseDomain}";
"server_name" = "matrix.${nathan.services.matrix.baseDomain}"; "server_name" = "matrix.${nathan.services.matrix.baseDomain}";
}; };
showLabsSettings = true; showLabsSettings = true;
@ -279,7 +275,6 @@ with lib;
}; };
} }
{ {
"name" = "Selenized light theme"; "name" = "Selenized light theme";
"is_dark" = false; "is_dark" = false;

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 "/Users/nathan" else "/home/nathan"; home = if pkgs.stdenv.isDarwin then
"/Users/${nc.user}"
else
"/home/${nc.user}";
description = "Nathan McCarty"; description = "Nathan McCarty";
shell = pkgs.fish; shell = pkgs.fish;
# Linux specific configuration next # 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,20 +1,14 @@
{ 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; [ environment.systemPackages = with pkgs; [ virtmanager ];
virtmanager
];
}) })
(mkIf nc.virtualization.docker { (mkIf nc.virtualization.docker {
# Enable docker # Enable 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

@ -5,26 +5,22 @@ with lib;{
# 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,12 +1,8 @@
{ 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; [ environment.packages = with pkgs; [
# Basic command line utilities # Basic command line utilities
wget wget
@ -29,10 +25,7 @@ with lib;
]; ];
}) })
(mkIf nathan.programs.utils.devel { (mkIf nathan.programs.utils.devel {
environment.packages = with pkgs; [ environment.packages = with pkgs; [ gcc binutils ];
gcc
binutils
];
}) })
]; ];
} }

View File

@ -1,10 +1,14 @@
{ 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; { })
nLib;
in {
options = with lib;
with nLib; {
nathan = { nathan = {
# Programs, many of these will be generic # Programs, many of these will be generic
programs = { programs = {

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,11 +78,8 @@ stdenv.mkDerivation rec {
libgcc libgcc
]; ];
installPhase = installPhase = let electron_exec = "${electron}/bin/electron";
let in ''
electron_exec = "${electron}/bin/electron";
in
''
mkdir -p $out/{bin,opt/${binaryName},share/pixmaps} mkdir -p $out/{bin,opt/${binaryName},share/pixmaps}
mv * $out/opt/${binaryName} mv * $out/opt/${binaryName}
chmod +x $out/opt/${binaryName}/${binaryName} chmod +x $out/opt/${binaryName}/${binaryName}
@ -158,8 +102,7 @@ stdenv.mkDerivation rec {
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;
@ -173,7 +116,9 @@ stdenv.mkDerivation rec {
#!/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";
}; };