mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2026-04-16 06:43:58 +02:00
Added comments for better readability to flake.nix
This commit is contained in:
parent
7377d68831
commit
337ce65d74
1 changed files with 133 additions and 119 deletions
74
flake.nix
74
flake.nix
|
|
@ -2,25 +2,26 @@
|
||||||
description = "system";
|
description = "system";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
nixpkgs.url = "nixpkgs/nixos-unstable"; # Primary package set: Rolling release unstable
|
||||||
nixpkgs-stable.url = "nixpkgs/nixos-25.11";
|
nixpkgs-stable.url = "nixpkgs/nixos-25.11"; # Stable channel used for packages that cannot be volatile
|
||||||
nixpkgs-unstable-small.url = "nixpkgs/nixos-unstable-small";
|
nixpkgs-unstable-small.url = "nixpkgs/nixos-unstable-small"; # Smaller unstable channel with faster binary cache updates
|
||||||
stylix.url = "github:danth/stylix";
|
stylix.url = "github:danth/stylix"; # System-wide theming (colors, fonts, wallpaper) via Home Manager
|
||||||
typst-within.url = "github:schrottkatze/typst";
|
typst-within.url = "github:schrottkatze/typst"; # Custom fork of typst
|
||||||
crane.url = "github:ipetkov/crane";
|
crane.url = "github:ipetkov/crane"; # Nix rust project library
|
||||||
nixcord.url = "github:kaylorben/nixcord";
|
nixcord.url = "github:kaylorben/nixcord"; # Nix configured Discord
|
||||||
home-manager = {
|
home-manager = {
|
||||||
|
# home environment nix configuration and config handler
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
fenix = {
|
fenix = {
|
||||||
|
# Rust toolchain manager
|
||||||
url = "github:nix-community/fenix";
|
url = "github:nix-community/fenix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs = {
|
||||||
{
|
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
nixpkgs-stable,
|
nixpkgs-stable,
|
||||||
|
|
@ -32,28 +33,37 @@
|
||||||
fenix,
|
fenix,
|
||||||
crane,
|
crane,
|
||||||
...
|
...
|
||||||
}@inputs:
|
} @ inputs: let
|
||||||
let
|
# Global System configuration variables
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
|
# Instantiate the three package sets for the target system
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
||||||
pkgs-unstable-small = nixpkgs-unstable-small.legacyPackages.${system};
|
pkgs-unstable-small = nixpkgs-unstable-small.legacyPackages.${system};
|
||||||
rs-toolchain =
|
|
||||||
with fenix.packages.${system};
|
# Pre-build the complete rust tool-chain and combine it into a single derivation
|
||||||
|
rs-toolchain = with fenix.packages.${system};
|
||||||
combine [
|
combine [
|
||||||
complete.toolchain
|
complete.toolchain
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Set up crane with the custom Rust toolchain above instead of the nixpkgs default
|
||||||
crane-lib = (crane.mkLib nixpkgs.legacyPackages.${system}).overrideToolchain rs-toolchain;
|
crane-lib = (crane.mkLib nixpkgs.legacyPackages.${system}).overrideToolchain rs-toolchain;
|
||||||
|
|
||||||
|
# A nixpkgs overlay that adds locally-built Rust binaries to the package set (NOTE: At least I assume that's what's happening here...)
|
||||||
rs-programs = final: prev: {
|
rs-programs = final: prev: {
|
||||||
s10e-jrnl = crane-lib.buildPackage {
|
s10e-jrnl = crane-lib.buildPackage {
|
||||||
pname = "s10e-bs";
|
pname = "s10e-bs"; # NOTE: There's a discrepancy between the package names. Idk if it's on purpose or no
|
||||||
version = "0.0.1";
|
version = "0.0.1";
|
||||||
src = crane-lib.cleanCargoSource (crane-lib.path ./.);
|
src = crane-lib.cleanCargoSource (crane-lib.path ./.);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
# Default Nix formatter
|
||||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
|
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
|
||||||
|
|
||||||
|
# Global dev shell configuration
|
||||||
devShells."x86_64-linux".default = pkgs.mkShell {
|
devShells."x86_64-linux".default = pkgs.mkShell {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
rs-toolchain
|
rs-toolchain
|
||||||
|
|
@ -63,6 +73,7 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
|
# DESKTOP # (NOTE: I assume from our conversations)
|
||||||
monosodium-glutamate-g = nixpkgs.lib.nixosSystem {
|
monosodium-glutamate-g = nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit
|
inherit
|
||||||
|
|
@ -74,9 +85,9 @@
|
||||||
};
|
};
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
stylix.nixosModules.stylix
|
stylix.nixosModules.stylix # Enable Stylix themeing
|
||||||
./hosts/monosodium-glutamate-g/configuration.nix
|
./hosts/monosodium-glutamate-g/configuration.nix # Host specific config
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager # Embed HM as a host module
|
||||||
{
|
{
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
|
|
@ -84,21 +95,25 @@
|
||||||
inherit pkgs-unstable-small pkgs-stable typst-within;
|
inherit pkgs-unstable-small pkgs-stable typst-within;
|
||||||
};
|
};
|
||||||
home-manager.sharedModules = [
|
home-manager.sharedModules = [
|
||||||
inputs.nixcord.homeModules.nixcord
|
inputs.nixcord.homeModules.nixcord # Enable Nixcord as an HM module for all users
|
||||||
];
|
];
|
||||||
home-manager.users.jade =
|
|
||||||
{
|
# HM CONFIG: jade
|
||||||
|
home-manager.users.jade = {
|
||||||
nixosConfig,
|
nixosConfig,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}: {
|
||||||
{
|
# Mirror the system timezone into the user session
|
||||||
home.sessionVariables.TZ = nixosConfig.time.timeZone;
|
home.sessionVariables.TZ = nixosConfig.time.timeZone;
|
||||||
|
|
||||||
|
# Pin HM state version to system state version to keep migration in sync
|
||||||
home.stateVersion = "${nixosConfig.system.stateVersion}";
|
home.stateVersion = "${nixosConfig.system.stateVersion}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
# DEVICE # (NOTE: I got no clue what this is, fix it urself)
|
||||||
denkbrett = nixpkgs.lib.nixosSystem {
|
denkbrett = nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit
|
inherit
|
||||||
|
|
@ -108,8 +123,9 @@
|
||||||
rs-programs
|
rs-programs
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux"; # NOTE: Maybe use ${system} ?
|
||||||
modules = [
|
modules = [
|
||||||
|
# Do the same as in the Desktop (MGS)
|
||||||
stylix.nixosModules.stylix
|
stylix.nixosModules.stylix
|
||||||
./hosts/denkbrett/configuration.nix
|
./hosts/denkbrett/configuration.nix
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
|
|
@ -122,15 +138,13 @@
|
||||||
home-manager.sharedModules = [
|
home-manager.sharedModules = [
|
||||||
inputs.nixcord.homeModules.nixcord
|
inputs.nixcord.homeModules.nixcord
|
||||||
];
|
];
|
||||||
home-manager.users.jade =
|
home-manager.users.jade = {
|
||||||
{
|
|
||||||
nixosConfig,
|
nixosConfig,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}: {
|
||||||
{
|
|
||||||
home.sessionVariables.TZ = nixosConfig.time.timeZone;
|
home.sessionVariables.TZ = nixosConfig.time.timeZone;
|
||||||
home.stateVersion = "22.11";
|
home.stateVersion = "22.11"; # Pin to an older version
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue