nixos/flake.nix

152 lines
4.6 KiB
Nix
Raw Normal View History

2021-12-11 14:21:48 +01:00
{
2021-12-11 14:44:46 +01:00
description = "Andreas Zweili's Nixos configuration";
inputs = {
2021-12-11 15:21:01 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
2021-12-11 14:44:46 +01:00
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
2021-12-16 20:19:21 +01:00
# look here for the hardware options https://github.com/NixOS/nixos-hardware/blob/master/flake.nix#L5
2021-12-11 15:42:32 +01:00
nixos-hardware.url = "github:nixos/nixos-hardware";
2021-12-16 20:19:21 +01:00
2022-03-16 14:30:12 +01:00
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-12-11 14:44:46 +01:00
home-manager = {
2021-12-11 15:21:01 +01:00
url = "github:nix-community/home-manager/release-21.11";
2021-12-11 14:44:46 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
};
2021-12-11 15:42:32 +01:00
outputs =
2022-01-03 20:29:08 +01:00
inputs@{ self
2021-12-11 15:42:32 +01:00
, nixpkgs
, nixpkgs-unstable
, nixos-hardware
, home-manager
}:
let
2022-02-21 11:36:12 +01:00
custom = import ./custom;
2022-02-16 22:27:50 +01:00
system = custom.system;
2022-02-23 10:34:14 +01:00
username = custom.username;
2021-12-11 17:20:54 +01:00
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
2022-02-16 22:19:13 +01:00
system = custom.system;
2021-12-11 17:20:54 +01:00
config.allowUnfree = true;
};
};
pkgs = import nixpkgs {
2022-02-16 22:27:50 +01:00
inherit system;
config = {
allowUnfree = true;
};
2021-12-11 17:20:54 +01:00
overlays = [
overlay-unstable
];
};
2022-03-15 17:44:59 +01:00
2022-02-28 22:50:56 +01:00
mkComputer = configurationNix: nixpkgs.lib.nixosSystem {
2022-02-16 22:27:50 +01:00
inherit system pkgs;
2022-02-21 11:36:12 +01:00
specialArgs = { inherit custom inputs; };
modules = (
[
# System configuration for this host
configurationNix
# Common configuration
2022-03-15 17:51:12 +01:00
./modules/common-x86
2022-01-04 21:11:13 +01:00
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
2022-02-16 22:19:13 +01:00
home-manager.users.${custom.username}.imports = [
2022-02-28 22:50:56 +01:00
(import ./home-manager/desktop.nix { inherit custom pkgs inputs; })
2022-01-22 07:15:47 +01:00
];
2022-01-04 21:11:13 +01:00
}
2022-02-28 22:39:17 +01:00
]);
2021-12-16 16:09:50 +01:00
};
2022-02-28 22:44:07 +01:00
mkVM = configurationNix: nixpkgs.lib.nixosSystem {
inherit system pkgs;
2022-03-15 17:28:47 +01:00
specialArgs = { inherit custom inputs; };
modules = (
[
# System configuration for this host
configurationNix
# Common configuration
2022-03-15 17:51:12 +01:00
./modules/common-x86
2022-03-15 17:28:47 +01:00
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${custom.username}.imports = [
(import ./home-manager/headless.nix { inherit custom pkgs inputs; })
];
}
]);
};
mkRaspi = configurationNix: nixpkgs.lib.nixosSystem {
2022-03-15 17:44:59 +01:00
system = "aarch64-linux";
2022-02-28 22:44:07 +01:00
specialArgs = { inherit custom inputs; };
modules = (
[
# System configuration for this host
configurationNix
# Common configuration
./modules/common
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${custom.username}.imports = [
2022-02-28 22:46:55 +01:00
(import ./home-manager/headless.nix { inherit custom pkgs inputs; })
2022-02-28 22:44:07 +01:00
];
}
]);
};
in
{
nixosConfigurations = {
2022-02-28 22:50:56 +01:00
gwyn = mkComputer ./systems/gwyn;
nixos-vm = mkComputer ./systems/desktop-vm;
2022-03-01 09:06:47 +01:00
staubfinger = mkComputer ./systems/staubfinger;
2022-02-28 22:19:52 +01:00
# Servers
2022-02-28 22:50:56 +01:00
git = mkVM ./systems/git;
2022-03-01 09:06:47 +01:00
grav = mkVM ./systems/grav;
heimdall = mkVM ./systems/heimdall;
jdownloader = mkVM ./systems/jdownloader;
2022-03-04 15:30:06 +01:00
k3s-master1 = mkVM ./systems/k3s-master1;
k3s-node1 = mkVM ./systems/k3s-node1;
k3s-node2 = mkVM ./systems/k3s-node2;
2022-02-28 22:50:56 +01:00
mail = mkVM ./systems/mail;
2022-03-01 09:06:47 +01:00
nextcloud = mkVM ./systems/nextcloud;
nixos-management = mkVM ./systems/nixos-management;
2022-03-07 22:53:35 +01:00
nomad-master1 = mkVM ./systems/nomad-master1;
nomad-client1 = mkVM ./systems/nomad-client1;
2022-02-28 22:50:56 +01:00
pihole = mkVM ./systems/pihole;
2022-03-01 09:06:47 +01:00
plex = mkVM ./systems/plex;
proxy = mkVM ./systems/proxy;
2022-03-15 17:44:59 +01:00
raspi-test = mkRaspi ./systems/raspi-test;
2022-02-28 22:50:56 +01:00
restic-server = mkVM ./systems/restic-server;
2022-03-01 09:06:47 +01:00
rss-bridge = mkVM ./systems/rss-bridge;
ttrss = mkVM ./systems/ttrss;
2022-01-01 15:26:53 +01:00
};
homeConfigurations = {
2022-02-16 22:19:13 +01:00
"${custom.username}@co-ws-con4" = home-manager.lib.homeManagerConfiguration {
configuration = import ./home-manager/work-wsl.nix;
2022-02-23 10:34:14 +01:00
inherit system username;
2022-02-16 22:19:13 +01:00
homeDirectory = "/home/${custom.username}";
extraSpecialArgs = {
2022-02-21 11:43:33 +01:00
inherit custom inputs;
2022-01-24 11:33:17 +01:00
};
};
};
2022-01-24 11:33:17 +01:00
};
}