nix-v0/flake.nix
2024-10-26 21:38:00 -05:00

58 lines
1.6 KiB
Nix

{
description = "Nixos config flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
impermanence.url = "github:nix-community/impermanence";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{ nixpkgs, self, ... }:
let
system = "x86_64-linux";
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
lib = import ./src/lib.nix {
inherit (nixpkgs) lib;
inherit pkgs;
inherit (inputs) home-manager;
};
createCommonArgs = system: {
inherit
self
inputs
nixpkgs
lib
pkgs
system
;
specialArgs = {
inherit self inputs;
};
};
commonArgs = createCommonArgs system;
# call with forAllSystems (commonArgs: function body)
forAllSystems =
fn:
lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system: fn (createCommonArgs system));
in
{
inherit lib self;
nixosConfigurations = (import ./src/hosts/default.nix commonArgs);
};
}