dotfiles/flake.nix

159 lines
4.3 KiB
Nix
Raw Normal View History

2022-04-27 01:36:16 +00:00
{
description = "My system";
2022-05-08 20:02:13 +00:00
# Other flakes that we want to pull from
2022-04-27 01:36:16 +00:00
inputs = {
2022-05-08 20:02:13 +00:00
# Used for system packages
2022-04-27 01:36:16 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2022-05-08 20:02:13 +00:00
2022-06-12 21:46:26 +00:00
# Used for MacOS system config
darwin = {
url = "github:/lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-07-08 01:31:00 +00:00
# Used for Windows Subsystem for Linux compatibility
wsl.url = "github:nix-community/NixOS-WSL";
2022-05-08 20:02:13 +00:00
# Used for user packages
2022-04-27 01:36:16 +00:00
home-manager = {
url = "github:nix-community/home-manager/master";
2022-05-08 20:02:13 +00:00
inputs.nixpkgs.follows =
"nixpkgs"; # Use system packages list where available
2022-04-27 01:36:16 +00:00
};
2022-05-08 20:02:13 +00:00
# Community packages; used for Firefox extensions
2022-05-07 18:24:00 +00:00
nur.url = "github:nix-community/nur";
2022-04-27 01:36:16 +00:00
# Wallpapers
wallpapers = {
url = "gitlab:exorcist365/wallpapers";
flake = false;
};
2022-09-20 04:01:45 +00:00
# Used to generate NixOS images for other platforms
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-04-27 01:36:16 +00:00
};
2022-09-20 04:01:45 +00:00
outputs = { self, nixpkgs, ... }@inputs:
2022-05-16 00:46:17 +00:00
2022-04-27 01:36:16 +00:00
let
2022-05-08 20:02:13 +00:00
# Global configuration for my systems
2022-09-10 02:16:45 +00:00
globals = rec {
2022-04-30 16:07:58 +00:00
user = "noah";
fullName = "Noah Masur";
2022-09-10 02:16:45 +00:00
gitName = fullName;
2022-04-30 16:07:58 +00:00
gitEmail = "7386960+nmasur@users.noreply.github.com";
2022-05-11 03:45:50 +00:00
mailServer = "noahmasur.com";
2022-10-01 18:28:03 +00:00
dotfilesRepo = "git@github.com:nmasur/dotfiles";
2022-04-29 00:54:37 +00:00
};
2022-05-08 20:02:13 +00:00
2022-05-16 00:46:17 +00:00
# System types to support.
supportedSystems =
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
2022-04-27 01:36:16 +00:00
in {
2022-05-08 20:02:13 +00:00
2022-09-20 04:01:45 +00:00
nixosConfigurations = with inputs; {
2022-06-20 03:44:29 +00:00
desktop = import ./hosts/desktop {
inherit nixpkgs home-manager nur globals wallpapers;
};
2022-07-08 01:31:00 +00:00
wsl = import ./hosts/wsl { inherit nixpkgs wsl home-manager globals; };
2022-10-01 16:21:34 +00:00
oracle =
import ./hosts/oracle { inherit nixpkgs home-manager globals; };
2022-04-27 01:36:16 +00:00
};
2022-05-08 20:02:13 +00:00
2022-09-20 04:01:45 +00:00
darwinConfigurations = with inputs; {
2022-06-12 21:46:26 +00:00
macbook = import ./hosts/macbook {
inherit nixpkgs darwin home-manager nur globals;
};
};
2022-06-05 13:24:46 +00:00
apps = forAllSystems (system:
let pkgs = import nixpkgs { inherit system; };
2022-08-08 00:32:11 +00:00
in rec {
default = readme;
# Format and install from nothing
installer = import ./apps/installer.nix { inherit pkgs; };
# Display the readme for this repository
readme = import ./apps/readme.nix { inherit pkgs; };
2022-10-02 20:54:26 +00:00
# Load the SSH key for this machine
loadkey = import ./apps/loadkey.nix { inherit pkgs; };
# Connect machine metrics to Netdata Cloud
netdata = import ./apps/netdata-cloud.nix { inherit pkgs; };
2022-08-08 00:32:11 +00:00
});
2022-06-05 13:24:46 +00:00
2022-05-16 00:46:17 +00:00
devShells = forAllSystems (system:
let pkgs = import nixpkgs { inherit system; };
2022-05-01 15:16:48 +00:00
in {
2022-08-21 21:27:47 +00:00
# Used to run commands and edit files in this repo
2022-05-01 15:16:48 +00:00
default = pkgs.mkShell {
2022-05-06 12:58:44 +00:00
buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ];
2022-05-01 15:16:48 +00:00
};
2022-08-21 21:27:47 +00:00
# Used for cloud and systems development and administration
2022-08-20 01:10:08 +00:00
devops = pkgs.mkShell {
buildInputs = with pkgs; [
git
terraform
consul
vault
awscli2
google-cloud-sdk
2022-09-21 20:58:04 +00:00
ansible
2022-09-10 20:14:30 +00:00
kubectl
kubernetes-helm
2022-08-20 01:10:08 +00:00
kustomize
fluxcd
];
};
2022-08-21 21:27:47 +00:00
2022-05-16 00:46:17 +00:00
});
2022-04-27 13:23:26 +00:00
2022-09-20 04:01:45 +00:00
# Package servers into images with a generator
packages.x86_64-linux = with inputs; {
aws = import ./generators/aws {
2022-09-20 04:01:45 +00:00
inherit nixpkgs nixos-generators home-manager globals;
system = "x86_64-linux";
};
};
2022-06-21 03:34:24 +00:00
# Templates for starting other projects quickly
2022-08-08 00:37:19 +00:00
templates = rec {
default = basic;
2022-08-07 18:52:00 +00:00
basic = {
path = ./templates/basic;
description = "Basic program template";
};
2022-06-21 03:34:24 +00:00
poetry = {
path = ./templates/poetry;
description = "Poetry template";
};
python = {
path = ./templates/python;
description = "Legacy Python template";
};
2022-07-04 23:17:58 +00:00
haskell = {
path = ./templates/haskell;
description = "Haskell template";
};
2022-06-21 03:34:24 +00:00
};
2022-04-27 01:36:16 +00:00
};
}