dotfiles/flake.nix

132 lines
3.3 KiB
Nix
Raw Normal View History

2021-09-08 19:43:08 +02:00
{
description = "My awesome system config";
2021-09-15 00:41:46 +02:00
2021-10-05 13:58:06 +02:00
##############
### Inputs ###
##############
2021-09-08 19:43:08 +02:00
inputs = {
2022-03-21 13:23:36 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
2021-12-04 11:46:18 +01:00
stable.url = "github:nixos/nixpkgs/nixos-21.11";
2021-09-11 13:25:38 +02:00
nur.url = "github:nix-community/NUR";
2022-02-07 15:29:45 +01:00
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
2021-09-14 13:12:34 +02:00
agenix.url = "github:ryantm/agenix";
2021-09-10 14:00:56 +02:00
emacs-overlay.url = "github:nix-community/emacs-overlay";
2021-11-11 18:34:54 +01:00
home-manager.url = "github:nix-community/home-manager";
2021-11-22 11:13:18 +01:00
statix.url = "github:nerdypepper/statix";
2022-03-21 13:20:46 +01:00
# Fish specific
dracula-fish = {
url = "github:dracula/fish";
flake = false;
};
# Zsh specific
2021-10-31 19:45:06 +01:00
forgit-git = {
url = "github:wfxr/forgit";
flake = false;
};
2021-09-08 19:43:08 +02:00
};
2021-10-04 23:08:16 +02:00
outputs = inputs@{ self, agenix, home-manager, nixpkgs, utils, ... }:
2021-09-08 20:30:19 +02:00
utils.lib.mkFlake {
2021-09-08 19:43:08 +02:00
inherit self inputs;
2021-10-05 13:57:48 +02:00
channelsConfig.allowUnfree = true;
2021-10-05 13:58:06 +02:00
################
### Overlays ###
################
2021-09-14 23:34:26 +02:00
overlay = import ./overlays { inherit inputs; };
2021-09-15 01:36:49 +02:00
overlays = utils.lib.exportOverlays { inherit (self) pkgs inputs; };
2021-09-11 13:15:08 +02:00
channels.nixpkgs.overlaysBuilder = channels: [
self.overlay
inputs.utils.overlay
inputs.emacs-overlay.overlay
2021-09-11 13:25:38 +02:00
inputs.nur.overlay
2021-09-11 13:15:08 +02:00
];
2021-10-05 13:58:06 +02:00
###############
### Modules ###
###############
2021-09-11 13:15:08 +02:00
2021-10-04 23:08:16 +02:00
nixosModules = utils.lib.exportModules [
./modules/default.nix
./modules/containers
./modules/gaming
];
2021-09-10 08:59:21 +02:00
2021-09-08 19:43:08 +02:00
hostDefaults.modules = [
2021-09-11 13:15:08 +02:00
home-manager.nixosModule
2021-09-09 21:55:28 +02:00
{
2021-09-11 13:15:08 +02:00
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs self; };
};
2021-09-09 21:55:28 +02:00
}
2021-09-11 13:15:08 +02:00
self.nixosModules.default
2021-09-14 13:12:34 +02:00
agenix.nixosModules.age
2021-09-08 19:43:08 +02:00
];
hosts.nixos-laptop.modules = [
./hosts/nixos-laptop
{
age.secrets.email = {
file = ./secrets/email-laptop.age;
owner = "1000";
};
}
];
2021-10-04 23:08:16 +02:00
hosts.nixos-desktop.modules = [
{
age.secrets.email = {
file = ./secrets/email-desktop.age;
owner = "1000";
};
}
2021-10-04 23:08:16 +02:00
./hosts/nixos-desktop
2021-10-31 15:24:02 +01:00
self.nixosModules.containers
2021-10-04 23:08:16 +02:00
self.nixosModules.gaming
];
2021-10-05 13:58:06 +02:00
###############
### Outputs ###
###############
2021-10-05 13:57:48 +02:00
outputsBuilder = channels:
with channels.nixpkgs; {
devShell = mkShell {
name = "dotfiles";
2021-11-22 11:13:18 +01:00
shellHook = ''
alias "lint"='echo "Running nixpkgs-fmt ..."
nixpkgs-fmt --check $(find . -name "*.nix")
echo ""
echo "Running statix ..."
statix check'
alias "fix"='echo "Running nixpkgs-fmt ..."
nixpkgs-fmt $(find . -name "*.nix")
echo ""
echo "Running statix ..."
statix fix'
'';
packages = [
# Linting
nixpkgs-fmt
statix
# Secrets
agenix.defaultPackage.x86_64-linux
# chachix
cachix
];
2021-10-05 13:57:48 +02:00
};
};
2021-09-08 19:43:08 +02:00
};
}