nixos-config/flake.nix

427 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";
clan-core = {
2024-05-29 21:54:53 +02:00
url = "git+https://git.clan.lol/clan/clan-core";
#url = "git+file:///home/palo/dev/nixos/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
};
polygon-art = {
url = "git+https://git.ingolf-wagner.de/palo/polygon-art.git";
};
sops-nix.url = "github:Mic92/sops-nix";
home-manager-utils = {
url = "github:mrvandalo/home-manager-utils";
inputs.home-manager.follows = "home-manager";
};
nixpkgs-fmt = {
url = "github:nix-community/nixpkgs-fmt";
inputs.nixpkgs.follows = "nixpkgs";
};
grocy-scanner = {
url = "github:mrVanDalo/grocy-scanner";
inputs.nixpkgs.follows = "nixpkgs";
};
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";
};
2022-06-22 23:06:16 +02:00
private_assets = {
2023-12-23 00:11:26 +01:00
#url = "git+file:///home/palo/dev/nixos/nixos-private-assets";
2024-05-08 21:21:02 +02:00
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
};
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-02-16 22:21:05 +01:00
srvos.url = "github:nix-community/srvos";
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
};
2023-02-17 11:45:09 +01:00
kmonad = {
url = "github:kmonad/kmonad?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-04-29 23:29:05 +02:00
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-06-30 00:14:18 +02:00
nixinate.url = "github:matthewcroughan/nixinate";
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-01-02 03:22:16 +01:00
smoke = {
url = github:SamirTalwar/smoke;
inputs.nixpkgs.follows = "nixpkgs";
};
2023-11-17 15:13:46 +01:00
taskshell = {
url = "github:mrvandalo/taskshell";
inputs.nixpkgs.follows = "nixpkgs";
};
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
2023-04-29 23:29:05 +02:00
, disko
2024-04-17 21:30:19 +02:00
, flake-parts
, grocy-scanner
, home-manager
, home-manager-utils
2023-06-13 19:58:51 +02:00
, kmonad
, landingpage
2023-06-30 00:14:18 +02:00
, nixinate
2024-02-26 09:44:59 +01:00
, nixos-anywhere
2023-01-23 20:04:50 +01:00
, nixos-hardware
, nixpkgs
, nixpkgs-fmt
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-01-02 03:22:16 +01:00
, smoke
2022-06-22 23:06:16 +02:00
, sops-nix
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;
2024-01-02 03:22:16 +01:00
smoke = smoke.packages.${system}.default;
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;
};
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
(sopsModule name)
2023-06-30 11:02:05 +02:00
{
imports = [
2024-05-29 20:16:04 +02:00
# 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
2023-06-30 11:02:05 +02:00
];
2024-05-29 23:11:51 +02:00
clan.static-hosts.topLevelDomain = "gummybear";
2023-06-30 11:02:05 +02:00
}
];
};
2023-06-30 00:14:18 +02:00
defaultModules = [
2023-06-30 11:02:05 +02:00
{
# todo : find out what this is?
# make flake inputs accessiable in NixOS
_module.args.self = self;
_module.args.inputs = self.inputs;
}
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-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 = [
nixpkgs-fmt.defaultPackage.${pkgs.system}
clan-core.packages.${pkgs.system}.clan-cli
];
2023-06-30 11:02:05 +02:00
imports = [
permown.nixosModules.permown
2024-05-27 10:48:38 +02:00
#disko.nixosModules.disko
2023-06-30 11:02:05 +02:00
kmonad.nixosModules.default
grocy-scanner.nixosModule
];
2024-04-17 21:30:19 +02:00
})
2023-06-30 00:14:18 +02:00
];
2024-04-17 21:30:19 +02:00
homeManagerModules = { pkgs, config, ... }: {
2023-06-30 17:28:17 +02:00
imports = [
home-manager.nixosModules.home-manager
2023-07-01 00:20:03 +02:00
stylix.nixosModules.stylix
2023-06-30 17:28:17 +02:00
];
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;
};
2023-07-01 00:20:03 +02:00
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 = [
2024-05-24 21:08:34 +02:00
#doom-emacs-nix.hmModule
2023-07-07 02:48:44 +02:00
home-manager-utils.hmModule
2024-01-26 23:16:14 +01:00
{ stylix.targets.bemenu.enable = false; }
2023-07-07 02:48:44 +02:00
];
home-manager.users.mainUser.home.stateVersion = "22.11";
home-manager.users.root.home.stateVersion = "22.11";
2023-06-30 11:02:05 +02:00
};
2023-06-30 00:14:18 +02:00
sopsModule = name: { lib, ... }: {
2024-04-17 21:30:19 +02:00
#imports = [ sops-nix.nixosModules.sops ];
2023-06-30 00:14:18 +02:00
sops.defaultSopsFile = lib.mkForce "${secrets}/secrets/${name}.yaml";
};
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 = {
sternchen = clanSetup {
2023-08-14 03:29:02 +02:00
name = "sternchen";
2024-05-27 10:48:38 +02:00
#host = "sternchen.secure";
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-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, ... }: {
home-manager.users = {
mainUser = {
programs.atuin.enable = lib.mkForce false;
};
root = {
programs.atuin.enable = lib.mkForce false;
};
};
})
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-04-17 21:30:19 +02:00
host = "cream.private";
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
2023-06-30 11:02:05 +02:00
homeManagerModules
{ 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-04-17 21:30:19 +02:00
host = "cherry.private";
2023-12-17 13:06:57 +01:00
modules = [
nixos-hardware.nixosModules.framework-13th-gen-intel
homeManagerModules
2024-05-28 17:01:27 +02:00
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-04-17 21:30:19 +02:00
host = "chungus.private";
2023-06-30 11:02:05 +02:00
modules = [
2023-07-01 00:20:03 +02:00
homeManagerModules
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-04-17 21:30:19 +02:00
host = "orbi.private";
2024-05-27 10:48:38 +02:00
# host = "95.216.66.212";
2024-02-16 22:21:05 +01:00
modules = [
2024-05-29 20:16:04 +02:00
{
clan.networking.zerotier.controller = {
enable = true;
public = false;
};
}
2024-02-16 22:21:05 +01:00
homeManagerModules
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
}