mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 17:17:22 +01:00
265 lines
7.3 KiB
Nix
265 lines
7.3 KiB
Nix
{
|
|
description = "SwarseFlake - Nix Flake for all SwarselSystems";
|
|
|
|
nixConfig = {
|
|
extra-substituters = [
|
|
"https://nix-community.cachix.org"
|
|
"https://cache.ngi0.nixos.org/"
|
|
];
|
|
|
|
extra-trusted-public-keys = [
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
"cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA="
|
|
];
|
|
};
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
|
|
|
|
systems.url = "github:nix-systems/default-linux";
|
|
|
|
# user-level configuration
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# overlay to access bleeding edge emacs
|
|
emacs-overlay = {
|
|
url = "github:nix-community/emacs-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# nix user repository
|
|
# i use this mainly to not have to build all firefox extensions
|
|
# myself as well as for the emacs-init package (tbd)
|
|
nur.url = "github:nix-community/NUR";
|
|
|
|
# provides GL to non-NixOS hosts
|
|
nixgl.url = "github:guibou/nixGL";
|
|
|
|
# manages all theming using Home-Manager
|
|
stylix.url = "github:danth/stylix";
|
|
|
|
# nix secrets management
|
|
sops-nix.url = "github:Mic92/sops-nix";
|
|
|
|
# enable secure boot on NixOS
|
|
lanzaboote.url = "github:nix-community/lanzaboote";
|
|
|
|
# nix for android
|
|
nix-on-droid = {
|
|
url = "github:nix-community/nix-on-droid/release-24.05";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# generate NixOS images
|
|
nixos-generators = {
|
|
url = "github:nix-community/nixos-generators";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# hardware quirks on nix
|
|
nixos-hardware = {
|
|
url = "github:NixOS/nixos-hardware/master";
|
|
};
|
|
|
|
# dynamic library loading
|
|
nix-alien = {
|
|
url = "github:thiagokokada/nix-alien";
|
|
};
|
|
|
|
# automatic nintendo switch payload injection
|
|
nswitch-rcm-nix = {
|
|
url = "github:Swarsel/nswitch-rcm-nix";
|
|
};
|
|
|
|
# weekly updated nix-index database
|
|
nix-index-database = {
|
|
url = "github:nix-community/nix-index-database";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
disko = {
|
|
url = "github:nix-community/disko";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
impermanence.url = "github:nix-community/impermanence";
|
|
|
|
zjstatus = {
|
|
url = "github:dj95/zjstatus";
|
|
};
|
|
|
|
fw-fanctrl = {
|
|
url = "github:TamtamHero/fw-fanctrl/packaging/nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
nix-darwin = {
|
|
url = "github:lnl7/nix-darwin";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
pre-commit-hooks = {
|
|
url = "github:cachix/git-hooks.nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
nix-secrets = {
|
|
url = "git+ssh://git@github.com/Swarsel/nix-secrets.git?ref=main&shallow=1";
|
|
flake = false;
|
|
inputs = { };
|
|
};
|
|
|
|
nix-topology.url = "github:oddlama/nix-topology";
|
|
|
|
};
|
|
|
|
outputs =
|
|
inputs@{ self
|
|
, nixpkgs
|
|
, home-manager
|
|
, nix-darwin
|
|
, systems
|
|
, ...
|
|
}:
|
|
let
|
|
|
|
inherit (self) outputs;
|
|
lib = (nixpkgs.lib // home-manager.lib).extend (_: _: { swarselsystems = import ./lib { inherit self lib inputs outputs systems; }; });
|
|
|
|
|
|
# NixOS modules that can only be used on NixOS systems
|
|
nixModules = [
|
|
inputs.stylix.nixosModules.stylix
|
|
inputs.lanzaboote.nixosModules.lanzaboote
|
|
inputs.disko.nixosModules.disko
|
|
inputs.impermanence.nixosModules.impermanence
|
|
inputs.sops-nix.nixosModules.sops
|
|
inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm
|
|
inputs.nix-topology.nixosModules.default
|
|
./profiles/common/nixos
|
|
];
|
|
|
|
# Home-Manager modules wanted on non-NixOS systems
|
|
homeModules = [
|
|
inputs.stylix.homeManagerModules.stylix
|
|
];
|
|
|
|
# Home-Manager modules wanted on both NixOS and non-NixOS systems
|
|
mixedModules = [
|
|
inputs.sops-nix.homeManagerModules.sops
|
|
inputs.nix-index-database.hmModules.nix-index
|
|
./profiles/common/home
|
|
];
|
|
|
|
in
|
|
{
|
|
|
|
inherit lib nixModules mixedModules homeModules;
|
|
|
|
nixosModules = import ./modules/nixos { inherit lib; };
|
|
homeManagerModules = import ./modules/home { inherit lib; };
|
|
packages = lib.swarselsystems.forEachSystem (pkgs: import ./pkgs { inherit lib pkgs; });
|
|
formatter = lib.swarselsystems.forEachSystem (pkgs: pkgs.nixpkgs-fmt);
|
|
overlays = import ./overlays { inherit self lib inputs; };
|
|
|
|
apps = lib.swarselsystems.forAllSystems (system:
|
|
let
|
|
appNames = [
|
|
"swarsel-bootstrap"
|
|
"swarsel-install"
|
|
"swarsel-rebuild"
|
|
"swarsel-postinstall"
|
|
];
|
|
appSet = lib.swarselsystems.mkApps system appNames self;
|
|
in
|
|
{
|
|
inherit appSet;
|
|
default = appSet.bootstrap;
|
|
});
|
|
|
|
devShells = lib.swarselsystems.forAllSystems (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
checks = self.checks.${system};
|
|
in
|
|
{
|
|
default = pkgs.mkShell {
|
|
NIX_CONFIG = "experimental-features = nix-command flakes";
|
|
inherit (checks.pre-commit-check) shellHook;
|
|
buildInputs = checks.pre-commit-check.enabledPackages;
|
|
nativeBuildInputs = with pkgs; [
|
|
nix
|
|
home-manager
|
|
git
|
|
just
|
|
age
|
|
ssh-to-age
|
|
sops
|
|
statix
|
|
deadnix
|
|
nixpkgs-fmt
|
|
];
|
|
};
|
|
}
|
|
);
|
|
|
|
checks = lib.swarselsystems.forAllSystems (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
import ./checks { inherit self inputs system pkgs; }
|
|
);
|
|
|
|
|
|
nixosConfigurations =
|
|
lib.swarselsystems.mkFullHostConfigs (lib.swarselsystems.readHosts "nixos") "nixos";
|
|
|
|
homeConfigurations =
|
|
|
|
# "swarsel@home-manager" = inputs.home-manager.lib.homeManagerConfiguration {
|
|
# pkgs = lib.swarselsystems.pkgsFor.x86_64-linux;
|
|
# extraSpecialArgs = { inherit inputs outputs; };
|
|
# modules = homeModules ++ mixedModules ++ [
|
|
# ./hosts/home-manager
|
|
# ];
|
|
# };
|
|
|
|
lib.swarselsystems.mkHalfHostConfigs (lib.swarselsystems.readHosts "home") "home" lib.swarselsystems.pkgsFor.x86_64-linux;
|
|
|
|
|
|
darwinConfigurations =
|
|
lib.swarselsystems.mkFullHostConfigs (lib.swarselsystems.readHosts "darwin") "darwin";
|
|
|
|
nixOnDroidConfigurations =
|
|
|
|
# magicant = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
|
# pkgs = lib.swarselsystems.pkgsFor.aarch64-linux;
|
|
# modules = [
|
|
# ./hosts/magicant
|
|
# ];
|
|
# };
|
|
|
|
lib.swarselsystems.mkHalfHostConfigs (lib.swarselsystems.readHosts "android") "android" lib.swarselsystems.pkgsFor.aarch64-linux;
|
|
|
|
|
|
|
|
topology =
|
|
|
|
lib.swarselsystems.forEachSystem (pkgs: import inputs.nix-topology {
|
|
inherit pkgs;
|
|
modules = [
|
|
# Your own file to define global topology. Works in principle like a nixos module but uses different options.
|
|
# ./topology.nix
|
|
{ inherit (self) nixosConfigurations; }
|
|
];
|
|
});
|
|
|
|
|
|
};
|
|
}
|