Start port to darwin

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

View File

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

137
flake.nix
View File

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

View File

@ -4,55 +4,48 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
fileSystems."/" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."crypt-pv".device = "/dev/disk/by-uuid/15e9f417-b35a-40fe-a066-595be13cf230";
boot.initrd.luks.devices."crypt-pv".device =
"/dev/disk/by-uuid/15e9f417-b35a-40fe-a066-595be13cf230";
fileSystems."/home" =
{
fileSystems."/home" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/nix" =
{
fileSystems."/nix" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/etc" =
{
fileSystems."/etc" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=etc" ];
};
fileSystems."/var" =
{
fileSystems."/var" = {
device = "/dev/mapper/crypt-pv";
fsType = "btrfs";
options = [ "subvol=var" ];
};
fileSystems."/boot" =
{
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/1425-B41E";
fsType = "vfat";
};
@ -70,8 +63,7 @@
fsType = "nfs";
};
swapDevices =
[{
swapDevices = [{
device = "/dev/disk/by-partuuid/f9d26ecd-7df5-48ad-bc19-b9ac4e91b0ee";
randomEncryption = {
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, ... }:
{
imports =
[
(modulesPath + "/profiles/qemu-guest.nix")
];
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=root,compress-force=zstd:1" ];
};
fileSystems."/boot" =
{
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/61AB-C10E";
fsType = "vfat";
};
fileSystems."/home" =
{
fileSystems."/home" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=home,compress-force=zstd:1" ];
};
fileSystems."/etc" =
{
fileSystems."/etc" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=etc,compress-force=zstd:1" ];
};
fileSystems."/var" =
{
fileSystems."/var" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=var,compress-force=zstd:1" ];
};
fileSystems."/nix" =
{
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/88f5bc7a-0101-4f10-8863-25def54bab4b";
fsType = "btrfs";
options = [ "subvol=nix,compress-force=zstd:6" ];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,10 @@
{ 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
home.packages = with pkgs; [
# For markdown rendering
@ -13,17 +16,13 @@
texlive.combined.scheme-medium
# For notifications
libnotify
# For flash cards
anki
# For spelling
aspell
aspellDicts.en
aspellDicts.en-science
aspellDicts.en-computers
myAspell
# For nix
rnix-lsp
manix
nix-doc
nixfmt
# For email
mu
# Desktop file for org-protocol
@ -39,9 +38,15 @@
programs.emacs = {
enable = true;
package = config.nathan.programs.emacs.package;
extraPackages = epkgs: [
pkgs.mu
extraPackages = epkgs: [ pkgs.mu ];
};
}))
(lib.mkIf (config.nathan.programs.emacs.enable && pkgs.stdenv.isLinux) {
home.packages = with pkgs;
[
# For flash cards
anki
];
})
];
};
};
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -63,9 +63,7 @@
autoGC = true;
};
harden = false;
virtualization = {
docker = true;
};
virtualization = { docker = true; };
};
};
# Configure bootloader
@ -92,22 +90,17 @@
home-manager.users.nathan = import ./home.nix;
# Setup minecraft container
containers.minecraft =
let
containers.minecraft = let
b2AccountID = "00284106ead1ac40000000002";
b2KeyFile = "${config.sops.secrets."friendpack-backblaze".path}";
b2Bucket = "ForwardProgressServerBackup";
in
{
in {
config = { pkgs, lib, ... }@attrs:
let
# OpenJDK 17
javaPackage = pkgs.jdk;
in
{
imports = [
inputs.quilt-server.nixosModules.default
];
in {
imports = [ inputs.quilt-server.nixosModules.default ];
###
## Container stuff
###
@ -200,18 +193,14 @@
};
# Setup the gitlab runners
services.gitlab-runner =
let
services.gitlab-runner = let
nix-shared = with lib; {
dockerImage = "nixpkgs/nix-flakes";
dockerVolumes = [
"/var/sharedstore:/sharedstore"
];
dockerVolumes = [ "/var/sharedstore:/sharedstore" ];
dockerDisableCache = true;
dockerPrivileged = true;
};
in
{
in {
enable = true;
concurrent = 4;
checkInterval = 1;
@ -241,15 +230,11 @@
image = "searxng/searxng";
autoStart = true;
ports = [ "8091:8080" ];
volumes = [
"/var/searxng:/etc/searxng"
];
volumes = [ "/var/searxng:/etc/searxng" ];
};
services.nginx.virtualHosts."searx-ng.mccarty.io" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:8091";
};
locations."/" = { proxyPass = "http://localhost:8091"; };
};
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,8 @@
{ config, lib, pkgs, ... }:
let
nathan = config.nathan;
in
with lib;
{
let nathan = config.nathan;
in with lib; {
config = mkMerge [
(mkIf nathan.programs.utils.core
{
(mkIf nathan.programs.utils.core {
environment.systemPackages = with pkgs; [
# Basic command line utilities
wget
@ -23,11 +19,8 @@ with lib;
pv
];
})
(mkIf nathan.programs.utils.devel {
environment.systemPackages = with pkgs; [
gcc
binutils
];
(mkIf (nathan.programs.utils.devel && pkgs.stdenv.isLinux) {
environment.systemPackages = with pkgs; [ gcc binutils ];
})
];
}

View File

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

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

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

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

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

View File

@ -3,14 +3,16 @@
{
nLib = {
# mkEnableOption, but defaults to true
mkEnableOptionT = name: lib.mkOption {
mkEnableOptionT = name:
lib.mkOption {
default = true;
example = false;
description = "Whether to enable ${name}.";
type = lib.types.bool;
};
# mkEnableOption, but with a default
mkDefaultOption = name: default: lib.mkOption {
mkDefaultOption = name: default:
lib.mkOption {
default = default;
example = false;
description = "Whether to enable ${name}.";

View File

@ -1,8 +1,11 @@
{ config, lib, pkgs, ... }:
let
inherit (import ../lib.nix { inherit lib; inherit pkgs; }) nLib;
in
{
inherit (import ../lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in {
imports = [
../options.nix
./base.nix
@ -23,13 +26,15 @@ in
./linux/base.nix
];
options = with lib; with nLib; {
options = with lib;
with nLib; {
nathan = {
# Control enabling of services
# Services are system specific so they go here
services = {
# Use zramSwap, enabled by default
zramSwap = mkDefaultOption "zram memory compression" config.nathan.config.isDesktop;
zramSwap = mkDefaultOption "zram memory compression"
config.nathan.config.isDesktop;
# Enable ssh and configure firewall
# On by default
ssh = mkEnableOptionT "ssh";
@ -80,7 +85,8 @@ in
example = "mccarty.io";
type = lib.types.str;
};
element = mkDefaultOption "element" config.nathan.services.matrix.enable;
element =
mkDefaultOption "element" config.nathan.services.matrix.enable;
enableRegistration = mkEnableOption "synapse registration";
};
};
@ -154,13 +160,15 @@ in
qemu = mkDefaultOption "qemu" config.nathan.config.isDesktop;
docker = mkDefaultOption "docker" config.nathan.config.isDesktop;
lxc = mkDefaultOption "lxc" config.nathan.config.isDesktop;
nixos = mkDefaultOption "nixos containers" config.nathan.config.isDesktop;
nixos =
mkDefaultOption "nixos containers" config.nathan.config.isDesktop;
};
# Support for interacting with a dual booted windows system
windows = {
enable = mkEnableOption "Windows Integration";
mount = {
enable = mkDefaultOption "Mount a bitlockered windows partition" config.nathan.config.windows.enable;
enable = mkDefaultOption "Mount a bitlockered windows partition"
config.nathan.config.windows.enable;
device = mkOption {
description = "Device to mount";
example = "/dev/sda2";
@ -172,7 +180,8 @@ in
type = types.str;
};
keyFile = mkOption {
description = "File containing the recovery key for the partition";
description =
"File containing the recovery key for the partition";
type = types.str;
};
};
@ -187,9 +196,7 @@ in
# Enable unfree packages
nixpkgs.config.allowUnfree = config.nathan.config.enableUnfree;
# Work around for discord jank ugh
nixpkgs.config.permittedInsecurePackages = [
"electron-13.6.9"
];
nixpkgs.config.permittedInsecurePackages = [ "electron-13.6.9" ];
# Set system state version
system.stateVersion = "22.05";

View File

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

View File

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

View File

@ -1,20 +1,16 @@
{ config, lib, pkgs, inputs, ... }@attrs:
with lib;
{
with lib; {
config = mkMerge [
(mkIf pkgs.stdenv.isLinux
{
zramSwap = mkIf config.nathan.services.zramSwap
{
(mkIf pkgs.stdenv.isLinux {
zramSwap = mkIf config.nathan.services.zramSwap {
enable = true;
algorithm = "lz4";
memoryPercent = 25;
};
nix = mkIf config.nathan.config.nix.autoGC {
autoOptimiseStore = true;
};
nix = mkIf config.nathan.config.nix.autoGC { autoOptimiseStore = true; };
})
(mkIf config.nathan.config.harden (import "${inputs.nixpkgs}/nixos/modules/profiles/hardened.nix" attrs))
(mkIf config.nathan.config.harden
(import "${inputs.nixpkgs}/nixos/modules/profiles/hardened.nix" attrs))
(mkIf config.nathan.config.harden {
boot.kernelPackages = pkgs.linuxPackages_5_18_hardened;
security = {
@ -22,23 +18,17 @@ with lib;
unprivilegedUsernsClone = true;
};
})
(mkIf ((! config.nathan.config.harden) && config.nathan.config.isDesktop) {
(mkIf ((!config.nathan.config.harden) && config.nathan.config.isDesktop) {
# Use the zen kernel with muqss turned on
boot.kernelPackages =
let
linuxZenWMuQSS = pkgs.linuxPackagesFor (pkgs.linuxPackages_zen.kernel.override {
structuredExtraConfig = with lib.kernel; {
SCHED_MUQSS = yes;
};
boot.kernelPackages = let
linuxZenWMuQSS = pkgs.linuxPackagesFor
(pkgs.linuxPackages_zen.kernel.override {
structuredExtraConfig = with lib.kernel; { SCHED_MUQSS = yes; };
ignoreConfigErrors = true;
}
);
in
linuxZenWMuQSS;
});
in linuxZenWMuQSS;
})
(mkIf
(config.nathan.config.nix.autoUpdate && pkgs.stdenv.isLinux)
{
(mkIf (config.nathan.config.nix.autoUpdate && pkgs.stdenv.isLinux) {
# Auto update daily at 2 am
system.autoUpgrade = {
enable = true;

View File

@ -1,12 +1,8 @@
{ config, lib, pkgs, inputs, ... }:
let
np = config.nathan.programs;
in
with lib;
{
let np = config.nathan.programs;
in with lib; {
config = mkIf np.games {
environment.systemPackages =
let
environment.systemPackages = let
# https://github.com/Admicos/minecraft-wayland
glfw-patched = pkgs.glfw-wayland.overrideAttrs (attrs: {
patches = attrs.patches ++ [
@ -23,12 +19,13 @@ with lib;
inputs.polymc.packages."${system}".polymc
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
];
in
stable-packages ++ unstable-packages;
in stable-packages ++ unstable-packages;
# Install steam
programs.steam.enable = true;
};

View File

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

View File

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

View File

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

View File

@ -1,12 +1,8 @@
{ config, lib, pkgs, inputs, ... }:
let
nathan = config.nathan;
in
with lib;
{
let nathan = config.nathan;
in with lib; {
config = mkMerge [
(mkIf nathan.services.matrix.enable
{
(mkIf nathan.services.matrix.enable {
# Enable nginx
nathan.services.nginx.enable = true;
services = {
@ -28,21 +24,17 @@ with lib;
enable_registration = nathan.services.matrix.enableRegistration;
server_name = nathan.services.matrix.baseDomain;
listeners = [
{
listeners = [{
port = 8008;
bind_addresses = [ "::1" ];
type = "http";
tls = false;
x_forwarded = true;
resources = [
{
resources = [{
names = [ "client" "federation" ];
compress = false;
}
];
}
];
}];
}];
database.args = {
user = "matrix-synapse";
database = "synapse";
@ -56,7 +48,9 @@ with lib;
forceSSL = true;
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
@ -69,16 +63,18 @@ with lib;
};
};
};
}
)
})
(mkIf nathan.services.matrix.element {
services.nginx.virtualHosts."element.${nathan.services.matrix.baseDomain}" = {
services.nginx.virtualHosts."element.${nathan.services.matrix.baseDomain}" =
{
enableACME = true;
forceSSL = true;
root = inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.element-web.override {
root =
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.element-web.override {
conf = {
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}";
};
showLabsSettings = true;
@ -279,7 +275,6 @@ with lib;
};
}
{
"name" = "Selenized light theme";
"is_dark" = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,8 @@
{ config, lib, pkgs, ... }:
let
nathan = config.nathan;
in
with lib;
{
let nathan = config.nathan;
in with lib; {
config = mkMerge [
(mkIf nathan.programs.utils.core
{
(mkIf nathan.programs.utils.core {
environment.packages = with pkgs; [
# Basic command line utilities
wget
@ -29,10 +25,7 @@ with lib;
];
})
(mkIf nathan.programs.utils.devel {
environment.packages = with pkgs; [
gcc
binutils
];
environment.packages = with pkgs; [ gcc binutils ];
})
];
}

View File

@ -1,10 +1,14 @@
{ config, lib, pkgs, ... }:
let
inherit (import ./lib.nix { inherit lib; inherit pkgs; }) nLib;
in
{
options = with lib; with nLib; {
inherit (import ./lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in {
options = with lib;
with nLib; {
nathan = {
# Programs, many of these will be generic
programs = {

View File

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

View File

@ -1,63 +1,14 @@
{ pname
, version
, src
, binaryName
, desktopName
, autoPatchelfHook
, makeDesktopItem
, lib
, stdenv
, wrapGAppsHook
, alsaLib
, at-spi2-atk
, at-spi2-core
, atk
, cairo
, cups
, dbus
, expat
, fontconfig
, freetype
, gdk-pixbuf
, glib
, gtk3
, libcxx
, libdrm
, libnotify
, libpulseaudio
, libuuid
, libX11
, libXScrnSaver
, libXcomposite
, libXcursor
, libXdamage
, libXext
, libXfixes
, libXi
, libXrandr
, libXrender
, libXtst
, libxcb
, libxshmfence
, mesa
, nspr
, nss
, pango
, systemd
, libappindicator-gtk3
, libdbusmenu
, writeScript
, common-updater-scripts
, electron
, nodePackages
, libgcc
, glibc
}:
{ pname, version, src, binaryName, desktopName, autoPatchelfHook
, makeDesktopItem, lib, stdenv, wrapGAppsHook, alsaLib, at-spi2-atk
, at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig, freetype, gdk-pixbuf
, glib, gtk3, libcxx, libdrm, libnotify, libpulseaudio, libuuid, libX11
, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext, libXfixes
, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence, mesa, nspr, nss
, pango, systemd, libappindicator-gtk3, libdbusmenu, writeScript
, common-updater-scripts, electron, nodePackages, libgcc, glibc }:
let
inherit binaryName;
in
stdenv.mkDerivation rec {
let inherit binaryName;
in stdenv.mkDerivation rec {
inherit pname version src;
nativeBuildInputs = [
@ -80,11 +31,7 @@ stdenv.mkDerivation rec {
autoPatchelfHook
];
buildInputs = [
electron
libgcc
glibc
];
buildInputs = [ electron libgcc glibc ];
dontWrapGApps = true;
@ -131,11 +78,8 @@ stdenv.mkDerivation rec {
libgcc
];
installPhase =
let
electron_exec = "${electron}/bin/electron";
in
''
installPhase = let electron_exec = "${electron}/bin/electron";
in ''
mkdir -p $out/{bin,opt/${binaryName},share/pixmaps}
mv * $out/opt/${binaryName}
chmod +x $out/opt/${binaryName}/${binaryName}
@ -158,8 +102,7 @@ stdenv.mkDerivation rec {
ln -s $out/bin/${binaryName} $out/bin/${lib.strings.toLower binaryName}
'';
desktopItem =
makeDesktopItem {
desktopItem = makeDesktopItem {
name = pname;
exec = "${binaryName}";
icon = pname;
@ -173,7 +116,9 @@ stdenv.mkDerivation rec {
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnugrep common-updater-scripts
set -eou pipefail;
url=$(curl -sI "https://discordapp.com/api/download/${builtins.replaceStrings ["discord-" "discord"] ["" "stable"] pname}?platform=linux&format=tar.gz" | grep -oP 'location: \K\S+')
url=$(curl -sI "https://discordapp.com/api/download/${
builtins.replaceStrings [ "discord-" "discord" ] [ "" "stable" ] pname
}?platform=linux&format=tar.gz" | grep -oP 'location: \K\S+')
version=''${url##https://dl*.discordapp.net/apps/linux/}
version=''${version%%/*.tar.gz}
update-source-version ${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix

View File

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