dotfiles/flake.nix

150 lines
4.4 KiB
Nix
Raw Normal View History

2024-01-05 18:42:21 +01:00
{
2024-01-06 18:40:20 +01:00
description = "Geoffrey Frogeye's base configurations";
2024-01-05 18:42:21 +01:00
inputs = {
2024-01-06 18:40:20 +01:00
nixpkgs.url = "nixpkgs/nixos-23.11";
2024-03-26 17:04:16 +01:00
unixpkgs.url = "nixpkgs";
2024-01-06 18:40:20 +01:00
# OS
disko = {
url = "disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "nixos-hardware";
2024-01-16 22:39:29 +01:00
# NOD
nix-on-droid = {
2024-01-16 23:27:15 +01:00
url = "github:nix-community/nix-on-droid/release-23.05"; # No 23.11 :(
2024-01-16 22:39:29 +01:00
inputs.nixpkgs.follows = "nixpkgs";
2024-01-16 23:27:15 +01:00
inputs.home-manager.follows = "home-manager";
2024-01-16 22:39:29 +01:00
};
2024-01-06 18:40:20 +01:00
# HM
home-manager = {
url = "home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
2024-03-21 23:23:22 +01:00
url = "github:danth/stylix/release-23.11";
2024-01-06 18:40:20 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:GeoffreyFrogeye/nixvim/frogeye-23.11";
# 24.05 Ensure merged: https://github.com/nix-community/nixvim/pull/953
# url = "github:nix-community/nixvim";
2024-01-06 18:40:20 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
nur.url = "github:nix-community/NUR";
2024-01-05 18:42:21 +01:00
};
2024-03-26 17:04:16 +01:00
outputs = { self, nixpkgs, unixpkgs, disko, nix-on-droid, stylix, ... }@attrs:
2024-01-06 18:40:20 +01:00
let
nixpkgsConfig = {
2024-03-21 23:23:22 +01:00
config = {
allowUnfree = true;
# TODO Not sure why, HM needs nixos-option which needs an old Nix?
permittedInsecurePackages = [
"nix-2.15.3"
];
};
2024-03-26 17:04:16 +01:00
overlays = [
(final: prev: { unstable = unixpkgs.legacyPackages.${prev.system}.pkgs; })
];
# Only allows importing packages, not NixOS modules. If that is needed, see:
# https://discourse.nixos.org/t/how-to-use-unstable-nixpkgs-in-imports-with-flake/17414/7
};
homeManagerConfig = {
sharedModules = [ self.homeManagerModules.dotfiles ];
extraSpecialArgs = attrs;
};
2024-01-06 18:40:20 +01:00
lib = {
2024-01-16 22:39:29 +01:00
nixosSystem = { system, modules ? [ ] }: nixpkgs.lib.nixosSystem {
2024-01-06 18:40:20 +01:00
inherit system;
specialArgs = attrs;
2024-01-06 18:40:20 +01:00
modules = modules ++ [
self.nixosModules.dotfiles
{
nixpkgs = nixpkgsConfig;
2024-03-26 17:04:16 +01:00
home-manager = homeManagerConfig;
2024-01-06 18:40:20 +01:00
}
];
};
2024-01-16 22:39:29 +01:00
nixOnDroidConfiguration = { modules ? [ ] }: nix-on-droid.lib.nixOnDroidConfiguration {
pkgs = import nixpkgs (nixpkgsConfig // {
system = "aarch64-linux"; # nod doesn't support anything else
});
2024-01-16 22:39:29 +01:00
modules = modules ++ [
self.nixOnDroidModules.dotfiles
{
2024-03-26 17:04:16 +01:00
home-manager = homeManagerConfig;
2024-01-16 22:39:29 +01:00
}
];
};
2024-01-06 18:40:20 +01:00
};
in
{
2024-02-17 23:35:53 +01:00
# Easily expose apps to scripts
apps = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system: {
disko = {
type = "app";
program = "${disko.packages.${system}.default}/bin/disko";
};
nixos-generate-config = {
type = "app";
program = "${nixpkgs.legacyPackages.${system}.nixos-install-tools}/bin/nixos-generate-config";
};
nixos-install = {
type = "app";
program = "${nixpkgs.legacyPackages.${system}.nixos-install-tools}/bin/nixos-install";
};
nixos-rebuild = {
type = "app";
program = "${nixpkgs.legacyPackages.${system}.nixos-rebuild}/bin/nixos-rebuild";
};
});
# Reusable configurations
2024-01-06 18:40:20 +01:00
lib = lib;
nixosModules.dotfiles = {
imports = [
./os
disko.nixosModules.disko
];
};
2024-01-16 22:39:29 +01:00
nixOnDroidModules.dotfiles = {
imports = [
./nod
# home-manager is included
2024-01-16 22:39:29 +01:00
];
};
2024-01-06 18:40:20 +01:00
homeManagerModules.dotfiles = {
imports = [
./hm
stylix.homeManagerModules.stylix
];
};
2024-02-17 23:35:53 +01:00
# Actual configurations
2024-01-06 18:40:20 +01:00
nixosConfigurations.curacao = lib.nixosSystem {
system = "x86_64-linux";
modules = [
2024-02-17 18:39:09 +01:00
./curacao
];
};
2024-02-17 23:35:53 +01:00
nixosConfigurations.curacao-usb = lib.nixosSystem {
2024-02-17 18:39:09 +01:00
system = "x86_64-linux";
modules = [
./curacao/usb.nix
2024-01-06 18:40:20 +01:00
];
};
nixosConfigurations.pindakaas = lib.nixosSystem {
system = "aarch64-linux";
modules = [
2024-02-17 18:39:09 +01:00
./pindakaas
];
};
nixosConfigurations.pindakaas-sd = lib.nixosSystem {
system = "aarch64-linux";
modules = [
./pindakaas/sd.nix
2024-01-06 18:40:20 +01:00
];
};
2024-01-16 22:39:29 +01:00
nixOnDroidConfigurations.sprinkles = lib.nixOnDroidConfiguration { };
2024-01-05 18:42:21 +01:00
};
}