System/flake.nix

193 lines
5.6 KiB
Nix
Raw Normal View History

2021-12-20 13:37:26 -05:00
{
description = "Nathan's system configurations";
inputs = {
2022-05-30 21:47:04 -04:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
2021-12-20 13:37:26 -05:00
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
fenix = {
url = "github:nix-community/fenix";
2022-05-17 00:18:49 -04:00
inputs.nixpgks.follows = "nixpkgs";
2021-12-20 13:37:26 -05:00
};
emacs = {
2022-06-23 02:57:41 -04:00
url = "github:nix-community/emacs-overlay";
2022-05-25 04:48:14 -04:00
inputs.nixpkgs.follows = "nixpkgs";
2022-01-26 16:53:39 -05:00
};
mozilla = {
url = "github:mozilla/nixpkgs-mozilla";
flake = false;
2021-12-20 13:37:26 -05:00
};
2022-05-17 00:18:49 -04:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-04-19 19:39:39 -04:00
polymc = {
url = "github:PolyMC/PolyMC";
2022-06-01 13:02:33 -04:00
inputs.nixpkgs.follows = "nixpkgs";
2022-04-19 19:39:39 -04:00
};
2022-04-21 15:18:47 -04:00
nix-doom-emacs = {
url = "github:nix-community/nix-doom-emacs";
inputs.nixpkgs.follows = "nixpkgs";
inputs.emacs-overlay.follows = "emacs";
};
2022-06-14 01:00:09 -04:00
java = {
url = "github:nathans-flakes/java";
inputs.nixpkgs.follows = "nixpkgs";
};
quilt-server = {
url = "github:forward-progress/quilt-server-nix-container";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-12-20 13:37:26 -05:00
};
outputs =
{ self
, nixpkgs
, nixpkgs-unstable
, fenix
, emacs
, mozilla
, sops-nix
, home-manager
, darwin
, polymc
, nix-doom-emacs
2022-06-14 01:00:09 -04:00
, java
, quilt-server
2022-06-23 02:57:41 -04:00
}@inputs:
2021-12-23 00:45:21 -05:00
let
2022-06-23 02:57:41 -04:00
makeNixosSystem = { system, hostName, extraModules ? [ ], ourNixpkgs ? nixpkgs }: ourNixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inputs = inputs;
2022-05-18 01:09:25 -04:00
};
2022-06-23 02:57:41 -04:00
modules = [
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
./modules/default.nix
({ pkgs, lib, config, ... }: {
2022-06-23 02:57:41 -04:00
# Configure hostname
networking = {
hostName = hostName;
};
# Setup sops
# Add default secrets
sops = {
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
};
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = (pkg: true);
# Home manager configuration
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {
inputs = inputs;
nixosConfig = config;
2022-06-23 02:57:41 -04:00
};
sharedModules = [
./home-manager/default.nix
];
};
})
] ++ extraModules;
};
2021-12-23 00:45:21 -05:00
in
2022-06-23 02:57:41 -04:00
rec {
nixosConfigurations = {
2022-06-23 02:57:41 -04:00
levitation = makeNixosSystem {
system = "x86_64-linux";
2022-06-23 02:57:41 -04:00
hostName = "levitation";
extraModules = [
./hardware/levitation.nix
2022-06-23 02:57:41 -04:00
({ pkgs, config, lib, ... }: {
2022-07-02 14:33:15 -04:00
# sops for borg
sops.secrets."borg-ssh-key" = {
sopsFile = ./secrets/levitation/borg.yaml;
format = "yaml";
};
sops.secrets."borg-password" = {
sopsFile = ./secrets/levitation/borg.yaml;
format = "yaml";
2022-06-23 02:57:41 -04:00
};
# Setup system configuration
nathan = {
programs = {
games = true;
};
2022-07-02 14:33:15 -04:00
services = {
borg = {
enable = true;
extraExcludes = [
"/home/${config.nathan.config.user}/Music"
"/var/lib/docker"
"/var/log"
];
passwordFile = config.sops.secrets."borg-password".path;
sshKey = config.sops.secrets."borg-ssh-key".path;
};
};
2022-06-23 02:57:41 -04:00
config = {
isDesktop = true;
2022-07-02 14:33:15 -04:00
setupGrub = true;
2022-06-23 02:57:41 -04:00
nix.autoUpdate = false;
2022-07-02 02:44:43 -04:00
harden = false;
2022-06-23 02:57:41 -04:00
};
};
# Configure networking
networking = {
domain = "mccarty.io";
useDHCP = false;
interfaces.enp6s0.useDHCP = true;
nat.externalInterface = "enp6s0";
# Open ports for soulseek
# TODO add in soulseek
firewall = {
allowedTCPPorts = [ 61377 ];
allowedUDPPorts = [ 61377 ];
};
};
# FIXME borg backup module
2022-05-13 22:11:39 -04:00
2022-06-23 02:57:41 -04:00
# Setup home manager
2022-07-02 02:44:43 -04:00
home-manager.users.nathan = import ./home-manager/machines/levitation.nix;
2022-06-23 02:57:41 -04:00
})
];
2022-05-13 22:36:53 -04:00
};
2022-06-23 02:57:41 -04:00
x86vm = makeNixosSystem {
2022-05-14 01:09:02 -04:00
system = "x86_64-linux";
2022-06-23 02:57:41 -04:00
hostName = "x86vm";
extraModules = [
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
"${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
({ pkgs, config, lib, ... }: {
nathan = {
programs = {
games = true;
};
config = {
isDesktop = true;
nix.autoUpdate = false;
};
};
home-manager.users.nathan = import ./home-manager/machines/x86vm.nix;
2022-05-14 01:09:02 -04:00
2022-06-23 02:57:41 -04:00
# Workaround to get sway working in qemu
environment.variables = {
"WLR_RENDERER" = "pixman";
};
})
];
2021-12-23 00:47:40 -05:00
};
};
2021-12-20 13:37:26 -05:00
};
}