1
0
Fork 0
nix-configuration/flake.nix

146 lines
4.4 KiB
Nix
Raw Normal View History

2024-12-06 18:04:47 +00:00
# Uses Snowfall: https://snowfall.org/
2024-02-29 14:53:34 +00:00
# For info on Flakes, see: https://nixos-and-flakes.thiscute.world/nixos-with-flakes/nixos-with-flakes-enabled
{
description = "Aires' system Flake";
2024-02-29 14:53:34 +00:00
inputs = {
# Import the desired Nix channel. Defaults to unstable, which uses a fully tested rolling release model.
2024-11-15 21:16:22 +00:00
# You can find a list of channels at https://wiki.nixos.org/wiki/Channel_branches
# To follow a different channel, replace `nixos-unstable` with the channel name, e.g. `nixos-24.05`.
2024-11-18 16:10:20 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2024-05-06 12:38:54 +00:00
2024-12-06 18:04:47 +00:00
# Flatpak support
flatpak.url = "github:gmodena/nix-flatpak/v0.5.1";
2024-12-06 18:04:47 +00:00
# Home-manager support
home-manager = {
2024-11-18 16:10:20 +00:00
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
# SecureBoot support
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
# Use Lix in place of Nix.
# If you'd rather use regular Nix, remove `lix-module.nixosModules.default` from the `modules` section below.
# To learn more about Lix, see https://lix.systems/
2024-12-06 18:04:47 +00:00
lix = {
url = "git+https://git.lix.systems/lix-project/nixos-module?ref=stable";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-02-29 14:53:34 +00:00
# NixOS hardware quirks
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
2024-12-06 18:04:47 +00:00
# Snowfall lib: https://snowfall.org/guides/lib/quickstart/
# Jake's reference config: https://github.com/jakehamilton/config
snowfall-lib = {
url = "github:snowfallorg/lib";
inputs.nixpkgs.follows = "nixpkgs";
};
# Code formatter
2024-12-06 18:04:47 +00:00
treefmt = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2024-02-29 14:53:34 +00:00
outputs =
2024-12-06 18:04:47 +00:00
inputs:
let
2024-12-06 18:04:47 +00:00
lib = inputs.snowfall-lib.mkLib {
inherit inputs;
2024-12-06 18:04:47 +00:00
# Root dir for flake.nix
src = ./.;
2024-12-06 18:04:47 +00:00
# Configure Snowfall
snowfall = {
# Choose a namespace to use for your flake's packages, library, and overlays.
namespace = "Sapana";
# Add flake metadata that can be processed by tools like Snowfall Frost.
meta = {
# A slug to use in documentation when displaying things like file paths.
name = "aires-flake";
# A title to show for your flake, typically the name.
title = "Aires' Flake";
};
};
};
in
lib.mkFlake {
# Configure Nix channels
channels-config.allowUnfree = true;
# Define systems
systems = {
# Modules to import for all systems
modules.nixos = with inputs; [
lix.nixosModules.default
lanzaboote.nixosModules.lanzaboote
flatpak.nixosModules.nix-flatpak
home-manager.nixosModules.home-manager
{
_module.args = {
inherit inputs;
};
home-manager = {
/*
When running, Home Manager will use the global package cache.
It will also back up any files that it would otherwise overwrite.
The originals will have the extension shown below.
*/
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "home-manager-backup";
};
}
];
# Individual host configurations
hosts = {
Dimaga.modules = with inputs; [
nixos-hardware.nixosModules.common-cpu-intel
];
2024-02-29 14:53:34 +00:00
2024-12-06 18:04:47 +00:00
Hevana.modules = with inputs; [
nixos-hardware.nixosModules.common-cpu-amd-pstate
nixos-hardware.nixosModules.common-gpu-amd
];
2024-12-06 18:04:47 +00:00
Khanda.modules = with inputs; [
nixos-hardware.nixosModules.microsoft-surface-pro-9
];
2024-12-06 18:04:47 +00:00
Pihole.modules = with inputs; [
nixos-hardware.nixosModules.raspberry-pi-4
];
2024-12-06 18:04:47 +00:00
Shura.modules = with inputs; [
nixos-hardware.nixosModules.lenovo-legion-16arha7
];
};
};
2024-12-06 18:04:47 +00:00
# Use treefmt to format project repo
outputs-builder =
channels:
let
treefmtEval = inputs.treefmt.lib.evalModule channels.nixpkgs ./treefmt.nix;
in
{
# For `nix fmt`
formatter = treefmtEval.config.build.wrapper;
# For `nix flake check`
checks = {
formatting = treefmtEval.config.build.check inputs.self;
};
};
};
}