119 lines
3.5 KiB
Nix
119 lines
3.5 KiB
Nix
{
|
|
nixConfig = {
|
|
extra-substituters = "https://cache.garnix.io";
|
|
extra-trusted-public-keys = "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=";
|
|
};
|
|
|
|
inputs = {
|
|
nixpkgs.follows = "emanote/nixpkgs";
|
|
flake-parts.follows = "emanote/flake-parts";
|
|
};
|
|
|
|
inputs = {
|
|
# Upstream deps
|
|
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
|
|
|
lanzaboote = {
|
|
url = "github:nix-community/lanzaboote/v0.4.1";
|
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
|
};
|
|
|
|
# Packages
|
|
home-manager.url = "github:nix-community/home-manager/master";
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs-stable";
|
|
|
|
catppuccin.url = "github:catppuccin/nix";
|
|
|
|
fcc-unlock = {
|
|
url = "github:fabianhauser/fcc-unlock";
|
|
inputs.nixpkgs.follows = "nixpkgs-stable";
|
|
};
|
|
|
|
emanote = {
|
|
url = "github:srid/emanote";
|
|
inputs = {
|
|
emanote-template.follows = "";
|
|
nixpkgs.follows = "nixpkgs-unstable";
|
|
};
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
catppuccin,
|
|
emanote,
|
|
fcc-unlock,
|
|
home-manager,
|
|
lanzaboote,
|
|
nixos-hardware,
|
|
nixpkgs-stable,
|
|
nixpkgs-unstable,
|
|
...
|
|
}@inputs:
|
|
let
|
|
system = "x86_64-linux";
|
|
pkgsUnstable = import nixpkgs-unstable {
|
|
inherit system;
|
|
config.allowUnfree = true; # For vscode
|
|
};
|
|
hosts = [
|
|
"ochsenchopf"
|
|
];
|
|
in
|
|
{
|
|
# Build with `nixos-rebuild --flake .#<hostname>` or
|
|
# `nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel
|
|
nixosConfigurations =
|
|
let
|
|
sharedSpecialArgs = {
|
|
inherit pkgsUnstable;
|
|
pkgFccUnlock = fcc-unlock.packages.${system}.default;
|
|
};
|
|
home-manager-config = {
|
|
home-manager = {
|
|
backupFileExtension = ".hm-bak";
|
|
useGlobalPkgs = true;
|
|
useUserPackages = true;
|
|
extraSpecialArgs = sharedSpecialArgs;
|
|
users.fhauser.imports = [
|
|
./home/fhauser/default.nix
|
|
catppuccin.homeManagerModules.catppuccin
|
|
emanote.homeManagerModule
|
|
];
|
|
};
|
|
};
|
|
mapHostnameToAttr =
|
|
host:
|
|
nixpkgs-stable.lib.nixosSystem {
|
|
inherit system;
|
|
specialArgs = sharedSpecialArgs // {
|
|
hardwareModules = nixos-hardware.nixosModules;
|
|
};
|
|
modules = [
|
|
home-manager.nixosModules.home-manager
|
|
catppuccin.nixosModules.catppuccin
|
|
lanzaboote.nixosModules.lanzaboote
|
|
./host/${host}/default.nix
|
|
] ++ (if host == "bachtel" then [ ] else [ home-manager-config ]);
|
|
};
|
|
in
|
|
pkgsUnstable.lib.genAttrs hosts mapHostnameToAttr;
|
|
|
|
# Nix development shell
|
|
devShells.${system}.default = import ./shell.nix { pkgs = pkgsUnstable; };
|
|
|
|
# Run checks and build all hosts as default package
|
|
packages.${system}.default =
|
|
with pkgsUnstable.lib;
|
|
let
|
|
checks = attrValues self.checks.${system};
|
|
nixosConfigs = mapAttrsToList (n: v: v.config.system.build.toplevel) self.nixosConfigurations;
|
|
in
|
|
pkgsUnstable.linkFarmFromDrvs "allHosts" (checks ++ nixosConfigs);
|
|
|
|
formatter.${system} = pkgsUnstable.nixfmt-rfc-style;
|
|
};
|
|
}
|