2023-04-13 19:21:12 +02:00
|
|
|
{
|
|
|
|
description = "NixOS system flake";
|
|
|
|
|
2023-04-14 01:56:52 +02:00
|
|
|
inputs = {
|
2023-12-04 22:03:33 +01:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
2023-12-30 20:59:44 +01:00
|
|
|
logseq-fix-nixpkgs.url = "github:kilianar/nixpkgs?rev=8de164c9152a31d7b5e510df1546d257a64a4374";
|
2023-04-13 19:57:56 +02:00
|
|
|
nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2023-04-13 20:34:56 +02:00
|
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
2023-04-13 21:30:17 +02:00
|
|
|
home-manager = {
|
2023-12-04 22:03:33 +01:00
|
|
|
url = "github:nix-community/home-manager/release-23.11";
|
2023-04-13 21:30:17 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-08-17 17:26:57 +02:00
|
|
|
lanzaboote = {
|
|
|
|
url = "github:nix-community/lanzaboote/v0.3.0";
|
|
|
|
# deliberately do _not_ follow the nixpkgs input here, because paranoia and test coverage
|
|
|
|
};
|
2024-01-09 23:48:38 +01:00
|
|
|
utils.url = "github:numtide/flake-utils";
|
2023-08-17 17:26:57 +02:00
|
|
|
|
|
|
|
nur.url = "github:nix-community/NUR";
|
2023-04-14 01:56:52 +02:00
|
|
|
# TODO: possible make this a flake as well
|
|
|
|
mysecrets = {
|
|
|
|
flake = false;
|
|
|
|
url = "git+ssh://gitea@git.orlives.de:2342/schmittlauch/home-manager_secrets.git";
|
|
|
|
};
|
|
|
|
|
2023-04-13 19:21:12 +02:00
|
|
|
};
|
|
|
|
|
2023-04-13 21:30:17 +02:00
|
|
|
outputs =
|
2024-01-10 00:25:45 +01:00
|
|
|
{ self, nixpkgs, nur, lanzaboote, flake-utils, home-manager, ... }@inputs:
|
2023-04-14 01:56:52 +02:00
|
|
|
let
|
2024-01-09 23:48:38 +01:00
|
|
|
# FIXME: allow different systems
|
|
|
|
systems = flake-utils.lib.system;
|
|
|
|
# necessary to make the top-level inputs available to system configuration
|
2024-01-20 12:25:32 +01:00
|
|
|
# inspired by https://jade.fyi/blog/flakes-arent-real/
|
|
|
|
inputInjection = {pkgs, lib, ...}: {
|
|
|
|
options.inputInjection = lib.mkOption {
|
|
|
|
type = with lib.types; attrsOf unspecified;
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
config.inputInjection = {
|
|
|
|
flake-inputs = inputs;
|
|
|
|
};
|
|
|
|
};
|
2024-01-19 00:24:00 +01:00
|
|
|
defaultModules = system: [
|
2024-01-20 12:25:32 +01:00
|
|
|
inputInjection
|
2024-01-09 23:48:38 +01:00
|
|
|
];
|
|
|
|
mkSystem = system: extraModules:
|
|
|
|
nixpkgs.lib.nixosSystem rec {
|
2024-01-19 00:24:00 +01:00
|
|
|
modules = (defaultModules system) ++ extraModules;
|
2024-01-09 23:48:38 +01:00
|
|
|
inherit system;
|
2024-01-20 12:25:32 +01:00
|
|
|
specialArgs = {inherit system;};
|
2024-01-09 23:48:38 +01:00
|
|
|
};
|
2024-01-10 00:25:45 +01:00
|
|
|
mkHomeManager = confName: user: system: # unfortunately, home-manager configs are still system-specific
|
|
|
|
# FIXME: this is thus still linux-x86_64 specific
|
|
|
|
home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2023-04-14 01:56:52 +02:00
|
|
|
modules = [
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
nur.hmModules.nur
|
2024-01-10 00:25:45 +01:00
|
|
|
# TODO: $name can be utilised to conditionally load other config files
|
2023-04-14 01:56:52 +02:00
|
|
|
./home/home.nix
|
|
|
|
];
|
|
|
|
# extends the home config
|
2024-01-10 00:25:45 +01:00
|
|
|
home.username = user;
|
|
|
|
home.homeDirectory = "/home/${user}";
|
2023-04-14 01:56:52 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
# Optionally use extraSpecialArgs
|
|
|
|
# to pass through arguments to home.nix
|
|
|
|
extraSpecialArgs = {
|
2024-01-10 00:25:45 +01:00
|
|
|
inherit inputs system;
|
2023-04-14 01:56:52 +02:00
|
|
|
};
|
|
|
|
};
|
2024-01-10 00:25:45 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
nixosConfigurations = {
|
|
|
|
thinknix = mkSystem systems.x86_64-linux [ ./hosts/thinknix inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440s lanzaboote.nixosModules.lanzaboote ];
|
|
|
|
framenix = mkSystem systems.x86_64-linux [ ./hosts/framenix inputs.nixos-hardware.nixosModules.framework-13-7040-amd lanzaboote.nixosModules.lanzaboote ];
|
|
|
|
};
|
|
|
|
homeConfigurations.spiollinux = mkHomeManager "spiollinux" "spiollinux" systems.x86_64-linux;
|
2023-04-13 19:21:12 +02:00
|
|
|
};
|
|
|
|
}
|