nixos-config/flake.nix

449 lines
14 KiB
Nix
Raw Normal View History

2021-09-24 06:09:20 +02:00
{
inputs = {
2023-04-29 23:29:05 +02:00
2021-09-25 11:07:09 +02:00
secrets = {
2024-05-08 21:21:02 +02:00
url = "git+ssh://forgejo@git.ingolf-wagner.de/palo/nixos-secrets.git?ref=main";
2021-09-25 11:07:09 +02:00
flake = false;
};
2024-04-17 21:30:19 +02:00
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
2024-06-02 20:50:17 +02:00
clan-fact-generators = {
url = "github:mrvandalo/clan-fact-generators";
inputs.clan-core.follows = "clan-core";
};
2024-04-17 21:30:19 +02:00
clan-core = {
2024-05-29 21:54:53 +02:00
url = "git+https://git.clan.lol/clan/clan-core";
2024-06-02 21:38:48 +02:00
#url = "git+file:///home/palo/dev/clan-core";
2024-04-17 21:30:19 +02:00
inputs.nixpkgs.follows = "nixpkgs"; # Needed if your configuration uses nixpkgs unstable.
inputs.flake-parts.follows = "flake-parts";
};
2024-05-24 19:04:21 +02:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2023-06-29 10:08:09 +02:00
nixpkgs-legacy_2105.url = "github:nixos/nixpkgs/nixos-21.05";
2024-05-24 19:04:21 +02:00
nixpkgs-legacy_2205.url = "github:nixos/nixpkgs/nixos-22.05";
nixpkgs-legacy_2211.url = "github:nixos/nixpkgs/nixos-22.11";
nixpkgs-legacy_2305.url = "github:nixos/nixpkgs/nixos-23.05";
nixpkgs-legacy_2311.url = "github:nixos/nixpkgs/nixos-23.11";
2023-06-30 00:14:18 +02:00
nixos-hardware.url = "github:nixos/nixos-hardware";
2024-02-26 09:44:59 +01:00
nixos-anywhere.url = "github:nix-community/nixos-anywhere";
2023-06-29 10:08:09 +02:00
home-manager = {
2024-05-24 21:08:34 +02:00
#url = "github:nix-community/home-manager/release-23.11";
url = "github:nix-community/home-manager";
#inputs.nixpkgs.follows = "nixpkgs";
2023-06-29 10:08:09 +02:00
};
2024-05-30 16:38:33 +02:00
polygon-art = {
url = "git+https://git.ingolf-wagner.de/palo/polygon-art.git";
};
2024-05-30 16:38:33 +02:00
home-manager-utils = {
url = "github:mrvandalo/home-manager-utils";
inputs.home-manager.follows = "home-manager";
};
2024-05-30 16:38:33 +02:00
2022-12-18 16:46:20 +01:00
permown = {
2022-12-18 17:29:16 +01:00
url = "github:mrVanDalo/module.permown";
2022-12-18 16:46:20 +01:00
#url = "git+file:///home/palo/dev/nixos/permown";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-05-30 16:38:33 +02:00
2022-06-22 23:06:16 +02:00
private_assets = {
2024-06-05 15:10:28 +02:00
#url = "git+file:///home/palo/dev/nixos/nixos-private-assets";
url = "git+ssh://forgejo@git.ingolf-wagner.de/palo/nixos-private-assets.git?ref=main";
flake = true;
2022-06-22 23:06:16 +02:00
};
2024-05-30 16:38:33 +02:00
2022-09-29 12:36:36 +02:00
retiolum = {
2023-02-16 21:43:28 +01:00
url = "github:Mic92/retiolum";
#url = "git+file:///home/palo/dev/nixos/retiolum";
2022-09-29 12:36:36 +02:00
};
2024-05-30 16:38:33 +02:00
2024-02-16 22:21:05 +01:00
srvos.url = "github:nix-community/srvos";
2024-05-30 16:38:33 +02:00
2022-11-24 13:48:18 +01:00
landingpage = {
#url = "git+file:///home/palo/dev/landingpage";
url = "github:mrVanDalo/landingpage";
2022-10-22 15:01:11 +02:00
};
2024-05-30 16:38:33 +02:00
# todo: mabye use https://github.com/jtroo/kanata instead
# fixme: kmonad crashes every now and than and the keyboard is not usable anymore.
2023-02-17 11:45:09 +01:00
kmonad = {
url = "github:kmonad/kmonad?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-05-30 16:38:33 +02:00
2023-07-17 09:47:42 +02:00
stylix = {
2023-12-11 22:34:04 +01:00
#url = "github:danth/stylix?ref=35cab8eb76c1d3672b2b290a64f357847c30d090";
2024-05-24 21:08:34 +02:00
#url = "github:danth/stylix/release-23.11";
url = "github:danth/stylix";
2024-01-02 03:41:35 +01:00
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
2023-07-17 09:47:42 +02:00
};
2024-05-30 16:38:33 +02:00
# smoke test framwork to trigger tests (enable if I want to use it for real)
#smoke = {
# url = github:SamirTalwar/smoke;
# inputs.nixpkgs.follows = "nixpkgs";
#};
# had to override it to remove colors
2023-11-17 15:13:46 +01:00
taskshell = {
url = "github:mrvandalo/taskshell";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-05-30 16:38:33 +02:00
# my own tool
2024-05-08 21:21:02 +02:00
overviewer.url = "git+ssh://forgejo@git.ingolf-wagner.de/palo/overviewer.git?ref=main";
2021-09-24 06:09:20 +02:00
};
outputs =
2024-04-17 21:30:19 +02:00
inputs@{ self
, clan-core
, clan-fact-generators
2024-04-17 21:30:19 +02:00
, flake-parts
, home-manager
, home-manager-utils
2023-06-13 19:58:51 +02:00
, kmonad
, landingpage
2024-02-26 09:44:59 +01:00
, nixos-anywhere
2023-01-23 20:04:50 +01:00
, nixos-hardware
, nixpkgs
2023-06-29 10:08:09 +02:00
, nixpkgs-legacy_2105
, nixpkgs-legacy_2205
2023-06-30 00:14:18 +02:00
, nixpkgs-legacy_2211
2023-12-08 21:27:13 +01:00
, nixpkgs-legacy_2305
2024-05-24 19:04:21 +02:00
, nixpkgs-legacy_2311
2023-12-02 16:05:29 +01:00
, overviewer
2023-01-23 20:04:50 +01:00
, permown
, polygon-art
2022-06-22 23:06:16 +02:00
, private_assets
2023-04-29 23:29:05 +02:00
, retiolum
, secrets
2024-04-17 21:30:19 +02:00
, srvos
2023-07-22 01:16:50 +02:00
, stylix
2023-11-17 15:13:46 +01:00
, taskshell
}:
2024-04-17 21:30:19 +02:00
2021-09-25 20:28:25 +02:00
let
2024-04-17 21:30:19 +02:00
#system = "x86_64-linux";
2023-06-30 00:14:18 +02:00
2024-04-17 21:30:19 +02:00
#pkgs = nixpkgs.legacyPackages.${system};
2023-06-30 00:14:18 +02:00
inherit (nixpkgs) lib;
2024-04-17 21:30:19 +02:00
meta = rec {
2023-06-30 00:14:18 +02:00
system = "x86_64-linux";
2024-04-17 21:30:19 +02:00
pkgs = import nixpkgs {
2023-06-30 00:14:18 +02:00
inherit system;
config.allowUnfree = true;
2023-07-01 17:34:23 +02:00
config.permittedInsecurePackages = [
2024-05-24 21:08:34 +02:00
"electron-24.8.6" # for bitwarden
2023-07-01 17:34:23 +02:00
"python-2.7.18.6"
2023-12-08 21:27:13 +01:00
"python-2.7.18.7"
2024-05-24 21:08:34 +02:00
"python-2.7.18.8"
2023-07-01 17:34:23 +02:00
];
2023-06-30 00:14:18 +02:00
overlays = [
(_self: _super: {
2024-05-24 21:08:34 +02:00
# todo : remove this, we are on unstable in the future
2024-05-24 19:04:21 +02:00
unstable = import nixpkgs {
2023-06-30 00:14:18 +02:00
inherit system;
config.allowUnfree = true;
};
2023-12-08 21:27:13 +01:00
legacy_2205 = import nixpkgs-legacy_2205 { inherit system; };
2024-05-24 19:04:21 +02:00
legacy_2211 = import nixpkgs-legacy_2211 { inherit system; };
2024-05-27 21:19:01 +02:00
legacy_2305 = import nixpkgs-legacy_2305 { inherit system; };
legacy_2311 = import nixpkgs-legacy_2311 { inherit system; };
2023-06-30 11:02:05 +02:00
polygon-art = polygon-art.packages.${system};
landingpage = landingpage.packages.${system}.plain;
kmonad = kmonad.packages.${system}.kmonad;
2023-11-17 15:13:46 +01:00
tasksh = taskshell.packages.${system}.tasksh;
2023-12-02 16:05:29 +01:00
overviewer = overviewer.packages.${system}.overviewer;
2023-06-30 00:14:18 +02:00
})
(import ./nixos/pkgs)
2022-06-23 00:33:59 +02:00
];
};
2023-06-30 00:14:18 +02:00
specialArgs = {
inherit private_assets;
assets = ./nixos/assets;
factsGenerator = clan-fact-generators.lib { inherit pkgs; };
2023-06-30 00:14:18 +02:00
};
2024-04-17 21:30:19 +02:00
};
2023-06-30 11:02:05 +02:00
2024-04-17 21:30:19 +02:00
clanSetup =
2023-06-30 11:02:05 +02:00
{ name
2024-04-17 21:30:19 +02:00
, host
2023-06-30 11:02:05 +02:00
, modules
2024-04-17 21:30:19 +02:00
}: {
clan.networking.targetHost = lib.mkDefault "root@${host}";
nixpkgs.pkgs = meta.pkgs;
nixpkgs.hostPlatform = meta.system;
2024-05-29 20:16:04 +02:00
clanCore.facts.secretStore = "password-store";
2024-04-17 21:30:19 +02:00
imports = modules ++ defaultModules ++ [
2024-05-29 20:16:04 +02:00
./nixos/machines/${name}/configuration.nix
2024-05-30 16:38:33 +02:00
# clan core configuration
2024-06-02 20:50:17 +02:00
({ pkgs, lib, ... }: {
2024-06-05 17:51:03 +02:00
imports = [
# this magically adds all my machines in the zero tier network
# and makes the controller accept them.
# will automatic look into `/machines/<name>/facts/zerotier-ip
inputs.clan-core.clanModules.zerotier-static-peers
# Statically configure the host names of machines based on their respective zerotier-ip.
inputs.clan-core.clanModules.static-hosts
# generate ssh host keys with facts
# fixme: not working
# inputs.clan-core.clanModules.sshd
];
2024-06-02 20:50:17 +02:00
documentation.nixos.enable = true;
2024-06-05 18:09:29 +02:00
clan.static-hosts.topLevelDomain = "bear";
2024-06-02 21:38:48 +02:00
#clan.static-hosts.excludeHosts = lib.mkForce [ ];
2024-05-30 16:38:33 +02:00
environment.systemPackages = [
clan-core.packages.${pkgs.system}.clan-cli
];
})
2023-06-30 11:02:05 +02:00
];
};
2023-06-30 00:14:18 +02:00
defaultModules = [
2024-05-30 16:38:33 +02:00
# make flake inputs accessiable in NixOS
2023-06-30 11:02:05 +02:00
{
_module.args.self = self;
_module.args.inputs = self.inputs;
}
2024-05-31 22:02:52 +02:00
# ssh keys
({ config, ... }: {
users.users.root.openssh.authorizedKeys.keyFiles = [
# master key
2024-05-31 22:02:52 +02:00
./nixos/assets/ssh/palo_rsa.pub
# backup key
2024-06-02 21:38:48 +02:00
"${config.clanCore.clanDir}/machines/chungus/facts/ssh.syncoid.id_ed25519.pub"
2024-06-05 11:33:28 +02:00
"${config.clanCore.clanDir}/machines/chungus/facts/ssh.rbackup.id_ed25519.pub"
2024-05-31 22:02:52 +02:00
];
})
2024-05-30 16:38:33 +02:00
# configure nix
2024-05-27 10:48:38 +02:00
({ pkgs, ... }:
{
nix.settings.substituters = [ "https://cache.nixos.org/" ];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
2024-05-29 10:05:07 +02:00
nix.settings.max-jobs = 1;
2024-04-17 21:30:19 +02:00
# no channesl needed this way
2024-05-27 10:48:38 +02:00
nix.nixPath = [ "nixpkgs=${pkgs.path}" ];
})
2024-05-30 16:38:33 +02:00
# some modules I always use
permown.nixosModules.permown
kmonad.nixosModules.default
# some default things I always want
2024-04-17 21:30:19 +02:00
({ pkgs, ... }: {
2023-06-30 11:02:05 +02:00
boot.tmp.useTmpfs = lib.mkDefault true;
2024-05-27 19:10:54 +02:00
environment.systemPackages = [
2024-05-30 16:38:33 +02:00
pkgs.nixpkgs-fmt
2023-06-30 11:02:05 +02:00
];
2024-04-17 21:30:19 +02:00
})
2023-06-30 00:14:18 +02:00
];
2024-05-30 16:38:33 +02:00
stylixModules = { pkgs, config, ... }: {
imports = [ stylix.nixosModules.stylix ];
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-light-medium.yaml";
2024-01-26 23:16:14 +01:00
stylix.image = ./nixos/assets/wallpaper.png;
stylix.fonts = {
serif = {
package = pkgs.ubuntu_font_family;
name = "Ubuntu";
};
sansSerif = {
package = pkgs.ubuntu_font_family;
name = "Ubuntu";
};
monospace = {
package = pkgs.jetbrains-mono;
name = "JetBrains Mono";
};
emoji = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
2024-04-19 20:16:28 +02:00
sizes.popups = 15;
};
2024-05-30 16:38:33 +02:00
# todo: remove this if not needed anymore
#home-manager.sharedModules = [
# { stylix.targets.bemenu.enable = false; }
#];
};
2023-07-01 00:20:03 +02:00
2024-05-30 16:38:33 +02:00
homeManagerModules = { pkgs, config, ... }: {
imports = [
home-manager.nixosModules.home-manager
];
2024-04-21 21:15:45 +02:00
home-manager.extraSpecialArgs = {
inherit private_assets;
assets = ./nixos/assets;
};
2023-06-30 11:02:05 +02:00
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
2024-05-24 21:08:34 +02:00
home-manager.backupFileExtension = "backup";
2023-07-07 02:48:44 +02:00
home-manager.sharedModules = [
home-manager-utils.hmModule
];
2023-06-30 00:14:18 +02:00
};
2023-02-13 18:40:56 +01:00
2023-06-30 00:14:18 +02:00
in
2023-01-31 15:28:24 +01:00
2024-04-17 21:30:19 +02:00
flake-parts.lib.mkFlake { inherit inputs; } ({ self, pkgs, ... }: {
# We define our own systems below. you can still use this to add system specific outputs to your flake.
# See: https://flake.parts/getting-started
systems = [ ];
2023-06-30 11:02:05 +02:00
2024-04-17 21:30:19 +02:00
# import clan-core modules
imports = [
clan-core.flakeModules.default
];
# Define your clan
clan = {
2024-05-29 20:16:04 +02:00
# Clan wide settings.
2024-04-17 21:30:19 +02:00
clanName = "gummybears"; # Ensure to choose a unique name.
specialArgs = meta.specialArgs;
2022-06-23 08:39:18 +02:00
2024-04-17 21:30:19 +02:00
machines = {
2024-04-17 21:30:19 +02:00
sternchen = clanSetup {
2023-08-14 03:29:02 +02:00
name = "sternchen";
2024-06-03 22:01:55 +02:00
host = "sternchen.bear";
#host = "192.168.178.25";
2023-08-14 03:29:02 +02:00
modules = [
nixos-hardware.nixosModules.lenovo-thinkpad-x220
2023-08-14 03:08:56 +02:00
homeManagerModules
2024-05-30 16:38:33 +02:00
stylixModules
2024-05-23 16:04:36 +02:00
{ home-manager.users.mainUser.gui.enable = true; }
{
home-manager.users.mainUser = import ./nixos/homes/tina;
home-manager.users.root = import ./nixos/homes/root;
}
2024-05-23 22:31:30 +02:00
# todo : strange overrides, this should be an option kinda an be changed on another level (the homes/<name> folders or something)
({ lib, ... }: {
2024-05-30 16:38:33 +02:00
home-manager.sharedModules = [
{
2024-05-23 22:31:30 +02:00
programs.atuin.enable = lib.mkForce false;
2024-05-30 16:38:33 +02:00
}
];
2024-05-23 22:31:30 +02:00
})
2024-05-27 19:35:34 +02:00
{
clanCore.machineDescription = "LaLaptop";
}
2023-08-14 03:08:56 +02:00
];
};
2024-04-17 21:30:19 +02:00
cream = clanSetup {
2023-06-30 11:02:05 +02:00
name = "cream";
2024-06-05 11:57:04 +02:00
host = "cream";
#host = "cream.bear";
2023-06-30 11:02:05 +02:00
modules = [
nixos-hardware.nixosModules.framework-12th-gen-intel
retiolum.nixosModules.retiolum
2024-05-27 10:48:38 +02:00
private_assets.nixosModules.cream
2024-05-31 21:02:22 +02:00
private_assets.nixosModules.yubikey
2023-06-30 11:02:05 +02:00
homeManagerModules
2024-05-30 16:38:33 +02:00
stylixModules
{ home-manager.users.mainUser.gui.enable = true; }
2024-02-05 10:47:09 +01:00
{
home-manager.users.mainUser = import ./nixos/homes/palo;
home-manager.users.root = import ./nixos/homes/root;
}
2024-05-27 19:35:34 +02:00
{
clanCore.machineDescription = "Laptop";
}
2023-06-30 11:02:05 +02:00
];
};
2024-04-17 21:30:19 +02:00
cherry = clanSetup {
2023-12-17 13:06:57 +01:00
name = "cherry";
2024-06-05 11:57:04 +02:00
#host = "cherry.bear";
host = "cherry";
2023-12-17 13:06:57 +01:00
modules = [
nixos-hardware.nixosModules.framework-13th-gen-intel
homeManagerModules
2024-05-30 16:38:33 +02:00
stylixModules
2024-05-31 21:02:22 +02:00
private_assets.nixosModules.yubikey
2023-12-17 13:06:57 +01:00
{ home-manager.users.mainUser.gui.enable = true; }
2024-02-05 10:47:09 +01:00
{
home-manager.users.mainUser = import ./nixos/homes/palo;
home-manager.users.root = import ./nixos/homes/root;
}
2024-05-27 19:35:34 +02:00
{
clanCore.machineDescription = "Laptop";
}
2023-12-17 13:06:57 +01:00
];
};
2024-04-17 21:30:19 +02:00
chungus = clanSetup {
2023-06-30 11:02:05 +02:00
name = "chungus";
2024-06-05 11:33:28 +02:00
#host = "chungus.bear";
host = "chungus";
2023-06-30 11:02:05 +02:00
modules = [
2024-06-05 17:51:03 +02:00
{
clan.networking.zerotier.controller = {
enable = true;
public = false;
};
}
2023-07-01 00:20:03 +02:00
homeManagerModules
2024-05-30 16:38:33 +02:00
stylixModules
2023-07-05 20:43:59 +02:00
retiolum.nixosModules.retiolum
2024-05-27 10:48:38 +02:00
private_assets.nixosModules.chungus
2024-05-29 20:16:04 +02:00
#srvos.nixosModules.server
#srvos.nixosModules.mixins-terminfo
2024-02-05 10:47:09 +01:00
{
home-manager.users.mainUser = import ./nixos/homes/palo;
home-manager.users.root = import ./nixos/homes/root;
}
2024-05-27 19:35:34 +02:00
{
clanCore.machineDescription = "Home Server";
}
2023-06-30 11:02:05 +02:00
];
};
2024-04-17 21:30:19 +02:00
orbi = clanSetup {
2024-02-16 22:21:05 +01:00
name = "orbi";
2024-06-05 11:57:04 +02:00
#host = "orbi.bear";
host = "95.216.66.212";
2024-06-05 13:33:33 +02:00
#host = "10.100.0.1";
2024-02-16 22:21:05 +01:00
modules = [
homeManagerModules
2024-05-30 16:38:33 +02:00
stylixModules
2024-02-16 22:21:05 +01:00
srvos.nixosModules.hardware-hetzner-online-intel
srvos.nixosModules.server
srvos.nixosModules.mixins-terminfo
2024-05-27 19:35:34 +02:00
{
2024-05-28 17:01:27 +02:00
# not needed for servers in general
boot.initrd.systemd.emergencyAccess = false;
systemd.enableEmergencyMode = false;
2024-05-27 19:35:34 +02:00
}
2024-02-05 10:47:09 +01:00
{
home-manager.users.mainUser = import ./nixos/homes/palo;
home-manager.users.root = import ./nixos/homes/root;
}
2024-05-27 19:35:34 +02:00
{
2024-05-28 17:01:27 +02:00
clanCore.machineDescription = "Internet Server";
2024-05-27 19:35:34 +02:00
}
2024-05-30 11:33:44 +02:00
{
# can be removed when this is fixed https://github.com/nix-community/srvos/issues/434
system.switch.enableNg = false;
system.switch.enable = true;
}
2023-07-01 17:34:23 +02:00
];
};
2024-05-28 17:01:27 +02:00
};
2024-04-17 21:30:19 +02:00
};
});
2021-09-24 06:09:20 +02:00
}