100 lines
2.3 KiB
Nix
100 lines
2.3 KiB
Nix
{
|
|
description = "My nixOS flake for home-manager";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
niri = {
|
|
url = "github:sodiboo/niri-flake";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
agenix = {
|
|
url = "github:ryantm/agenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
inputs.home-manager.follows = "home-manager";
|
|
};
|
|
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
zen-browser = {
|
|
# https://github.com/NixOS/nixpkgs/pull/347222
|
|
url = "github:matthewpi/nixpkgs/zen-browser";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
home-manager,
|
|
niri,
|
|
rust-overlay,
|
|
agenix,
|
|
...
|
|
}@inputs:
|
|
let
|
|
username = "primary";
|
|
homeDirectory = "/home/${username}";
|
|
hostname = nixpkgs.lib.strings.removeSuffix "\n" (builtins.readFile /etc/hostname);
|
|
pkgs = import nixpkgs { };
|
|
|
|
# stolen from: https://stackoverflow.com/a/42398526
|
|
optimizeWithFlags =
|
|
pkg: flags:
|
|
pkgs.lib.overrideDerivation pkg (
|
|
old:
|
|
let
|
|
newflags = pkgs.lib.foldl' (acc: x: "${acc} ${x}") "" flags;
|
|
oldflags = if (pkgs.lib.hasAttr "NIX_CFLAGS_COMPILE" old) then "${old.NIX_CFLAGS_COMPILE}" else "";
|
|
in
|
|
{
|
|
NIX_CFLAGS_COMPILE = "${oldflags} ${newflags}";
|
|
stdenv = pkgs.clang19Stdenv;
|
|
}
|
|
);
|
|
in
|
|
{
|
|
homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
|
|
inherit pkgs;
|
|
extraSpecialArgs = {
|
|
inherit
|
|
inputs
|
|
username
|
|
homeDirectory
|
|
optimizeWithFlags
|
|
;
|
|
};
|
|
|
|
modules = [
|
|
./system-${hostname}.nix
|
|
niri.homeModules.config
|
|
agenix.homeManagerModules.age
|
|
|
|
(
|
|
{ pkgs, ... }:
|
|
{
|
|
nixpkgs.overlays = [
|
|
rust-overlay.overlays.default
|
|
inputs.niri.overlays.niri
|
|
];
|
|
|
|
# home-manager stuff
|
|
home = {
|
|
inherit username homeDirectory;
|
|
};
|
|
}
|
|
)
|
|
];
|
|
};
|
|
};
|
|
}
|