Restructure flake

This commit is contained in:
Julian Mutter 2025-04-22 20:48:18 +02:00
parent 459c6ac27e
commit 07a321c79a
2 changed files with 116 additions and 67 deletions

167
flake.nix
View File

@ -57,80 +57,113 @@
}; };
outputs = outputs =
inputs: {
inputs.snowfall-lib.mkFlake { self,
inherit inputs; nixpkgs,
# Must always be ./. home-manager,
src = ./.; systems,
...
}@inputs:
let
inherit (self) outputs;
lib = nixpkgs.lib // home-manager.lib;
forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system});
pkgsFor = lib.genAttrs (import systems) (
system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
}
);
in
{
inherit lib;
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
overlays = import ./overlays { inherit inputs outputs; };
# hydraJobs = import ./hydra.nix { inherit inputs outputs; };
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; });
devShells = forEachSystem (pkgs: import ./shell.nix { inherit pkgs; });
formatter = forEachSystem (pkgs: pkgs.alejandra);
nixosConfigurations = {
# Main laptop
aspi = lib.nixosSystem {
modules = [ ./hosts/aspi ];
specialArgs = {
inherit inputs outputs;
};
};
# Piano raspberry pi
pianonix = lib.nixosSystem {
modules = [ ./hosts/pianonix ];
specialArgs = {
inherit inputs outputs;
};
};
};
# Standalone HM
homeConfigurations = {
# Main laptop
"julian@aspi" = lib.homeManagerConfiguration {
modules = [
./home/julian/aspi.nix
./home/julian/nixpkgs.nix
];
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = {
inherit inputs outputs;
};
};
# Media server (RPi)
"julian@pianonix" = lib.homeManagerConfiguration {
modules = [
./home/julian/pianonix.nix
./home/julian/nixpkgs.nix
];
pkgs = pkgsFor.aarch64-linux;
extraSpecialArgs = {
inherit inputs outputs;
};
};
};
# Add overlays for the `nixpkgs` channel. # Add overlays for the `nixpkgs` channel.
overlays = with inputs; [ # overlays = with inputs; [
nix-matlab.overlay # nix-matlab.overlay
nix-topology.overlays.default # nix-topology.overlays.default
]; # ];
snowfall = { # systems.modules.nixos = with inputs; [
# The root of the snowfall config # sops-nix.nixosModules.sops
root = ./.; # disko.nixosModules.disko
# lib, package and overlay namespace # ];
namespace = "frajul"; # defaults to "internal" # systems.hosts.pianonix.modules = with inputs; [ nixos-hardware.nixosModules.raspberry-pi-4 ];
meta = {
name = "Julian's dotfiles";
title = "Julian's dotfiles";
};
};
# The attribute set specified here will be passed directly to NixPkgs when
# instantiating the package set.
channels-config = {
# Allow unfree packages.
allowUnfree = true;
nvidia.acceptLicense = true;
# Allow certain insecure packages
permittedInsecurePackages = [ "olm-3.2.16" ];
};
systems.modules.nixos = with inputs; [
nix-topology.nixosModules.default
sops-nix.nixosModules.sops
disko.nixosModules.disko
];
systems.hosts.pianonix.modules = with inputs; [ nixos-hardware.nixosModules.raspberry-pi-4 ];
# topology =
# with inputs;
# let
# host = self.nixosConfigurations.${builtins.head (builtins.attrNames self.nixosConfigurations)};
# in
# import nix-topology {
# inherit (host) pkgs; # Only this package set must include nix-topology.overlays.default
# modules = [
# (import ./topology { inherit (host) config; })
# { inherit (self) nixosConfigurations; }
# ];
# };
}
// {
# deploy-rs node configuration # deploy-rs node configuration
deploy.nodes.pianonix = { deploy.nodes = {
hostname = "pianonix.local"; pianonix = {
profiles.system = { hostname = "pianonix.local";
sshUser = "root"; profiles.system = {
user = "root"; sshUser = "root";
path = inputs.deploy-rs.lib.aarch64-linux.activate.nixos inputs.self.nixosConfigurations.pianonix; user = "root";
confirmTimeout = 90; # default: 30s; raspberrypi takes a little longer restarting services path = inputs.deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.pianonix;
confirmTimeout = 90; # default: 30s; raspberrypi takes a little longer restarting services
};
}; };
};
deploy.nodes.builder = { builder = {
hostname = "builder.julian-mutter.de"; hostname = "builder.julian-mutter.de";
profiles.system = { profiles.system = {
sshUser = "root"; sshUser = "root";
user = "root"; user = "root";
path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos inputs.self.nixosConfigurations.builder; path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.builder;
remoteBuild = true; remoteBuild = true;
};
}; };
}; };
}; };

16
overlays/default.nix Normal file
View File

@ -0,0 +1,16 @@
{
inputs,
outputs,
}:
{
nixpkgs-stable-unstable = final: prev: {
unstable = import inputs.nixpkgs {
system = prev.system;
config.allowUnfree = true;
};
stable = import inputs.nixpkgs-stable {
system = prev.system;
config.allowUnfree = true;
};
};
}